diff options
Diffstat (limited to 'fs/ufs')
-rw-r--r-- | fs/ufs/Makefile | 2 | ||||
-rw-r--r-- | fs/ufs/acl.c | 68 | ||||
-rw-r--r-- | fs/ufs/dir.c | 21 | ||||
-rw-r--r-- | fs/ufs/file.c | 3 | ||||
-rw-r--r-- | fs/ufs/ialloc.c | 1 | ||||
-rw-r--r-- | fs/ufs/inode.c | 8 | ||||
-rw-r--r-- | fs/ufs/namei.c | 32 | ||||
-rw-r--r-- | fs/ufs/super.c | 19 |
8 files changed, 41 insertions, 113 deletions
diff --git a/fs/ufs/Makefile b/fs/ufs/Makefile index f8326866d..39d0d39ef 100644 --- a/fs/ufs/Makefile +++ b/fs/ufs/Makefile @@ -8,7 +8,7 @@ # Note 2! The CFLAGS definitions are now in the main makefile. O_TARGET := ufs.o -O_OBJS := acl.o balloc.o cylinder.o dir.o file.o ialloc.o inode.o \ +O_OBJS := balloc.o cylinder.o dir.o file.o ialloc.o inode.o \ namei.o super.o symlink.o truncate.o util.o M_OBJS := $(O_TARGET) diff --git a/fs/ufs/acl.c b/fs/ufs/acl.c deleted file mode 100644 index b002d3398..000000000 --- a/fs/ufs/acl.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * linux/fs/ufs/acl.c - * - * Copyright (C) 1998 - * Daniel Pirkl <daniel.pirkl@email.cz> - * Charles University, Faculty of Mathematics and Physics - * - * from - * - * linux/fs/ext2/acl.c - * - * Copyright (C) 1993, 1994, 1995 - * Remy Card (card@masi.ibp.fr) - * Laboratoire MASI - Institut Blaise Pascal - * Universite Pierre et Marie Curie (Paris VI) - */ - -/* - * This file will contain the Access Control Lists management for UFS - */ - -#include <linux/errno.h> -#include <linux/fs.h> -#include <linux/ufs_fs.h> -#include <linux/sched.h> -#include <linux/stat.h> - -/* - * ufs_permission () - * - * Check for access rights - */ -int ufs_permission (struct inode * inode, int mask) -{ - unsigned short mode = inode->i_mode; - - /* - * Nobody gets write access to a file on a readonly-fs - */ - if ((mask & S_IWOTH) && - (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)) && - IS_RDONLY(inode)) - return -EROFS; - /* - * Nobody gets write access to an immutable file - */ - if ((mask & S_IWOTH) && IS_IMMUTABLE(inode)) - return -EACCES; - - /* - * If no ACL, checks using the file mode - */ - else if (current->fsuid == inode->i_uid) - mode >>= 6; - else if (in_group_p (inode->i_gid)) - mode >>= 3; - /* - * Access is always granted for root. We now check last, - * though, for BSD process accounting correctness - */ - if (((mode & mask & S_IRWXO) == mask) || capable(CAP_DAC_OVERRIDE)) - return 0; - if ((mask == S_IROTH) || - (S_ISDIR(mode) && !(mask & ~(S_IROTH | S_IXOTH)))) - if (capable(CAP_DAC_READ_SEARCH)) - return 0; - return -EACCES; -} diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c index 0e4e3a720..28798e294 100644 --- a/fs/ufs/dir.c +++ b/fs/ufs/dir.c @@ -177,25 +177,8 @@ int ufs_check_dir_entry (const char * function, struct inode * dir, return (error_msg == NULL ? 1 : 0); } -static struct file_operations ufs_dir_operations = { +struct file_operations ufs_dir_operations = { + read: generic_read_dir, readdir: ufs_readdir, fsync: file_fsync, }; - -struct inode_operations ufs_dir_inode_operations = { - &ufs_dir_operations, /* default directory file operations */ - ufs_create, /* create */ - ufs_lookup, /* lookup */ - ufs_link, /* link */ - ufs_unlink, /* unlink */ - ufs_symlink, /* symlink */ - ufs_mkdir, /* mkdir */ - ufs_rmdir, /* rmdir */ - ufs_mknod, /* mknod */ - ufs_rename, /* rename */ - NULL, /* readlink */ - NULL, /* follow_link */ - NULL, /* truncate */ - ufs_permission, /* permission */ - NULL /* revalidate */ -}; diff --git a/fs/ufs/file.c b/fs/ufs/file.c index 384774cc5..2a27f6f23 100644 --- a/fs/ufs/file.c +++ b/fs/ufs/file.c @@ -71,7 +71,7 @@ static long long ufs_file_lseek( * We have mostly NULL's here: the current defaults are ok for * the ufs filesystem. */ -static struct file_operations ufs_file_operations = { +struct file_operations ufs_file_operations = { llseek: ufs_file_lseek, read: generic_file_read, write: generic_file_write, @@ -79,6 +79,5 @@ static struct file_operations ufs_file_operations = { }; struct inode_operations ufs_file_inode_operations = { - &ufs_file_operations, truncate: ufs_truncate, }; diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c index 8b1943a84..93b520a0b 100644 --- a/fs/ufs/ialloc.c +++ b/fs/ufs/ialloc.c @@ -290,7 +290,6 @@ cg_found: inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; inode->u.ufs_i.i_flags = dir->u.ufs_i.i_flags; inode->u.ufs_i.i_lastfrag = 0; - inode->i_op = NULL; insert_inode_hash(inode); mark_inode_dirty(inode); diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index de2eec9a8..af07961e1 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c @@ -641,14 +641,14 @@ void ufs_read_inode (struct inode * inode) } - inode->i_op = NULL; - if (S_ISREG(inode->i_mode)) { inode->i_op = &ufs_file_inode_operations; + inode->i_fop = &ufs_file_operations; inode->i_mapping->a_ops = &ufs_aops; - } else if (S_ISDIR(inode->i_mode)) + } else if (S_ISDIR(inode->i_mode)) { inode->i_op = &ufs_dir_inode_operations; - else if (S_ISLNK(inode->i_mode)) { + inode->i_fop = &ufs_dir_operations; + } else if (S_ISLNK(inode->i_mode)) { if (!inode->i_blocks) inode->i_op = &ufs_fast_symlink_inode_operations; else { diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c index 71198abc4..a36a6c3af 100644 --- a/fs/ufs/namei.c +++ b/fs/ufs/namei.c @@ -183,7 +183,7 @@ failed: return NULL; } -struct dentry *ufs_lookup(struct inode * dir, struct dentry *dentry) +static struct dentry *ufs_lookup(struct inode * dir, struct dentry *dentry) { struct super_block * sb; struct inode * inode; @@ -403,7 +403,7 @@ static int ufs_delete_entry (struct inode * inode, struct ufs_dir_entry * dir, * If the create succeeds, we fill in the inode information * with d_instantiate(). */ -int ufs_create (struct inode * dir, struct dentry * dentry, int mode) +static int ufs_create (struct inode * dir, struct dentry * dentry, int mode) { struct super_block * sb; struct inode * inode; @@ -424,6 +424,7 @@ int ufs_create (struct inode * dir, struct dentry * dentry, int mode) if (!inode) return err; inode->i_op = &ufs_file_inode_operations; + inode->i_fop = &ufs_file_operations; inode->i_mapping->a_ops = &ufs_aops; inode->i_mode = mode; mark_inode_dirty(inode); @@ -450,7 +451,7 @@ int ufs_create (struct inode * dir, struct dentry * dentry, int mode) return 0; } -int ufs_mknod (struct inode * dir, struct dentry *dentry, int mode, int rdev) +static int ufs_mknod (struct inode * dir, struct dentry *dentry, int mode, int rdev) { struct super_block * sb; struct inode * inode; @@ -494,7 +495,7 @@ out_no_entry: goto out; } -int ufs_mkdir(struct inode * dir, struct dentry * dentry, int mode) +static int ufs_mkdir(struct inode * dir, struct dentry * dentry, int mode) { struct super_block * sb; struct inode * inode; @@ -516,6 +517,7 @@ int ufs_mkdir(struct inode * dir, struct dentry * dentry, int mode) goto out; inode->i_op = &ufs_dir_inode_operations; + inode->i_fop = &ufs_dir_operations; inode->i_size = UFS_SECTOR_SIZE; dir_block = ufs_bread (inode, 0, 1, &err); if (!dir_block) { @@ -631,7 +633,7 @@ static int ufs_empty_dir (struct inode * inode) return 1; } -int ufs_rmdir (struct inode * dir, struct dentry *dentry) +static int ufs_rmdir (struct inode * dir, struct dentry *dentry) { struct super_block *sb; int retval; @@ -690,7 +692,7 @@ end_rmdir: return retval; } -int ufs_unlink(struct inode * dir, struct dentry *dentry) +static int ufs_unlink(struct inode * dir, struct dentry *dentry) { struct super_block * sb; int retval; @@ -749,7 +751,7 @@ end_unlink: /* * Create symbolic link. We use only slow symlinks at this time. */ -int ufs_symlink (struct inode * dir, struct dentry * dentry, +static int ufs_symlink (struct inode * dir, struct dentry * dentry, const char * symname) { struct super_block * sb = dir->i_sb; @@ -813,7 +815,7 @@ out_no_entry: goto out; } -int ufs_link (struct dentry * old_dentry, struct inode * dir, +static int ufs_link (struct dentry * old_dentry, struct inode * dir, struct dentry *dentry) { struct inode *inode = old_dentry->d_inode; @@ -857,7 +859,7 @@ int ufs_link (struct dentry * old_dentry, struct inode * dir, * Anybody can rename anything with this: the permission checks are left to the * higher-level routines. */ -int ufs_rename (struct inode * old_dir, struct dentry * old_dentry, +static int ufs_rename (struct inode * old_dir, struct dentry * old_dentry, struct inode * new_dir, struct dentry * new_dentry ) { struct super_block * sb; @@ -973,3 +975,15 @@ end_rename: return retval; } + +struct inode_operations ufs_dir_inode_operations = { + create: ufs_create, + lookup: ufs_lookup, + link: ufs_link, + unlink: ufs_unlink, + symlink: ufs_symlink, + mkdir: ufs_mkdir, + rmdir: ufs_rmdir, + mknod: ufs_mknod, + rename: ufs_rename, +}; diff --git a/fs/ufs/super.c b/fs/ufs/super.c index 901c91ff2..80e97bb06 100644 --- a/fs/ufs/super.c +++ b/fs/ufs/super.c @@ -173,6 +173,8 @@ void ufs_print_cylinder_stuff(struct ufs_cylinder_group *cg, unsigned swab) } #endif /* UFS_SUPER_DEBUG_MORE */ +static struct super_operations ufs_super_ops; + static char error_buf[1024]; void ufs_error (struct super_block * sb, const char * function, @@ -947,15 +949,14 @@ int ufs_statfs (struct super_block * sb, struct statfs * buf, int bufsiz) } static struct super_operations ufs_super_ops = { - ufs_read_inode, - ufs_write_inode, - ufs_put_inode, - ufs_delete_inode, - NULL, /* notify_change() */ - ufs_put_super, - ufs_write_super, - ufs_statfs, - ufs_remount + read_inode: ufs_read_inode, + write_inode: ufs_write_inode, + put_inode: ufs_put_inode, + delete_inode: ufs_delete_inode, + put_super: ufs_put_super, + write_super: ufs_write_super, + statfs: ufs_statfs, + remount_fs: ufs_remount, }; static struct file_system_type ufs_fs_type = { |