login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2008
»
April
»
26
Re: [PATCH 6/19] UML - hppfs fixes
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: WANG Cong
Subject:
Re: [PATCH 6/19] UML - hppfs fixes
Date: Saturday, April 26, 2008 - 1:31 am
From: Jeff Dike <jdike@addtoit.com> Date: Fri, 25 Apr 2008 13:56:09 -0400
quoted text
> hppfs tidying and fixes noticed during hch's get_inode work - > style fixes > a copy_to_user got its return value checked > hppfs_write no longer fiddles file->f_pos because it gets and > returns pos in its arguments > hppfs_delete_inode dputs the underlyng procfs dentry stored in > its private data and mntputs the vfsmnt stashed in s_fs_info > hppfs_put_super no longer needs to mntput the s_fs_info, so it > no longer needs to exist > hppfs_readlink and hppfs_follow_link were doing a bunch of stuff > with a struct file which they didn't use > there is now a ->permission which calls generic_permission > get_inode was always returning 0 for some reason - it now > returns an inode if nothing bad happened > > Signed-off-by: Jeff Dike <jdike@linux.intel.com> > --- > fs/hppfs/hppfs_kern.c | 82 ++++++++++++++++++-------------------------------- > 1 file changed, 30 insertions(+), 52 deletions(-) > > Index: linux-2.6.22/fs/hppfs/hppfs_kern.c > =================================================================== > --- linux-2.6.22.orig/fs/hppfs/hppfs_kern.c 2008-04-24 13:35:54.000000000 -0400 > +++ linux-2.6.22/fs/hppfs/hppfs_kern.c 2008-04-24 15:31:59.000000000 -0400 > @@ -33,7 +33,7 @@ struct hppfs_private { > }; > > struct hppfs_inode_info { > - struct dentry *proc_dentry; > + struct dentry *proc_dentry; > struct inode vfs_inode; > }; > > @@ -52,7 +52,7 @@ static int is_pid(struct dentry *dentry) > int i; > > sb = dentry->d_sb; > - if ((sb->s_op != &hppfs_sbops) || (dentry->d_parent != sb->s_root)) > + if (dentry->d_parent != sb->s_root) > return 0; > > for (i = 0; i < dentry->d_name.len; i++) { > @@ -136,7 +136,7 @@ static int file_removed(struct dentry *d > } > > static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry, > - struct nameidata *nd) > + struct nameidata *nd) > { > struct dentry *proc_dentry, *new, *parent; > struct inode *inode; > @@ -254,6 +254,8 @@ static ssize_t hppfs_read(struct file *f > int err; > > if (hppfs->contents != NULL) { > + int rem; > + > if (*ppos >= hppfs->len) > return 0; > > @@ -267,8 +269,10 @@ static ssize_t hppfs_read(struct file *f > > if (off + count > hppfs->len) > count = hppfs->len - off; > - copy_to_user(buf, &data->contents[off], count); > - *ppos += count; > + rem = copy_to_user(buf, &data->contents[off], count); > + *ppos += count - rem; > + if (rem > 0) > + return -EFAULT;
Could you please explain why check 'rem' after using it here?
quoted text
> } else if (hppfs->host_fd != -1) { > err = os_seek_file(hppfs->host_fd, *ppos); > if (err) { > @@ -285,21 +289,15 @@ static ssize_t hppfs_read(struct file *f > return count; > } > > -static ssize_t hppfs_write(struct file *file, const char __user *buf, size_t len, > - loff_t *ppos) > +static ssize_t hppfs_write(struct file *file, const char __user *buf, > + size_t len, loff_t *ppos) > { > struct hppfs_private *data = file->private_data; > struct file *proc_file = data->proc_file; > ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *); > - int err; > > write = proc_file->f_path.dentry->d_inode->i_fop->write; > - > - proc_file->f_pos = file->f_pos; > - err = (*write)(proc_file, buf, len, &proc_file->f_pos); > - file->f_pos = proc_file->f_pos; > - > - return err; > + return (*write)(proc_file, buf, len, ppos); > } > > static int open_host_sock(char *host_file, int *filter_out) > @@ -357,7 +355,7 @@ static struct hppfs_data *hppfs_get_data > > if (filter) { > while ((n = read_proc(proc_file, data->contents, > - sizeof(data->contents), NULL, 0)) > 0) > + sizeof(data->contents), NULL, 0)) > 0) > os_write_file(fd, data->contents, n); > err = os_shutdown_socket(fd, 0, 1); > if (err) { > @@ -429,8 +427,8 @@ static int file_mode(int fmode) > static int hppfs_open(struct inode *inode, struct file *file) > { > struct hppfs_private *data; > - struct dentry *proc_dentry; > struct vfsmount *proc_mnt; > + struct dentry *proc_dentry;
And what does this kind of change mean?
quoted text
> char *host_file; > int err, fd, type, filter; > > @@ -492,8 +490,8 @@ static int hppfs_open(struct inode *inod > static int hppfs_dir_open(struct inode *inode, struct file *file) > { > struct hppfs_private *data; > - struct dentry *proc_dentry; > struct vfsmount *proc_mnt; > + struct dentry *proc_dentry;
ditto <snip> Thanks! Cong --
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[PATCH 6/19] UML - hppfs fixes
, Jeff Dike
, (Fri Apr 25, 10:56 am)
Re: [PATCH 6/19] UML - hppfs fixes
, WANG Cong
, (Sat Apr 26, 1:31 am)
Re: [PATCH 6/19] UML - hppfs fixes
, Jeff Dike
, (Mon Apr 28, 8:16 am)
Re: [PATCH 6/19] UML - hppfs fixes
, Jeff Dike
, (Mon Apr 28, 8:29 am)
Re: [PATCH 6/19] UML - hppfs fixes
, WANG Cong
, (Tue Apr 29, 1:04 am)
Navigation
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Ken Chen
[patch] sched: fix inconsistency when redistribute per-cpu tg->cfs_rq shares.
Nick Piggin
Re: [PATCH 2/2] smp_call_function: use rwlocks on queues rather than rcu
Kyle Moffett
Re: [PATCH 1/4] stringbuf: A string buffer implementation
Ingo Molnar
Re: [PATCH 00/12] mm/x86: bootmem
Andrew Morton
Re: [patch 1/5] wait: use lock bitops for __wait_on_bit_lock
git
:
Stephen Boyd
Re: [PATCH] Speed up bash completion loading
Jakub Narebski
Re: Avery Pennarun's git-subtree?
Junio C Hamano
Re: [PATCH v2 04/13] Teach rebase interactive the mark command
Catalin Marinas
Re: [ANNOUNCE] Stacked GIT 0.14.2
Eric Wong
[PATCH 5/5] rerere: add the diff command
git-commits-head
:
Linux Kernel Mailing List
[POWERPC] fsl_soc: add support to gianfar for fixed-link property
Linux Kernel Mailing List
fat: fix parse_options()
Linux Kernel Mailing List
ipmi: add oem message handling
Linux Kernel Mailing List
powerpc/85xx/86xx: Fix build w/ CONFIG_PCI=n
Linux Kernel Mailing List
KVM: x86 emulator: during rep emulation decrement ECX only if emulation succeeded
linux-netdev
:
Paweł Staszewski
Re: DCA/IOAT problem
Jarek Poplawski
Re: [PATCH iproute2] Re: HTB accuracy for high speed
Ingo Oeser
Re: [NET-NEXT PATCH 3/3] e1000e: add support for new 82574L part
Rick Jones
Re: UDP path MTU discovery
Dmitry Kozlov
Re: [PATCH v8] PPTP: PPP over IPv4 (Point-to-Point Tunneling Protocol)
openbsd-misc
:
David Vasek
Re: how to undelete?
Gruppo BCC
Banca inviato una notifica che e necessario completare
Pau Amaro-Seoane
Re: First install: Grub doesn't find partitions
Nick Holland
Re: Unattended OpenBSD Installation
stuart van Zee
Re: CVS hosed
Colocation donated by:
Syndicate