Commit 2c4b185c authored by Richard Gooch's avatar Richard Gooch

Switched to ISO C structure field initialisers.

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.
parent 4161a75e
...@@ -1931,3 +1931,11 @@ Changes for patch v213 ...@@ -1931,3 +1931,11 @@ Changes for patch v213
- Protected <scan_dir_for_removable> and <get_removable_partition> - Protected <scan_dir_for_removable> and <get_removable_partition>
from changing directory contents 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
...@@ -3,7 +3,7 @@ Devfs (Device File System) FAQ ...@@ -3,7 +3,7 @@ Devfs (Device File System) FAQ
Linux Devfs (Device File System) FAQ Linux Devfs (Device File System) FAQ
Richard Gooch Richard Gooch
7-APR-2002 21-JUL-2002
Document languages: Document languages:
...@@ -788,6 +788,9 @@ following to set this up: ...@@ -788,6 +788,9 @@ following to set this up:
make sure the kernel does not mount devfs at boot time 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 create the /dev-state directory
...@@ -1288,9 +1291,10 @@ parameters:c=1,b=2,t=3,u=4 would appear as: ...@@ -1288,9 +1291,10 @@ parameters:c=1,b=2,t=3,u=4 would appear as:
SCSI Generic Devices SCSI Generic Devices
All SCSI CD-ROMs are placed under /dev/sg. A similar naming The generic (aka. raw) interface for all SCSI devices are placed under
scheme is used as for SCSI discs. A SCSI generic device with the /dev/sg. A similar naming scheme is used as for SCSI discs. A
parameters:c=1,b=2,t=3,u=4 would appear as: SCSI generic device with the parameters:c=1,b=2,t=3,u=4 would appear
as:
/dev/sg/c1b2t3u4 /dev/sg/c1b2t3u4
...@@ -1605,6 +1609,23 @@ make sure that devfs is mounted on /dev. See above for how to ...@@ -1605,6 +1609,23 @@ make sure that devfs is mounted on /dev. See above for how to
do that. 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.
......
...@@ -633,6 +633,11 @@ ...@@ -633,6 +633,11 @@
20020514 Richard Gooch <rgooch@atnf.csiro.au> 20020514 Richard Gooch <rgooch@atnf.csiro.au>
Minor cleanup of <scan_dir_for_removable>. Minor cleanup of <scan_dir_for_removable>.
v1.17 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/types.h>
#include <linux/errno.h> #include <linux/errno.h>
...@@ -665,7 +670,7 @@ ...@@ -665,7 +670,7 @@
#include <asm/bitops.h> #include <asm/bitops.h>
#include <asm/atomic.h> #include <asm/atomic.h>
#define DEVFS_VERSION "1.17 (20020514)" #define DEVFS_VERSION "1.18 (20020722)"
#define DEVFS_NAME "devfs" #define DEVFS_NAME "devfs"
...@@ -877,7 +882,7 @@ static ssize_t stat_read (struct file *file, char *buf, size_t len, ...@@ -877,7 +882,7 @@ static ssize_t stat_read (struct file *file, char *buf, size_t len,
loff_t *ppos); loff_t *ppos);
static struct file_operations stat_fops = static struct file_operations stat_fops =
{ {
read: stat_read, .read = stat_read,
}; };
#endif #endif
...@@ -885,9 +890,9 @@ static struct file_operations stat_fops = ...@@ -885,9 +890,9 @@ static struct file_operations stat_fops =
/* Devfs daemon file operations */ /* Devfs daemon file operations */
static struct file_operations devfsd_fops = static struct file_operations devfsd_fops =
{ {
read: devfsd_read, .read = devfsd_read,
ioctl: devfsd_ioctl, .ioctl = devfsd_ioctl,
release: devfsd_close, .release = devfsd_close,
}; };
...@@ -1446,12 +1451,12 @@ static int wait_for_devfsd_finished (struct fs_info *fs_info) ...@@ -1446,12 +1451,12 @@ static int wait_for_devfsd_finished (struct fs_info *fs_info)
if (fs_info->devfsd_task == NULL) return (TRUE); if (fs_info->devfsd_task == NULL) return (TRUE);
if (devfsd_queue_empty (fs_info) && fs_info->devfsd_sleeping) return TRUE; if (devfsd_queue_empty (fs_info) && fs_info->devfsd_sleeping) return TRUE;
if ( is_devfsd_or_child (fs_info) ) return (FALSE); if ( is_devfsd_or_child (fs_info) ) return (FALSE);
set_current_state (TASK_UNINTERRUPTIBLE);
add_wait_queue (&fs_info->revalidate_wait_queue, &wait); add_wait_queue (&fs_info->revalidate_wait_queue, &wait);
current->state = TASK_UNINTERRUPTIBLE;
if (!devfsd_queue_empty (fs_info) || !fs_info->devfsd_sleeping) if (!devfsd_queue_empty (fs_info) || !fs_info->devfsd_sleeping)
if (fs_info->devfsd_task) schedule (); if (fs_info->devfsd_task) schedule ();
remove_wait_queue (&fs_info->revalidate_wait_queue, &wait); remove_wait_queue (&fs_info->revalidate_wait_queue, &wait);
current->state = TASK_RUNNING; __set_current_state (TASK_RUNNING);
return (TRUE); return (TRUE);
} /* End Function wait_for_devfsd_finished */ } /* End Function wait_for_devfsd_finished */
...@@ -2576,9 +2581,9 @@ static void devfs_clear_inode (struct inode *inode) ...@@ -2576,9 +2581,9 @@ static void devfs_clear_inode (struct inode *inode)
static struct super_operations devfs_sops = static struct super_operations devfs_sops =
{ {
drop_inode: generic_delete_inode, .drop_inode = generic_delete_inode,
clear_inode: devfs_clear_inode, .clear_inode = devfs_clear_inode,
statfs: simple_statfs, .statfs = simple_statfs,
}; };
...@@ -2724,19 +2729,20 @@ static int devfs_readdir (struct file *file, void *dirent, filldir_t filldir) ...@@ -2724,19 +2729,20 @@ static int devfs_readdir (struct file *file, void *dirent, filldir_t filldir)
{ {
err = (*filldir) (dirent, de->name, de->namelen, err = (*filldir) (dirent, de->name, de->namelen,
file->f_pos, de->inode.ino, de->mode >> 12); file->f_pos, de->inode.ino, de->mode >> 12);
if (err >= 0) if (err < 0) devfs_put (de);
else
{ {
file->f_pos++; file->f_pos++;
++stored; ++stored;
} }
} }
if (err == -EINVAL) break;
if (err < 0) return err;
read_lock (&parent->u.dir.lock); read_lock (&parent->u.dir.lock);
next = devfs_get (de->next); next = devfs_get (de->next);
read_unlock (&parent->u.dir.lock); read_unlock (&parent->u.dir.lock);
devfs_put (de); devfs_put (de);
de = next; de = next;
if (err == -EINVAL) break;
if (err < 0) return err;
} }
break; break;
} }
...@@ -2795,14 +2801,14 @@ static int devfs_open (struct inode *inode, struct file *file) ...@@ -2795,14 +2801,14 @@ static int devfs_open (struct inode *inode, struct file *file)
static struct file_operations devfs_fops = static struct file_operations devfs_fops =
{ {
open: devfs_open, .open = devfs_open,
}; };
static struct file_operations devfs_dir_fops = static struct file_operations devfs_dir_fops =
{ {
read: generic_read_dir, .read = generic_read_dir,
readdir: devfs_readdir, .readdir = devfs_readdir,
open: devfs_open, .open = devfs_open,
}; };
...@@ -2844,19 +2850,19 @@ static int devfs_d_delete (struct dentry *dentry); ...@@ -2844,19 +2850,19 @@ static int devfs_d_delete (struct dentry *dentry);
static struct dentry_operations devfs_dops = static struct dentry_operations devfs_dops =
{ {
d_delete: devfs_d_delete, .d_delete = devfs_d_delete,
d_release: devfs_d_release, .d_release = devfs_d_release,
d_iput: devfs_d_iput, .d_iput = devfs_d_iput,
}; };
static int devfs_d_revalidate_wait (struct dentry *dentry, int flags); static int devfs_d_revalidate_wait (struct dentry *dentry, int flags);
static struct dentry_operations devfs_wait_dops = static struct dentry_operations devfs_wait_dops =
{ {
d_delete: devfs_d_delete, .d_delete = devfs_d_delete,
d_release: devfs_d_release, .d_release = devfs_d_release,
d_iput: devfs_d_iput, .d_iput = devfs_d_iput,
d_revalidate: devfs_d_revalidate_wait, .d_revalidate = devfs_d_revalidate_wait,
}; };
/** /**
...@@ -2943,8 +2949,8 @@ static int devfs_d_revalidate_wait (struct dentry *dentry, int flags) ...@@ -2943,8 +2949,8 @@ static int devfs_d_revalidate_wait (struct dentry *dentry, int flags)
read_lock (&parent->u.dir.lock); read_lock (&parent->u.dir.lock);
if (dentry->d_fsdata) if (dentry->d_fsdata)
{ {
set_current_state (TASK_UNINTERRUPTIBLE);
add_wait_queue (&lookup_info->wait_queue, &wait); add_wait_queue (&lookup_info->wait_queue, &wait);
current->state = TASK_UNINTERRUPTIBLE;
read_unlock (&parent->u.dir.lock); read_unlock (&parent->u.dir.lock);
schedule (); schedule ();
} }
...@@ -3223,25 +3229,25 @@ static int devfs_follow_link (struct dentry *dentry, struct nameidata *nd) ...@@ -3223,25 +3229,25 @@ static int devfs_follow_link (struct dentry *dentry, struct nameidata *nd)
static struct inode_operations devfs_iops = static struct inode_operations devfs_iops =
{ {
setattr: devfs_notify_change, .setattr = devfs_notify_change,
}; };
static struct inode_operations devfs_dir_iops = static struct inode_operations devfs_dir_iops =
{ {
lookup: devfs_lookup, .lookup = devfs_lookup,
unlink: devfs_unlink, .unlink = devfs_unlink,
symlink: devfs_symlink, .symlink = devfs_symlink,
mkdir: devfs_mkdir, .mkdir = devfs_mkdir,
rmdir: devfs_rmdir, .rmdir = devfs_rmdir,
mknod: devfs_mknod, .mknod = devfs_mknod,
setattr: devfs_notify_change, .setattr = devfs_notify_change,
}; };
static struct inode_operations devfs_symlink_iops = static struct inode_operations devfs_symlink_iops =
{ {
readlink: devfs_readlink, .readlink = devfs_readlink,
follow_link: devfs_follow_link, .follow_link = devfs_follow_link,
setattr: devfs_notify_change, .setattr = devfs_notify_change,
}; };
static int devfs_fill_super (struct super_block *sb, void *data, int silent) 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, ...@@ -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 = static struct file_system_type devfs_fs_type =
{ {
name: DEVFS_NAME, .name = DEVFS_NAME,
get_sb: devfs_get_sb, .get_sb = devfs_get_sb,
kill_sb: kill_anon_super, .kill_sb = kill_anon_super,
}; };
/* File operations for devfsd follow */ /* File operations for devfsd follow */
...@@ -3305,8 +3311,8 @@ static ssize_t devfsd_read (struct file *file, char *buf, size_t len, ...@@ -3305,8 +3311,8 @@ static ssize_t devfsd_read (struct file *file, char *buf, size_t len,
info->major = 0; info->major = 0;
info->minor = 0; info->minor = 0;
/* Block for a new entry */ /* Block for a new entry */
set_current_state (TASK_INTERRUPTIBLE);
add_wait_queue (&fs_info->devfsd_wait_queue, &wait); add_wait_queue (&fs_info->devfsd_wait_queue, &wait);
current->state = TASK_INTERRUPTIBLE;
while ( devfsd_queue_empty (fs_info) ) while ( devfsd_queue_empty (fs_info) )
{ {
fs_info->devfsd_sleeping = TRUE; fs_info->devfsd_sleeping = TRUE;
...@@ -3316,13 +3322,13 @@ static ssize_t devfsd_read (struct file *file, char *buf, size_t len, ...@@ -3316,13 +3322,13 @@ static ssize_t devfsd_read (struct file *file, char *buf, size_t len,
if ( signal_pending (current) ) if ( signal_pending (current) )
{ {
remove_wait_queue (&fs_info->devfsd_wait_queue, &wait); remove_wait_queue (&fs_info->devfsd_wait_queue, &wait);
current->state = TASK_RUNNING; __set_current_state (TASK_RUNNING);
return -EINTR; return -EINTR;
} }
set_current_state (TASK_INTERRUPTIBLE); set_current_state (TASK_INTERRUPTIBLE);
} }
remove_wait_queue (&fs_info->devfsd_wait_queue, &wait); remove_wait_queue (&fs_info->devfsd_wait_queue, &wait);
current->state = TASK_RUNNING; __set_current_state (TASK_RUNNING);
/* Now play with the data */ /* Now play with the data */
ival = atomic_read (&fs_info->devfsd_overrun_count); ival = atomic_read (&fs_info->devfsd_overrun_count);
info->overrun_count = ival; info->overrun_count = ival;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment