Skip to contentSkip to conversation

mountd: Add check for 'struct file_handle'

PATCH In review Petr Vorel 2 participants 2 messages Nov 17, 2019 – Nov 18, 2019

Subsystems (2)
lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH 1/1 mountd: Add check for 'struct file_handle'

From: Maxime Hadjinlian <[email protected]>

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.

[ pvorel: rebased from nfs-utils-1-3-4 ]
---
 configure.ac         | 1 +
 utils/mountd/cache.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
configure.ac +1 -0
index 9ba9d4b5..949ff9fc 100644
@@ -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
utils/mountd/cache.c +1 -1
index 3861f84a..31e9507d 100644
@@ -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];
Signature · 1 line
2.24.0
#1 lore raw
Quoted 7 lines · Petr Vorel

From: Maxime Hadjinlian <[email protected]>

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.

Quoted 8 lines

So, this patch adds a check for this struct.

Patch taken from buildroot distribution.

[ pvorel: rebased from nfs-utils-1-3-4 ]

Committed... (tag: nfs-utils-2-4-3-rc1)

steved.

Quoted 31 lines
---
 configure.ac         | 1 +
 utils/mountd/cache.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
configure.ac +1 -0
index 9ba9d4b5..949ff9fc 100644
@@ -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
utils/mountd/cache.c +1 -1
index 3861f84a..31e9507d 100644
@@ -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];