diff options
author | kay.sievers@vrfy.org <kay.sievers@vrfy.org> | 2005-02-09 04:37:32 +0100 |
---|---|---|
committer | Greg KH <gregkh@suse.de> | 2005-04-26 23:27:32 -0700 |
commit | c1ab046124ebef3c82950b91ccfd1678d9f7fe5b (patch) | |
tree | 1b160f9cba6681028f8993ca723300611172b133 /namedev.c | |
parent | bce52be81ec679bf080bb11f292c899d9fde084e (diff) |
[PATCH] provide temporary device node for callouts to access the device
%N will create a temporary node for a callout a be sustituted with the
name of the node.
Diffstat (limited to 'namedev.c')
-rw-r--r-- | namedev.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -201,6 +201,12 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, switch (c) { + case 'p': + if (strlen(udev->devpath) == 0) + break; + strfieldcatmax(string, udev->devpath, maxsize); + dbg("substitute kernel name '%s'", udev->kernel_name); + break; case 'b': if (strlen(udev->bus_id) == 0) break; @@ -290,6 +296,15 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, strfieldcatmax(string, temp2, maxsize); } break; + case 'N': + if (udev->tmp_node[0] == '\0') { + dbg("create temporary device node for callout"); + snprintf(udev->tmp_node, NAME_SIZE-1, "%s/.tmp-%u-%u", udev_root, udev->major, udev->minor); + udev_make_node(udev, udev->tmp_node, udev->major, udev->minor, 0600, 0, 0); + } + strfieldcatmax(string, udev->tmp_node, maxsize); + dbg("substitute temporary device node name '%s'", udev->tmp_node); + break; default: dbg("unknown substitution type '%%%c'", c); break; @@ -787,5 +802,11 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d dbg("no rule found, use kernel name '%s'", udev->name); exit: + if (udev->tmp_node[0] != '\0') { + dbg("removing temporary device node"); + unlink_secure(udev->tmp_node); + udev->tmp_node[0] = '\0'; + } + return 0; } |