diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-02-23 00:40:54 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-02-23 00:40:54 +0000 |
commit | 529c593ece216e4aaffd36bd940cb94f1fa63129 (patch) | |
tree | 78f1c0b805f5656aa7b0417a043c5346f700a2cf /fs/ufs | |
parent | 0bd079751d25808d1972baee5c4eaa1db2227257 (diff) |
Merge with 2.3.43. I did ignore all modifications to the qlogicisp.c
driver due to the Origin A64 hacks.
Diffstat (limited to 'fs/ufs')
-rw-r--r-- | fs/ufs/dir.c | 17 | ||||
-rw-r--r-- | fs/ufs/file.c | 85 | ||||
-rw-r--r-- | fs/ufs/inode.c | 44 | ||||
-rw-r--r-- | fs/ufs/namei.c | 4 | ||||
-rw-r--r-- | fs/ufs/symlink.c | 10 |
5 files changed, 49 insertions, 111 deletions
diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c index a828f3036..0e4e3a720 100644 --- a/fs/ufs/dir.c +++ b/fs/ufs/dir.c @@ -178,18 +178,8 @@ int ufs_check_dir_entry (const char * function, struct inode * dir, } static struct file_operations ufs_dir_operations = { - NULL, /* lseek */ - NULL, /* read */ - NULL, /* write */ - ufs_readdir, /* readdir */ - NULL, /* select */ - NULL, /* ioctl */ - NULL, /* mmap */ - NULL, /* open */ - NULL, /* flush */ - NULL, /* release */ - file_fsync, /* fsync */ - NULL, /* fasync */ + readdir: ufs_readdir, + fsync: file_fsync, }; struct inode_operations ufs_dir_inode_operations = { @@ -205,9 +195,6 @@ struct inode_operations ufs_dir_inode_operations = { ufs_rename, /* rename */ NULL, /* readlink */ NULL, /* follow_link */ - NULL, /* get_block */ - NULL, /* readpage */ - NULL, /* writepage */ NULL, /* truncate */ ufs_permission, /* permission */ NULL /* revalidate */ diff --git a/fs/ufs/file.c b/fs/ufs/file.c index fa4734d23..384774cc5 100644 --- a/fs/ufs/file.c +++ b/fs/ufs/file.c @@ -36,11 +36,6 @@ #include <linux/mm.h> #include <linux/pagemap.h> -#define NBUF 32 - -#define MIN(a,b) (((a)<(b))?(a):(b)) -#define MAX(a,b) (((a)>(b))?(a):(b)) - /* * Make sure the offset never goes beyond the 32-bit mark.. */ @@ -72,86 +67,18 @@ static long long ufs_file_lseek( return retval; } -static inline void remove_suid(struct inode *inode) -{ - unsigned int mode; - - /* set S_IGID if S_IXGRP is set, and always set S_ISUID */ - mode = (inode->i_mode & S_IXGRP)*(S_ISGID/S_IXGRP) | S_ISUID; - - /* was any of the uid bits set? */ - mode &= inode->i_mode; - if (mode && !suser()) { - inode->i_mode &= ~mode; - mark_inode_dirty(inode); - } -} - -/* - * Write to a file (through the page cache). - */ -static ssize_t -ufs_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos) -{ - ssize_t retval; - - retval = generic_file_write(file, buf, count, - ppos, block_write_partial_page); - if (retval > 0) { - struct inode *inode = file->f_dentry->d_inode; - remove_suid(inode); - inode->i_ctime = inode->i_mtime = CURRENT_TIME; - mark_inode_dirty(inode); - } - return retval; -} - -/* - * Called when an inode is released. Note that this is different - * from ufs_open: open gets called at every open, but release - * gets called only when /all/ the files are closed. - */ -static int ufs_release_file (struct inode * inode, struct file * filp) -{ - return 0; -} - /* * We have mostly NULL's here: the current defaults are ok for * the ufs filesystem. */ static struct file_operations ufs_file_operations = { - ufs_file_lseek, /* lseek */ - generic_file_read, /* read */ - ufs_file_write, /* write */ - NULL, /* readdir - bad */ - NULL, /* poll - default */ - NULL, /* ioctl */ - generic_file_mmap, /* mmap */ - NULL, /* no special open is needed */ - NULL, /* flush */ - ufs_release_file, /* release */ - NULL, /* fsync */ - NULL, /* fasync */ + llseek: ufs_file_lseek, + read: generic_file_read, + write: generic_file_write, + mmap: generic_file_mmap, }; struct inode_operations ufs_file_inode_operations = { - &ufs_file_operations,/* default file operations */ - NULL, /* create */ - NULL, /* lookup */ - NULL, /* link */ - NULL, /* unlink */ - NULL, /* symlink */ - NULL, /* mkdir */ - NULL, /* rmdir */ - NULL, /* mknod */ - NULL, /* rename */ - NULL, /* readlink */ - NULL, /* follow_link */ - ufs_getfrag_block, /* get_block */ - block_read_full_page, /* readpage */ - block_write_full_page, /* writepage */ - ufs_truncate, /* truncate */ - NULL, /* permission */ - NULL /* revalidate */ + &ufs_file_operations, + truncate: ufs_truncate, }; diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index 333186247..de2eec9a8 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c @@ -395,7 +395,7 @@ out: return result; } -int ufs_getfrag_block (struct inode *inode, long fragment, struct buffer_head *bh_result, int create) +static int ufs_getfrag_block (struct inode *inode, long fragment, struct buffer_head *bh_result, int create) { struct super_block * sb; struct ufs_sb_private_info * uspi; @@ -540,6 +540,30 @@ struct buffer_head * ufs_bread (struct inode * inode, unsigned fragment, return NULL; } +static int ufs_writepage(struct dentry *dentry, struct page *page) +{ + return block_write_full_page(page,ufs_getfrag_block); +} +static int ufs_readpage(struct dentry *dentry, struct page *page) +{ + return block_read_full_page(page,ufs_getfrag_block); +} +static int ufs_prepare_write(struct page *page, unsigned from, unsigned to) +{ + return block_prepare_write(page,from,to,ufs_getfrag_block); +} +static int ufs_bmap(struct address_space *mapping, long block) +{ + return generic_block_bmap(mapping,block,ufs_getfrag_block); +} +struct address_space_operations ufs_aops = { + readpage: ufs_readpage, + writepage: ufs_writepage, + prepare_write: ufs_prepare_write, + commit_write: generic_commit_write, + bmap: ufs_bmap +}; + void ufs_read_inode (struct inode * inode) { struct super_block * sb; @@ -619,15 +643,19 @@ void ufs_read_inode (struct inode * inode) inode->i_op = NULL; - if (S_ISREG(inode->i_mode)) + if (S_ISREG(inode->i_mode)) { inode->i_op = &ufs_file_inode_operations; - else if (S_ISDIR(inode->i_mode)) + inode->i_mapping->a_ops = &ufs_aops; + } else if (S_ISDIR(inode->i_mode)) inode->i_op = &ufs_dir_inode_operations; - else if (S_ISLNK(inode->i_mode)) - inode->i_op = inode->i_blocks - ?&ufs_symlink_inode_operations - :&ufs_fast_symlink_inode_operations; - else + else if (S_ISLNK(inode->i_mode)) { + if (!inode->i_blocks) + inode->i_op = &ufs_fast_symlink_inode_operations; + else { + inode->i_op = &page_symlink_inode_operations; + inode->i_mapping->a_ops = &ufs_aops; + } + } else init_special_inode(inode, inode->i_mode, SWAB32(ufs_inode->ui_u2.ui_addr.ui_db[0])); diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c index 33413b8cd..71198abc4 100644 --- a/fs/ufs/namei.c +++ b/fs/ufs/namei.c @@ -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_mapping->a_ops = &ufs_aops; inode->i_mode = mode; mark_inode_dirty(inode); bh = ufs_add_entry (dir, dentry->d_name.name, dentry->d_name.len, &de, &err); @@ -776,7 +777,8 @@ int ufs_symlink (struct inode * dir, struct dentry * dentry, if (l > sb->u.ufs_sb.s_uspi->s_maxsymlinklen) { /* slow symlink */ - inode->i_op = &ufs_symlink_inode_operations; + inode->i_op = &page_symlink_inode_operations; + inode->i_mapping->a_ops = &ufs_aops; err = block_symlink(inode, symname, l); if (err) goto out_no_entry; diff --git a/fs/ufs/symlink.c b/fs/ufs/symlink.c index 06ee82740..4550f44cf 100644 --- a/fs/ufs/symlink.c +++ b/fs/ufs/symlink.c @@ -1,6 +1,8 @@ /* * linux/fs/ufs/symlink.c * + * Only fast symlinks left here - the rest is done by generic code. AV, 1999 + * * Copyright (C) 1998 * Daniel Pirkl <daniel.pirkl@emai.cz> * Charles University, Faculty of Mathematics and Physics @@ -24,7 +26,6 @@ */ #include <linux/fs.h> -#include <linux/ufs_fs.h> static int ufs_readlink(struct dentry *dentry, char *buffer, int buflen) { @@ -42,10 +43,3 @@ struct inode_operations ufs_fast_symlink_inode_operations = { readlink: ufs_readlink, follow_link: ufs_follow_link, }; - -struct inode_operations ufs_symlink_inode_operations = { - readlink: page_readlink, - follow_link: page_follow_link, - get_block: ufs_getfrag_block, - readpage: block_read_full_page -}; |