Commit 059c6fac authored by Richard Gooch's avatar Richard Gooch

Removed DEVFS_FL_AUTO_OWNER flag

parent 53731310
...@@ -1965,3 +1965,7 @@ Changes for patch v217 ...@@ -1965,3 +1965,7 @@ Changes for patch v217
- Updated README from master HTML file - Updated README from master HTML file
- Fixed module unload race in <devfs_open> - Fixed module unload race in <devfs_open>
===============================================================================
Changes for patch v218
- Removed DEVFS_FL_AUTO_OWNER flag
...@@ -1367,8 +1367,7 @@ static int video1394_init(struct ti_ohci *ohci) ...@@ -1367,8 +1367,7 @@ static int video1394_init(struct ti_ohci *ohci)
sprintf(name, "%d", video->id); sprintf(name, "%d", video->id);
minor = IEEE1394_MINOR_BLOCK_VIDEO1394 * 16 + video->id; minor = IEEE1394_MINOR_BLOCK_VIDEO1394 * 16 + video->id;
video->devfs = devfs_register(devfs_handle, name, video->devfs = devfs_register(devfs_handle, name, DEVFS_FL_DEFAULT,
DEVFS_FL_AUTO_OWNER,
IEEE1394_MAJOR, minor, IEEE1394_MAJOR, minor,
S_IFCHR | S_IRUSR | S_IWUSR, S_IFCHR | S_IRUSR | S_IWUSR,
&video1394_fops, NULL); &video1394_fops, NULL);
......
...@@ -648,6 +648,9 @@ ...@@ -648,6 +648,9 @@
20020820 Richard Gooch <rgooch@atnf.csiro.au> 20020820 Richard Gooch <rgooch@atnf.csiro.au>
Fixed module unload race in <devfs_open>. Fixed module unload race in <devfs_open>.
v1.21 v1.21
20021013 Richard Gooch <rgooch@atnf.csiro.au>
Removed DEVFS_ FL_AUTO_OWNER.
v1.22
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/errno.h> #include <linux/errno.h>
...@@ -680,7 +683,7 @@ ...@@ -680,7 +683,7 @@
#include <asm/bitops.h> #include <asm/bitops.h>
#include <asm/atomic.h> #include <asm/atomic.h>
#define DEVFS_VERSION "1.21 (20020820)" #define DEVFS_VERSION "1.22 (20021013)"
#define DEVFS_NAME "devfs" #define DEVFS_NAME "devfs"
...@@ -778,7 +781,6 @@ struct fcb_type /* File, char, block type */ ...@@ -778,7 +781,6 @@ struct fcb_type /* File, char, block type */
struct device_type device; struct device_type device;
} }
u; u;
unsigned char auto_owner:1;
unsigned char aopen_notify:1; unsigned char aopen_notify:1;
unsigned char removable:1; /* Belongs in device_type, but save space */ unsigned char removable:1; /* Belongs in device_type, but save space */
unsigned char open:1; /* Not entirely correct */ unsigned char open:1; /* Not entirely correct */
...@@ -1480,6 +1482,7 @@ static int wait_for_devfsd_finished (struct fs_info *fs_info) ...@@ -1480,6 +1482,7 @@ static int wait_for_devfsd_finished (struct fs_info *fs_info)
* @uid: The user ID. * @uid: The user ID.
* @gid: The group ID. * @gid: The group ID.
* @fs_info: The filesystem info. * @fs_info: The filesystem info.
* @atomic: If TRUE, an atomic allocation is required.
* *
* Returns %TRUE if an event was queued and devfsd woken up, else %FALSE. * Returns %TRUE if an event was queued and devfsd woken up, else %FALSE.
*/ */
...@@ -1631,7 +1634,6 @@ devfs_handle_t devfs_register (devfs_handle_t dir, const char *name, ...@@ -1631,7 +1634,6 @@ devfs_handle_t devfs_register (devfs_handle_t dir, const char *name,
de->inode.gid = 0; de->inode.gid = 0;
} }
de->u.fcb.ops = ops; de->u.fcb.ops = ops;
de->u.fcb.auto_owner = (flags & DEVFS_FL_AUTO_OWNER) ? TRUE : FALSE;
de->u.fcb.aopen_notify = (flags & DEVFS_FL_AOPEN_NOTIFY) ? TRUE : FALSE; de->u.fcb.aopen_notify = (flags & DEVFS_FL_AOPEN_NOTIFY) ? TRUE : FALSE;
de->hide = (flags & DEVFS_FL_HIDE) ? TRUE : FALSE; de->hide = (flags & DEVFS_FL_HIDE) ? TRUE : FALSE;
if (flags & DEVFS_FL_REMOVABLE) de->u.fcb.removable = TRUE; if (flags & DEVFS_FL_REMOVABLE) de->u.fcb.removable = TRUE;
...@@ -1918,7 +1920,6 @@ int devfs_get_flags (devfs_handle_t de, unsigned int *flags) ...@@ -1918,7 +1920,6 @@ int devfs_get_flags (devfs_handle_t de, unsigned int *flags)
if (de->hide) fl |= DEVFS_FL_HIDE; if (de->hide) fl |= DEVFS_FL_HIDE;
if ( S_ISCHR (de->mode) || S_ISBLK (de->mode) || S_ISREG (de->mode) ) if ( S_ISCHR (de->mode) || S_ISBLK (de->mode) || S_ISREG (de->mode) )
{ {
if (de->u.fcb.auto_owner) fl |= DEVFS_FL_AUTO_OWNER;
if (de->u.fcb.aopen_notify) fl |= DEVFS_FL_AOPEN_NOTIFY; if (de->u.fcb.aopen_notify) fl |= DEVFS_FL_AOPEN_NOTIFY;
if (de->u.fcb.removable) fl |= DEVFS_FL_REMOVABLE; if (de->u.fcb.removable) fl |= DEVFS_FL_REMOVABLE;
} }
...@@ -1943,7 +1944,6 @@ int devfs_set_flags (devfs_handle_t de, unsigned int flags) ...@@ -1943,7 +1944,6 @@ int devfs_set_flags (devfs_handle_t de, unsigned int flags)
de->hide = (flags & DEVFS_FL_HIDE) ? TRUE : FALSE; de->hide = (flags & DEVFS_FL_HIDE) ? TRUE : FALSE;
if ( S_ISCHR (de->mode) || S_ISBLK (de->mode) || S_ISREG (de->mode) ) if ( S_ISCHR (de->mode) || S_ISBLK (de->mode) || S_ISREG (de->mode) )
{ {
de->u.fcb.auto_owner = (flags & DEVFS_FL_AUTO_OWNER) ? TRUE : FALSE;
de->u.fcb.aopen_notify = (flags & DEVFS_FL_AOPEN_NOTIFY) ? TRUE:FALSE; de->u.fcb.aopen_notify = (flags & DEVFS_FL_AOPEN_NOTIFY) ? TRUE:FALSE;
} }
return 0; return 0;
...@@ -2497,13 +2497,9 @@ static int devfs_notify_change (struct dentry *dentry, struct iattr *iattr) ...@@ -2497,13 +2497,9 @@ static int devfs_notify_change (struct dentry *dentry, struct iattr *iattr)
(int) inode->i_mode, (int) inode->i_uid, (int) inode->i_gid); (int) inode->i_mode, (int) inode->i_uid, (int) inode->i_gid);
/* Inode is not on hash chains, thus must save permissions here rather /* Inode is not on hash chains, thus must save permissions here rather
than in a write_inode() method */ than in a write_inode() method */
if ( ( !S_ISREG (inode->i_mode) && !S_ISCHR (inode->i_mode) && de->mode = inode->i_mode;
!S_ISBLK (inode->i_mode) ) || !de->u.fcb.auto_owner ) de->inode.uid = inode->i_uid;
{ de->inode.gid = inode->i_gid;
de->mode = inode->i_mode;
de->inode.uid = inode->i_uid;
de->inode.gid = inode->i_gid;
}
de->inode.atime = inode->i_atime; de->inode.atime = inode->i_atime;
de->inode.mtime = inode->i_mtime; de->inode.mtime = inode->i_mtime;
de->inode.ctime = inode->i_ctime; de->inode.ctime = inode->i_ctime;
...@@ -2606,9 +2602,7 @@ static struct inode *_devfs_get_vfs_inode (struct super_block *sb, ...@@ -2606,9 +2602,7 @@ static struct inode *_devfs_get_vfs_inode (struct super_block *sb,
inode->i_op = &devfs_symlink_iops; inode->i_op = &devfs_symlink_iops;
inode->i_size = de->u.symlink.length; inode->i_size = de->u.symlink.length;
} }
if (is_fcb && de->u.fcb.auto_owner) inode->i_mode = de->mode;
inode->i_mode = (de->mode & S_IFMT) | S_IRUGO | S_IWUGO;
else inode->i_mode = de->mode;
inode->i_uid = de->inode.uid; inode->i_uid = de->inode.uid;
inode->i_gid = de->inode.gid; inode->i_gid = de->inode.gid;
inode->i_atime = de->inode.atime; inode->i_atime = de->inode.atime;
...@@ -2728,13 +2722,6 @@ static int devfs_open (struct inode *inode, struct file *file) ...@@ -2728,13 +2722,6 @@ static int devfs_open (struct inode *inode, struct file *file)
/* Open was successful */ /* Open was successful */
if (df->open) return 0; if (df->open) return 0;
df->open = TRUE; /* This is the first open */ df->open = TRUE; /* This is the first open */
if (df->auto_owner)
{
/* Change the ownership/protection to what driver specified */
inode->i_mode = de->mode;
inode->i_uid = current->euid;
inode->i_gid = current->egid;
}
if ( df->aopen_notify && !is_devfsd_or_child (fs_info) ) if ( df->aopen_notify && !is_devfsd_or_child (fs_info) )
devfsd_notify_de (de, DEVFSD_NOTIFY_ASYNC_OPEN, inode->i_mode, devfsd_notify_de (de, DEVFSD_NOTIFY_ASYNC_OPEN, inode->i_mode,
current->euid, current->egid, fs_info, 0); current->euid, current->egid, fs_info, 0);
...@@ -2837,11 +2824,6 @@ static int devfs_d_delete (struct dentry *dentry) ...@@ -2837,11 +2824,6 @@ static int devfs_d_delete (struct dentry *dentry)
if (de->u.fcb.aopen_notify) if (de->u.fcb.aopen_notify)
devfsd_notify_de (de, DEVFSD_NOTIFY_CLOSE, inode->i_mode, devfsd_notify_de (de, DEVFSD_NOTIFY_CLOSE, inode->i_mode,
current->euid, current->egid, fs_info, 1); current->euid, current->egid, fs_info, 1);
if (!de->u.fcb.auto_owner) return 0;
/* Change the ownership/protection back */
inode->i_mode = (de->mode & S_IFMT) | S_IRUGO | S_IWUGO;
inode->i_uid = de->inode.uid;
inode->i_gid = de->inode.gid;
return 0; return 0;
} /* End Function devfs_d_delete */ } /* End Function devfs_d_delete */
......
...@@ -23,21 +23,14 @@ ...@@ -23,21 +23,14 @@
#define DEVFS_FL_NONE 0x000 /* This helps to make code more readable #define DEVFS_FL_NONE 0x000 /* This helps to make code more readable
*/ */
#define DEVFS_FL_AUTO_OWNER 0x001 /* When a closed inode is opened the #define DEVFS_FL_HIDE 0x001 /* Do not show entry in directory list */
ownerships are set to the opening #define DEVFS_FL_AUTO_DEVNUM 0x002 /* Automatically generate device number
process and the protection is set to
that given in <<mode>>. When the inode
is closed, ownership reverts back to
<<uid>> and <<gid>> and the protection
is set to read-write for all */
#define DEVFS_FL_HIDE 0x002 /* Do not show entry in directory list */
#define DEVFS_FL_AUTO_DEVNUM 0x004 /* Automatically generate device number
*/ */
#define DEVFS_FL_AOPEN_NOTIFY 0x008 /* Asynchronously notify devfsd on open #define DEVFS_FL_AOPEN_NOTIFY 0x004 /* Asynchronously notify devfsd on open
*/ */
#define DEVFS_FL_REMOVABLE 0x010 /* This is a removable media device */ #define DEVFS_FL_REMOVABLE 0x008 /* This is a removable media device */
#define DEVFS_FL_WAIT 0x020 /* Wait for devfsd to finish */ #define DEVFS_FL_WAIT 0x010 /* Wait for devfsd to finish */
#define DEVFS_FL_CURRENT_OWNER 0x040 /* Set initial ownership to current */ #define DEVFS_FL_CURRENT_OWNER 0x020 /* Set initial ownership to current */
#define DEVFS_FL_DEFAULT DEVFS_FL_NONE #define DEVFS_FL_DEFAULT DEVFS_FL_NONE
......
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