summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Bentele2020-11-16 09:01:54 +0100
committerManuel Bentele2020-11-16 09:01:54 +0100
commit9bd0efee359d5436b3b8433dc76c69315b1126a3 (patch)
tree3400aab3dac23aab047255325fc9fe62ea5ba058
parentcmake: Add default include dir for fuse (diff)
downloaddnbd3-9bd0efee359d5436b3b8433dc76c69315b1126a3.tar.gz
dnbd3-9bd0efee359d5436b3b8433dc76c69315b1126a3.tar.xz
dnbd3-9bd0efee359d5436b3b8433dc76c69315b1126a3.zip
[KERNEL] add support for Linux kernel 4.19 on Ubuntu 18.04 (GCC 7.5)
This patch replaces the __VA_OPT__ varadic macro for the C preprocessor with a builtin GCC extension for optional varadic arguments. Based on this change, the dnbd3 Linux kernel module can be also built with GCC 7.5 on a fresh Ubuntu 18.04 with Linux kernel version 4.19.x.
-rw-r--r--README.md14
-rw-r--r--src/kernel/net.c16
2 files changed, 22 insertions, 8 deletions
diff --git a/README.md b/README.md
index a46423e..1e60477 100644
--- a/README.md
+++ b/README.md
@@ -13,6 +13,7 @@ The dnbd3 components can be built for the following Linux kernel versions and Un
- Archlinux with **Linux kernel 5.9.x** or **5.4.x**
- Ubuntu 20.04 with **Linux kernel 5.4.x**
+ - Ubuntu 18.04 with **Linux kernel 4.19.x**
- CentOS 8 with **Linux kernel 4.18.x**
- FreeBSD 12.1 (only user space programs, eg. dnbd3-server)
@@ -50,6 +51,19 @@ apt-get install git \
Note that `afl` is not available on Ubuntu 20.04 and should be built from the [original sources](https://github.com/google/AFL).
+#### Ubuntu 18.04 with Linux kernel 4.19.x
+```shell
+apt-get install git \
+ make \
+ cmake \
+ gcc \
+ linux-headers-generic \
+ libfuse-dev \
+ libjansson-dev \
+ afl \
+ rpm
+```
+
#### CentOS 8 with Linux kernel 4.18.x
```shell
yum install git \
diff --git a/src/kernel/net.c b/src/kernel/net.c
index a044be2..a0444d2 100644
--- a/src/kernel/net.c
+++ b/src/kernel/net.c
@@ -55,24 +55,24 @@
*/
#define __dnbd3_dev_dbg_host(dev, host, fmt, ...) do { \
if ((host).type == HOST_IP4) { \
- dev_dbg(dnbd3_device_to_dev((dev)), "(%pI4:%d): " fmt, (host).addr, (int)ntohs((host).port) __VA_OPT__(,) __VA_ARGS__); \
+ dev_dbg(dnbd3_device_to_dev((dev)), "(%pI4:%d): " fmt, (host).addr, (int)ntohs((host).port), ##__VA_ARGS__); \
} else { \
- dev_dbg(dnbd3_device_to_dev((dev)), "([%pI6]:%d): " fmt, (host).addr, (int)ntohs((host).port) __VA_OPT__(,) __VA_ARGS__); \
+ dev_dbg(dnbd3_device_to_dev((dev)), "([%pI6]:%d): " fmt, (host).addr, (int)ntohs((host).port), ##__VA_ARGS__); \
} \
} while (0)
#define __dnbd3_dev_err_host(dev, host, fmt, ...) do { \
if ((host).type == HOST_IP4) { \
- dev_err(dnbd3_device_to_dev((dev)), "(%pI4:%d): " fmt, (host).addr, (int)ntohs((host).port) __VA_OPT__(,) __VA_ARGS__); \
+ dev_err(dnbd3_device_to_dev((dev)), "(%pI4:%d): " fmt, (host).addr, (int)ntohs((host).port), ##__VA_ARGS__); \
} else { \
- dev_err(dnbd3_device_to_dev((dev)), "([%pI6]:%d): " fmt, (host).addr, (int)ntohs((host).port) __VA_OPT__(,) __VA_ARGS__); \
+ dev_err(dnbd3_device_to_dev((dev)), "([%pI6]:%d): " fmt, (host).addr, (int)ntohs((host).port), ##__VA_ARGS__); \
} \
} while (0)
-#define dnbd3_dev_dbg_host_cur(dev, fmt, ...) __dnbd3_dev_dbg_host((dev), (dev)->cur_server.host, fmt __VA_OPT__(,) __VA_ARGS__)
-#define dnbd3_dev_err_host_cur(dev, fmt, ...) __dnbd3_dev_err_host((dev), (dev)->cur_server.host, fmt __VA_OPT__(,) __VA_ARGS__)
-#define dnbd3_dev_dbg_host_alt(dev, fmt, ...) __dnbd3_dev_dbg_host((dev), (dev)->alt_servers[i].host, fmt __VA_OPT__(,) __VA_ARGS__)
-#define dnbd3_dev_err_host_alt(dev, fmt, ...) __dnbd3_dev_err_host((dev), (dev)->alt_servers[i].host, fmt __VA_OPT__(,) __VA_ARGS__)
+#define dnbd3_dev_dbg_host_cur(dev, fmt, ...) __dnbd3_dev_dbg_host((dev), (dev)->cur_server.host, fmt, ##__VA_ARGS__)
+#define dnbd3_dev_err_host_cur(dev, fmt, ...) __dnbd3_dev_err_host((dev), (dev)->cur_server.host, fmt, ##__VA_ARGS__)
+#define dnbd3_dev_dbg_host_alt(dev, fmt, ...) __dnbd3_dev_dbg_host((dev), (dev)->alt_servers[i].host, fmt, ##__VA_ARGS__)
+#define dnbd3_dev_err_host_alt(dev, fmt, ...) __dnbd3_dev_err_host((dev), (dev)->alt_servers[i].host, fmt, ##__VA_ARGS__)
static inline dnbd3_server_t *get_free_alt_server(dnbd3_device_t * const dev)
{