[Pvfs2-cvs] commit by slang in pvfs2/src/kernel/linux-2.6: file.c
CVS commit program
cvs at parl.clemson.edu
Mon Aug 20 22:23:03 EDT 2007
Update of /projects/cvsroot/pvfs2/src/kernel/linux-2.6
In directory parlweb1:/tmp/cvs-serv6749/src/kernel/linux-2.6
Modified Files:
file.c
Log Message:
add SETFLAG GETFLAG ioctls for immutable/append flags to work with chattr/lsattr.
Index: file.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/kernel/linux-2.6/file.c,v
diff -p -u -r1.137 -r1.138
--- file.c 19 Aug 2007 18:20:27 -0000 1.137
+++ file.c 21 Aug 2007 02:23:03 -0000 1.138
@@ -2855,8 +2855,54 @@ int pvfs2_ioctl(
unsigned long arg)
{
int ret = -ENOTTY;
+ uint64_t val = 0;
+ unsigned long uval;
gossip_debug(GOSSIP_FILE_DEBUG, "pvfs2_ioctl: called with cmd %d\n", cmd);
+
+ /* we understand some general ioctls on files, such as the immutable
+ * and append flags
+ */
+ if(cmd == FS_IOC_GETFLAGS)
+ {
+ val = 0;
+ ret = pvfs2_xattr_get_default(inode,
+ "user.pvfs2.meta_hint",
+ &val, sizeof(val));
+ if(ret < 0 && ret != -ENODATA)
+ {
+ return ret;
+ }
+ else if(ret == -ENODATA)
+ {
+ val = 0;
+ }
+ uval = val;
+ gossip_debug(GOSSIP_FILE_DEBUG, "pvfs2_ioctl: FS_IOC_GETFLAGS: %llu\n",
+ (unsigned long long)uval);
+ return put_user(uval, (int __user *)arg);
+ }
+ else if(cmd == FS_IOC_SETFLAGS)
+ {
+ ret = 0;
+ if(get_user(uval, (int __user *)arg))
+ {
+ return -EFAULT;
+ }
+ if(uval & (~(FS_IMMUTABLE_FL|FS_APPEND_FL|FS_NOATIME_FL)))
+ {
+ gossip_err("pvfs2_ioctl: the FS_IOC_SETFLAGS only supports setting "
+ "one of FS_IMMUTABLE_FL|FS_APPEND_FL|FS_NOATIME_FL\n");
+ return -EINVAL;
+ }
+ val = uval;
+ gossip_debug(GOSSIP_FILE_DEBUG, "pvfs2_ioctl: FS_IOC_SETFLAGS: %llu\n",
+ (unsigned long long)val);
+ ret = pvfs2_xattr_set_default(inode,
+ "user.pvfs2.meta_hint",
+ &val, sizeof(val), 0);
+ }
+
return ret;
}
More information about the Pvfs2-cvs
mailing list