* @dev_num: number to assign to the newly created UBI device
* (%UBI_DEV_NUM_AUTO should be used to automatically assign the
* number)
- * @mtd_num: MTD device number to attach (used if @dev is %NULL)
- * @dev: path to MTD device node to attach
+ * @mtd_num: MTD device number to attach (used if @mtd_dev_node is %NULL)
+ * @mtd_dev_node: path to MTD device node to attach
* @vid_hdr_offset: VID header offset (%0 means default offset and this is what
* most of the users want)
*/
{
int dev_num;
int mtd_num;
- const char *dev;
+ const char *mtd_dev_node;
int vid_hdr_offset;
};
* @req: MTD attach request
*
* This function creates new UBI device by attaching an MTD device described by
- * @req. If @req->dev is given it should contain path to the MTD device node.
- * Otherwise functionality is similar than in function 'ubi_attach_mtd()' where
- * @req->mtd_num is used.
+ * @req. If @req->mtd_dev_node is given it should contain path to the MTD
+ * device node. Otherwise functionality is similar than in function
+ * 'ubi_attach_mtd()' where @req->mtd_num is used.
*
* Returns %0 in case of success and %-1 in case of failure (errno is set). The
* newly created UBI device number is returned in @req->dev_num.
* ubi_detach - detach an MTD device by its node path.
* @desc: UBI library descriptor
* @node: name of the UBI control character device node
- * @dev: path to an MTD device node
+ * @mtd_dev_node: path to an MTD device node
*
- * This function detaches an MTD device @dev from UBI. Returns zero in case of
- * success and %-1 in case of failure.
+ * This function detaches an MTD device @mtd_dev_node from UBI. Returns zero in
+ * case of success and %-1 in case of failure.
*/
-int ubi_detach(libubi_t desc, const char *node, const char *dev);
+int ubi_detach(libubi_t desc, const char *node, const char *mtd_dev_node);
/**
* ubi_remove_dev - remove an UBI device.
#endif
/**
- * dev_to_mtdnum - converts device node to MTD number.
- * @dev: path to device node to convert
+ * mtd_node_to_num - converts device node to MTD number.
+ * @mtd_dev_node: path to device node to convert
*
- * This function converts given @dev to MTD device number. @dev should contain
- * path to the MTD device node. Returns MTD device number in case of success and
- * %-1 in case of failure (errno is set).
+ * This function converts given @mtd_dev_node to MTD device number.
+ * @mtd_dev_node should contain path to the MTD device node. Returns MTD device
+ * number in case of success and %-1 in case of failure (errno is set).
*/
-static int dev_to_mtdnum(const char *dev)
+static int mtd_node_to_num(const char *mtd_dev_node)
{
int major, minor;
struct stat sb;
- if (stat(dev, &sb) < 0)
- return sys_errmsg("cannot stat \"%s\"", dev);
+ if (stat(mtd_dev_node, &sb) < 0)
+ return sys_errmsg("cannot stat \"%s\"", mtd_dev_node);
if (!S_ISCHR(sb.st_mode)) {
errno = EINVAL;
- return sys_errmsg("\"%s\" is not a character device", dev);
+ return sys_errmsg("\"%s\" is not a character device",
+ mtd_dev_node);
}
major = major(sb.st_rdev);
if (major != MTD_CHAR_MAJOR) {
errno = EINVAL;
- return sys_errmsg("\"%s\" is not an MTD device", dev);
+ return sys_errmsg("\"%s\" is not an MTD device", mtd_dev_node);
}
return minor / 2;
struct ubi_attach_req r;
int ret;
- if (!req->dev)
+ if (!req->mtd_dev_node)
/* Fallback to opening by mtd_num */
return ubi_attach_mtd(desc, node, req);
* User has passed path to device node. Lets find out MTD device number
* of the device and pass it to the kernel.
*/
- r.mtd_num = dev_to_mtdnum(req->dev);
+ r.mtd_num = mtd_node_to_num(req->mtd_dev_node);
if (r.mtd_num == -1)
return -1;
return ubi_remove_dev(desc, node, ubi_dev);
}
-int ubi_detach(libubi_t desc, const char *node, const char *dev)
+int ubi_detach(libubi_t desc, const char *node, const char *mtd_dev_node)
{
int mtd_num;
- if (!dev) {
+ if (!mtd_dev_node) {
errno = EINVAL;
return -1;
}
- mtd_num = dev_to_mtdnum(dev);
+ mtd_num = mtd_node_to_num(mtd_dev_node);
if (mtd_num == -1)
return -1;