linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robert Love <rml@tech9.net>
To: linux-hotplug@vger.kernel.org
Subject: [patch] udev: mode should be mode_t
Date: Sat, 18 Oct 2003 01:57:44 +0000	[thread overview]
Message-ID: <marc-linux-hotplug-106644236824455@msgid-missing> (raw)

Unix file modes should be stored in a mode_t, not a standard type.  At the moment it is actually unsigned, in fact, not a signed integer.

Attached patch does an s/int mode/mode_t mode/ and cleans up the
results.

Patch is against udev-003.

	Robert Love


 namedev.c  |   12 +++++++-----
 udev-add.c |    4 ++--
 udev.h     |    2 +-
 udevdb.c   |    2 +-
 udevdb.h   |    2 +-
 5 files changed, 12 insertions(+), 10 deletions(-)

diff -urN udev-003/namedev.c udev/namedev.c
--- udev-003/namedev.c	2003-10-15 20:24:10.000000000 -0400
+++ udev/namedev.c	2003-10-17 21:54:11.063810768 -0400
@@ -446,7 +446,8 @@
 		dev.attr.mode = strtol(temp, NULL, 8);
 
 		dbg_parse("name = %s, owner = %s, group = %s, mode = %#o",
-				dev.attr.name, dev.attr.owner, dev.attr.group, dev.attr.mode);
+				dev.attr.name, dev.attr.owner, dev.attr.group,
+				dev.attr.mode);
 		retval = add_dev(&dev);
 		if (retval) {
 			dbg("add_dev returned with error %d", retval);
@@ -459,7 +460,7 @@
 	return retval;
 }	
 
-static int get_default_mode(struct sysfs_class_device *class_dev)
+static mode_t get_default_mode(struct sysfs_class_device *class_dev)
 {
 	/* just default everyone to rw for the world! */
 	return 0666;
@@ -544,7 +545,7 @@
 	int retval = 0;
 	int found;
 
-	attr->mode = -1;
+	attr->mode = 0;
 	if (class_dev->sysdevice) {
 		dbg_parse("class_dev->sysdevice->directory->path = '%s'", class_dev->sysdevice->directory->path);
 		dbg_parse("class_dev->sysdevice->bus_id = '%s'", class_dev->sysdevice->bus_id);
@@ -751,9 +752,10 @@
 		}	
 	}
 	strcpy(attr->name, class_dev->name);
-	
+
 done:
-	if (attr->mode = -1) {	
+	/* mode was never set above */
+	if (!attr->mode) {
 		attr->mode = get_default_mode(class_dev);
 		attr->owner[0] = 0x00;
 		attr->group[0] = 0x00;
diff -urN udev-003/udev-add.c udev/udev-add.c
--- udev-003/udev-add.c	2003-10-15 20:24:10.000000000 -0400
+++ udev/udev-add.c	2003-10-17 21:46:01.073300648 -0400
@@ -71,7 +71,7 @@
 /*
  * We also want to add some permissions here, and possibly some symlinks
  */
-static int create_node(char *name, char type, int major, int minor, int mode)
+static int create_node(char *name, char type, int major, int minor, mode_t mode)
 {
 	char filename[255];
 	int retval = 0;
@@ -94,7 +94,7 @@
 	}
 
 	dbg("mknod(%s, %#o, %u, %u)", filename, mode, major, minor);
-	retval = mknod(filename,mode,makedev(major,minor));
+	retval = mknod(filename, mode, makedev(major, minor));
 	if (retval)
 		dbg("mknod(%s, %#o, %u, %u) failed with error '%s'",
 		    filename, mode, major, minor, strerror(errno));
diff -urN udev-003/udevdb.c udev/udevdb.c
--- udev-003/udevdb.c	2003-10-16 21:04:04.000000000 -0400
+++ udev/udevdb.c	2003-10-17 21:46:01.074300496 -0400
@@ -68,7 +68,7 @@
 	char type;
 	int major;
 	int minor;
-	int mode;
+	mode_t mode;
 };
 
 /**
diff -urN udev-003/udevdb.h udev/udevdb.h
--- udev-003/udevdb.h	2003-10-15 20:24:10.000000000 -0400
+++ udev/udevdb.h	2003-10-17 21:46:01.075300344 -0400
@@ -25,7 +25,7 @@
 	char type;
 	int major;
 	int minor;
-	int mode;
+	mode_t mode;
 };
 
 /* Function Prototypes */
diff -urN udev-003/udev.h udev/udev.h
--- udev-003/udev.h	2003-10-15 20:24:10.000000000 -0400
+++ udev/udev.h	2003-10-17 21:48:10.576613152 -0400
@@ -59,7 +59,7 @@
 	char name[NAME_SIZE];
 	char owner[OWNER_SIZE];
 	char group[GROUP_SIZE];
-	int mode;
+	mode_t mode;
 };
 
 extern int udev_add_device(char *device, char *subsystem);




-------------------------------------------------------
This SF.net email sponsored by: Enterprise Linux Forum Conference & Expo
The Event For Linux Datacenter Solutions & Strategies in The Enterprise 
Linux in the Boardroom; in the Front Office; & in the Server Room 
http://www.enterpriselinuxforum.com
_______________________________________________
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

             reply	other threads:[~2003-10-18  1:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-18  1:57 Robert Love [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-10-19 20:57 [patch] udev: mode should be mode_t 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-106644236824455@msgid-missing \
    --to=rml@tech9.net \
    --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).