linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [nfs-utils PATCH 1/1] mountd: Add check for 'struct file_handle'
@ 2019-11-17 22:15 Petr Vorel
  2019-11-18 14:02 ` Steve Dickson
  0 siblings, 1 reply; 2+ messages in thread
From: Petr Vorel @ 2019-11-17 22:15 UTC (permalink / raw)
  To: linux-nfs; +Cc: Maxime Hadjinlian, Thomas Petazzoni, Petr Vorel

From: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>

The code to check if name_to_handle_at() is implemented generates only a
warning but with some toolchain it doesn't fail to link (the function must be
implemented somewhere).
However the "struct file_handle" type is not available.

So, this patch adds a check for this struct.

Patch taken from buildroot distribution.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
[ pvorel: rebased from nfs-utils-1-3-4 ]
Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
---
 configure.ac         | 1 +
 utils/mountd/cache.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 9ba9d4b5..949ff9fc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -510,6 +510,7 @@ AC_TYPE_PID_T
 AC_TYPE_SIZE_T
 AC_HEADER_TIME
 AC_STRUCT_TM
+AC_CHECK_TYPES([struct file_handle])
 
 dnl *************************************************************
 dnl Check for functions
diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index 3861f84a..31e9507d 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -446,7 +446,7 @@ static int same_path(char *child, char *parent, int len)
 	if (count_slashes(p) != count_slashes(parent))
 		return 0;
 
-#if HAVE_NAME_TO_HANDLE_AT
+#if defined(HAVE_NAME_TO_HANDLE_AT) && defined(HAVE_STRUCT_FILE_HANDLE)
 	struct {
 		struct file_handle fh;
 		unsigned char handle[128];
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [nfs-utils PATCH 1/1] mountd: Add check for 'struct file_handle'
  2019-11-17 22:15 [nfs-utils PATCH 1/1] mountd: Add check for 'struct file_handle' Petr Vorel
@ 2019-11-18 14:02 ` Steve Dickson
  0 siblings, 0 replies; 2+ messages in thread
From: Steve Dickson @ 2019-11-18 14:02 UTC (permalink / raw)
  To: Petr Vorel, linux-nfs; +Cc: Maxime Hadjinlian, Thomas Petazzoni



On 11/17/19 5:15 PM, Petr Vorel wrote:
> From: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
> 
> The code to check if name_to_handle_at() is implemented generates only a
> warning but with some toolchain it doesn't fail to link (the function must be
> implemented somewhere).
> However the "struct file_handle" type is not available.
> 
> So, this patch adds a check for this struct.
> 
> Patch taken from buildroot distribution.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> [ pvorel: rebased from nfs-utils-1-3-4 ]
> Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
> Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
Committed... (tag: nfs-utils-2-4-3-rc1)

steved.
> ---
>  configure.ac         | 1 +
>  utils/mountd/cache.c | 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 9ba9d4b5..949ff9fc 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -510,6 +510,7 @@ AC_TYPE_PID_T
>  AC_TYPE_SIZE_T
>  AC_HEADER_TIME
>  AC_STRUCT_TM
> +AC_CHECK_TYPES([struct file_handle])
>  
>  dnl *************************************************************
>  dnl Check for functions
> diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
> index 3861f84a..31e9507d 100644
> --- a/utils/mountd/cache.c
> +++ b/utils/mountd/cache.c
> @@ -446,7 +446,7 @@ static int same_path(char *child, char *parent, int len)
>  	if (count_slashes(p) != count_slashes(parent))
>  		return 0;
>  
> -#if HAVE_NAME_TO_HANDLE_AT
> +#if defined(HAVE_NAME_TO_HANDLE_AT) && defined(HAVE_STRUCT_FILE_HANDLE)
>  	struct {
>  		struct file_handle fh;
>  		unsigned char handle[128];
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-18 14:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-17 22:15 [nfs-utils PATCH 1/1] mountd: Add check for 'struct file_handle' Petr Vorel
2019-11-18 14:02 ` Steve Dickson

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).