diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2006-10-02 11:24:43 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-10-02 11:24:43 -0400 |
commit | 128e5ebaf8abbda375bba82690b09630003c9213 (patch) | |
tree | 8c8dcf1f0f8f04a9c56dd2e9378dac1a5a3e4e5c /fs/gfs2 | |
parent | d00223f1693173c7b51f867dd52049955a92d0ed (diff) |
[GFS2] Remove iflags.h, use FS_
Update GFS2 in the light of David Howells' patch:
[PATCH] BLOCK: Move common FS-specific ioctls to linux/fs.h [try #6]
36695673b012096228ebdc1b39a6a5850daa474e
which calls the filesystem independant flags FS_..._FL. As a result
we no longer need the flags.h file and the conversion routine is
moved into the GFS2 source code.
Userland programs which used to include iflags.h should now include
fs.h and use the new flag names.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/ops_file.c | 74 |
1 files changed, 47 insertions, 27 deletions
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c index fafa48b9105e..3064f133bf3c 100644 --- a/fs/gfs2/ops_file.c +++ b/fs/gfs2/ops_file.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/gfs2_ondisk.h> | 21 | #include <linux/gfs2_ondisk.h> |
22 | #include <linux/ext2_fs.h> | 22 | #include <linux/ext2_fs.h> |
23 | #include <linux/crc32.h> | 23 | #include <linux/crc32.h> |
24 | #include <linux/iflags.h> | ||
25 | #include <linux/lm_interface.h> | 24 | #include <linux/lm_interface.h> |
26 | #include <asm/uaccess.h> | 25 | #include <asm/uaccess.h> |
27 | 26 | ||
@@ -201,27 +200,48 @@ static int gfs2_readdir(struct file *file, void *dirent, filldir_t filldir) | |||
201 | return error; | 200 | return error; |
202 | } | 201 | } |
203 | 202 | ||
203 | /** | ||
204 | * fsflags_cvt | ||
205 | * @table: A table of 32 u32 flags | ||
206 | * @val: a 32 bit value to convert | ||
207 | * | ||
208 | * This function can be used to convert between fsflags values and | ||
209 | * GFS2's own flags values. | ||
210 | * | ||
211 | * Returns: the converted flags | ||
212 | */ | ||
213 | static u32 fsflags_cvt(const u32 *table, u32 val) | ||
214 | { | ||
215 | u32 res = 0; | ||
216 | while(val) { | ||
217 | if (val & 1) | ||
218 | res |= *table; | ||
219 | table++; | ||
220 | val >>= 1; | ||
221 | } | ||
222 | return res; | ||
223 | } | ||
204 | 224 | ||
205 | static const u32 iflags_to_gfs2[32] = { | 225 | static const u32 fsflags_to_gfs2[32] = { |
206 | [iflag_Sync] = GFS2_DIF_SYNC, | 226 | [3] = GFS2_DIF_SYNC, |
207 | [iflag_Immutable] = GFS2_DIF_IMMUTABLE, | 227 | [4] = GFS2_DIF_IMMUTABLE, |
208 | [iflag_Append] = GFS2_DIF_APPENDONLY, | 228 | [5] = GFS2_DIF_APPENDONLY, |
209 | [iflag_NoAtime] = GFS2_DIF_NOATIME, | 229 | [7] = GFS2_DIF_NOATIME, |
210 | [iflag_Index] = GFS2_DIF_EXHASH, | 230 | [12] = GFS2_DIF_EXHASH, |
211 | [iflag_JournalData] = GFS2_DIF_JDATA, | 231 | [14] = GFS2_DIF_JDATA, |
212 | [iflag_DirectIO] = GFS2_DIF_DIRECTIO, | 232 | [20] = GFS2_DIF_DIRECTIO, |
213 | }; | 233 | }; |
214 | 234 | ||
215 | static const u32 gfs2_to_iflags[32] = { | 235 | static const u32 gfs2_to_fsflags[32] = { |
216 | [gfs2fl_Sync] = IFLAG_SYNC, | 236 | [gfs2fl_Sync] = FS_SYNC_FL, |
217 | [gfs2fl_Immutable] = IFLAG_IMMUTABLE, | 237 | [gfs2fl_Immutable] = FS_IMMUTABLE_FL, |
218 | [gfs2fl_AppendOnly] = IFLAG_APPEND, | 238 | [gfs2fl_AppendOnly] = FS_APPEND_FL, |
219 | [gfs2fl_NoAtime] = IFLAG_NOATIME, | 239 | [gfs2fl_NoAtime] = FS_NOATIME_FL, |
220 | [gfs2fl_ExHash] = IFLAG_INDEX, | 240 | [gfs2fl_ExHash] = FS_INDEX_FL, |
221 | [gfs2fl_Jdata] = IFLAG_JOURNAL_DATA, | 241 | [gfs2fl_Jdata] = FS_JOURNAL_DATA_FL, |
222 | [gfs2fl_Directio] = IFLAG_DIRECTIO, | 242 | [gfs2fl_Directio] = FS_DIRECTIO_FL, |
223 | [gfs2fl_InheritDirectio] = IFLAG_DIRECTIO, | 243 | [gfs2fl_InheritDirectio] = FS_DIRECTIO_FL, |
224 | [gfs2fl_InheritJdata] = IFLAG_JOURNAL_DATA, | 244 | [gfs2fl_InheritJdata] = FS_JOURNAL_DATA_FL, |
225 | }; | 245 | }; |
226 | 246 | ||
227 | static int gfs2_get_flags(struct file *filp, u32 __user *ptr) | 247 | static int gfs2_get_flags(struct file *filp, u32 __user *ptr) |
@@ -230,15 +250,15 @@ static int gfs2_get_flags(struct file *filp, u32 __user *ptr) | |||
230 | struct gfs2_inode *ip = GFS2_I(inode); | 250 | struct gfs2_inode *ip = GFS2_I(inode); |
231 | struct gfs2_holder gh; | 251 | struct gfs2_holder gh; |
232 | int error; | 252 | int error; |
233 | u32 iflags; | 253 | u32 fsflags; |
234 | 254 | ||
235 | gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, &gh); | 255 | gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, &gh); |
236 | error = gfs2_glock_nq_m_atime(1, &gh); | 256 | error = gfs2_glock_nq_m_atime(1, &gh); |
237 | if (error) | 257 | if (error) |
238 | return error; | 258 | return error; |
239 | 259 | ||
240 | iflags = iflags_cvt(gfs2_to_iflags, ip->i_di.di_flags); | 260 | fsflags = fsflags_cvt(gfs2_to_fsflags, ip->i_di.di_flags); |
241 | if (put_user(iflags, ptr)) | 261 | if (put_user(fsflags, ptr)) |
242 | error = -EFAULT; | 262 | error = -EFAULT; |
243 | 263 | ||
244 | gfs2_glock_dq_m(1, &gh); | 264 | gfs2_glock_dq_m(1, &gh); |
@@ -327,19 +347,19 @@ out: | |||
327 | 347 | ||
328 | static int gfs2_set_flags(struct file *filp, u32 __user *ptr) | 348 | static int gfs2_set_flags(struct file *filp, u32 __user *ptr) |
329 | { | 349 | { |
330 | u32 iflags, gfsflags; | 350 | u32 fsflags, gfsflags; |
331 | if (get_user(iflags, ptr)) | 351 | if (get_user(fsflags, ptr)) |
332 | return -EFAULT; | 352 | return -EFAULT; |
333 | gfsflags = iflags_cvt(iflags_to_gfs2, iflags); | 353 | gfsflags = fsflags_cvt(fsflags_to_gfs2, fsflags); |
334 | return do_gfs2_set_flags(filp, gfsflags, ~0); | 354 | return do_gfs2_set_flags(filp, gfsflags, ~0); |
335 | } | 355 | } |
336 | 356 | ||
337 | static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 357 | static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
338 | { | 358 | { |
339 | switch(cmd) { | 359 | switch(cmd) { |
340 | case IFLAGS_GET_IOC: | 360 | case FS_IOC_GETFLAGS: |
341 | return gfs2_get_flags(filp, (u32 __user *)arg); | 361 | return gfs2_get_flags(filp, (u32 __user *)arg); |
342 | case IFLAGS_SET_IOC: | 362 | case FS_IOC_SETFLAGS: |
343 | return gfs2_set_flags(filp, (u32 __user *)arg); | 363 | return gfs2_set_flags(filp, (u32 __user *)arg); |
344 | } | 364 | } |
345 | return -ENOTTY; | 365 | return -ENOTTY; |