public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 2.5.2-pre7: fix up devfs
@ 2002-01-03 22:59 Luc Van Oostenryck
  0 siblings, 0 replies; only message in thread
From: Luc Van Oostenryck @ 2002-01-03 22:59 UTC (permalink / raw)
  To: Linus Torvalds, Kernel mailing list

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

here's a patch to fix the devfs part:


-- 
Luc Van Oostenryck

[-- Attachment #2: devfs-2.5.2.6.patch --]
[-- Type: application/octet-stream, Size: 3518 bytes --]

diff -ur linux-2.5.2-pre7/fs/devfs/base.c linux/fs/devfs/base.c
--- linux-2.5.2-pre7/fs/devfs/base.c	Thu Jan  3 23:34:49 2002
+++ linux/fs/devfs/base.c	Thu Jan  3 23:42:03 2002
@@ -894,7 +894,7 @@
     {
 	devfs_dealloc_devnum ( S_ISCHR (de->mode) ? DEVFS_SPECIAL_CHR :
 			       DEVFS_SPECIAL_BLK,
-			       MKDEV (de->u.fcb.u.device.major,
+			       mk_kdev(de->u.fcb.u.device.major,
 				      de->u.fcb.u.device.minor) );
     }
     WRITE_ENTRY_MAGIC (de, 0);
@@ -1552,7 +1552,7 @@
     if ( ( S_ISCHR (mode) || S_ISBLK (mode) ) &&
 	 (flags & DEVFS_FL_AUTO_DEVNUM) )
     {
-	if ( ( devnum = devfs_alloc_devnum (devtype) ) == NODEV )
+	if ( kdev_none( devnum = devfs_alloc_devnum (devtype) ) )
 	{
 	    PRINTK ("(%s): exhausted %s device numbers\n",
 		    name, S_ISCHR (mode) ? "char" : "block");
@@ -1564,14 +1564,14 @@
     if ( ( de = _devfs_prepare_leaf (&dir, name, mode) ) == NULL )
     {
 	PRINTK ("(%s): could not prepare leaf\n", name);
-	if (devnum != NODEV) devfs_dealloc_devnum (devtype, devnum);
+	if (!kdev_none(devnum)) devfs_dealloc_devnum (devtype, devnum);
 	return NULL;
     }
     if ( S_ISCHR (mode) || S_ISBLK (mode) )
     {
 	de->u.fcb.u.device.major = major;
 	de->u.fcb.u.device.minor = minor;
-	de->u.fcb.autogen = (devnum == NODEV) ? FALSE : TRUE;
+	de->u.fcb.autogen = kdev_none(devnum) ? FALSE : TRUE;
     }
     else if ( !S_ISREG (mode) )
     {
@@ -1601,7 +1601,7 @@
     {
 	PRINTK ("(%s): could not append to parent, err: %d\n", name, err);
 	devfs_put (dir);
-	if (devnum != NODEV) devfs_dealloc_devnum (devtype, devnum);
+	if (!kdev_none(devnum)) devfs_dealloc_devnum (devtype, devnum);
 	return NULL;
     }
     DPRINTK (DEBUG_REGISTER, "(%s): de: %p dir: %p \"%s\"  pp: %p\n",
@@ -2413,7 +2413,7 @@
 {
     int tmp;
     int retval = 0;
-    kdev_t dev = MKDEV (de->u.fcb.u.device.major, de->u.fcb.u.device.minor);
+    kdev_t dev = mk_kdev(de->u.fcb.u.device.major, de->u.fcb.u.device.minor);
     struct block_device_operations *bdops;
     extern int warn_no_part;
 
@@ -2599,14 +2599,14 @@
     inode->i_rdev = NODEV;
     if ( S_ISCHR (de->mode) )
     {
-	inode->i_rdev = MKDEV (de->u.fcb.u.device.major,
+	inode->i_rdev = mk_kdev(de->u.fcb.u.device.major,
 			       de->u.fcb.u.device.minor);
 	inode->i_cdev = cdget ( kdev_t_to_nr (inode->i_rdev) );
 	is_fcb = TRUE;
     }
     else if ( S_ISBLK (de->mode) )
     {
-	inode->i_rdev = MKDEV (de->u.fcb.u.device.major,
+	inode->i_rdev = mk_kdev(de->u.fcb.u.device.major,
 			       de->u.fcb.u.device.minor);
 	if (bd_acquire (inode) == 0)
 	{
diff -ur linux-2.5.2-pre7/fs/devfs/util.c linux/fs/devfs/util.c
--- linux-2.5.2-pre7/fs/devfs/util.c	Thu Jan  3 23:34:49 2002
+++ linux/fs/devfs/util.c	Thu Jan  3 23:45:14 2002
@@ -267,7 +267,7 @@
 	if (minor >= 256) continue;
 	__set_bit (minor, entry->bits);
 	up (semaphore);
-	return MKDEV (entry->major, minor);
+	return mk_kdev(entry->major, minor);
     }
     /*  Need to allocate a new major  */
     if ( ( entry = kmalloc (sizeof *entry, GFP_KERNEL) ) == NULL )
@@ -289,7 +289,7 @@
     else list->last->next = entry;
     list->last = entry;
     up (semaphore);
-    return MKDEV (entry->major, 0);
+    return mk_kdev(entry->major, 0);
 }   /*  End Function devfs_alloc_devnum  */
 EXPORT_SYMBOL(devfs_alloc_devnum);
 
@@ -309,7 +309,7 @@
     struct device_list *list;
     struct minor_list *entry;
 
-    if (devnum == NODEV) return;
+    if (kdev_none(devnum)) return;
     if (type == DEVFS_SPECIAL_CHR)
     {
 	semaphore = &char_semaphore;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-01-03 23:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-01-03 22:59 [PATCH] 2.5.2-pre7: fix up devfs Luc Van Oostenryck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox