diff options
Diffstat (limited to 'fs/coda')
-rw-r--r-- | fs/coda/dir.c | 3 | ||||
-rw-r--r-- | fs/coda/file.c | 17 | ||||
-rw-r--r-- | fs/coda/pioctl.c | 2 | ||||
-rw-r--r-- | fs/coda/symlink.c | 116 | ||||
-rw-r--r-- | fs/coda/sysctl.c | 10 |
5 files changed, 35 insertions, 113 deletions
diff --git a/fs/coda/dir.c b/fs/coda/dir.c index 883e34a91..794a8d263 100644 --- a/fs/coda/dir.c +++ b/fs/coda/dir.c @@ -80,11 +80,8 @@ struct inode_operations coda_dir_inode_operations = NULL, /* get_block */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* flushpage */ NULL, /* truncate */ coda_permission, /* permission */ - NULL, /* smap */ - NULL, /* update page */ coda_revalidate_inode /* revalidate */ }; diff --git a/fs/coda/file.c b/fs/coda/file.c index d5cf1afef..d053258e8 100644 --- a/fs/coda/file.c +++ b/fs/coda/file.c @@ -26,7 +26,7 @@ #include <linux/coda_proc.h> /* file operations */ -static int coda_readpage(struct file *file, struct page * page); +static int coda_readpage(struct dentry *dentry, struct page * page); static ssize_t coda_file_read(struct file *f, char *buf, size_t count, loff_t *off); static ssize_t coda_file_write(struct file *f, const char *buf, size_t count, loff_t *off); static int coda_file_mmap(struct file * file, struct vm_area_struct * vma); @@ -50,10 +50,8 @@ struct inode_operations coda_file_inode_operations = { NULL, /* get_block */ coda_readpage, /* readpage */ NULL, /* writepage */ - NULL, /* flushpage */ NULL, /* truncate */ coda_permission, /* permission */ - NULL, /* smap */ coda_revalidate_inode /* revalidate */ }; @@ -76,12 +74,10 @@ struct file_operations coda_file_operations = { }; /* File file operations */ -static int coda_readpage(struct file * coda_file, struct page * page) +static int coda_readpage(struct dentry * dentry, struct page * page) { - struct dentry *de = coda_file->f_dentry; - struct inode *coda_inode = de->d_inode; + struct inode *coda_inode = dentry->d_inode; struct dentry cont_dentry; - struct file cont_file; struct coda_inode_info *cii; ENTRY; @@ -91,17 +87,16 @@ static int coda_readpage(struct file * coda_file, struct page * page) if ( ! cii->c_ovp ) { printk("coda_readpage: no open inode for ino %ld, %s\n", - coda_inode->i_ino, de->d_name.name); + coda_inode->i_ino, dentry->d_name.name); return -ENXIO; } - coda_prepare_openfile(coda_inode, coda_file, cii->c_ovp, - &cont_file, &cont_dentry); + cont_dentry.d_inode = cii->c_ovp; CDEBUG(D_INODE, "coda ino: %ld, cached ino %ld, page offset: %lx\n", coda_inode->i_ino, cii->c_ovp->i_ino, page->index); - block_read_full_page(&cont_file, page); + block_read_full_page(&cont_dentry, page); EXIT; return 0; } diff --git a/fs/coda/pioctl.c b/fs/coda/pioctl.c index 3e6924f15..cec92b7f4 100644 --- a/fs/coda/pioctl.c +++ b/fs/coda/pioctl.c @@ -49,10 +49,8 @@ struct inode_operations coda_ioctl_inode_operations = NULL, /* get_block */ NULL, /* readpage */ NULL, /* writepage */ - NULL, /* flushpage */ NULL, /* truncate */ coda_ioctl_permission, /* permission */ - NULL, /* smap */ NULL /* revalidate */ }; diff --git a/fs/coda/symlink.c b/fs/coda/symlink.c index cfe0dbcb7..872370cf9 100644 --- a/fs/coda/symlink.c +++ b/fs/coda/symlink.c @@ -14,9 +14,6 @@ #include <linux/stat.h> #include <linux/errno.h> #include <linux/locks.h> -#include <asm/segment.h> -#include <asm/uaccess.h> -#include <linux/string.h> #include <linux/coda.h> #include <linux/coda_linux.h> @@ -25,99 +22,34 @@ #include <linux/coda_cache.h> #include <linux/coda_proc.h> -static int coda_readlink(struct dentry *de, char *buffer, int length); -static struct dentry *coda_follow_link(struct dentry *, struct dentry *, - unsigned int); - -struct inode_operations coda_symlink_inode_operations = { - NULL, /* no file-operations */ - NULL, /* create */ - NULL, /* lookup */ - NULL, /* link */ - NULL, /* unlink */ - NULL, /* symlink */ - NULL, /* mkdir */ - NULL, /* rmdir */ - NULL, /* mknod */ - NULL, /* rename */ - coda_readlink, /* readlink */ - coda_follow_link, /* follow_link */ - NULL, /* get_block */ - NULL, /* readpage */ - NULL, /* writepage */ - NULL, /* flushpage */ - NULL, /* truncate */ - NULL, /* permission */ - NULL, /* smap */ - NULL /* revalidate */ -}; - -static int coda_readlink(struct dentry *de, char *buffer, int length) +static int coda_symlink_filler(struct dentry *dentry, struct page *page) { - struct inode *inode = de->d_inode; - int len; - int error; - char *buf; - struct coda_inode_info *cp; - ENTRY; - - cp = ITOC(inode); - coda_vfs_stat.readlink++; - - /* the maximum length we receive is len */ - if ( length > CODA_MAXPATHLEN ) - len = CODA_MAXPATHLEN; - else - len = length; - CODA_ALLOC(buf, char *, len); - if ( !buf ) - return -ENOMEM; - - error = venus_readlink(inode->i_sb, &(cp->c_fid), buf, &len); - - CDEBUG(D_INODE, "result %s\n", buf); - if (! error) { - copy_to_user(buffer, buf, len); - put_user('\0', buffer + len); - error = len; - } - if ( buf ) - CODA_FREE(buf, len); - return error; -} - -static struct dentry *coda_follow_link(struct dentry *de, struct dentry *base, - unsigned int follow) -{ - struct inode *inode = de->d_inode; + struct inode *inode = dentry->d_inode; int error; struct coda_inode_info *cnp; - unsigned int len; - char mem[CODA_MAXPATHLEN]; - char *path; - ENTRY; - CDEBUG(D_INODE, "(%x/%ld)\n", inode->i_dev, inode->i_ino); - + unsigned int len = PAGE_SIZE; + char *p = (char*)kmap(page); + cnp = ITOC(inode); coda_vfs_stat.follow_link++; - len = CODA_MAXPATHLEN; - error = venus_readlink(inode->i_sb, &(cnp->c_fid), mem, &len); - - if (error) { - dput(base); - return ERR_PTR(error); - } - len = strlen(mem); - path = kmalloc(len + 1, GFP_KERNEL); - if (!path) { - dput(base); - return ERR_PTR(-ENOMEM); - } - memcpy(path, mem, len); - path[len] = 0; - - base = lookup_dentry(path, base, follow); - kfree(path); - return base; + error = venus_readlink(inode->i_sb, &(cnp->c_fid), p, &len); + if (error) + goto fail; + SetPageUptodate(page); + kunmap(page); + UnlockPage(page); + return 0; + +fail: + SetPageError(page); + kunmap(page); + UnlockPage(page); + return error; } + +struct inode_operations coda_symlink_inode_operations = { + readlink: page_readlink, + follow_link: page_follow_link, + readpage: coda_symlink_filler +}; diff --git a/fs/coda/sysctl.c b/fs/coda/sysctl.c index 42b0fafca..046153362 100644 --- a/fs/coda/sysctl.c +++ b/fs/coda/sysctl.c @@ -285,7 +285,7 @@ int do_reset_coda_cache_inv_stats( ctl_table * table, int write, } int coda_vfs_stats_get_info( char * buffer, char ** start, off_t offset, - int length, int dummy ) + int length) { int len=0; off_t begin; @@ -352,7 +352,7 @@ int coda_vfs_stats_get_info( char * buffer, char ** start, off_t offset, } int coda_upcall_stats_get_info( char * buffer, char ** start, off_t offset, - int length, int dummy ) + int length) { int len=0; int i; @@ -399,7 +399,7 @@ int coda_upcall_stats_get_info( char * buffer, char ** start, off_t offset, } int coda_permission_stats_get_info( char * buffer, char ** start, off_t offset, - int length, int dummy ) + int length) { int len=0; off_t begin; @@ -428,7 +428,7 @@ int coda_permission_stats_get_info( char * buffer, char ** start, off_t offset, } int coda_cache_inv_stats_get_info( char * buffer, char ** start, off_t offset, - int length, int dummy ) + int length) { int len=0; off_t begin; @@ -492,7 +492,7 @@ void coda_sysctl_init() reset_coda_cache_inv_stats(); #ifdef CONFIG_PROC_FS - proc_fs_coda = create_proc_entry("coda", S_IFDIR, proc_root_fs); + proc_fs_coda = proc_mkdir("coda", proc_root_fs); proc_fs_coda->owner = THIS_MODULE; coda_proc_create("vfs_stats", coda_vfs_stats_get_info); coda_proc_create("upcall_stats", coda_upcall_stats_get_info); |