From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A565ECA9EA0 for ; Tue, 22 Oct 2019 22:14:35 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 529102084B for ; Tue, 22 Oct 2019 22:14:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=dilger-ca.20150623.gappssmtp.com header.i=@dilger-ca.20150623.gappssmtp.com header.b="XIkqrxaA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 529102084B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=dilger.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46ySV04nmszDqM6 for ; Wed, 23 Oct 2019 09:14:32 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=permerror (SPF Permanent Error: Void lookup limit of 2 exceeded) smtp.mailfrom=dilger.ca (client-ip=2607:f8b0:4864:20::442; helo=mail-pf1-x442.google.com; envelope-from=adilger@dilger.ca; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=dilger.ca Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=dilger-ca.20150623.gappssmtp.com header.i=@dilger-ca.20150623.gappssmtp.com header.b="XIkqrxaA"; dkim-atps=neutral Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46ySTq2BKgzDqKK for ; Wed, 23 Oct 2019 09:14:15 +1100 (AEDT) Received: by mail-pf1-x442.google.com with SMTP id q7so11508705pfh.8 for ; Tue, 22 Oct 2019 15:14:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dilger-ca.20150623.gappssmtp.com; s=20150623; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=jdSjvTdb7YhhV+yeBoGT2uoOFpXOTdsEt8mUL1v5JjU=; b=XIkqrxaAVGv4cKdfDL9k/xAlmXBfmv2xaqBwDFkiO+RuiaJ/qx8Qv68C18O/MO1irW Cy3Vn+tIJxOtFj8DY52CQH0sqz1B3iiTZccOjh0yUYyHLsKbUqIOJZkP1hpBi5FJn608 BEKbvyyNE55qhvNvrbZH2IZmNn1WRfEs8EFa630Z7qZk27nOSVksTd9wxV/XGh89QoMm Za0X342Laxsi4tJ3eJWdVY07aJeei3nhk9yeONMbDuwXBHxa9DmHFXabN91oSXoIjD1+ 8erSnFeO/EhdCZAlrBE7LptFLs02TiPVVGY+Laj64nj95GyisCNv2t0bm1swjOyHxZ8j 6L/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=jdSjvTdb7YhhV+yeBoGT2uoOFpXOTdsEt8mUL1v5JjU=; b=ghLApFxZHT6PhNNGIyDVYIVFHNiL36cp+t5o7axm/nKEPOd9RgbyM0YWASPwQJ0Y2y XOLVeGy4XK3LiHKiBLgOwnghpGMF/kP5HammVic6OQJs2w/RfYxnESKCzLR5EdZq2zMT geBZ/baBWlgVcG6PmKcLNDxLLzYip3OHmXl1VrnGPEARhNUmeI3x56Oo0aSAKMLNa4wb 8XniVsgMvyaPHQmIb8C8bjTvHqlgjGRkLAlE102tld8t/Gx88cNv255ySQaMnLnzwJcm jz7gvZvnGyqSghgNDm4r0oWaNS6YoYACvMBOWmUh91ZjEbH93ItUKq6Qa0FDLe4mafgw GZrQ== X-Gm-Message-State: APjAAAXEqZXz2ir5v9iufxgGwDsanvSljJeWu1DWUvtkUt8GG+U1s0sZ MLkEJMMUWR40T3m33bt15hyQOQ== X-Google-Smtp-Source: APXvYqyCGFGpT2C3cY7XT0d1Dal+bVUH3K7BRELFdnAX59mbUm04n1z8zWdaK4LGbMaAkUt/N9526w== X-Received: by 2002:a17:90a:a60f:: with SMTP id c15mr7467310pjq.18.1571782451665; Tue, 22 Oct 2019 15:14:11 -0700 (PDT) Received: from cabot-wlan.adilger.int (S0106a84e3fe4b223.cg.shawcable.net. [70.77.216.213]) by smtp.gmail.com with ESMTPSA id r24sm21302038pfh.69.2019.10.22.15.13.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Oct 2019 15:14:10 -0700 (PDT) From: Andreas Dilger Message-Id: <8CE5B6E8-DCB7-4F0B-91C1-48030947F585@dilger.ca> Content-Type: multipart/signed; boundary="Apple-Mail=_37420EF0-273E-43F4-97D0-62F6238C01CC"; protocol="application/pgp-signature"; micalg=pgp-sha256 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: [PATCH v14 1/5] Add flags option to get xattr method paired to __vfs_getxattr Date: Tue, 22 Oct 2019 16:13:53 -0600 In-Reply-To: <20191022204453.97058-2-salyzyn@android.com> To: Mark Salyzyn References: <20191022204453.97058-1-salyzyn@android.com> <20191022204453.97058-2-salyzyn@android.com> X-Mailer: Apple Mail (2.3273) X-BeenThere: linux-erofs@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development of Linux EROFS file system List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Latchesar Ionkov , Hugh Dickins , Mauro Carvalho Chehab , Mike Marshall , James Morris , devel@lists.orangefs.org, Eric Van Hensbergen , Joel Becker , Anna Schumaker , Trond Myklebust , Mathieu Malaterre , Greg Kroah-Hartman , Linux Kernel Mailing List , Jan Kara , Casey Schaufler , Andrew Morton , Dave Kleikamp , linux-doc@vger.kernel.org, Jeff Layton , Mimi Zohar , CIFS , Paul Moore , "Darrick J . Wong" , Eric Sandeen , kernel-team@android.com, selinux@vger.kernel.org, Brian Foster , reiserfs-devel@vger.kernel.org, Linux FS-devel Mailing List , Jaegeuk Kim , Theodore Ts'o , Jonathan Corbet , linux-f2fs-devel@lists.sourceforge.net, Benjamin Coddington , linux-integrity@vger.kernel.org, Martin Brandenburg , Chris Mason , linux-mtd@lists.infradead.org, linux-afs@lists.infradead.org, Miklos Szeredi , Ilya Dryomov , Ext4 Developers List , Stephen Smalley , Serge Hallyn , Eric Paris , ceph-devel , Gao Xiang , linux-nfs , Joseph Qi , samba-technical , linux-xfs , Bob Peterson , Tejun Heo , linux-erofs@lists.ozlabs.org, "David S. Miller" , ocfs2-devel@oss.oracle.com, jfs-discussion@lists.sourceforge.net, Jan Kara , Eric Biggers , Dominique Martinet , overlayfs , David Howells , linux-mm , Andreas Gruenbacher , Sage Weil , Richard Weinberger , Mark Fasheh , cluster-devel@redhat.com, Steve French , v9fs-developer@lists.sourceforge.net, Bharath Vedartham , Jann Horn , ecryptfs@vger.kernel.org, Josef Bacik , Dave Chinner , David Sterba , Artem Bityutskiy , netdev@vger.kernel.org, Adrian Hunter , Tyler Hicks , linux-security-module@vger.kernel.org, Phillip Lougher , David Woodhouse , linux-btrfs , Alexander Viro Errors-To: linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Sender: "Linux-erofs" --Apple-Mail=_37420EF0-273E-43F4-97D0-62F6238C01CC Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Oct 22, 2019, at 2:44 PM, Mark Salyzyn wrote: >=20 > Replace arguments for get and set xattr methods, and __vfs_getxattr > and __vfs_setaxtr functions with a reference to the following now > common argument structure: >=20 > struct xattr_gs_args { > struct dentry *dentry; > struct inode *inode; > const char *name; > union { > void *buffer; > const void *value; > }; > size_t size; > int flags; > }; As part of this change (which is touching all of the uses of these fields anyway) it would be useful to give these structure fields a prefix like "xga_" so that they can be easily found with tags. Otherwise, there are so many different "dentry" and "inode" fields in various structures that it is hard to find the right one. > #define __USE_KERNEL_XATTR_DEFS >=20 > -#define XATTR_CREATE 0x1 /* set value, fail if attr already = exists */ > -#define XATTR_REPLACE 0x2 /* set value, fail if attr does = not exist */ > +#define XATTR_CREATE 0x1 /* set value, fail if attr already = exists */ > +#define XATTR_REPLACE 0x2 /* set value, fail if attr does = not exist */ > +#ifdef __KERNEL__ /* following is kernel internal, colocated for = maintenance */ > +#define XATTR_NOSECURITY 0x4 /* get value, do not involve security = check */ > +#endif Now that these arguments are separated out into their own structure, rather than using "int flags" (there are a million different flags in the kernel and easily confused) it would be immediately clear *which* flags are used here with a named enum, like: enum xattr_flags { XATTR_CREATE =3D 0x1, /* set value, fail if attr = already exists */ XATTR_REPLACE =3D 0x2, /* set value, fail if attr does = not exist */ #ifdef __KERNEL__ /* following is kernel internal, colocated for = maintenance */ XATTR_NOSECURITY=3D 0x4, /* get value, do not involve security = check */ #endif }; and use this in the struct like: struct xattr_gs_args { struct dentry *xga_dentry; struct inode *xga_inode; const char *xga_name; union { void *xga_buffer; const void *xga_value; }; size_t xga_size; enum xattr_flags xga_flags; }; Beyond the benefit for the reader to understand the code better, this can also allow the compiler to warn if incorrect values are being assigned to this field. Cheers, Andreas --Apple-Mail=_37420EF0-273E-43F4-97D0-62F6238C01CC Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iQIzBAEBCAAdFiEEDb73u6ZejP5ZMprvcqXauRfMH+AFAl2vfyEACgkQcqXauRfM H+AxqxAAq6h17WEPF6r1UpAZIwUiPfdUH5qvEj5YwdktQwWuj4vM4AD1SnRYnDv2 erszJKsHxSS8RBP18hvIK3TC7Z1TwOPYxRcZb1KRnxX0TthhtHTNL103RmQvUvKm 8KjV2ZmRZAlgrvw09BGHJF4f4ina+Ua1AQsIg7l+6eGjBHJ3Nvjmv3M/Eca3Y9Gx eWYOM5vlA7+eVqKpCEyQ+/EN5lhBOWA+qsQhfEyPjSns/VsVae7bWkUrZSIRHpk9 i7HCwOkDj9cmfU4iZ34JePW8dtqHfoq3ECMUvsO681CznbyWB7yDnmX+UL8OFw2s Vj2n0fIHc/r3SJ87LF/k5JhjWaYM4rCM+1+uzXmukWQWXIU2U2vkLdAPkyibo6nq 5/Z98+GzWMwnP9esRhIM1lAf2Q0QQ/Bmmz5/2rwCEYpleEKInHDZyJ3ddSCC9mxQ +bf/9EeqBVd7b2R8rQLNcrY9R5zewIE+NovyaCcz71H6lyQ/NwfAAlUrjXN6zjGo aZYq3D2plzK5PnJwZrmarfiI2Qtge9h2sbFNX2dRT6oLeZNzv/rAx/8AueYIcGjb bPlf+rGFqzCVPkUQFPYqlsa/oEqUTnmr+6p8FvKO8DJhdVZEuOn/vJZV4e903hHl VURWEhW1Djzh/zWJVrNeOQRk+0KBXXfgvZ9nHpMRbX0xESTU+cY= =8Giq -----END PGP SIGNATURE----- --Apple-Mail=_37420EF0-273E-43F4-97D0-62F6238C01CC--