]> git.hungrycats.org Git - linux/commitdiff
Switched to ISO C structure field initialisers.
authorRichard Gooch <rgooch@atnf.csiro.au>
Wed, 24 Jul 2002 16:33:50 +0000 (16:33 +0000)
committerRichard Gooch <rgooch@atnf.csiro.au>
Wed, 24 Jul 2002 16:33:50 +0000 (16:33 +0000)
Switch to set_current_state() and move before add_wait_queue().
Updated README from master HTML file.
Fixed devfs entry leak in <devfs_readdir> when *readdir fails.

Documentation/filesystems/devfs/ChangeLog
Documentation/filesystems/devfs/README
fs/devfs/base.c

index 1db800e739c77222e0c8d905c546aa890b32e373..89788a23d0887ff8105d4ca5d55349a7c14017a1 100644 (file)
@@ -1931,3 +1931,11 @@ Changes for patch v213
 
 - Protected <scan_dir_for_removable> and <get_removable_partition>
   from changing directory contents
+===============================================================================
+Changes for patch v214
+
+- Switched to ISO C structure field initialisers
+
+- Updated README from master HTML file
+
+- Fixed devfs entry leak in <devfs_readdir> when *readdir fails
index 3c9d29861e281b3c5d194642fc099da9243d0837..147f2efa86e37f86b64c026f6c73a872ccff6ed8 100644 (file)
@@ -3,7 +3,7 @@ Devfs (Device File System) FAQ
 
 Linux Devfs (Device File System) FAQ
 Richard Gooch
-7-APR-2002
+21-JUL-2002
 
 
 Document languages:
@@ -788,6 +788,9 @@ following to set this up:
 make sure the kernel does not mount devfs at boot time
 
 
+make sure you have a correct /dev/console entry in your
+root file-system (where your disc-based /dev lives)
+
 create the /dev-state directory
 
 
@@ -1288,9 +1291,10 @@ parameters:c=1,b=2,t=3,u=4 would appear as:
 
 SCSI Generic Devices
 
-All SCSI CD-ROMs are placed under /dev/sg. A similar naming
-scheme is used as for SCSI discs. A SCSI generic device with the
-parameters:c=1,b=2,t=3,u=4 would appear as:
+The generic (aka. raw) interface for all SCSI devices are placed under
+/dev/sg. A similar naming scheme is used as for SCSI discs. A
+SCSI generic device with the parameters:c=1,b=2,t=3,u=4 would appear
+as:
 
        /dev/sg/c1b2t3u4
 
@@ -1605,6 +1609,23 @@ make sure that devfs is mounted on /dev. See above for how to
 do that.
 
 
+I have extra or incorrect entries in /dev
+
+You may have stale entries in your dev-state area. Check for a
+RESTORE configuration line in your devfsd configuration
+(typically /etc/devfsd.conf). If you have this line, check
+the contents of the specified directory for stale entries. Remove
+any entries which are incorrect, then reboot.
+
+
+I get "Unable to open initial console" messages at boot
+
+This usually happens when you don't have devfs automounted onto
+/dev at boot time, and there is no valid
+/dev/console entry on your root file-system. Create a valid
+/dev/console device node.
+
+
 
 
 
index 1ca3bd01c15ce9dbaa9386adaa640be5ac390a32..ab8583dec270a12336828d8458d2b4a9cdff927d 100644 (file)
     20020514   Richard Gooch <rgooch@atnf.csiro.au>
               Minor cleanup of <scan_dir_for_removable>.
   v1.17
+    20020721   Richard Gooch <rgooch@atnf.csiro.au>
+              Switched to ISO C structure field initialisers.
+    20020722   Richard Gooch <rgooch@atnf.csiro.au>
+              Fixed devfs entry leak in <devfs_readdir> when *readdir fails.
+  v1.18
 */
 #include <linux/types.h>
 #include <linux/errno.h>
 #include <asm/bitops.h>
 #include <asm/atomic.h>
 
-#define DEVFS_VERSION            "1.17 (20020514)"
+#define DEVFS_VERSION            "1.18 (20020722)"
 
 #define DEVFS_NAME "devfs"
 
@@ -877,7 +882,7 @@ static ssize_t stat_read (struct file *file, char *buf, size_t len,
                          loff_t *ppos);
 static struct file_operations stat_fops =
 {
-    read:    stat_read,
+    .read    = stat_read,
 };
 #endif
 
@@ -885,9 +890,9 @@ static struct file_operations stat_fops =
 /*  Devfs daemon file operations  */
 static struct file_operations devfsd_fops =
 {
-    read:    devfsd_read,
-    ioctl:   devfsd_ioctl,
-    release: devfsd_close,
+    .read    = devfsd_read,
+    .ioctl   = devfsd_ioctl,
+    .release = devfsd_close,
 };
 
 
@@ -1446,12 +1451,12 @@ static int wait_for_devfsd_finished (struct fs_info *fs_info)
     if (fs_info->devfsd_task == NULL) return (TRUE);
     if (devfsd_queue_empty (fs_info) && fs_info->devfsd_sleeping) return TRUE;
     if ( is_devfsd_or_child (fs_info) ) return (FALSE);
+    set_current_state (TASK_UNINTERRUPTIBLE);
     add_wait_queue (&fs_info->revalidate_wait_queue, &wait);
-    current->state = TASK_UNINTERRUPTIBLE;
     if (!devfsd_queue_empty (fs_info) || !fs_info->devfsd_sleeping)
        if (fs_info->devfsd_task) schedule ();
     remove_wait_queue (&fs_info->revalidate_wait_queue, &wait);
-    current->state = TASK_RUNNING;
+    __set_current_state (TASK_RUNNING);
     return (TRUE);
 }   /*  End Function wait_for_devfsd_finished  */
 
@@ -2576,9 +2581,9 @@ static void devfs_clear_inode (struct inode *inode)
 
 static struct super_operations devfs_sops =
 { 
-    drop_inode:    generic_delete_inode,
-    clear_inode:   devfs_clear_inode,
-    statfs:        simple_statfs,
+    .drop_inode    = generic_delete_inode,
+    .clear_inode   = devfs_clear_inode,
+    .statfs        = simple_statfs,
 };
 
 
@@ -2724,19 +2729,20 @@ static int devfs_readdir (struct file *file, void *dirent, filldir_t filldir)
            {
                err = (*filldir) (dirent, de->name, de->namelen,
                                  file->f_pos, de->inode.ino, de->mode >> 12);
-               if (err >= 0)
+               if (err < 0) devfs_put (de);
+               else
                {
                    file->f_pos++;
                    ++stored;
                }
            }
+           if (err == -EINVAL) break;
+           if (err < 0) return err;
            read_lock (&parent->u.dir.lock);
            next = devfs_get (de->next);
            read_unlock (&parent->u.dir.lock);
            devfs_put (de);
            de = next;
-           if (err == -EINVAL) break;
-           if (err < 0) return err;
        }
        break;
     }
@@ -2795,14 +2801,14 @@ static int devfs_open (struct inode *inode, struct file *file)
 
 static struct file_operations devfs_fops =
 {
-    open:    devfs_open,
+    .open    = devfs_open,
 };
 
 static struct file_operations devfs_dir_fops =
 {
-    read:    generic_read_dir,
-    readdir: devfs_readdir,
-    open:    devfs_open,
+    .read    = generic_read_dir,
+    .readdir = devfs_readdir,
+    .open    = devfs_open,
 };
 
 
@@ -2844,19 +2850,19 @@ static int devfs_d_delete (struct dentry *dentry);
 
 static struct dentry_operations devfs_dops =
 {
-    d_delete:     devfs_d_delete,
-    d_release:    devfs_d_release,
-    d_iput:       devfs_d_iput,
+    .d_delete     = devfs_d_delete,
+    .d_release    = devfs_d_release,
+    .d_iput       = devfs_d_iput,
 };
 
 static int devfs_d_revalidate_wait (struct dentry *dentry, int flags);
 
 static struct dentry_operations devfs_wait_dops =
 {
-    d_delete:     devfs_d_delete,
-    d_release:    devfs_d_release,
-    d_iput:       devfs_d_iput,
-    d_revalidate: devfs_d_revalidate_wait,
+    .d_delete     = devfs_d_delete,
+    .d_release    = devfs_d_release,
+    .d_iput       = devfs_d_iput,
+    .d_revalidate = devfs_d_revalidate_wait,
 };
 
 /**
@@ -2943,8 +2949,8 @@ static int devfs_d_revalidate_wait (struct dentry *dentry, int flags)
     read_lock (&parent->u.dir.lock);
     if (dentry->d_fsdata)
     {
+       set_current_state (TASK_UNINTERRUPTIBLE);
        add_wait_queue (&lookup_info->wait_queue, &wait);
-       current->state = TASK_UNINTERRUPTIBLE;
        read_unlock (&parent->u.dir.lock);
        schedule ();
     }
@@ -3223,25 +3229,25 @@ static int devfs_follow_link (struct dentry *dentry, struct nameidata *nd)
 
 static struct inode_operations devfs_iops =
 {
-    setattr:        devfs_notify_change,
+    .setattr        = devfs_notify_change,
 };
 
 static struct inode_operations devfs_dir_iops =
 {
-    lookup:         devfs_lookup,
-    unlink:         devfs_unlink,
-    symlink:        devfs_symlink,
-    mkdir:          devfs_mkdir,
-    rmdir:          devfs_rmdir,
-    mknod:          devfs_mknod,
-    setattr:        devfs_notify_change,
+    .lookup         = devfs_lookup,
+    .unlink         = devfs_unlink,
+    .symlink        = devfs_symlink,
+    .mkdir          = devfs_mkdir,
+    .rmdir          = devfs_rmdir,
+    .mknod          = devfs_mknod,
+    .setattr        = devfs_notify_change,
 };
 
 static struct inode_operations devfs_symlink_iops =
 {
-    readlink:       devfs_readlink,
-    follow_link:    devfs_follow_link,
-    setattr:        devfs_notify_change,
+    .readlink       = devfs_readlink,
+    .follow_link    = devfs_follow_link,
+    .setattr        = devfs_notify_change,
 };
 
 static int devfs_fill_super (struct super_block *sb, void *data, int silent)
@@ -3279,9 +3285,9 @@ static struct super_block *devfs_get_sb (struct file_system_type *fs_type,
 
 static struct file_system_type devfs_fs_type =
 {
-    name:      DEVFS_NAME,
-    get_sb:    devfs_get_sb,
-    kill_sb:   kill_anon_super,
+    .name      = DEVFS_NAME,
+    .get_sb    = devfs_get_sb,
+    .kill_sb   = kill_anon_super,
 };
 
 /*  File operations for devfsd follow  */
@@ -3305,8 +3311,8 @@ static ssize_t devfsd_read (struct file *file, char *buf, size_t len,
     info->major = 0;
     info->minor = 0;
     /*  Block for a new entry  */
+    set_current_state (TASK_INTERRUPTIBLE);
     add_wait_queue (&fs_info->devfsd_wait_queue, &wait);
-    current->state = TASK_INTERRUPTIBLE;
     while ( devfsd_queue_empty (fs_info) )
     {
        fs_info->devfsd_sleeping = TRUE;
@@ -3316,13 +3322,13 @@ static ssize_t devfsd_read (struct file *file, char *buf, size_t len,
        if ( signal_pending (current) )
        {
            remove_wait_queue (&fs_info->devfsd_wait_queue, &wait);
-           current->state = TASK_RUNNING;
+           __set_current_state (TASK_RUNNING);
            return -EINTR;
        }
        set_current_state (TASK_INTERRUPTIBLE);
     }
     remove_wait_queue (&fs_info->devfsd_wait_queue, &wait);
-    current->state = TASK_RUNNING;
+    __set_current_state (TASK_RUNNING);
     /*  Now play with the data  */
     ival = atomic_read (&fs_info->devfsd_overrun_count);
     info->overrun_count = ival;