From: Eric Biggers <ebiggers@kernel.org>
To: cem@kernel.org
Cc: linux-xfs@vger.kernel.org, wbx@openadk.org
Subject: Re: [PATCH] xfs_io: Fix fscrypt macros ordering
Date: Fri, 16 Aug 2024 13:05:35 -0700 [thread overview]
Message-ID: <20240816200535.GA15887@sol.localdomain> (raw)
In-Reply-To: <20240816193957.42626-1-cem@kernel.org>
On Fri, Aug 16, 2024 at 09:39:38PM +0200, cem@kernel.org wrote:
> #define FSCRYPT_POLICY_V2 2
> #define FSCRYPT_KEY_IDENTIFIER_SIZE 16
> /* struct fscrypt_policy_v2 was defined earlier */
The above comment needs to be removed.
> +/*
> + * Since the log2_data_unit_size field was added later than fscrypt_policy_v2
> + * itself, we may need to override the system definition to get that field.
> + * And also fscrypt_get_policy_ex_arg since it contains fscrypt_policy_v2.
> + */
> +#if !defined(FS_IOC_GET_ENCRYPTION_POLICY_EX) || \
> + defined(OVERRIDE_SYSTEM_FSCRYPT_POLICY_V2)
> +#undef fscrypt_policy_v2
> +struct fscrypt_policy_v2 {
> + __u8 version;
> + __u8 contents_encryption_mode;
> + __u8 filenames_encryption_mode;
> + __u8 flags;
> + __u8 log2_data_unit_size;
> + __u8 __reserved[3];
> + __u8 master_key_identifier[FSCRYPT_KEY_IDENTIFIER_SIZE];
> +};
> +
> +#undef fscrypt_get_policy_ex_arg
> +struct fscrypt_get_policy_ex_arg {
> + __u64 policy_size; /* input/output */
> + union {
> + __u8 version;
> + struct fscrypt_policy_v1 v1;
> + struct fscrypt_policy_v2 v2;
> + } policy; /* output */
> +};
> +
> +#define FS_IOC_GET_ENCRYPTION_POLICY_EX _IOWR('f', 22, __u8[9]) /* size + version */
> +
> +#endif
FS_IOC_GET_ENCRYPTION_POLICY_EX needs to be guarded by an ifdef that checks only
itself, like FS_IOC_ADD_ENCRYPTION_KEY is below.
> +
> /*
> * Since the key_id field was added later than struct fscrypt_add_key_arg
> * itself, we may need to override the system definition to get that field.
> */
> #if !defined(FS_IOC_ADD_ENCRYPTION_KEY) || \
> defined(OVERRIDE_SYSTEM_FSCRYPT_ADD_KEY_ARG)
> #undef fscrypt_add_key_arg
> struct fscrypt_add_key_arg {
> struct fscrypt_key_specifier key_spec;
> __u32 raw_size;
> __u32 key_id;
> __u32 __reserved[8];
> __u8 raw[];
> };
> #endif
>
> #ifndef FS_IOC_ADD_ENCRYPTION_KEY
> # define FS_IOC_ADD_ENCRYPTION_KEY _IOWR('f', 23, struct fscrypt_add_key_arg)
> #endif
Otherwise this looks good, thanks. Sorry for the trouble. It might be time to
find a way to build the file without <linux/fs.h> included --- then the local
definitions can just be used unconditionally.
- Eric
next prev parent reply other threads:[~2024-08-16 20:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-16 19:39 [PATCH] xfs_io: Fix fscrypt macros ordering cem
2024-08-16 20:05 ` Eric Biggers [this message]
2024-08-16 20:20 ` Bill O'Donnell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240816200535.GA15887@sol.localdomain \
--to=ebiggers@kernel.org \
--cc=cem@kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=wbx@openadk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.