310 lines
8.0 KiB
HTML
310 lines
8.0 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of IOCTL_IFLAGS</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>IOCTL_IFLAGS</H1>
|
|
Section: Linux Programmer's Manual (2)<BR>Updated: 2019-11-19<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
ioctl_iflags - ioctl() operations for inode flags
|
|
<A NAME="lbAC"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
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><A HREF="/cgi-bin/man/man2html?2+ioctl">ioctl</A></B>(2)
|
|
|
|
operations:
|
|
<P>
|
|
|
|
|
|
|
|
int attr;
|
|
fd = open("pathname", ...);
|
|
<P>
|
|
ioctl(fd, FS_IOC_GETFLAGS, &attr); /* Place current flags
|
|
<BR> in 'attr' */
|
|
attr |= FS_NOATIME_FL; /* Tweak returned bit mask */
|
|
ioctl(fd, FS_IOC_SETFLAGS, &attr); /* Update flags for inode
|
|
<BR> referred to by 'fd' */
|
|
|
|
|
|
<P>
|
|
|
|
The
|
|
<B><A HREF="/cgi-bin/man/man2html?1+lsattr">lsattr</A></B>(1)
|
|
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?1+chattr">chattr</A></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>
|
|
|
|
The following flags are supported
|
|
(shown along with the corresponding letter used to indicate the flag by
|
|
<B><A HREF="/cgi-bin/man/man2html?1+lsattr">lsattr</A></B>(1)
|
|
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?1+chattr">chattr</A></B>(1)):
|
|
|
|
<DL COMPACT>
|
|
<DT id="1"><B>FS_APPEND_FL</B> 'a'
|
|
|
|
<DD>
|
|
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.
|
|
<DT id="2"><B>FS_COMPR_FL</B> 'c'
|
|
|
|
<DD>
|
|
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><A HREF="/cgi-bin/man/man2html?5+btrfs">btrfs</A></B>(5).
|
|
|
|
<DT id="3"><B>FS_DIRSYNC_FL</B> 'D' (since Linux 2.6.0)
|
|
|
|
<DD>
|
|
Write directory changes synchronously to disk.
|
|
This flag provides semantics equivalent to the
|
|
<B><A HREF="/cgi-bin/man/man2html?2+mount">mount</A></B>(2)
|
|
|
|
<B>MS_DIRSYNC</B>
|
|
|
|
option, but on a per-directory basis.
|
|
This flag can be applied only to directories.
|
|
|
|
|
|
|
|
<DT id="4"><B>FS_IMMUTABLE_FL</B> 'i'
|
|
|
|
<DD>
|
|
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.
|
|
<DT id="5"><B>FS_JOURNAL_DATA_FL</B> 'j'
|
|
|
|
<DD>
|
|
Enable journaling of file data on
|
|
<B><A HREF="/cgi-bin/man/man2html?5+ext3">ext3</A></B>(5)
|
|
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?5+ext4">ext4</A></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.
|
|
<DT id="6"><B>FS_NOATIME_FL</B> 'A'
|
|
|
|
<DD>
|
|
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><A HREF="/cgi-bin/man/man2html?2+mount">mount</A></B>(2)
|
|
|
|
<B>MS_NOATIME</B>
|
|
|
|
flag, but on a per-file basis.
|
|
|
|
|
|
|
|
<DT id="7"><B>FS_NOCOW_FL</B> 'C' (since Linux 2.6.39)
|
|
|
|
<DD>
|
|
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><A HREF="/cgi-bin/man/man2html?1+chattr">chattr</A></B>(1)
|
|
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?5+btrfs">btrfs</A></B>(5).
|
|
|
|
<DT id="8"><B>FS_NODUMP_FL</B> 'd'
|
|
|
|
<DD>
|
|
Don't include this file in backups made using
|
|
<B><A HREF="/cgi-bin/man/man2html?8+dump">dump</A></B>(8).
|
|
|
|
<DT id="9"><B>FS_NOTAIL_FL</B> 't'
|
|
|
|
<DD>
|
|
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.
|
|
<DT id="10"><B>FS_PROJINHERIT_FL</B> 'P' (since Linux 4.5)
|
|
|
|
<DD>
|
|
|
|
|
|
|
|
Inherit the quota project ID.
|
|
Files and subdirectories will inherit the project ID of the directory.
|
|
This flag can be applied only to directories.
|
|
<DT id="11"><B>FS_SECRM_FL</B> 's'
|
|
|
|
<DD>
|
|
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.
|
|
<DT id="12"><B>FS_SYNC_FL</B> 'S'
|
|
|
|
<DD>
|
|
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.
|
|
<DT id="13"><B>FS_TOPDIR_FL</B> 'T'
|
|
|
|
<DD>
|
|
Mark a directory for special treatment under the Orlov block-allocation
|
|
strategy.
|
|
See
|
|
<B><A HREF="/cgi-bin/man/man2html?1+chattr">chattr</A></B>(1)
|
|
|
|
for details.
|
|
This flag can be applied only to directories and
|
|
has an effect only for ext2, ext3, and ext4.
|
|
<DT id="14"><B>FS_UNRM_FL</B> 'u'
|
|
|
|
<DD>
|
|
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.
|
|
</DL>
|
|
<P>
|
|
|
|
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.
|
|
<A NAME="lbAD"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
Inode flags are a nonstandard Linux extension.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
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>
|
|
|
|
The type of the argument given to the
|
|
<B>FS_IOC_GETFLAGS</B>
|
|
|
|
and
|
|
<B>FS_IOC_SETFLAGS</B>
|
|
|
|
operations is
|
|
<I>int *</I>,
|
|
|
|
notwithstanding the implication in the kernel source file
|
|
<I>include/uapi/linux/fs.h</I>
|
|
|
|
that the argument is
|
|
<I>long *</I>.
|
|
|
|
<A NAME="lbAF"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+chattr">chattr</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+lsattr">lsattr</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+mount">mount</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?5+btrfs">btrfs</A></B>(5),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?5+ext4">ext4</A></B>(5),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?5+xfs">xfs</A></B>(5),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+xattr">xattr</A></B>(7),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+mount">mount</A></B>(8)
|
|
|
|
<A NAME="lbAG"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 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
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="15"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="16"><A HREF="#lbAC">DESCRIPTION</A><DD>
|
|
<DT id="17"><A HREF="#lbAD">CONFORMING TO</A><DD>
|
|
<DT id="18"><A HREF="#lbAE">NOTES</A><DD>
|
|
<DT id="19"><A HREF="#lbAF">SEE ALSO</A><DD>
|
|
<DT id="20"><A HREF="#lbAG">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:33 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|