linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kay Sievers <lkml001@vrfy.org>
To: linux-hotplug@vger.kernel.org
Subject: Re: [ANNOUNCE] udev 004 release
Date: Fri, 24 Oct 2003 13:42:26 +0000	[thread overview]
Message-ID: <marc-linux-hotplug-106705168232439@msgid-missing> (raw)
In-Reply-To: <marc-linux-hotplug-106675444401980@msgid-missing>

[-- Attachment #1: Type: text/plain, Size: 1206 bytes --]

On Wed, Oct 22, 2003 at 04:52:10PM -0700, Greg KH wrote:
> On Wed, Oct 22, 2003 at 05:24:24AM +0200, Kay Sievers wrote:
> > 
> > attached is a patch for udev-add.c to set file permissions.
> 
> Nice.
> 
> > The problem is that the resolving of owner/group name to its numeric id
> > needs shared libc libs. What does this mean for klibc?
> 
> Hm, not good.  udev has to be able to be linked statically.  I just got
> the klibc build working properly, and it makes a world of difference in
> size compared to glibc.
> 
> Could we convert the permissions file to numbers at build time?  That
> way the /etc/* file parsing would not be needed.  Yeah, it's not the
> nicest solution.  Anyone know of any other way we can do this properly?

Hi,
here is the patch for ownership setting on the ceated device node,
supporting only numeric id's given in udev.permissions.
For now, it may be better than nothing.

o set ownership of device node
  for now, we only accept numeric id's in udev.permissions
  cause we are unable to resolve it with klibc and/or
  before real /etc is even mounted



and for the man page:

o present the tiny udev in bold font :)
o make CALLOUT example look less fictious


thanks,
Kay


[-- Attachment #2: udev-add.c.diff --]
[-- Type: text/plain, Size: 1259 bytes --]

--- udev-add.c.orig	2003-10-23 02:30:51.000000000 +0200
+++ udev-add.c	2003-10-24 15:37:07.000000000 +0200
@@ -67,7 +67,8 @@
 }
 
 /*
- * We also want to add some permissions here, and possibly some symlinks
+ * we possibly want to add some symlinks here
+ * only numeric owner/group id's are supported
  */
 static int create_node(struct udevice *dev)
 {
@@ -106,7 +107,35 @@
 		dbg("mknod(%s, %#o, %u, %u) failed with error '%s'",
 		    filename, dev->mode, dev->major, dev->minor, strerror(errno));
 
-	// FIXME set the ownership of the node
+	uid_t uid = 0;
+	gid_t gid = 0;
+
+	if (*dev->owner) {
+		char *endptr;
+		unsigned long id = strtoul(dev->owner, &endptr, 10);
+		if (*endptr == 0x00)
+			uid = (uid_t) id;
+		else
+			dbg("only numeric owner id supported: %s", dev->owner);
+	}
+
+	if (*dev->group) {
+		char *endptr;
+		unsigned long id = strtoul(dev->group, &endptr, 10);
+		if (*endptr == 0x00)
+			gid = (gid_t) id;
+		else
+			dbg("only numeric group id supported: %s", dev->group);
+	}
+
+	if (uid || gid) {
+		dbg("chown(%s, %u, %u)", filename, uid, gid);
+		retval = chown(filename, uid, gid);
+		if (retval)
+			dbg("chown(%s, %u, %u) failed with error '%s'", filename,
+			    uid, gid, strerror(errno));
+	}
+
 	return retval;
 }
 

[-- Attachment #3: udev.8.diff --]
[-- Type: text/plain, Size: 1495 bytes --]

--- udev.8	2003-10-22 01:09:41.000000000 +0200
+++ /home/kay/udev/udev.8	2003-10-24 15:06:41.000000000 +0200
@@ -20,13 +20,15 @@
 like label, serial number or bus device number.
 These attributes are treated as a key 
 to determine a unique name for device file creation.
-udev maintains a database for devices present on the system.
+.B udev
+maintains a database for devices present on the system.
 .br
 On device removal,
 .B udev
 queries the internal database for the name of the device file to be deleted.
 .SH "CONFIGURATION"
-udev expects its configuration at
+.B udev
+expects its configuration at
 .I /etc/udev/udev.config.
 The file consists of a set of lines. All empty lines and
 lines beginning with a '#' will be ignored.
@@ -85,8 +87,8 @@
 # ttyUSB1 should always be called pda
 REPLACE, KERNEL="ttyUSB1", NAME="pda"
 
-# if /sbin/dev_id returns "V0815" device will be called dev0815
-CALLOUT, PROGRAM="/sbin/dev_id", BUS="pci", ID="V0815", NAME="dev0815"
+# if /sbin/scsi_id returns "OEM 0815" device will be called disk1
+CALLOUT, PROGRAM="/sbin/scsi_id" BUS="scsi", ID="OEM 0815" NAME="disk1"
 .fi
 .P
 Permissions and ownership for the created device files may specified at
@@ -120,5 +122,6 @@
 .I http://linux-hotplug.sourceforge.net/
 web site.
 .SH AUTHORS
-udev was developed by Greg Kroah-Hartman <greg@kroah.com> with much help from
+.B udev
+was developed by Greg Kroah-Hartman <greg@kroah.com> with much help from
 Dan Stekloff <dsteklof@us.ibm.com> and many others.

  parent reply	other threads:[~2003-10-24 13:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-21 16:28 [ANNOUNCE] udev 004 release Greg KH
2003-10-21 20:34 ` Kay Sievers
2003-10-21 20:50 ` Greg KH
2003-10-21 21:45 ` Jesse Barnes
2003-10-21 22:13 ` Greg KH
2003-10-22  1:46 ` Greg KH
2003-10-22  3:24 ` Kay Sievers
2003-10-22  7:09 ` Daniel Stekloff
2003-10-22  8:52 ` Ananth N Mavinakayanahalli
2003-10-22 23:52 ` Greg KH
2003-10-24 13:42 ` Kay Sievers [this message]
2003-10-25 10:40 ` Erik van Konijnenburg
2003-10-25 10:40 ` Erik van Konijnenburg
2003-11-14  1:36 ` Greg KH
2003-11-23 21:32 ` 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=marc-linux-hotplug-106705168232439@msgid-missing \
    --to=lkml001@vrfy.org \
    --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).