Why doesn't this patch work?
I'm attempting to write this little dinky patch to see who calls fsync() or fdatasync(), but it's spitting out compiler warnings. I can't figure out why, though. What did I do wrong?
buffer.c: In function `report_culprit':
buffer.c:409: warning: assignment from incompatible pointer type buffer.c:410: warning: passing arg 2 of d_path' from incompatible pointer type buffer.c:420: warning: passing arg 1 of mntput' from incompatible pointer type
fs/buffer.c renamed from fs/buffer.c.orig +28 -0
@@ -396,6 +396,30 @@return ret; } +static void report_culprit (struct dentry *dentry,struct file *file,char *action) +{ +struct vfsmnt * mnt; +char * buf = (char *)__get_free_page (GFP_KERNEL ); +char * path; +int len; + +if (!buf) +return ; + + mnt =mntget (file->f_vfsmnt); + path =d_path (dentry, mnt, buf,PAGE_SIZE -1 ); + len = buf +PAGE_SIZE -1 - path; +if (len >=PAGE_SIZE -1 ) + len =PAGE_SIZE -1 ; + path[len] ='\0' ; + +printk ("Process %u (%s) %s()ed \"%s\".\n" , + current->pid, current->comm, action, path); + +free_page ((unsigned long )buf); +mntput (mnt); +} +asmlinkage long sys_fsync (unsigned int fd) {struct file * file;
@@ -415,6 +439,8 @@if (!file->f_op || !file->f_op->fsync) goto out_putf; +report_culprit (dentry, file,"fsync" ); +/* We need to protect against concurrent writers.. */ down (&inode->i_sem);filemap_fdatasync (inode->i_mapping);
@@ -446,6 +472,8 @@ err = -EINVAL ;if (!file->f_op || !file->f_op->fsync) goto out_putf; + +report_culprit (dentry, file,"fdatasync" );down (&inode->i_sem);filemap_fdatasync (inode->i_mapping);
Simon-
[ Stormix Technologies Inc. ][ NetNation Communications Inc. ]
[ [email protected] ][ [email protected] ]
[ Opinions expressed are not necessarily those of my employers. ]
Quoted 8 lines · Simon Kirby
I'm attempting to write this little dinky patch to see who calls
fsync()orfdatasync(), but it's spitting out compiler warnings. I can't figure out why, though. What did I do wrong?
buffer.c: In function `report_culprit':
buffer.c:409: warning: assignment from incompatible pointer type buffer.c:410: warning: passing arg 2 ofd_path' from incompatible pointer type buffer.c:420: warning: passing arg 1 ofmntput' from incompatible pointer type
s/struct vfsmnt/struct vfsmount/
Robert Love
fs/buffer.c line 401
Quoted 3 lines · Simon Kirby
buffer.c:409: warning: assignment from incompatible pointer type
fs/buffer.c renamed from fs/buffer.c.orig +1
-0+struct vfsmnt * mnt;
vfsmount perhaps ?
Dave.
Signature · 2 lines
| Dave Jones. http://www.codemonkey.org.uk | SuSE Labs
Quoted 11 lines · Robert Love
Quoted 8 lines · Simon Kirby
I'm attempting to write this little dinky patch to see who calls
fsync()orfdatasync(), but it's spitting out compiler warnings. I can't figure out why, though. What did I do wrong?
buffer.c: In function `report_culprit':
buffer.c:409: warning: assignment from incompatible pointer type buffer.c:410: warning: passing arg 2 ofd_path' from incompatible pointer type buffer.c:420: warning: passing arg 1 ofmntput' from incompatible pointer types/struct vfsmnt/struct vfsmount/
Doh!
Simon-
[ Stormix Technologies Inc. ][ NetNation Communications Inc. ]
[ [email protected] ][ [email protected] ]
[ Opinions expressed are not necessarily those of my employers. ]