From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.47 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795961974; b=RANd6OMXQata3Br5kmhTmVmQ6DYjpBg53kH0BX4UmgUgi1ZPcYXcfpiSqgU6y8eUXtVR eZ7pSPFtlBuz8U4Rh7QawBpYIs9wB6ke2vZyXYKQGAiy0cirX/sYqroCbw0PWO67K73g6 dB44ooZYRR7s6HIB21yv/ElYEfqBJKkgKurA8n/rFc5NgN8kRwjEztu28HO21Ae+uobza VA3TWA7Rk9BuBtg2vbkY339VkliyaHsHdlqE4sbicPdUwJEbv5RbQc9QWiyvvKE+WW9mz pGAlVzIlm/ZJJDQH0ofBLgPoJzfHaWIDhQZCuV8MKGQb65vUaBMYub88+n1Ql9Xh1zQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795961974; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To:X-Mailer: References:In-Reply-To; bh=CozrNqexywsVV7oy9oabYEW2bkD3JbL1ITITXpZ5ECs=; b=fMlWSt0HsEAi25VqG2CieU79oMhXIY5eD/z7cP8jwEu2L3DhjTAKCfU6rwKxcAblSwEY Y+egTUYHIrTCoP/zAqj55hO82xkCuZpkPrDzP9crHnLqiGkDIwGlhowcjOhtWWnoKufam lfPAsPvh5d1rOAKbKahI5fikBpGCELBTgwY4MGVCK6C9f/veNrphsSdtq6FmRdyf/TjNH jB2TxtvU5wTSewDlpL7Wwv4ITzQCsHmLAD5vHzEGtF+Tk9PZHLjRpZa9uES7htVPS0vM4 sCNe66zB9fe6Uh0O5ZsYzniddLw+UIZostV3KGS1ooszs8yxYkPzk5NBhtmWZhEYOcQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=h1zokzqn; arc=none smtp.remote-ip=209.85.128.47 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A77FC606A32F for ; Sun, 29 Nov 2026 14:19:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A77FC606A32F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=h1zokzqn Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4ba013938d7so90506395e9.2 for ; Sun, 29 Nov 2026 06:19:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795961971; x=1796566771; darn=vger.kernel.org; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-type:mime-version:from:to:cc:subject:date:message-id :reply-to:content-type; bh=CozrNqexywsVV7oy9oabYEW2bkD3JbL1ITITXpZ5ECs=; b=h1zokzqniiTGaVCnXIxgjS3IaVp9LHUdnmVjWyd2VrITpmGgB5+ali2d/jVPqUEGDn 09tkV6qBN2PryvfhuBEBsgn9Od60xn9/RjHNIcftAbpfay3H/m3js7s4H4U4/b1urb1u 4DX5szEwXYMf+tU87pkV2O0DK3zjofQUI446Aph0JwI27QefR3BfxLAZAdWvQIKC0Frg xDvblC2zItXZFEAKQncxfUKfz8aYMPptc4eLX9OTyBI9tyzuzvluxIFwA8Jif51a6hSn MEPHge6pi/MLOtPaWAbctHJIAam10CHiYsPMr3w1CHdcq625FxcIPXS5DURVGd4zjN5N eB6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795961971; x=1796566771; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-type:mime-version:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=CozrNqexywsVV7oy9oabYEW2bkD3JbL1ITITXpZ5ECs=; b=S5QcTV+S1nLHGxGW5YpRxwgF6k9eix95EAoLg+KXiXZ8LMfpOF4DyM+7f8ED9+WPUA F92A92nxm4XKLdDdJfV2IzFxsMiHYjUUbfp20dDsecOlO2QEYnz0pVoLsss+ZtqBf0wX 6x+mSzc2fGZ2ETbruli721TjlbPJ/u8/0XV9i4xau31LiiaS6aQFTm9IriC6tF0QjA07 QmoNFHowiM5l1altIvTI+gW5cJeLXhT2AhQoNZ31hTFzRX9dgrvKJxMclOJDkxxF1CTe 4Fs8DM44yfWszrGO38tjHxdgGj96wh6EYvcx8P7a5NybmFqVhDKB4GZRR7m2N/rwO1XI Oi0g== X-Forwarded-Encrypted: i=1; AL+hErFNVVI/eFHdRI61zJVtECTdrNfAL181OfBRCMD3Eg1jk+isQtxXr+Yz40w9Q2M5Yed3fhwTqPk11FA=@vger.kernel.org X-Gm-Message-State: APuU4Z/g2sVgBztguoSpHotLkQ4FbVMFAr0XoNCXTSlzQfwcG8TCI75Z ZW/rdMZ0Us5ieQGWJ0ynoIZ+YKdC4HVPfX2wZtgD8dmpq6mOv3GQAvNz X-Gm-Gg: AZFdTZfgyaDa1jiun+Sm84jYn2tZ/zo4iY/Lq492f2Bln2fgQmXm7yHP9jYJ17jWXRv OqnAU0lzeMkTD6vbnWfqKg9d2g484Thq64eMCoUNOnIdVB6IAFkUymHtGIOblMH7qxUw1wrqAAb GlX8O698vjQyt1GzJkyTXdrkAijo/P7+lG2521S4C1mr1719vtPJRZTEiuPvFZqAdEP2p+Fw2vY ox7HqwqiAkcoj5x3qmm+BwZaQ5CKx8AfPkRKnqTHw8WIOPf53QYNunq/B6vRVRS6aiZDjw7vu85 ZFkkmli7EIAipufa9utTkHPH4vUL5eR3Dc0Ap2S5kdv0EotBPCjXPQoU28iItxRQhJBGWuRlLlB JljrVMfgup9kM0BamNvIUv4wEYJFp6/hF+td4uCh1ie/u3i9Ezwzx0fBM+tBWt8tXEyUUt4Bt27 mDB/9yDpIOM3LEUWI8V97C5exxkfy7gapeh2U8Tj+NNe2ha9lOUWBooGMU209sQVeYj/IXFwtuL AFnxZjS9J/UJ/N5DGJS8deAyFgA4zPsrixPSg7jPD6jtuvV3Lzo9DXzUBSnMs9KaCLcm8bWe2jp MzB2tdKECVj5n6XRl9Ux8XpMXQ== X-Received: by 2002:a05:600d:17:b0:4bb:aa4f:c027 with SMTP id 5b1f17b1804b1-4bbaa4fc171mr224804395e9.0.1795961970524; Sun, 29 Nov 2026 06:19:30 -0800 (PST) Received: from localhost ([2001:b07:5d26:7a6a:365a:60ff:fe0d:cfc6]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb884b8429sm1340148265e9.14.2026.11.29.06.19.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 29 Nov 2026 06:19:29 -0800 (PST) X-Mailing-List: linux-api@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 Content-Type: multipart/signed; boundary=4ab233504dc5564f7ae5b289d3f34bd0bfd452427c2640224167c35b2e90; micalg=pgp-sha512; protocol="application/pgp-signature" Date: Sun, 29 Nov 2026 15:19:24 +0100 Message-Id: Cc: "Namjae Jeon" , "Hyunchul Lee" , "Jonathan Corbet" , "Eric Biggers" , "Theodore Y . Ts'o" , "Jaegeuk Kim" , "Alexander Viro" , "Christian Brauner" , "Shuah Khan" , "Randy Dunlap" , "Chuck Lever" , "Jeff Layton" , "Jan Kara" , "Alexander Aring" , "Darrick J . Wong" , "Andrey Albershteyn" , "Miklos Szeredi" , =?utf-8?q?Pali_Roh=C3=A1r?= , "Lauri Gates" , "Christoph Hellwig" , "Dave Chinner" , , , , , , , , , Subject: Re: [PATCH v3 5/5] docs: add fileattr API documentation From: "koraynilay" To: "Amir Goldstein" , "koraynilay" X-Mailer: aerc 0.22.0-0-gc2f86b7abde3 References: <20261129024233.2361718-1-koray.fra@gmail.com> <20261129024233.2361718-6-koray.fra@gmail.com> In-Reply-To: --4ab233504dc5564f7ae5b289d3f34bd0bfd452427c2640224167c35b2e90 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 On Sun Nov 29, 2026 at 12:32 PM CET, Amir Goldstein wrote: > On Sun, Nov 29, 2026 at 3:43=E2=80=AFAM koraynilay = wrote: >> >> Add documentation for the fileattr API. >> >> Signed-off-by: koraynilay >> --- >> Documentation/filesystems/fileattr.rst | 530 +++++++++++++++++++++++++ >> Documentation/filesystems/index.rst | 1 + >> Documentation/filesystems/vfs.rst | 19 +- >> include/uapi/linux/fs.h | 28 +- >> 4 files changed, 568 insertions(+), 10 deletions(-) >> create mode 100644 Documentation/filesystems/fileattr.rst >> >> diff --git a/Documentation/filesystems/fileattr.rst b/Documentation/file= systems/fileattr.rst >> new file mode 100644 >> index 000000000000..9e3515dc4517 >> --- /dev/null >> +++ b/Documentation/filesystems/fileattr.rst >> @@ -0,0 +1,530 @@ >> +.. SPDX-License-Identifier: GPL-2.0 >> + >> +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> +Fileattr API >> +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> + >> +Overview >> +=3D=3D=3D=3D=3D=3D=3D=3D >> + >> +The fileattr API provides a modern way (instead of the older >> +``FS_IOC_[GS]ETFLAGS`` and ``FS_IOC_FS[GS]ETXATTR`` ioctls) to query an= d modify inode >> +flags (like immutable and append-only). >> + > > This is nice! > Much easier to review the UAPI this way. > > I would add something about the terminology "file attributes" which was a= source > of confusion and bikeshedding and the relation to other UAPIs: > > The "file attributes" that this document refers to are structured file > attributes > much like the inode information advertised by stat(2) and statx(2). > statx(2) even advertises some of the file attributes described in this do= cument: > File attributes > The stx_attributes field contains a set of ORed flags that > indicate additional attributes of the file. Yes, I used "inode flags" because "file attributes" was used for a bunch of other things too (even tho the API is "fileattr"). > The file attributes described in this document could be described as an > extension to the standard inode attributes of a POSIX filesystem inode. > However, "extended attributes" terminology is already used for describing > the unstructured string key/blob value inode attributes of the > [gs]etxattr() api, > which are something completely different. I hadn't checked statx(2) but since it does report the same ones, I'll switch the terminology to just "file attributes" in the doc, maybe adding a clarification at the start (like the >> (like immutable and append-only). I already have) like the one you wrote here. >> +Userspace API >> +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> + >> +System Call Interface >> +--------------------- >> + >> +:: >> + >> + #include >> + #include >> + #include >> + #include >> + >> + long syscall(SYS_file_getattr, int dfd, const char *filename, >> + struct file_attr *attr, size_t usize, >> + unsigned int at_flags); >> + >> + long syscall(SYS_file_setattr, int dfd, const char *filename, >> + struct file_attr *attr, size_t usize, >> + unsigned int at_flags); >> + >> +Since C library wrappers don't exist yet, file_getattr() and >> +file_setattr() need to be called using :manpage:`syscall(2)`. >> + >> +Parameters >> +---------- >> + >> +``dfd`` >> + Directory file descriptor for relative path lookups, ``AT_FDCWD`` f= or the >> + current working directory, or the target file descriptor when used = with >> + ``AT_EMPTY_PATH``. >> + >> +``filename`` >> + Target pathname (relative to ``dfd`` when not absolute). >> + >> +``attr`` >> + Pointer to a struct file_attr buffer. >> + >> +``usize`` >> + Size of the buffer pointed to by ``attr``, in bytes. >> + >> +``at_flags`` >> + Bitwise OR of control flags: >> + >> + - ``AT_FILEATTR_MASKS``: Enable mask semantics (as detailed in :ref= :`Masks `). >> + - ``AT_SYMLINK_NOFOLLOW``: Do not follow symbolic links, operate on= the >> + link itself. >> + - ``AT_EMPTY_PATH``: If ``filename`` is an empty string (``""`` or >> + ``NULL``), operate directly on ``dfd``. >> + >> + >> +The struct file_attr Structure >> +------------------------------ >> + >> +.. kernel-doc:: include/uapi/linux/fs.h >> + :identifiers: file_attr >> + >> +.. _masks: >> + >> +Masks >> +=3D=3D=3D=3D=3D >> + >> +In 7.X, the fileattr API introduced ``_masks`` fields (``fa_xflags_rw_m= ask`` > > The "in 7.x" language is inspired by man-pages, but it has no place here > because this document lives in the same repo as the code. > > I think you should mention the versions V0 V1 somewhere in the doc and > then you can refer to them instead of saying 7.x or when describing a fla= g > which applies only to V1 (PROJID). Ah ok, will do. >> +and ``fa_xflags_ro_mask``), to enable usage of this API without having = to do a >> +Read-Modify-Write cycle like ``FS_IOC_SETFLAGS`` and ``FS_IOC_FSSETXATT= R`` >> +require. >> + >> +To use this feature ``AT_FILEATTR_MASKS`` needs to be set in the >> +``at_flags`` argument of the syscall, otherwise the normal behaviour is= kept. >> + >> +.. note:: >> + Currently most filesystems don't support masks, but this only has a = visible >> + effect with file_getattr(), since file_setattr() is handled internal= ly. > > I understand it, but don't think it is clear to readers what this note me= ans. Yeah I wanted to explain a bit about the conversions but I thought that since this is the userspace section it was too detailed. I'll change it to mention the format conversion without many details and make a reference to the detailed in-kernel explanation below. > Also please avoid text that will go stale as "Currently most filesystems" > Use language that is not dependent on how many fs are converted. Right, makes sense. > Nore to bot: this doc should not go stale/incorrect while filesystems > are converted and support for more flags added in the future. > >> + >> +On file_getattr() >> +----------------- >> + >> +- If the filesystem supports mask reporting, file_getattr() populates >> + ``fa_xflags_rw_mask`` with all xflags it supports modifying on this i= node, >> + and ``fa_xflags_ro_mask`` with all read-only xflags it supports repor= ting. >> +- If the filesystem does not support masks, file_getattr() sets to ``0`= ` >> + both ``fa_xflags_rw_mask`` and ``fa_xflags_ro_mask``. >> + >> +.. caution:: >> + >> + Passing the result of file_getattr() directly into file_setattr() >> + like this:: >> + >> + file_getattr(file1, &fa, ..., AT_FILEATTR_MASKS); >> + file_setattr(file2, &fa, ..., AT_FILEATTR_MASKS); >> + >> + does not always work as-is because of the different semantics of >> + ``fa_xflags_rw_mask`` on get vs set: >> + >> + - on filesystems without mask support, file_getattr() returns >> + ``fa_xflags_rw_mask =3D 0``, turning file_setattr() into a no-op (= because of >> + the meaning of ``fa_xflags_rw_mask``); >> + - on filesystems with mask support, file_getattr() returns all suppo= rted >> + writable xflags in ``fa_xflags_rw_mask``, so file_setattr() sets a= ll of >> + them on ``file2``, which could fail if ``file2`` is on a different >> + filesystem that supports a different subset of xflags. > > This sounds like a caution for regressing sync/backup workloads Mainly yes, I added it also because you had mentioned get -> set should work directly (so users may expect that), but since it can't I put it as caution. > with the new UAPI, but isn't it the same with the old UAPI when > file2 is on an fs that does not accept a flag that file1 advertizes? Yes. > I anything, the new UAPI improves the situation by making it > transparent and testable for the sync/backup program and allows > the program to make intelligent decisions based on the advertized > information in the masks. > > So the caution should be framed as change of behavior for > backup/sync - instead of silently dropping unsupported flags, > the new apis may reject them and provide the reason to the program > so that it can handle the situation correctly. Hmm yes, the main reason for this caution was non masks filesystems returning 0 as rw_mask -> no-op, which could be unexpected by programs. I'll update it so it's clearer and mentions sync/backups, since yeah, I can't really think of many use-cases where this get -> set (using masks) would make sense apart from that. >> + >> +On file_setattr() >> +----------------- >> + >> +- Userspace populates ``fa_xflags_rw_mask`` with the xflags it wishes t= o >> + change. If ``fa_xflags_rw_mask`` is ``0``, VFS treats it as a no-op, = checking >> + only inode permissions and if the filesystem supports the fileattr AP= I. >> +- Any valid flag outside ``fa_xflags_rw_mask`` is ignored and left unmo= dified. >> +- For boolean attributes: >> + >> + - Setting the xflag bit in both ``fa_xflags_rw_mask`` and ``fa_xflags= `` >> + enables the feature. >> + - Setting the bit in ``fa_xflags_rw_mask`` and clearing the bit in >> + ``fa_xflags`` disables the feature. >> + >> +- For value attributes (``FS_XFLAG_PROJID``, ``FS_XFLAG_EXTSIZE``, >> + ``FS_XFLAG_EXTSZINHERIT``, ``FS_XFLAG_COWEXTSIZE``): > > Phrase as generic rule with examples so doc won't go stale when adding > new value fields. Right. >> + >> + - Setting the flag bit in both ``fa_xflags_rw_mask`` and ``fa_xflags`= ` sets >> + the attribute from the corresponding struct field. >> + - Setting the flag bit in ``fa_xflags_rw_mask`` and clearing the bit = in >> + ``fa_xflags`` unsets/clears the attribute (resetting the value to 0= ). >> + >> +- Validation and capability rules: >> + >> + - If the filesystem supports masks, requesting modification of any fl= ag not advertised in >> + the filesystem's writable mask fails with ``-EOPNOTSUPP``. >> + - If the filesystem does not support masks, requesting any flag outsi= de >> + ``((FS_XFLAGS_MASK & ~FS_XFLAG_RDONLY_MASK) | FS_XFLAG_PROJID)`` fa= ils > > Sorry this is too ugly to live. Lmao. Yeah and FS_XFLAGS_MASK etc aren't even exposed to userspace, forgot about that. > Need to do something about this. > Nobody can understand and follow this PROJID exemption > it needs to be better abstracted. Hmm, maybe in the userspace part we should treat FS_XFLAG_PROJID as part of FS_XFLAGS_MASK, since that's basically how we treat it as, and I'll rephrase that so it's actually understandable by people. > >> + with ``-EOPNOTSUPP``. >> + >> +Usage Examples >> +-------------- >> + >> +Setting normal boolean flags:: >> + >> + struct file_attr fa =3D { >> + .fa_xflags =3D FS_XFLAG_NOATIME | FS_XFLAG_NODUMP, >> + .fa_xflags_rw_mask =3D FS_XFLAG_NOATIME | FS_XFLAG_NODUMP, >> + }; >> + syscall(SYS_file_setattr, dfd, path, &fa, sizeof(fa), AT_FILEATTR_M= ASKS); >> + >> +Clearing both flags in one call:: >> + >> + struct file_attr fa =3D { >> + .fa_xflags =3D 0, >> + .fa_xflags_rw_mask =3D FS_XFLAG_NOATIME | FS_XFLAG_NODUMP, >> + }; >> + syscall(SYS_file_setattr, dfd, path, &fa, sizeof(fa), AT_FILEATTR_M= ASKS); >> + >> +Setting one flag while clearing another:: >> + >> + struct file_attr fa =3D { >> + .fa_xflags =3D FS_XFLAG_NOATIME, >> + .fa_xflags_rw_mask =3D FS_XFLAG_NOATIME | FS_XFLAG_NODUMP, >> + }; >> + syscall(SYS_file_setattr, dfd, path, &fa, sizeof(fa), AT_FILEATTR_M= ASKS); >> + >> +Setting a value flag (``FS_XFLAG_PROJID``):: >> + >> + struct file_attr fa =3D { >> + .fa_xflags =3D FS_XFLAG_PROJID, >> + .fa_xflags_rw_mask =3D FS_XFLAG_PROJID, >> + .fa_projid =3D 67, >> + }; >> + syscall(SYS_file_setattr, dfd, path, &fa, sizeof(fa), AT_FILEATTR_M= ASKS); >> + >> +Clearing/unsetting a value flag (``FS_XFLAG_PROJID``):: >> + >> + struct file_attr fa =3D { >> + .fa_xflags =3D 0, >> + .fa_xflags_rw_mask =3D FS_XFLAG_PROJID, >> + }; >> + syscall(SYS_file_setattr, dfd, path, &fa, sizeof(fa), AT_FILEATTR_M= ASKS); >> + >> +.. note:: >> + Here, there is no need to also set ``fa.fa_projid =3D 0`` since the = above >> + code already means "unset". > > I still very much dislike this. > Yes, it is elegant and consistent, but humans sometimes > have expectations from apis which are different than documentation > and this becomes a source of bugs. > > I ask again, what do we lose by requiring fa.fa_projid =3D 0 > along with clearing FS_XFLAG_PROJID? The possibility for filesystems to use a value that is not 0 to mean "unset" for a specific field, but since > We can always relax it later if the need arises that's fair. > and in the meanwhile > we make sure that all programs do not reset projid by mistake. > This is a bug so easy to write by mistake or by using a stale copy of > the constant FS_XFLAGS_MASK in a program, which copied it > from the kernel headers. You mean someone forgetting to set FS_XFLAG_PROJID in fa_xflags and setting it only in rw_mask (along with fa_projid > 0), since PROJID in fa_xflags was never required before (unlike extsize/cowextsize)? So should we require fa_value =3D=3D 0 when fa_xflags doesn't have VALUE also for extsize/cowextsize too? > People do not read the fine print of documentation and man pages > when writing software! Yeah fair. >> + >> +.. _fileattr_flags: >> + >> +Flag Reference >> +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> + >> ++--------------------------------+------------+--------+---------------= ----------------------------------------+ >> +| Flag Macro | Hex Value | Mode | Description an= d Constraints | >> ++=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D= =3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+ >> +| ``FS_XFLAG_REALTIME`` | 0x00000001 | RW | Realtime volum= e storage (XFS). | >> ++--------------------------------+------------+--------+---------------= ----------------------------------------+ >> +| ``FS_XFLAG_PREALLOC`` | 0x00000002 | RO | File has preal= located extents. | >> ++--------------------------------+------------+--------+---------------= ----------------------------------------+ >> +| ``FS_XFLAG_IMMUTABLE`` | 0x00000008 | RW | Inode cannot b= e modified. Requires | >> +| | | | ``CAP_LINUX_IM= MUTABLE``. | >> ++--------------------------------+------------+--------+---------------= ----------------------------------------+ >> +| ``FS_XFLAG_APPEND`` | 0x00000010 | RW | All writes app= end only. Requires | >> +| | | | ``CAP_LINUX_IM= MUTABLE``. | >> ++--------------------------------+------------+--------+---------------= ----------------------------------------+ >> +| ``FS_XFLAG_SYNC`` | 0x00000020 | RW | File writes ar= e synchronous. | >> ++--------------------------------+------------+--------+---------------= ----------------------------------------+ >> +| ``FS_XFLAG_NOATIME`` | 0x00000040 | RW | Do not update = inode access time (atime). | >> ++--------------------------------+------------+--------+---------------= ----------------------------------------+ >> +| ``FS_XFLAG_NODUMP`` | 0x00000080 | RW | Exclude file f= rom dump/backup utilities. | >> ++--------------------------------+------------+--------+---------------= ----------------------------------------+ >> +| ``FS_XFLAG_RTINHERIT`` | 0x00000100 | RW | Inherit realti= me bit on newly created files | >> +| | | | (directories o= nly). | >> ++--------------------------------+------------+--------+---------------= ----------------------------------------+ >> +| ``FS_XFLAG_PROJINHERIT`` | 0x00000200 | RW | Inherit projec= t ID on newly created files | >> +| | | | (directories o= nly). | >> +| | | | Updates requir= e ``init_user_ns``. | >> ++--------------------------------+------------+--------+---------------= ----------------------------------------+ >> +| ``FS_XFLAG_NOSYMLINKS`` | 0x00000400 | RW | Disallow creat= ion of symlinks (directories only). | >> ++--------------------------------+------------+--------+---------------= ----------------------------------------+ >> +| ``FS_XFLAG_EXTSIZE`` | 0x00000800 | RW | Extent size al= locator hint (regular files only). | >> ++--------------------------------+------------+--------+---------------= ----------------------------------------+ >> +| ``FS_XFLAG_EXTSZINHERIT`` | 0x00001000 | RW | Inherit extent= size allocator hint | >> +| | | | (directories o= nly). | >> ++--------------------------------+------------+--------+---------------= ----------------------------------------+ >> +| ``FS_XFLAG_NODEFRAG`` | 0x00002000 | RW | Disable filesy= stem defragmentation for file. | >> ++--------------------------------+------------+--------+---------------= ----------------------------------------+ >> +| ``FS_XFLAG_FILESTREAM`` | 0x00004000 | RW | Enable filestr= eam allocator (directories only; XFS). | >> ++--------------------------------+------------+--------+---------------= ----------------------------------------+ >> +| ``FS_XFLAG_DAX`` | 0x00008000 | RW | Direct Access = (DAX) I/O (regular files and | >> +| | | | directories on= ly); mutually exclusive with | >> +| | | | ``FS_XFLAG_VER= ITY``. | >> ++--------------------------------+------------+--------+---------------= ----------------------------------------+ >> +| ``FS_XFLAG_COWEXTSIZE`` | 0x00010000 | RW | Copy-on-Write = extent size allocator hint | >> +| | | | (regular files= and directories only). | >> ++--------------------------------+------------+--------+---------------= ----------------------------------------+ >> +| ``FS_XFLAG_VERITY`` | 0x00020000 | RO | fs-verity enab= led, read-only (set via verity ioctl). | >> ++--------------------------------+------------+--------+---------------= ----------------------------------------+ >> +| ``FS_XFLAG_CASEFOLD`` | 0x00040000 | RO/RW | Case-insensiti= ve lookups. | > > RO/RW not very clear. Maybe a footnote RO/RW[*] for RW only via SETFLAGS Huh why only via SETFLAGS? It should be settable also by file_setattr once filesystems that support it as rw switch to using xflags (without even the need for supporting masks) no? >> ++--------------------------------+------------+--------+---------------= ----------------------------------------+ >> +| ``FS_XFLAG_CASENONPRESERVING`` | 0x00080000 | RO | Case not prese= rved in directory lookups. | >> ++--------------------------------+------------+--------+---------------= ----------------------------------------+ >> +| ``FS_XFLAG_PROJID`` | 0x00100000 | RW | Project ID val= ue flag (Linux >=3D 7.X). | > > No 7.x please, V1 or something > >> +| | | | Updates requir= e ``init_user_ns``. | >> ++--------------------------------+------------+--------+---------------= ----------------------------------------+ >> +| ``FS_XFLAG_COMPR`` | 0x00200000 | RO/RW | Compressed fil= e flag. | > > Same RO/RW[*] > >> ++--------------------------------+------------+--------+---------------= ----------------------------------------+ >> +| ``FS_XFLAG_ENCRYPT`` | 0x00400000 | RO | Encrypted file= flag (fscrypt). Read-only. | >> ++--------------------------------+------------+--------+---------------= ----------------------------------------+ >> +| ``FS_XFLAG_HASATTR`` | 0x80000000 | RO | Inode has exte= nded attributes. Read-only. | >> ++--------------------------------+------------+--------+---------------= ----------------------------------------+ >> + >> + >> +Behaviour without ``AT_FILEATTR_MASKS`` >> +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> + >> +When not using ``AT_FILEATTR_MASKS``, file_getattr() and >> +file_setattr() behave in the same way as :manpage:`ioctl_xfs_fsgetxattr= (2)` >> +and :manpage:`ioctl_xfs_fssetxattr(2)` respectively. >> + >> +In-Kernel Filesystem Interface >> +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D >> + >> +Filesystem Operations >> +--------------------- >> + >> +Filesystems wanting to implement this API, need to set the ``fileattr_g= et`` and >> +``fileattr_set`` functions in ``struct inode_operations``: >> + >> +.. code-block:: c >> + >> + struct inode_operations { >> + ... >> + int (*fileattr_get)(struct dentry *dentry, struct file_kattr *f= a); >> + int (*fileattr_set)(const struct mnt_idmap *idmap, struct dentr= y *dentry, >> + struct file_kattr *fa); >> + ... >> + }; >> + >> +Internal Structure: struct file_kattr >> +------------------------------------- >> + >> +Defined in ````: >> + >> +.. code-block:: c >> + >> + struct file_kattr { >> + u32 flags; /* FS_*_FL legacy flags */ >> + u32 fsx_xflags; /* FS_XFLAG_* modern flags */ >> + u32 fsx_xflags_rw_mask; /* Supported writable flags (get) / fl= ags to set (set) */ >> + u32 fsx_xflags_ro_mask; /* Supported read-only flags (get) */ >> + u32 fsx_extsize; /* Extent size hint */ >> + u32 fsx_nextents; /* Extent count */ >> + u32 fsx_projid; /* Project ID */ >> + u32 fsx_cowextsize; /* CoW extent size hint */ >> + bool flags_valid:1; /* Legacy flags valid */ >> + bool fsx_valid:1; /* Modern xflags valid */ >> + bool has_masks:1; /* Mask API supported */ >> + }; >> + >> +Fields of struct file_kattr have the same semantics as their user-facin= g >> +counterparts in struct file_attr above. >> +In addition, struct file_kattr has: >> + >> +``flags`` >> + Bit mask of the ``FS_*_FL`` flags, used by ``FS_IOC_GETFLAGS`` and = ``FS_IOC_SETFLAGS``. >> + >> +``flags_valid`` / ``fsx_valid`` >> + Selector indicating whether the field to be used is ``flags`` or >> + ``fsx_xflags``. They should be treated as mutually exclusive. >> + >> +``has_masks`` >> + Selector indicating whether the filesystem (on get) or request (on = set) >> + uses the mask API. > > Probably better as Kerneldoc in the patch itself. Ah yeah, I forgot to add an explanation comment there. >> + >> +VFS Helpers >> +----------- >> + >> +When implementing ``->fileattr_get()``, filesystems can populate >> +struct file_kattr using either fileattr_fill_xflags() or >> +fileattr_fill_flags():: >> + >> + void fileattr_fill_xflags(struct file_kattr *fa, u32 xflags); >> + >> + void fileattr_fill_flags(struct file_kattr *fa, u32 flags); >> + >> +fileattr_fill_xflags() sets ``fa->fsx_valid`` to ``true``, >> +copies ``xflags`` into ``fa->fsx_xflags`` and translates the passed >> +``FS_XFLAG_*`` xflags to their corresponding ``FS_*_FL`` flags into >> +``fa->flags``. >> + >> +fileattr_fill_flags() sets ``fa->flags_valid`` to ``true``, copies ``fl= ags`` >> +into ``fa->flags`` and translates the passed ``FS_*_FL`` flags to their >> +corresponding ``FS_XFLAG_*`` xflags into ``fa->fsx_xflags``. >> + >> +The table below lists all ``FS_*_FL`` and ``FS_XFLAG_*`` flags and thei= r >> +corresponding translations: >> + >> ++------------------------+--------------------------------+ >> +| ``FS_*_FL`` | ``FS_XFLAG_*`` | >> ++=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D+ >> +| ``FS_IMMUTABLE_FL`` | ``FS_XFLAG_IMMUTABLE`` | >> ++------------------------+--------------------------------+ >> +| ``FS_APPEND_FL`` | ``FS_XFLAG_APPEND`` | >> ++------------------------+--------------------------------+ >> +| ``FS_SYNC_FL`` | ``FS_XFLAG_SYNC`` | >> ++------------------------+--------------------------------+ >> +| ``FS_NOATIME_FL`` | ``FS_XFLAG_NOATIME`` | >> ++------------------------+--------------------------------+ >> +| ``FS_NODUMP_FL`` | ``FS_XFLAG_NODUMP`` | >> ++------------------------+--------------------------------+ >> +| ``FS_DAX_FL`` | ``FS_XFLAG_DAX`` | >> ++------------------------+--------------------------------+ >> +| ``FS_PROJINHERIT_FL`` | ``FS_XFLAG_PROJINHERIT`` | >> ++------------------------+--------------------------------+ >> +| ``FS_VERITY_FL`` | ``FS_XFLAG_VERITY`` | >> ++------------------------+--------------------------------+ >> +| ``FS_CASEFOLD_FL`` | ``FS_XFLAG_CASEFOLD`` | >> ++------------------------+--------------------------------+ >> +| ``FS_COMPR_FL`` | ``FS_XFLAG_COMPR`` | >> ++------------------------+--------------------------------+ >> +| ``FS_ENCRYPT_FL`` | ``FS_XFLAG_ENCRYPT`` | >> ++------------------------+--------------------------------+ >> +| ``FS_SECRM_FL`` | | >> ++------------------------+--------------------------------+ >> +| ``FS_UNRM_FL`` | | >> ++------------------------+--------------------------------+ >> +| ``FS_DIRTY_FL`` | | >> ++------------------------+--------------------------------+ >> +| ``FS_COMPRBLK_FL`` | | >> ++------------------------+--------------------------------+ >> +| ``FS_NOCOMP_FL`` | | >> ++------------------------+--------------------------------+ >> +| ``FS_BTREE_FL`` / | | >> +| ``FS_INDEX_FL`` | | >> ++------------------------+--------------------------------+ >> +| ``FS_IMAGIC_FL`` | | >> ++------------------------+--------------------------------+ >> +| ``FS_JOURNAL_DATA_FL`` | | >> ++------------------------+--------------------------------+ >> +| ``FS_NOTAIL_FL`` | | >> ++------------------------+--------------------------------+ >> +| ``FS_DIRSYNC_FL`` | | >> ++------------------------+--------------------------------+ >> +| ``FS_TOPDIR_FL`` | | >> ++------------------------+--------------------------------+ >> +| ``FS_HUGE_FILE_FL`` | | >> ++------------------------+--------------------------------+ >> +| ``FS_EXTENT_FL`` | | >> ++------------------------+--------------------------------+ >> +| ``FS_EA_INODE_FL`` | | >> ++------------------------+--------------------------------+ >> +| ``FS_EOFBLOCKS_FL`` | | >> ++------------------------+--------------------------------+ >> +| ``FS_NOCOW_FL`` | | >> ++------------------------+--------------------------------+ >> +| ``FS_INLINE_DATA_FL`` | | >> ++------------------------+--------------------------------+ >> +| ``FS_RESERVED_FL`` | | >> ++------------------------+--------------------------------+ >> +| | ``FS_XFLAG_REALTIME`` | >> ++------------------------+--------------------------------+ >> +| | ``FS_XFLAG_PREALLOC`` | >> ++------------------------+--------------------------------+ >> +| | ``FS_XFLAG_RTINHERIT`` | >> ++------------------------+--------------------------------+ >> +| | ``FS_XFLAG_NOSYMLINKS`` | >> ++------------------------+--------------------------------+ >> +| | ``FS_XFLAG_EXTSIZE`` | >> ++------------------------+--------------------------------+ >> +| | ``FS_XFLAG_EXTSZINHERIT`` | >> ++------------------------+--------------------------------+ >> +| | ``FS_XFLAG_NODEFRAG`` | >> ++------------------------+--------------------------------+ >> +| | ``FS_XFLAG_FILESTREAM`` | >> ++------------------------+--------------------------------+ >> +| | ``FS_XFLAG_COWEXTSIZE`` | >> ++------------------------+--------------------------------+ >> +| | ``FS_XFLAG_CASENONPRESERVING`` | >> ++------------------------+--------------------------------+ >> +| | ``FS_XFLAG_PROJID`` | >> ++------------------------+--------------------------------+ >> +| | ``FS_XFLAG_HASATTR`` | >> ++------------------------+--------------------------------+ > > Come on! This is writing the code in the doc. I like having the visual table here though :( since in the headers they're just separate lists (and actually, I thought the overlap between FS_*_FL flags and FS_XFLAG_* xflags was a lot more before having this table). > This document should tell the high level story of why those converters > exist and when and why they should be used by vfs and/or > filesystems. > > The documentation of each helper interface belongs in Kerneldoc > not here. Right, for now I only added a simple comments but I should add the full kernel-doc for them. Kinda related, but should we EXPORT_SYMBOL the rmw_to_mask and back helpers? > >> + >> +Drivers that only support ``FS_*_FL`` flags can check for unsupported >> +extended attributes in ``->fileattr_set()`` using fileattr_has_fsx():: >> + >> + bool fileattr_has_fsx(const struct file_kattr *fa); >> + >> +fileattr_has_fsx() returns ``true`` if ``fa->fsx_valid`` is set with an= y >> +xflags outside ``FS_XFLAG_COMMON`` or with non-zero ``fsx_extsize``, >> +``fsx_projid``, or ``fsx_cowextsize``. >> + >> +VFS Translation Helpers >> +----------------------- >> + >> +With fileattr_set_convert(), the VFS bridges differing >> +caller and driver capabilities automatically using the inode's current >> +attributes retrieved via vfs_fileattr_get(): >> + >> +- fileattr_set_rmw_to_mask(): Converts Read-Modify-Write requests >> + (``FS_IOC_SETFLAGS``, ``FS_IOC_FSSETXATTR``, or file_setattr() withou= t >> + ``AT_FILEATTR_MASKS``) to a request with masks when targeting a files= ystem >> + that supports them. It does RMW itself, computing which flags and val= ue >> + attributes changed, then populates ``fa->fsx_xflags`` and >> + ``fa->fsx_xflags_rw_mask`` accordingly. >> +- fileattr_set_mask_to_rmw(): Converts masked requests (file_setattr() = with >> + ``AT_FILEATTR_MASKS``) to Read-Modify-Write format when targeting a >> + filesystem that doesn't support masks. It rejects changes to read-onl= y or >> + unsupported flags and then merges the new values with the current one= s, >> + preserving unchanged flags and clearing the masks. >> +- flags_to_xflags() / xflags_to_flags(): Convert between ``FS_XFLAG_*``= xflags >> + and ``FS_*_FL`` flags using fileattr_fill_xflags() and fileattr_fill_= flags() >> + and returning only the new bitmask. >> + > > This is a hard read, try to simplify if you can, less interface, more hig= h > level maybe. not sure. Hmm, for me it's high level enough, but since I already know what these functions do I'll ask friends/other people too and take it from there. >> +Mask-Aware Driver Example >> +------------------------- >> + >> +An example of a filesystem that supports masks can be found in ``fs/ntf= s/file.c``. >> + >> +Locking >> +------- >> + >> +- vfs_fileattr_set() takes inode_lock(), > >> a vfs_fileattr_set_locked() will be >> + added for cases where inode lock is already held. > > This is an odd thing to write in the context of this doc. Fair, I added it since I had to make the _locked() variant for NFS/CIFS (iirc), so I thought it could be useful to point out in the doc that it hasn't been added yet but it will (whenever we'll need to use it for changing btime probably). >> + >> +Permissions >> +----------- >> + >> +- Inode ownership or ``CAP_FOWNER`` in the owning user namespace is req= uired. >> +- Modifying ``FS_XFLAG_IMMUTABLE`` or ``FS_XFLAG_APPEND`` requires >> + ``CAP_LINUX_IMMUTABLE`` in the initial user namespace. >> +- Modifying ``FS_XFLAG_PROJID`` (when ``fsx_projid`` changes) or >> + ``FS_XFLAG_PROJINHERIT`` requires the caller to reside in the initial= user >> + namespace. >> + >> +Error Codes >> +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> + >> +``-EINVAL`` >> + Invalid structure size, ``AT_FILEATTR_MASKS`` passed with non-mask = struct, >> + non-zero masks passed to file_setattr() without ``AT_FILEATTR_MASKS= ``, >> + unknown flags in ``at_flags``, unknown bits in ``fa_xflags`` or >> + ``fa_xflags_rw_mask`` (including ``FS_XFLAG_PROJID`` without >> + ``AT_FILEATTR_MASKS``), > > We must get rid of this exemption somehow. > It's unreadable. > Possibly with V1/V0 phrasing. Yeah. >> invalid inode type for ``FS_XFLAG_EXTSIZE`` / >> + ``FS_XFLAG_EXTSZINHERIT`` / ``FS_XFLAG_COWEXTSIZE`` / ``FS_XFLAG_DA= X``, > > Note to bot: keep it general with examples. no need to bloat the doc > with a list of all the relevant flags in current code. Right, same as the above for the generic phrasing. >> + incompatible attribute combinations (e.g. DAX on >> + fs-verity), invalid project ID or >> + changing ``FS_XFLAG_PROJID`` / ``FS_XFLAG_PROJINHERIT`` outside >> + the host namespace. >> + >> +``-EOPNOTSUPP`` >> + The filesystem does not implement ``fileattr`` operations for this = inode, >> + or userspace requested modification of an attribute not writable by= the >> + filesystem. >> + >> +``-EPERM`` >> + Insufficient permissions (missing ``CAP_FOWNER``, missing >> + ``CAP_LINUX_IMMUTABLE``, filesystem-enforced immutability constrain= ts). >> + >> +``-EROFS`` >> + Target inode resides on a read-only mount or filesystem. >> + >> +``-ENOKEY`` >> + Required encryption key is unavailable (e.g. enabling ``FS_XFLAG_CA= SEFOLD`` >> + on an encrypted directory without its key). >> + >> +``-E2BIG`` >> + ``usize`` exceeds ``PAGE_SIZE``, or trailing bytes in ``attr`` are = non-zero >> + when ``usize > FILE_ATTR_SIZE_LATEST`` on file_setattr(). >> + >> +``-EBADF`` >> + ``dfd`` is not a valid file descriptor. >> + >> +``-EFAULT`` >> + Invalid user memory pointer (including ``filename =3D=3D NULL`` wit= hout >> + ``AT_EMPTY_PATH``). >> + >> +``-ENOENT`` >> + Target file does not exist, or empty path without ``AT_EMPTY_PATH``= . >> + >> +``-EACCES`` / ``-ENOTDIR`` / ``-ELOOP`` / ``-ENAMETOOLONG`` >> + Pathname resolution errors. > > This is not supposed to be a man page and this duplicates information > not specific > to the new UAPI and not new. > > Only the new EINVAL/EOPNOTSUPP related to this patch set are relevant > in this doc. Ah ok, will remove them. >> diff --git a/Documentation/filesystems/index.rst b/Documentation/filesys= tems/index.rst >> index a556084c8858..71a1ae852e5b 100644 >> --- a/Documentation/filesystems/index.rst >> +++ b/Documentation/filesystems/index.rst >> @@ -28,6 +28,7 @@ algorithms work. >> dnotify >> fiemap >> files >> + fileattr >> locks >> mmap_prepare >> multigrain-ts >> diff --git a/Documentation/filesystems/vfs.rst b/Documentation/filesyste= ms/vfs.rst >> index 00fbcd549f15..e222d5025fe4 100644 >> --- a/Documentation/filesystems/vfs.rst >> +++ b/Documentation/filesystems/vfs.rst >> @@ -621,16 +621,19 @@ otherwise noted. >> the end. >> >> ``fileattr_get`` >> - called on ioctl(FS_IOC_GETFLAGS) and ioctl(FS_IOC_FSGETXATTR) to >> - retrieve miscellaneous file flags and attributes. Also called >> - before the relevant SET operation to check what is being changed >> - (in this case with i_rwsem locked exclusive). If unset, then >> - fall back to f_op->ioctl(). >> + called on ioctl(FS_IOC_GETFLAGS), ioctl(FS_IOC_FSGETXATTR) and >> + file_getattr(2) to retrieve miscellaneous file flags and attribu= tes >> + (see Documentation/filesystems/fileattr.rst). Also called befor= e the >> + relevant SET operation to check what is being changed (in this c= ase >> + with i_rwsem locked exclusive). If unset, then fall back to >> + f_op->ioctl(). >> >> ``fileattr_set`` >> - called on ioctl(FS_IOC_SETFLAGS) and ioctl(FS_IOC_FSSETXATTR) to >> - change miscellaneous file flags and attributes. Callers hold >> - i_rwsem exclusive. If unset, then fall back to f_op->ioctl(). >> + called on ioctl(FS_IOC_SETFLAGS), ioctl(FS_IOC_FSSETXATTR) and >> + file_setattr(2) to change miscellaneous file flags and attribute= s (see >> + Documentation/filesystems/fileattr.rst). Callers hold i_rwsem >> + exclusive. If unset, then fall back to f_op->ioctl(). >> + >> ``get_offset_ctx`` >> called to get the offset context for a directory inode. A >> filesystem must define this operation to use >> diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h >> index c1c487d07d29..5a58e1029bf8 100644 >> --- a/include/uapi/linux/fs.h >> +++ b/include/uapi/linux/fs.h >> @@ -225,9 +225,33 @@ struct fsxattr { >> unsigned char fsx_pad[8]; >> }; >> >> -/* >> - * Variable size structure for file_[sg]et_attr(). >> +/** >> + * struct file_attr - Variable size structure for file_getattr() / file= _setattr(). >> + * @fa_xflags: Bit mask of zero or more FS_XFLAG_* file attribute flags= to be >> + * set/unset (in) or currently enabled (out) on the inode. = See >> + * :ref:`Flag Reference ` for a list of fla= gs. >> + * @fa_extsize: Extent size allocator hint in bytes, value of the >> + * FS_XFLAG_EXTSIZE/FS_XFLAG_EXTSZINHERIT xflag. This valu= e >> + * suggests a preferred extent size for new allocations. (= in/out) >> + * @fa_nextents: Number of data extents in the file, read-only. Filled = in by >> + * file_getattr(2) and ignored by file_setattr(2). (out) >> + * @fa_projid: Project identifier, value of FS_XFLAG_PROJID. Used by qu= ota >> + * systems quotactl(2) to group related files. (in/out) >> + * @fa_cowextsize: Copy-on-Write (CoW) extent size hint in bytes, value= of >> + * FS_XFLAG_COWEXTSIZE. This value suggests a preferred= extent >> + * size for CoW operations. (in/out) >> + * @fa_xflags_rw_mask: Bit mask of writeable xflags supported by the fi= lesystem >> + * (out). Bit mask of xflags that need to be set to= their >> + * corresponding on/off state in @fa_xflags and, if= present, >> + * to their @fa_* value (in) ("flags that userspace= wants >> + * to change"). See :ref:`Masks ` for detail= s. >> + * @fa_xflags_ro_mask: Bit mask of read-only xflags supported by the fi= lesystem >> + * (out). See :ref:`Masks ` for details. >> * >> + * Note: @fa_xflags_rw_mask and @fa_xflags_ro_mask need the >> + * ``AT_FILEATTR_MASKS`` at_flag to be used. >> + */ >> +/* > > Keep this with the code patch. Ah ok. Thanks, koraynilay > Thanks, > Amir. --4ab233504dc5564f7ae5b289d3f34bd0bfd452427c2640224167c35b2e90 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQSgVimKafU5DQMcjcDmj22qf5IGXAUCaww0bAAKCRDmj22qf5IG XIE+AP0YH6oU0AvMHZK/P4o7b+S5Ig6A3eyNus8L/3NRNoQ36AEAs4i4LYS8jd8t piX2toPq9yUZMf43U/jW7dfTSSBBOgk= =SGUM -----END PGP SIGNATURE----- --4ab233504dc5564f7ae5b289d3f34bd0bfd452427c2640224167c35b2e90--