1 /* source: xio-fs.c */
2 /* Copyright Gerhard Rieger and contributors (see file CHANGES) */
3 /* Published under the GNU General Public License V.2, see file COPYING */
4 
5 /* this file contains the source for handling Linux fs options
6    they can also be set with chattr(1) and viewed with lsattr(1) */
7 
8 #include "xiosysincludes.h"
9 #include "xioopen.h"
10 
11 #include "xio-fs.h"
12 
13 
14 #if WITH_FS
15 
16 /****** FD options ******/
17 
18 #if defined(EXT2_IOC_GETFLAGS) && !defined(FS_IOC_GETFLAGS)
19 #  define FS_IOC_GETFLAGS EXT2_IOC_GETFLAGS
20 #endif
21 #if defined(EXT2_IOC_SETFLAGS) && !defined(FS_IOC_SETFLAGS)
22 #  define FS_IOC_SETFLAGS EXT2_IOC_SETFLAGS
23 #endif
24 
25 #if defined(EXT2_SECRM_FL) && !defined(FS_SECRM_FL)
26 #  define FS_SECRM_FL EXT2_SECRM_FL
27 #endif
28 #ifdef FS_SECRM_FL
29 /* secure deletion, chattr 's' */
30 const struct optdesc opt_fs_secrm        = { "fs-secrm",        "secrm",        OPT_FS_SECRM,        GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, FS_IOC_GETFLAGS, FS_IOC_SETFLAGS, FS_SECRM_FL };
31 #endif
32 
33 #if defined(EXT2_UNRM_FL) && !defined(FS_UNRM_FL)
34 #  define FS_UNRM_FL EXT2_UNRM_FL
35 #endif
36 #ifdef FS_UNRM_FL
37 /* undelete, chattr 'u' */
38 const struct optdesc opt_fs_unrm         = { "fs-unrm",         "unrm",         OPT_FS_UNRM,         GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, FS_IOC_GETFLAGS, FS_IOC_SETFLAGS, FS_UNRM_FL };
39 #endif /* FS_UNRM_FL */
40 
41 #if defined(EXT2_COMPR_FL) && !defined(FS_COMPR_FL)
42 #  define FS_COMPR_FL EXT2_COMPR_FL
43 #endif
44 #ifdef FS_COMPR_FL
45 /* compress file, chattr 'c' */
46 const struct optdesc opt_fs_compr        = { "fs-compr",        "compr",        OPT_FS_COMPR,        GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, FS_IOC_GETFLAGS, FS_IOC_SETFLAGS, FS_COMPR_FL };
47 #endif /* FS_COMPR_FL */
48 
49 #if defined(EXT2_SYNC_FL) && !defined(FS_SYNC_FL)
50 #  define FS_SYNC_FL EXT2_SYNC_FL
51 #endif
52 #ifdef FS_SYNC_FL
53 /* synchronous update, chattr 'S' */
54 const struct optdesc opt_fs_sync         = { "fs-sync",         "sync",         OPT_FS_SYNC,         GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, FS_IOC_GETFLAGS, FS_IOC_SETFLAGS, FS_SYNC_FL };
55 #endif /* FS_SYNC_FL */
56 
57 #if defined(EXT2_IMMUTABLE_FL) && !defined(FS_IMMUTABLE_FL)
58 #  define FS_IMMUTABLE_FL EXT2_IMMUTABLE_FL
59 #endif
60 #ifdef FS_IMMUTABLE_FL
61 /* immutable file, chattr 'i' */
62 const struct optdesc opt_fs_immutable    = { "fs-immutable",    "immutable",    OPT_FS_IMMUTABLE,    GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, FS_IOC_GETFLAGS, FS_IOC_SETFLAGS, FS_IMMUTABLE_FL };
63 #endif /* FS_IMMUTABLE_FL */
64 
65 #if defined(EXT2_APPEND_FL) && !defined(FS_APPEND_FL)
66 #  define FS_APPEND_FL EXT2_APPEND_FL
67 #endif
68 #ifdef FS_APPEND_FL
69 /* writes to file may only append, chattr 'a' */
70 const struct optdesc opt_fs_append       = { "fs-append",       "append",       OPT_FS_APPEND,       GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, FS_IOC_GETFLAGS, FS_IOC_SETFLAGS, FS_APPEND_FL };
71 #endif /* FS_APPEND_FL */
72 
73 #if defined(EXT2_NODUMP_FL) && !defined(FS_NODUMP_FL)
74 #  define FS_NODUMP_FL EXT2_NODUMP_FL
75 #endif
76 #ifdef FS_NODUMP_FL
77 /* do not dump file, chattr 'd' */
78 const struct optdesc opt_fs_nodump       = { "fs-nodump",       "nodump",       OPT_FS_NODUMP,       GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, FS_IOC_GETFLAGS, FS_IOC_SETFLAGS, FS_NODUMP_FL };
79 #endif /* FS_NODUMP_FL */
80 
81 #if defined(EXT2_NOATIME_FL) && !defined(FS_NOATIME_FL)
82 #  define FS_NOATIME_FL EXT2_NOATIME_FL
83 #endif
84 #ifdef FS_NOATIME_FL
85 /* do not update atime, chattr 'A' */
86 const struct optdesc opt_fs_noatime      = { "fs-noatime",      "noatime",      OPT_FS_NOATIME,      GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, FS_IOC_GETFLAGS, FS_IOC_SETFLAGS, FS_NOATIME_FL };
87 #endif /* FS_NOATIME_FL */
88 
89 /* FS_DIRTY_FL ??? */
90 /* FS_COMPRBLK_FL one ore more compress clusters */
91 /* FS_NOCOMPR_FL access raw compressed data */
92 /* FS_ECOMPR_FL compression error */
93 /* FS_BTREE_FL btree format dir */
94 /* FS_INDEX_FL hash indexed directory */
95 /* FS_IMAGIC ??? */
96 
97 #if defined(EXT2_JOURNAL_DATA_FL) && !defined(FS_JOURNAL_DATA_FL)
98 #  define FS_JOURNAL_DATA_FL EXT2_JOURNAL_DATA_FL
99 #endif
100 #ifdef FS_JOURNAL_DATA_FL
101 /* file data should be journaled, chattr 'j' */
102 const struct optdesc opt_fs_journal_data = { "fs-journal-data", "journal-data", OPT_FS_JOURNAL_DATA, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, FS_IOC_GETFLAGS, FS_IOC_SETFLAGS, FS_JOURNAL_DATA_FL };
103 #endif /* FS_JOURNAL_DATA_FL */
104 
105 #if defined(EXT2_NOTAIL_FL) && !defined(FS_NOTAIL_FL)
106 #  define FS_NOTAIL_FL EXT2_NOTAIL_FL
107 #endif
108 #ifdef FS_NOTAIL_FL
109 /* file tail should not be merged, chattr 't' */
110 const struct optdesc opt_fs_notail       = { "fs-notail",       "notail",       OPT_FS_NOTAIL,       GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, FS_IOC_GETFLAGS, FS_IOC_SETFLAGS, FS_NOTAIL_FL };
111 #endif /* FS_NOTAIL_FL */
112 
113 #if defined(EXT2_DIRSYNC_FL) && !defined(FS_DIRSYNC_FL)
114 #  define FS_DIRSYNC_FL EXT2_DIRSYNC_FL
115 #endif
116 #ifdef FS_DIRSYNC_FL
117 /* synchronous directory modifications, chattr 'D' */
118 const struct optdesc opt_fs_dirsync      = { "fs-dirsync",      "dirsync",      OPT_FS_DIRSYNC,      GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, FS_IOC_GETFLAGS, FS_IOC_SETFLAGS, FS_DIRSYNC_FL };
119 #endif /* FS_DIRSYNC_FL */
120 
121 #if defined(EXT2_TOPDIR_FL) && !defined(FS_TOPDIR_FL)
122 #  define FS_TOPDIR_FL EXT2_TOPDIR_FL
123 #endif
124 #ifdef FS_TOPDIR_FL
125 /* top of directory hierarchies, chattr 'T' */
126 const struct optdesc opt_fs_topdir       = { "fs-topdir",       "topdir",       OPT_FS_TOPDIR,       GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, FS_IOC_GETFLAGS, FS_IOC_SETFLAGS, FS_TOPDIR_FL };
127 #endif /* FS_TOPDIR_FL */
128 
129 /* EXTENTS inode uses extents */
130 
131 
132 #endif /* WITH_FS */
133 
134 
135