summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgreg@kroah.com <greg@kroah.com>2003-08-04 21:59:50 -0700
committerGreg KH <gregkh@suse.de>2005-04-26 21:01:40 -0700
commit1331c889c33a91f098fa7257488046e81241225c (patch)
tree5df10c890dc9ccbe803484af97a7eee35f41f575
parent0abf54fc09030f404f5c7d724a0f30d3e875e980 (diff)
[PATCH] cleanup the mknod code a bit.
-rw-r--r--udev-add.c29
-rw-r--r--udev.h3
2 files changed, 18 insertions, 14 deletions
diff --git a/udev-add.c b/udev-add.c
index adbeb92425..10df31458d 100644
--- a/udev-add.c
+++ b/udev-add.c
@@ -78,20 +78,27 @@ static int create_node(char *name, char type, int major, int minor, int mode)
int retval = 0;
strncpy(filename, UDEV_ROOT, sizeof(filename));
strncat(filename, name, sizeof(filename));
- if (type == 'b') {
- mode |= S_IFBLK;
- } else if ((type == 'c') || (type == 'u')){
- mode |= S_IFCHR;
- } else if ( type == 'p') {
- mode |= S_IFIFO;
- } else {
- dbg("unknown node type %c\n", type);
- return -1;
- }
+ switch (type) {
+ case 'b':
+ mode |= S_IFBLK;
+ break;
+ case 'c':
+ case 'u':
+ mode |= S_IFCHR;
+ break;
+ case 'p':
+ mode |= S_IFIFO;
+ break;
+ default:
+ dbg("unknown node type %c\n", type);
+ return -EINVAL;
+ }
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));
return retval;
-
}
struct sysfs_class_device *get_class_dev(char *device_name)
diff --git a/udev.h b/udev.h
index 3c3c3d5de7..590a8ed039 100644
--- a/udev.h
+++ b/udev.h
@@ -40,9 +40,6 @@
/* Where udev should create its device nodes, trailing / needed */
#define UDEV_ROOT "/udev/"
-/* Binaries that udev calls to do stuff */
-#define MKNOD "/bin/mknod"
-
extern int log_message (int level, const char *format, ...)
__attribute__ ((format (printf, 2, 3)));