From 569b0c6d49741e1efeafe6923f465e79dc3699cd Mon Sep 17 00:00:00 2001 From: Matthew Broomfield Date: Fri, 18 Oct 2024 18:11:02 +0000 Subject: [PATCH] Add macro DEVTMPFS Some users might mount devtmpfs to a location other than /dev. --- configure.ac | 9 +++++++++ include/ublksrv_priv.h | 8 ++++++-- lib/ublksrv_cmd.c | 4 ++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index e44a0a44..8a6e823b 100644 --- a/configure.ac +++ b/configure.ac @@ -153,6 +153,15 @@ else AC_MSG_RESULT([no]) fi +devtmpfs=/dev +AC_ARG_WITH( + [devtmpfs], + [AS_HELP_STRING([--with-devtmpfs], [Set the devtmpfs dir. Defaults to /dev.])], + [devtmpfs="$withval"] + [], +) +AC_DEFINE_UNQUOTED([DEVTMPFS], ["${devtmpfs}"], [devtmpfs dir]) + AC_CHECK_PROGS([DOXYGEN], [doxygen]) if test -z "$DOXYGEN"; then AC_MSG_WARN([Doxygen not found - continue without Doxygen support]) diff --git a/include/ublksrv_priv.h b/include/ublksrv_priv.h index f37bc440..646d1e5f 100644 --- a/include/ublksrv_priv.h +++ b/include/ublksrv_priv.h @@ -26,7 +26,11 @@ /* todo: relace the hardcode name with /dev/char/maj:min */ -#define UBLKC_DEV "/dev/ublkc" +#ifdef DEVTMPFS +#define UBLKC_DEV DEVTMPFS "/ublkc" +#else +#define UBLKC_DEV "/dev/ublkc" +#endif #define UBLKC_PATH_MAX 32 #ifdef __cplusplus @@ -97,7 +101,7 @@ struct _ublksrv_queue { * * ublksrv_io_desc(iod) is stored in this buffer, so iod * can be retrieved by request's tag directly. - * + * * ublksrv writes the iod into this array, and notify ublksrv daemon * by issued io_uring command beforehand. * */ diff --git a/lib/ublksrv_cmd.c b/lib/ublksrv_cmd.c index 8288e740..ac108519 100644 --- a/lib/ublksrv_cmd.c +++ b/lib/ublksrv_cmd.c @@ -4,7 +4,11 @@ #include "ublksrv_priv.h" +#ifdef DEVTMPFS +#define CTRL_DEV DEVTMPFS "/ublk-control" +#else #define CTRL_DEV "/dev/ublk-control" +#endif #define CTRL_CMD_HAS_DATA 1 #define CTRL_CMD_HAS_BUF 2