diff options
author | Chao Yu <chao2.yu@samsung.com> | 2015-01-23 07:36:04 -0500 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2015-02-11 20:04:35 -0500 |
commit | d49f3e890290bd1db047d02335401026d1886472 (patch) | |
tree | 37195404f8492f5fa2620db857b3fa0160a44214 /fs/f2fs | |
parent | bc4a1f873b9db010f5b0971ee5f2987d9be32c36 (diff) |
f2fs: add F2FS_IOC_GETVERSION support
In this patch we add the FS_IOC_GETVERSION ioctl for getting i_generation from
inode, after that, users can list file's generation number by using "lsattr -v".
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/f2fs.h | 1 | ||||
-rw-r--r-- | fs/f2fs/file.c | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 1795ce231118..5e16085d98d3 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h | |||
@@ -202,6 +202,7 @@ static inline bool __has_cursum_space(struct f2fs_summary_block *sum, int size, | |||
202 | */ | 202 | */ |
203 | #define F2FS_IOC_GETFLAGS FS_IOC_GETFLAGS | 203 | #define F2FS_IOC_GETFLAGS FS_IOC_GETFLAGS |
204 | #define F2FS_IOC_SETFLAGS FS_IOC_SETFLAGS | 204 | #define F2FS_IOC_SETFLAGS FS_IOC_SETFLAGS |
205 | #define F2FS_IOC_GETVERSION FS_IOC_GETVERSION | ||
205 | 206 | ||
206 | #define F2FS_IOCTL_MAGIC 0xf5 | 207 | #define F2FS_IOCTL_MAGIC 0xf5 |
207 | #define F2FS_IOC_START_ATOMIC_WRITE _IO(F2FS_IOCTL_MAGIC, 1) | 208 | #define F2FS_IOC_START_ATOMIC_WRITE _IO(F2FS_IOCTL_MAGIC, 1) |
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 710adc987937..ec17d05d6553 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c | |||
@@ -926,6 +926,13 @@ out: | |||
926 | return ret; | 926 | return ret; |
927 | } | 927 | } |
928 | 928 | ||
929 | static int f2fs_ioc_getversion(struct file *filp, unsigned long arg) | ||
930 | { | ||
931 | struct inode *inode = file_inode(filp); | ||
932 | |||
933 | return put_user(inode->i_generation, (int __user *)arg); | ||
934 | } | ||
935 | |||
929 | static int f2fs_ioc_start_atomic_write(struct file *filp) | 936 | static int f2fs_ioc_start_atomic_write(struct file *filp) |
930 | { | 937 | { |
931 | struct inode *inode = file_inode(filp); | 938 | struct inode *inode = file_inode(filp); |
@@ -1061,6 +1068,8 @@ long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
1061 | return f2fs_ioc_getflags(filp, arg); | 1068 | return f2fs_ioc_getflags(filp, arg); |
1062 | case F2FS_IOC_SETFLAGS: | 1069 | case F2FS_IOC_SETFLAGS: |
1063 | return f2fs_ioc_setflags(filp, arg); | 1070 | return f2fs_ioc_setflags(filp, arg); |
1071 | case F2FS_IOC_GETVERSION: | ||
1072 | return f2fs_ioc_getversion(filp, arg); | ||
1064 | case F2FS_IOC_START_ATOMIC_WRITE: | 1073 | case F2FS_IOC_START_ATOMIC_WRITE: |
1065 | return f2fs_ioc_start_atomic_write(filp); | 1074 | return f2fs_ioc_start_atomic_write(filp); |
1066 | case F2FS_IOC_COMMIT_ATOMIC_WRITE: | 1075 | case F2FS_IOC_COMMIT_ATOMIC_WRITE: |