diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2006-03-31 15:01:28 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-03-31 15:01:28 -0500 |
commit | 7ea9ea832212c4a755650f7c7cc1ff0b63292a41 (patch) | |
tree | 86ccc012c7b841de6391e7408bf3f3097ca2710d /include | |
parent | e3167ded1f1b16424bc14d5673cdc5414f179970 (diff) |
[GFS2] Update ioctl() to new interface
This is designed as a fs independent way to set flags on a
particular inode. The values of the ioctl() and flags are
designed to be identical to the ext2/3 values. Assuming that
this plan is acceptable to people in general, the plan is to
then move other fs across to using the same set of #defines,
etc.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/gfs2_ondisk.h | 16 | ||||
-rw-r--r-- | include/linux/iflags.h | 104 |
2 files changed, 120 insertions, 0 deletions
diff --git a/include/linux/gfs2_ondisk.h b/include/linux/gfs2_ondisk.h index a5fb4f99aa45..3ab40917383f 100644 --- a/include/linux/gfs2_ondisk.h +++ b/include/linux/gfs2_ondisk.h | |||
@@ -197,6 +197,22 @@ struct gfs2_quota { | |||
197 | #define DT2IF(dt) (((dt) << 12) & S_IFMT) | 197 | #define DT2IF(dt) (((dt) << 12) & S_IFMT) |
198 | #define IF2DT(sif) (((sif) & S_IFMT) >> 12) | 198 | #define IF2DT(sif) (((sif) & S_IFMT) >> 12) |
199 | 199 | ||
200 | enum { | ||
201 | gfs2fl_Jdata = 0, | ||
202 | gfs2fl_ExHash = 1, | ||
203 | gfs2fl_Unused = 2, | ||
204 | gfs2fl_EaIndirect = 3, | ||
205 | gfs2fl_Directio = 4, | ||
206 | gfs2fl_Immutable = 5, | ||
207 | gfs2fl_AppendOnly = 6, | ||
208 | gfs2fl_NoAtime = 7, | ||
209 | gfs2fl_Sync = 8, | ||
210 | gfs2fl_System = 9, | ||
211 | gfs2fl_TruncInProg = 29, | ||
212 | gfs2fl_InheritDirectio = 30, | ||
213 | gfs2fl_InheritJdata = 31, | ||
214 | }; | ||
215 | |||
200 | /* Dinode flags */ | 216 | /* Dinode flags */ |
201 | #define GFS2_DIF_JDATA 0x00000001 | 217 | #define GFS2_DIF_JDATA 0x00000001 |
202 | #define GFS2_DIF_EXHASH 0x00000002 | 218 | #define GFS2_DIF_EXHASH 0x00000002 |
diff --git a/include/linux/iflags.h b/include/linux/iflags.h new file mode 100644 index 000000000000..1b4d9ef5d62b --- /dev/null +++ b/include/linux/iflags.h | |||
@@ -0,0 +1,104 @@ | |||
1 | #ifndef _LINUX_IFLAGS_H | ||
2 | #define _LINUX_IFLAGS_H | ||
3 | |||
4 | /* | ||
5 | * A universal set of inode flags. | ||
6 | * | ||
7 | * Originally taken from ext2/3 with additions for other filesystems. | ||
8 | * Filesystems supporting this interface should interoperate with | ||
9 | * the lsattr and chattr command line tools. | ||
10 | * | ||
11 | * This interface is supported in whole or in part by: | ||
12 | * ext2 | ||
13 | * ext3 | ||
14 | * xfs | ||
15 | * jfs | ||
16 | * gfs2 | ||
17 | * | ||
18 | */ | ||
19 | |||
20 | #define IFLAGS_GET_IOC _IOR('f', 1, long) | ||
21 | #define IFLAGS_SET_IOC _IOW('f', 2, long) | ||
22 | |||
23 | /* | ||
24 | * These values are provided for use as indices of an array | ||
25 | * for use with the iflags_cvt function below | ||
26 | */ | ||
27 | enum { | ||
28 | iflag_SecureRm = 0, /* Secure deletion */ | ||
29 | iflag_Unrm = 1, /* Undelete */ | ||
30 | iflag_Compress = 2, /* Compress file */ | ||
31 | iflag_Sync = 3, /* Synchronous updates */ | ||
32 | iflag_Immutable = 4, /* Immutable */ | ||
33 | iflag_Append = 5, /* Append */ | ||
34 | iflag_NoDump = 6, /* Don't dump file */ | ||
35 | iflag_NoAtime = 7, /* No atime updates */ | ||
36 | /* Reserved for compression usage */ | ||
37 | iflag_Dirty = 8, | ||
38 | iflag_ComprBlk = 9, /* One or more compressed clusters */ | ||
39 | iflag_NoComp = 10, /* Don't compress */ | ||
40 | iflag_Ecompr = 11, /* Compression error */ | ||
41 | /* End of compression flags */ | ||
42 | iflag_Btree = 12, /* btree format dir */ | ||
43 | iflag_Index = 12, /* hash-indexed directory */ | ||
44 | iflag_Imagic = 13, /* AFS directory */ | ||
45 | iflag_JournalData = 14, /* file data should be journaled */ | ||
46 | iflag_NoTail = 15, /* file tail should not be merged */ | ||
47 | iflag_DirSync = 16, /* dirsync behaviour */ | ||
48 | iflag_TopDir = 17, /* Top of directory hierarchies */ | ||
49 | iflag_DirectIO = 18, /* Always use direct I/O on this file */ | ||
50 | iflag_InheritDirectIO = 19, /* Set DirectIO on new files in dir */ | ||
51 | iflag_InheritJdata = 20, /* Set JournalData on create in dir */ | ||
52 | iflag_Reserved = 31 /* reserved for ext2/3 lib */ | ||
53 | }; | ||
54 | |||
55 | #define __IFL(x) (1<<(iflag_##x)) | ||
56 | #define IFLAG_SECRM __IFL(SecureRm) /* 0x00000001 */ | ||
57 | #define IFLAG_UNRM __IFL(Unrm) /* 0x00000002 */ | ||
58 | #define IFLAG_COMPR __IFL(Compr) /* 0x00000004 */ | ||
59 | #define IFLAG_SYNC __IFL(Sync) /* 0x00000008 */ | ||
60 | #define IFLAG_IMMUTABLE __IFL(Immutable) /* 0x00000010 */ | ||
61 | #define IFLAG_APPEND __IFL(Append) /* 0x00000020 */ | ||
62 | #define IFLAG_NODUMP __IFL(NoDump) /* 0x00000040 */ | ||
63 | #define IFLAG_NOATIME __IFL(NoAtime) /* 0x00000080 */ | ||
64 | #define IFLAG_DIRTY __IFL(Dirty) /* 0x00000100 */ | ||
65 | #define IFLAG_COMPRBLK __IFL(ComprBlk) /* 0x00000200 */ | ||
66 | #define IFLAG_NOCOMP __IFL(NoComp) /* 0x00000400 */ | ||
67 | #define IFLAG_ECOMPR __IFL(Ecompr) /* 0x00000800 */ | ||
68 | #define IFLAG_BTREE __IFL(Btree) /* 0x00001000 */ | ||
69 | #define IFLAG_INDEX __IFL(Index) /* 0x00001000 */ | ||
70 | #define IFLAG_IMAGIC __IFL(Imagic) /* 0x00002000 */ | ||
71 | #define IFLAG_JOURNAL_DATA __IFL(JournalData) /* 0x00004000 */ | ||
72 | #define IFLAG_NOTAIL __IFL(NoTail) /* 0x00008000 */ | ||
73 | #define IFLAG_DIRSYNC __IFL(DirSync) /* 0x00010000 */ | ||
74 | #define IFLAG_TOPDIR __IFL(TopDir) /* 0x00020000 */ | ||
75 | #define IFLAG_DIRECTIO __IFL(DirectIO) /* 0x00040000 */ | ||
76 | #define IFLAG_INHERITDIRECTIO __IFL(InheritDirectIO) /* 0x00080000 */ | ||
77 | #define IFLAG_INHERITJDATA __IFL(InheritJdata) /* 0x00100000 */ | ||
78 | #define IFLAG_RESERVED __IFL(Reserved) /* 0x80000000 */ | ||
79 | |||
80 | #ifdef __KERNEL__ | ||
81 | /** | ||
82 | * iflags_cvt | ||
83 | * @table: A table of 32 u32 flags | ||
84 | * @val: a 32 bit value to convert | ||
85 | * | ||
86 | * This function can be used to convert between IFLAGS values and | ||
87 | * the filesystem's own flags values. | ||
88 | * | ||
89 | * Returns: the converted flags | ||
90 | */ | ||
91 | static inline u32 iflags_cvt(const u32 *table, u32 val) | ||
92 | { | ||
93 | u32 res = 0; | ||
94 | while(val) { | ||
95 | if (val & 1) | ||
96 | res |= *table; | ||
97 | table++; | ||
98 | val >>= 1; | ||
99 | } | ||
100 | return res; | ||
101 | } | ||
102 | #endif /* __KERNEL__ */ | ||
103 | |||
104 | #endif /* _LINUX_IFLAGS_H */ | ||