1IOCTL_IFLAGS(2)            Linux Programmer's Manual           IOCTL_IFLAGS(2)
2
3
4

NAME

6       ioctl_iflags - ioctl() operations for inode flags
7

DESCRIPTION

9       Various  Linux filesystems support the notion of inode flags—attributes
10       that modify the semantics of files and directories.  These flags can be
11       retrieved and modified using two ioctl(2) operations:
12
13           int attr;
14           fd = open("pathname", ...);
15
16           ioctl(fd, FS_IOC_GETFLAGS, &attr);  /* Place current flags
17                                                  in 'attr' */
18           attr |= FS_NOATIME_FL;              /* Tweak returned bit mask */
19           ioctl(fd, FS_IOC_SETFLAGS, &attr);  /* Update flags for inode
20                                                  referred to by 'fd' */
21
22       The  lsattr(1) and chattr(1) shell commands provide interfaces to these
23       two operations, allowing a user to view  and  modify  the  inode  flags
24       associated with a file.
25
26       The  following  flags are supported (shown along with the corresponding
27       letter used to indicate the flag by lsattr(1) and chattr(1)):
28
29       FS_APPEND_FL 'a'
30              The file can be opened  only  with  the  O_APPEND  flag.   (This
31              restriction  applies  even to the superuser.)  Only a privileged
32              process (CAP_LINUX_IMMUTABLE) can set or clear this attribute.
33
34       FS_COMPR_FL 'c'
35              Store the file in a compressed format on disk.  This flag is not
36              supported  by most of the mainstream filesystem implementations;
37              one exception is btrfs(5).
38
39       FS_DIRSYNC_FL 'D' (since Linux 2.6.0)
40              Write directory changes synchronously to disk.  This  flag  pro‐
41              vides  semantics  equivalent  to the mount(2) MS_DIRSYNC option,
42              but on a per-directory basis.  This flag can be applied only  to
43              directories.
44
45       FS_IMMUTABLE_FL 'i'
46              The file is immutable: no changes are permitted to the file con‐
47              tents or  metadata  (permissions,  timestamps,  ownership,  link
48              count  and  so on).  (This restriction applies even to the supe‐
49              ruser.)  Only a privileged process (CAP_LINUX_IMMUTABLE) can set
50              or clear this attribute.
51
52       FS_JOURNAL_DATA_FL 'j'
53              Enable  journaling  of file data on ext3(5) and ext4(5) filesys‐
54              tems.  On a filesystem that is journaling in ordered  or  write‐
55              back  mode, a privileged (CAP_SYS_RESOURCE) process can set this
56              flag to enable journaling of data updates on a per-file basis.
57
58       FS_NOATIME_FL 'A'
59              Don't update  the  file  last  access  time  when  the  file  is
60              accessed.   This can provide I/O performance benefits for appli‐
61              cations that do not care about the accuracy of  this  timestamp.
62              This flag provides functionality similar to the mount(2) MS_NOA‐
63              TIME flag, but on a per-file basis.
64
65       FS_NOCOW_FL 'C' (since Linux 2.6.39)
66              The file will not be subject  to  copy-on-write  updates.   This
67              flag  has  an  effect  only on filesystems that support copy-on-
68              write semantics, such as Btrfs.  See chattr(1) and btrfs(5).
69
70       FS_NODUMP_FL 'd'
71              Don't include this file in backups made using dump(8).
72
73       FS_NOTAIL_FL 't'
74              This flag is supported only on Reiserfs.  It disables the  Reis‐
75              erfs  tail-packing feature, which tries to pack small files (and
76              the final fragment of larger files) into the same disk block  as
77              the file metadata.
78
79       FS_PROJINHERIT_FL 'P' (since Linux 4.5)
80              Inherit  the  quota  project  ID.  Files and subdirectories will
81              inherit the project ID of  the  directory.   This  flag  can  be
82              applied only to directories.
83
84       FS_SECRM_FL 's'
85              Mark  the  file for secure deletion.  This feature is not imple‐
86              mented by any filesystem, since the task of securely  erasing  a
87              file from a recording medium is surprisingly difficult.
88
89       FS_SYNC_FL 'S'
90              Make file updates synchronous.  For files, this makes all writes
91              synchronous (as though all opens  of  the  file  were  with  the
92              O_SYNC  flag).  For directories, this has the same effect as the
93              FS_DIRSYNC_FL flag.
94
95       FS_TOPDIR_FL 'T'
96              Mark a directory for special treatment under  the  Orlov  block-
97              allocation  strategy.  See chattr(1) for details.  This flag can
98              be applied only to directories and has an effect only for  ext2,
99              ext3, and ext4.
100
101       FS_UNRM_FL 'u'
102              Allow  the  file to be undeleted if it is deleted.  This feature
103              is not implemented by any filesystem, since it  is  possible  to
104              implement file-recovery mechanisms outside the kernel.
105
106       In  most  cases, when any of the above flags is set on a directory, the
107       flag is inherited by  files  and  subdirectories  created  inside  that
108       directory.   Exceptions include FS_TOPDIR_FL, which is not inheritable,
109       and FS_DIRSYNC_FL, which is inherited only by subdirectories.
110

CONFORMING TO

112       Inode flags are a nonstandard Linux extension.
113

NOTES

115       In order to change the inode flags of a file using the  FS_IOC_SETFLAGS
116       operation,  the effective user ID of the caller must match the owner of
117       the file, or the caller must have the CAP_FOWNER capability.
118
119       The type of the argument given to the FS_IOC_GETFLAGS  and  FS_IOC_SET‐
120       FLAGS  operations is int *, notwithstanding the implication in the ker‐
121       nel source file include/uapi/linux/fs.h that the argument is long *.
122

SEE ALSO

124       chattr(1), lsattr(1), mount(2), btrfs(5),  ext4(5),  xfs(5),  xattr(7),
125       mount(8)
126

COLOPHON

128       This  page  is  part of release 5.07 of the Linux man-pages project.  A
129       description of the project, information about reporting bugs,  and  the
130       latest     version     of     this    page,    can    be    found    at
131       https://www.kernel.org/doc/man-pages/.
132
133
134
135Linux                             2019-11-19                   IOCTL_IFLAGS(2)
Impressum