Skip to contentSkip to conversation

fh_key_file: fix missing string.h inclusion

PATCH In review Giulio Benetti 2 participants 6 messages Apr 8 – May 15

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 fh_key_file: fix missing string.h inclusion

Add #include <string.h> to fix build failure.

---
V1->V2:
* no changes

---
 support/nfs/fh_key_file.c | 1 +
 1 file changed, 1 insertion(+)
support/nfs/fh_key_file.c +1 -0
index 5f5eafc1..81ea1500 100644
@@ -26,6 +26,7 @@
 #include <sys/types.h>
 #include <unistd.h>
 #include <errno.h>
+#include <string.h>
 #include <uuid/uuid.h>
 
 #include "nfslib.h"
Signature · 1 line
2.47.3
#1 lore raw

PATCH v2 2/3 Introduce compat.h file to deal with old Linux api and fix build failure due to missing NETLINK_EXT_ACK

In "compat.h" check if NETLINK_EXT_ACK exists, otherwise define it to fix build failure and where at the moment <linux/netlink.h> is included let's include "compat.h"

---
V1->V2:
* include "compat.h" in place of <linux/netlink.h>

---
 support/export/cache.c       |  2 +-
 support/export/cache_flush.c |  2 ++
 support/include/compat.h     | 10 ++++++++++
 utils/nfsdctl/nfsdctl.c      |  1 +
 4 files changed, 14 insertions(+), 1 deletion(-)
 create mode 100644 support/include/compat.h
support/export/cache.c +1 -1
index 2f128d7d..65008f51 100644
@@ -40,7 +40,7 @@
 #include <netlink/genl/ctrl.h>
 #include <netlink/msg.h>
 #include <netlink/attr.h>
-#include <linux/netlink.h>
+#include "compat.h"
 
 #ifdef USE_SYSTEM_NFSD_NETLINK_H
 #include <linux/nfsd_netlink.h>
support/export/cache_flush.c +2 -0
index ed7b964f..2a24dec7 100644
@@ -38,6 +38,8 @@ extern int no_netlink;
 #include "sunrpc_netlink.h"
 #endif
 
+#include "compat.h"
+
 static int nl_send_flush(struct nl_sock *sock, int family, int cmd)
 {
 	struct nl_msg *msg;
support/include/compat.h new file +10 -0
new file mode 100644
index 00000000..83229b65
@@ -0,0 +1,10 @@
+#ifndef COMPAT_H
+#define COMPAT_H
+
+#include <linux/netlink.h>
+
+#ifndef NETLINK_EXT_ACK
+#define NETLINK_EXT_ACK 11
+#endif
+
+#endif /* COMPAT_H */
utils/nfsdctl/nfsdctl.c +1 -0
index 016dd2eb..c7126748 100644
@@ -26,6 +26,7 @@
 #include <netlink/msg.h>
 #include <netlink/attr.h>
 #include <linux/netlink.h>
+#include "compat.h"
 
 #include <readline/readline.h>
 #include <readline/history.h>
Signature · 1 line
2.47.3
#2 lore raw

Re: [PATCH v2 2/3] Introduce compat.h file to deal with old Linux api and fix build failure due to missing NETLINK_EXT_ACK

Quoted 5 lines · Giulio Benetti

In "compat.h" check if NETLINK_EXT_ACK exists, otherwise define it to fix build failure and where at the moment <linux/netlink.h> is included let's include "compat.h"

Committed (tag: nfs-utils-2-9-2-rc3)

steved

Quoted 65 lines

---
V1->V2:
* include "compat.h" in place of <linux/netlink.h>

---
  support/export/cache.c       |  2 +-
  support/export/cache_flush.c |  2 ++
  support/include/compat.h     | 10 ++++++++++
  utils/nfsdctl/nfsdctl.c      |  1 +
  4 files changed, 14 insertions(+), 1 deletion(-)

create mode 100644 support/include/compat.h

support/export/cache.c +1 -1
index 2f128d7d..65008f51 100644
@@ -40,7 +40,7 @@
  #include <netlink/genl/ctrl.h>
  #include <netlink/msg.h>
  #include <netlink/attr.h>
-#include <linux/netlink.h>
+#include "compat.h"
 
  #ifdef USE_SYSTEM_NFSD_NETLINK_H
  #include <linux/nfsd_netlink.h>
support/export/cache_flush.c +2 -0
index ed7b964f..2a24dec7 100644
@@ -38,6 +38,8 @@ extern int no_netlink;
  #include "sunrpc_netlink.h"
  #endif
 
+#include "compat.h"
+
  static int nl_send_flush(struct nl_sock *sock, int family, int cmd)
  {
  	struct nl_msg *msg;
support/include/compat.h new file +10 -0
new file mode 100644
index 00000000..83229b65
@@ -0,0 +1,10 @@
+#ifndef COMPAT_H
+#define COMPAT_H
+
+#include <linux/netlink.h>
+
+#ifndef NETLINK_EXT_ACK
+#define NETLINK_EXT_ACK 11
+#endif
+
+#endif /* COMPAT_H */
utils/nfsdctl/nfsdctl.c +1 -0
index 016dd2eb..c7126748 100644
@@ -26,6 +26,7 @@
  #include <netlink/msg.h>
  #include <netlink/attr.h>
  #include <linux/netlink.h>
+#include "compat.h"
 
  #include <readline/readline.h>
  #include <readline/history.h>
#3 lore raw

PATCH v2 3/3 support/backend_sqlite.c: fix getrandom() fallback

In reply to Giulio Benetti

In old Linux/Glibc versions __NR_getrandom is defined in <sys/random.h> so let's add it to fix build failure.

---
V1->V2
* added patch

---
 support/reexport/backend_sqlite.c | 2 ++
 1 file changed, 2 insertions(+)
support/reexport/backend_sqlite.c +2 -0
index 0eb5ea37..a1e981e4 100644
@@ -9,6 +9,8 @@
 #include <string.h>
 #include <unistd.h>
 
+#include <sys/syscall.h>
+
 #ifdef HAVE_GETRANDOM
 # include <sys/random.h>
 # if !defined(SYS_getrandom) && defined(__NR_getrandom)
Signature · 1 line
2.47.3
#4 lore raw

Re: [PATCH v2 3/3] support/backend_sqlite.c: fix getrandom() fallback

Quoted 4 lines · Giulio Benetti

In old Linux/Glibc versions __NR_getrandom is defined in <sys/random.h> so let's add it to fix build failure.

Committed (tag: nfs-utils-2-9-2-rc3)

steved

Quoted 20 lines

---
V1->V2
* added patch

---
  support/reexport/backend_sqlite.c | 2 ++
  1 file changed, 2 insertions(+)
support/reexport/backend_sqlite.c +2 -0
index 0eb5ea37..a1e981e4 100644
@@ -9,6 +9,8 @@
  #include <string.h>
  #include <unistd.h>
 
+#include <sys/syscall.h>
+
  #ifdef HAVE_GETRANDOM
  # include <sys/random.h>
  # if !defined(SYS_getrandom) && defined(__NR_getrandom)
#5 lore raw
In reply to Giulio Benetti
Quoted 3 lines · Giulio Benetti

Add #include <string.h> to fix build failure.

Committed (tag: nfs-utils-2-9-2-rc3)

steved

Quoted 19 lines

---
V1->V2:
* no changes

---
  support/nfs/fh_key_file.c | 1 +
  1 file changed, 1 insertion(+)
support/nfs/fh_key_file.c +1 -0
index 5f5eafc1..81ea1500 100644
@@ -26,6 +26,7 @@
  #include <sys/types.h>
  #include <unistd.h>
  #include <errno.h>
+#include <string.h>
  #include <uuid/uuid.h>
 
  #include "nfslib.h"