aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hppfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/hppfs')
-rw-r--r--fs/hppfs/hppfs_kern.c43
1 files changed, 19 insertions, 24 deletions
diff --git a/fs/hppfs/hppfs_kern.c b/fs/hppfs/hppfs_kern.c
index f8e0cbd0cb..52930915ba 100644
--- a/fs/hppfs/hppfs_kern.c
+++ b/fs/hppfs/hppfs_kern.c
@@ -4,6 +4,7 @@
4 */ 4 */
5 5
6#include <linux/fs.h> 6#include <linux/fs.h>
7#include <linux/file.h>
7#include <linux/module.h> 8#include <linux/module.h>
8#include <linux/init.h> 9#include <linux/init.h>
9#include <linux/slab.h> 10#include <linux/slab.h>
@@ -37,7 +38,7 @@ struct hppfs_inode_info {
37 38
38static inline struct hppfs_inode_info *HPPFS_I(struct inode *inode) 39static inline struct hppfs_inode_info *HPPFS_I(struct inode *inode)
39{ 40{
40 return(list_entry(inode, struct hppfs_inode_info, vfs_inode)); 41 return container_of(inode, struct hppfs_inode_info, vfs_inode);
41} 42}
42 43
43#define HPPFS_SUPER_MAGIC 0xb00000ee 44#define HPPFS_SUPER_MAGIC 0xb00000ee
@@ -232,7 +233,7 @@ static ssize_t read_proc(struct file *file, char *buf, ssize_t count,
232 set_fs(USER_DS); 233 set_fs(USER_DS);
233 234
234 if(ppos) *ppos = file->f_pos; 235 if(ppos) *ppos = file->f_pos;
235 return(n); 236 return n;
236} 237}
237 238
238static ssize_t hppfs_read_file(int fd, char *buf, ssize_t count) 239static ssize_t hppfs_read_file(int fd, char *buf, ssize_t count)
@@ -253,7 +254,7 @@ static ssize_t hppfs_read_file(int fd, char *buf, ssize_t count)
253 err = os_read_file(fd, new_buf, cur); 254 err = os_read_file(fd, new_buf, cur);
254 if(err < 0){ 255 if(err < 0){
255 printk("hppfs_read : read failed, errno = %d\n", 256 printk("hppfs_read : read failed, errno = %d\n",
256 count); 257 err);
257 n = err; 258 n = err;
258 goto out_free; 259 goto out_free;
259 } 260 }
@@ -270,7 +271,7 @@ static ssize_t hppfs_read_file(int fd, char *buf, ssize_t count)
270 out_free: 271 out_free:
271 kfree(new_buf); 272 kfree(new_buf);
272 out: 273 out:
273 return(n); 274 return n;
274} 275}
275 276
276static ssize_t hppfs_read(struct file *file, char *buf, size_t count, 277static ssize_t hppfs_read(struct file *file, char *buf, size_t count,
@@ -491,7 +492,7 @@ static int hppfs_open(struct inode *inode, struct file *file)
491 fd = open_host_sock(host_file, &filter); 492 fd = open_host_sock(host_file, &filter);
492 if(fd > 0){ 493 if(fd > 0){
493 data->contents = hppfs_get_data(fd, filter, 494 data->contents = hppfs_get_data(fd, filter,
494 &data->proc_file, 495 data->proc_file,
495 file, &data->len); 496 file, &data->len);
496 if(!IS_ERR(data->contents)) 497 if(!IS_ERR(data->contents))
497 data->host_fd = fd; 498 data->host_fd = fd;
@@ -543,7 +544,7 @@ static int hppfs_dir_open(struct inode *inode, struct file *file)
543static loff_t hppfs_llseek(struct file *file, loff_t off, int where) 544static loff_t hppfs_llseek(struct file *file, loff_t off, int where)
544{ 545{
545 struct hppfs_private *data = file->private_data; 546 struct hppfs_private *data = file->private_data;
546 struct file *proc_file = &data->proc_file; 547 struct file *proc_file = data->proc_file;
547 loff_t (*llseek)(struct file *, loff_t, int); 548 loff_t (*llseek)(struct file *, loff_t, int);
548 loff_t ret; 549 loff_t ret;
549 550
@@ -586,7 +587,7 @@ static int hppfs_filldir(void *d, const char *name, int size,
586static int hppfs_readdir(struct file *file, void *ent, filldir_t filldir) 587static int hppfs_readdir(struct file *file, void *ent, filldir_t filldir)
587{ 588{
588 struct hppfs_private *data = file->private_data; 589 struct hppfs_private *data = file->private_data;
589 struct file *proc_file = &data->proc_file; 590 struct file *proc_file = data->proc_file;
590 int (*readdir)(struct file *, void *, filldir_t); 591 int (*readdir)(struct file *, void *, filldir_t);
591 struct hppfs_dirent dirent = ((struct hppfs_dirent) 592 struct hppfs_dirent dirent = ((struct hppfs_dirent)
592 { .vfs_dirent = ent, 593 { .vfs_dirent = ent,
@@ -661,42 +662,36 @@ static int hppfs_readlink(struct dentry *dentry, char *buffer, int buflen)
661{ 662{
662 struct file *proc_file; 663 struct file *proc_file;
663 struct dentry *proc_dentry; 664 struct dentry *proc_dentry;
664 int (*readlink)(struct dentry *, char *, int); 665 int ret;
665 int err, n;
666 666
667 proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry; 667 proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
668 proc_file = dentry_open(dget(proc_dentry), NULL, O_RDONLY); 668 proc_file = dentry_open(dget(proc_dentry), NULL, O_RDONLY);
669 err = PTR_ERR(proc_dentry); 669 if (IS_ERR(proc_file))
670 if(IS_ERR(proc_dentry)) 670 return PTR_ERR(proc_file);
671 return(err);
672 671
673 readlink = proc_dentry->d_inode->i_op->readlink; 672 ret = proc_dentry->d_inode->i_op->readlink(proc_dentry, buffer, buflen);
674 n = (*readlink)(proc_dentry, buffer, buflen);
675 673
676 fput(proc_file); 674 fput(proc_file);
677 675
678 return(n); 676 return ret;
679} 677}
680 678
681static int hppfs_follow_link(struct dentry *dentry, struct nameidata *nd) 679static void* hppfs_follow_link(struct dentry *dentry, struct nameidata *nd)
682{ 680{
683 struct file *proc_file; 681 struct file *proc_file;
684 struct dentry *proc_dentry; 682 struct dentry *proc_dentry;
685 int (*follow_link)(struct dentry *, struct nameidata *); 683 void *ret;
686 int err, n;
687 684
688 proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry; 685 proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
689 proc_file = dentry_open(dget(proc_dentry), NULL, O_RDONLY); 686 proc_file = dentry_open(dget(proc_dentry), NULL, O_RDONLY);
690 err = PTR_ERR(proc_dentry); 687 if (IS_ERR(proc_file))
691 if(IS_ERR(proc_dentry)) 688 return proc_file;
692 return(err);
693 689
694 follow_link = proc_dentry->d_inode->i_op->follow_link; 690 ret = proc_dentry->d_inode->i_op->follow_link(proc_dentry, nd);
695 n = (*follow_link)(proc_dentry, nd);
696 691
697 fput(proc_file); 692 fput(proc_file);
698 693
699 return(n); 694 return ret;
700} 695}
701 696
702static struct inode_operations hppfs_dir_iops = { 697static struct inode_operations hppfs_dir_iops = {