From: Patrick Mansfield <patmans@us.ibm.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: udev: provide temporary device nodes for callouts
Date: Thu, 10 Feb 2005 17:26:44 +0000 [thread overview]
Message-ID: <20050210172644.GA16370@us.ibm.com> (raw)
In-Reply-To: <20050210111951.GA6920@vrfy.org>
On Thu, Feb 10, 2005 at 12:19:51PM +0100, Kay Sievers wrote:
> %N - create a temporary node and substitute its name
> It will be created in udev_root as .tmp-<major>-<minor>
> The node is removed after the namedev call.
Hi Kay -
I tested with scsi_id, and found no S_IF* was being set for the mknod
mode.
The following patch fixed the problem.
=== namedev.c 1.176 vs edited ==--- 1.176/namedev.c Wed Feb 9 16:03:54 2005
+++ edited/namedev.c Thu Feb 10 09:07:55 2005
@@ -184,6 +184,7 @@
struct sysfs_attribute *tmpattr;
unsigned int next_free_number;
struct sysfs_class_device *class_dev_parent;
+ mode_t mode;
pos = string;
while (1) {
@@ -316,8 +317,11 @@
case 'N':
if (udev->tmp_node[0] = '\0') {
dbg("create temporary device node for callout");
+ mode = get_mode_type(udev);
+ if (!mode)
+ break;
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);
+ udev_make_node(udev, udev->tmp_node, udev->major, udev->minor, mode | 0600, 0, 0);
}
strfieldcatmax(string, udev->tmp_node, maxsize);
dbg("substitute temporary device node name '%s'", udev->tmp_node);
=== udev_add.c 1.91 vs edited ==--- 1.91/udev_add.c Tue Feb 8 15:43:18 2005
+++ edited/udev_add.c Thu Feb 10 09:13:31 2005
@@ -126,26 +126,16 @@
int tail;
char *pos;
int len;
+ mode_t mode;
int i;
snprintf(filename, NAME_SIZE, "%s/%s", udev_root, udev->name);
filename[NAME_SIZE-1] = '\0';
- switch (udev->type) {
- case 'b':
- udev->mode |= S_IFBLK;
- break;
- case 'c':
- case 'u':
- udev->mode |= S_IFCHR;
- break;
- case 'p':
- udev->mode |= S_IFIFO;
- break;
- default:
- dbg("unknown node type %c\n", udev->type);
+ mode = get_mode_type(udev);
+ if (!mode)
return -EINVAL;
- }
+ udev->mode |= mode;
/* create parent directories if needed */
if (strrchr(udev->name, '/'))
=== udev_utils.c 1.29 vs edited ==--- 1.29/udev_utils.c Wed Feb 9 12:51:41 2005
+++ edited/udev_utils.c Thu Feb 10 09:09:33 2005
@@ -314,3 +314,19 @@
closedir(dir);
return 0;
}
+
+mode_t get_mode_type (struct udevice *udev)
+{
+ switch (udev->type) {
+ case 'b':
+ return S_IFBLK;
+ case 'c':
+ case 'u':
+ return S_IFCHR;
+ case 'p':
+ return S_IFIFO;
+ default:
+ dbg("unknown node type %c\n", udev->type);
+ return 0;
+ }
+}
=== udev_utils.h 1.22 vs edited ==--- 1.22/udev_utils.h Tue Feb 8 11:37:31 2005
+++ edited/udev_utils.h Thu Feb 10 09:04:52 2005
@@ -88,5 +88,6 @@
typedef int (*file_fnct_t)(const char *filename, void *data);
extern int call_foreach_file(file_fnct_t fnct, const char *dirname,
const char *suffix, void *data);
+extern mode_t get_mode_type (struct udevice *udev);
#endif
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id\x14396&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
next prev parent reply other threads:[~2005-02-10 17:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-10 11:19 udev: provide temporary device nodes for callouts Kay Sievers
2005-02-10 17:26 ` Patrick Mansfield [this message]
2005-02-10 17:41 ` Kay Sievers
2005-02-10 17:43 ` Patrick Mansfield
2005-02-10 18:01 ` Kay Sievers
2005-02-10 18:05 ` Greg KH
2005-02-10 18:05 ` Patrick Mansfield
2005-02-10 18:18 ` Kay Sievers
2005-02-10 18:18 ` Patrick Mansfield
2005-02-10 18:26 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050210172644.GA16370@us.ibm.com \
--to=patmans@us.ibm.com \
--cc=linux-hotplug@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).