-
Notifications
You must be signed in to change notification settings - Fork 0
/
ioctl_iflags.html
231 lines (175 loc) · 7.57 KB
/
ioctl_iflags.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
<!-- Creator : groff version 1.22.4 -->
<!-- CreationDate: Wed Jan 29 11:26:24 2020 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>IOCTL_IFLAGS</title>
</head>
<body>
<h1 align="center">IOCTL_IFLAGS</h1>
<a href="#NAME">NAME</a><br>
<a href="#DESCRIPTION">DESCRIPTION</a><br>
<a href="#CONFORMING TO">CONFORMING TO</a><br>
<a href="#NOTES">NOTES</a><br>
<a href="#SEE ALSO">SEE ALSO</a><br>
<a href="#COLOPHON">COLOPHON</a><br>
<hr>
<h2>NAME
<a name="NAME"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">ioctl_iflags -
ioctl() operations for inode flags</p>
<h2>DESCRIPTION
<a name="DESCRIPTION"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">Various Linux
filesystems support the notion of <i>inode
flags</i>—attributes that modify the semantics of
files and directories. These flags can be retrieved and
modified using two <b>ioctl</b>(2) operations:</p>
<p style="margin-left:17%; margin-top: 1em">int attr; <br>
fd = open("pathname", ...);</p>
<p style="margin-left:17%; margin-top: 1em">ioctl(fd,
FS_IOC_GETFLAGS, &attr); /* Place current flags <br>
in 'attr' */ <br>
attr |= FS_NOATIME_FL; /* Tweak returned bit mask */ <br>
ioctl(fd, FS_IOC_SETFLAGS, &attr); /* Update flags for
inode <br>
referred to by 'fd' */</p>
<p style="margin-left:11%; margin-top: 1em">The
<b>lsattr</b>(1) and <b>chattr</b>(1) shell commands provide
interfaces to these two operations, allowing a user to view
and modify the inode flags associated with a file.</p>
<p style="margin-left:11%; margin-top: 1em">The following
flags are supported (shown along with the corresponding
letter used to indicate the flag by <b>lsattr</b>(1) and
<b>chattr</b>(1)): <b><br>
FS_APPEND_FL</b> 'a'</p>
<p style="margin-left:22%;">The file can be opened only
with the <b>O_APPEND</b> flag. (This restriction applies
even to the superuser.) Only a privileged process
(<b>CAP_LINUX_IMMUTABLE</b>) can set or clear this
attribute.</p>
<p style="margin-left:11%;"><b>FS_COMPR_FL</b> 'c'</p>
<p style="margin-left:22%;">Store the file in a compressed
format on disk. This flag is <i>not</i> supported by most of
the mainstream filesystem implementations; one exception is
<b>btrfs</b>(5).</p>
<p style="margin-left:11%;"><b>FS_DIRSYNC_FL</b> 'D' (since
Linux 2.6.0)</p>
<p style="margin-left:22%;">Write directory changes
synchronously to disk. This flag provides semantics
equivalent to the <b>mount</b>(2) <b>MS_DIRSYNC</b> option,
but on a per-directory basis. This flag can be applied only
to directories.</p>
<p style="margin-left:11%;"><b>FS_IMMUTABLE_FL</b> 'i'</p>
<p style="margin-left:22%;">The file is immutable: no
changes are permitted to the file contents or metadata
(permissions, timestamps, ownership, link count and so on).
(This restriction applies even to the superuser.) Only a
privileged process (<b>CAP_LINUX_IMMUTABLE</b>) can set or
clear this attribute.</p>
<p style="margin-left:11%;"><b>FS_JOURNAL_DATA_FL</b>
'j'</p>
<p style="margin-left:22%;">Enable journaling of file data
on <b>ext3</b>(5) and <b>ext4</b>(5) filesystems. On a
filesystem that is journaling in <i>ordered</i> or
<i>writeback</i> mode, a privileged
(<b>CAP_SYS_RESOURCE</b>) process can set this flag to
enable journaling of data updates on a per-file basis.</p>
<p style="margin-left:11%;"><b>FS_NOATIME_FL</b> 'A'</p>
<p style="margin-left:22%;">Don’t update the file
last access time when the file is accessed. This can provide
I/O performance benefits for applications that do not care
about the accuracy of this timestamp. This flag provides
functionality similar to the <b>mount</b>(2)
<b>MS_NOATIME</b> flag, but on a per-file basis.</p>
<p style="margin-left:11%;"><b>FS_NOCOW_FL</b> 'C' (since
Linux 2.6.39)</p>
<p style="margin-left:22%;">The file will not be subject to
copy-on-write updates. This flag has an effect only on
filesystems that support copy-on-write semantics, such as
Btrfs. See <b>chattr</b>(1) and <b>btrfs</b>(5).</p>
<p style="margin-left:11%;"><b>FS_NODUMP_FL</b> 'd'</p>
<p style="margin-left:22%;">Don’t include this file
in backups made using <b>dump</b>(8).</p>
<p style="margin-left:11%;"><b>FS_NOTAIL_FL</b> 't'</p>
<p style="margin-left:22%;">This flag is supported only on
Reiserfs. It disables the Reiserfs tail-packing feature,
which tries to pack small files (and the final fragment of
larger files) into the same disk block as the file
metadata.</p>
<p style="margin-left:11%;"><b>FS_PROJINHERIT_FL</b> 'P'
(since Linux 4.5)</p>
<p style="margin-left:22%;">Inherit the quota project ID.
Files and subdirectories will inherit the project ID of the
directory. This flag can be applied only to directories.</p>
<p style="margin-left:11%;"><b>FS_SECRM_FL</b> 's'</p>
<p style="margin-left:22%;">Mark the file for secure
deletion. This feature is not implemented by any filesystem,
since the task of securely erasing a file from a recording
medium is surprisingly difficult.</p>
<p style="margin-left:11%;"><b>FS_SYNC_FL</b> 'S'</p>
<p style="margin-left:22%;">Make file updates synchronous.
For files, this makes all writes synchronous (as though all
opens of the file were with the <b>O_SYNC</b> flag). For
directories, this has the same effect as the
<b>FS_DIRSYNC_FL</b> flag.</p>
<p style="margin-left:11%;"><b>FS_TOPDIR_FL</b> 'T'</p>
<p style="margin-left:22%;">Mark a directory for special
treatment under the Orlov block-allocation strategy. See
<b>chattr</b>(1) for details. This flag can be applied only
to directories and has an effect only for ext2, ext3, and
ext4.</p>
<p style="margin-left:11%;"><b>FS_UNRM_FL</b> 'u'</p>
<p style="margin-left:22%;">Allow the file to be undeleted
if it is deleted. This feature is not implemented by any
filesystem, since it is possible to implement file-recovery
mechanisms outside the kernel.</p>
<p style="margin-left:11%; margin-top: 1em">In most cases,
when any of the above flags is set on a directory, the flag
is inherited by files and subdirectories created inside that
directory. Exceptions include <b>FS_TOPDIR_FL</b>, which is
not inheritable, and <b>FS_DIRSYNC_FL</b>, which is
inherited only by subdirectories.</p>
<h2>CONFORMING TO
<a name="CONFORMING TO"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">Inode flags are
a nonstandard Linux extension.</p>
<h2>NOTES
<a name="NOTES"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">In order to
change the inode flags of a file using the
<b>FS_IOC_SETFLAGS</b> operation, the effective user ID of
the caller must match the owner of the file, or the caller
must have the <b>CAP_FOWNER</b> capability.</p>
<h2>SEE ALSO
<a name="SEE ALSO"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em"><b>chattr</b>(1),
<b>lsattr</b>(1), <b>mount</b>(2), <b>btrfs</b>(5),
<b>ext4</b>(5), <b>xfs</b>(5), <b>xattr</b>(7),
<b>mount</b>(8)</p>
<h2>COLOPHON
<a name="COLOPHON"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">This page is
part of release 5.02 of the Linux <i>man-pages</i> project.
A description of the project, information about reporting
bugs, and the latest version of this page, can be found at
https://www.kernel.org/doc/man-pages/.</p>
<hr>
</body>
</html>