linux-fscrypt.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: luca.boccassi@gmail.com
Cc: linux-fscrypt@vger.kernel.org
Subject: Re: [fsverity-utils PATCH 1/2] Remove unneeded includes
Date: Wed, 16 Dec 2020 10:44:53 -0800	[thread overview]
Message-ID: <X9pVpVC2Y/nGq4MG@sol.localdomain> (raw)
In-Reply-To: <20201216172719.540610-1-luca.boccassi@gmail.com>

On Wed, Dec 16, 2020 at 05:27:18PM +0000, luca.boccassi@gmail.com wrote:
> From: Luca Boccassi <luca.boccassi@microsoft.com>
> 
> Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
> ---
>  common/fsverity_uapi.h | 1 -
>  programs/cmd_enable.c  | 1 -
>  2 files changed, 2 deletions(-)
> 
> diff --git a/common/fsverity_uapi.h b/common/fsverity_uapi.h
> index 33f4415..0006c35 100644
> --- a/common/fsverity_uapi.h
> +++ b/common/fsverity_uapi.h
> @@ -10,7 +10,6 @@
>  #ifndef _UAPI_LINUX_FSVERITY_H
>  #define _UAPI_LINUX_FSVERITY_H
>  
> -#include <linux/ioctl.h>
>  #include <linux/types.h>

fsverity_uapi.h is supposed to be kept in sync with
include/uapi/linux/fsverity.h in the kernel source tree.

There's a reason why it includes <linux/ioctl.h>.  <linux/ioctl.h> provides the
_IOW() and _IOWR() macros to expand the values of FS_IOC_ENABLE_VERITY and
FS_IOC_MEASURE_VERITY.  Usually people referring to FS_IOC_* will include
<sys/ioctl.h> in order to actually call ioctl() too.  However it's not
guaranteed, so technically the header needs to include <linux/ioctl.h>.

Wrapping this include with '#ifdef _WIN32' would be better than removing it, as
then it would be clear that it's a Windows-specific modification.

However I think an even better approach would be to add empty files
win32-headers/linux/{types,ioctl.h} and add -Iwin32-headers to CPPFLAGS, so that
these headers can still be included in the Windows build without having to
modify the source files.

> diff --git a/programs/cmd_enable.c b/programs/cmd_enable.c
> index fdf26c7..14c3c17 100644
> --- a/programs/cmd_enable.c
> +++ b/programs/cmd_enable.c
> @@ -14,7 +14,6 @@
>  #include <fcntl.h>
>  #include <getopt.h>
>  #include <limits.h>
> -#include <sys/ioctl.h>
>  

This part looks fine though, as cmd_enable.c no longer directly uses an ioctl.

- Eric

  parent reply	other threads:[~2020-12-16 19:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-16 17:27 [fsverity-utils PATCH 1/2] Remove unneeded includes luca.boccassi
2020-12-16 17:27 ` [fsverity-utils PATCH 2/2] Allow to build and run sign/digest on Windows luca.boccassi
2020-12-16 19:08   ` Eric Biggers
2020-12-16 19:18     ` Eric Biggers
2020-12-17 14:54     ` Luca Boccassi
2020-12-16 18:44 ` Eric Biggers [this message]
2020-12-17 14:50   ` [fsverity-utils PATCH 1/2] Remove unneeded includes Luca Boccassi

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=X9pVpVC2Y/nGq4MG@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=linux-fscrypt@vger.kernel.org \
    --cc=luca.boccassi@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).