patch-2.4.7 linux/include/linux/devfs_fs_kernel.h

Next file: linux/include/linux/ethtool.h
Previous file: linux/include/linux/cramfs_fs_sb.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.6/linux/include/linux/devfs_fs_kernel.h linux/include/linux/devfs_fs_kernel.h
@@ -3,6 +3,11 @@
 
 #include <linux/fs.h>
 #include <linux/config.h>
+#include <linux/locks.h>
+#include <linux/kdev_t.h>
+#include <linux/types.h>
+
+#include <asm/semaphore.h>
 
 #define DEVFS_SUPER_MAGIC                0x1373
 
@@ -53,6 +58,19 @@
 
 
 #ifdef CONFIG_DEVFS_FS
+
+struct unique_numspace
+{
+    spinlock_t init_lock;
+    unsigned char sem_initialised;
+    unsigned int num_free;          /*  Num free in bits       */
+    unsigned int length;            /*  Array length in bytes  */
+    __u32 *bits;
+    struct semaphore semaphore;
+};
+
+#define UNIQUE_NUMBERSPACE_INITIALISER {SPIN_LOCK_UNLOCKED, 0, 0, 0, NULL}
+
 extern devfs_handle_t devfs_register (devfs_handle_t dir, const char *name,
 				      unsigned int flags,
 				      unsigned int major, unsigned int minor,
@@ -95,10 +113,26 @@
 				   unsigned int flags, unsigned int major,
 				   unsigned int minor_start,
 				   umode_t mode, void *ops, void *info);
+extern int devfs_alloc_major (char type);
+extern void devfs_dealloc_major (char type, int major);
+extern kdev_t devfs_alloc_devnum (char type);
+extern void devfs_dealloc_devnum (char type, kdev_t devnum);
+extern int devfs_alloc_unique_number (struct unique_numspace *space);
+extern void devfs_dealloc_unique_number (struct unique_numspace *space,
+					 int number);
 
 extern void mount_devfs_fs (void);
 extern void devfs_make_root (const char *name);
+
 #else  /*  CONFIG_DEVFS_FS  */
+
+struct unique_numspace
+{
+    char dummy;
+};
+
+#define UNIQUE_NUMBERSPACE_INITIALISER {0}
+
 static inline devfs_handle_t devfs_register (devfs_handle_t dir,
 					     const char *name,
 					     unsigned int flags,
@@ -228,6 +262,37 @@
 					  unsigned int major,
 					  unsigned int minor_start,
 					  umode_t mode, void *ops, void *info)
+{
+    return;
+}
+
+static inline int devfs_alloc_major (char type)
+{
+    return -1;
+}
+
+static inline void devfs_dealloc_major (char type, int major)
+{
+    return;
+}
+
+static inline kdev_t devfs_alloc_devnum (char type)
+{
+    return NODEV;
+}
+
+static inline void devfs_dealloc_devnum (char type, kdev_t devnum)
+{
+    return;
+}
+
+static inline int devfs_alloc_unique_number (struct unique_numspace *space)
+{
+    return -1;
+}
+
+static inline void devfs_dealloc_unique_number (struct unique_numspace *space,
+						int number)
 {
     return;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)