Skip to content

Commit

Permalink
Add macro DEVTMPFS
Browse files Browse the repository at this point in the history
Some users might mount devtmpfs to a location other than /dev.
  • Loading branch information
mattysweeps committed Oct 18, 2024
1 parent 892868d commit 569b0c6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
9 changes: 9 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
8 changes: 6 additions & 2 deletions include/ublksrv_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
* */
Expand Down
4 changes: 4 additions & 0 deletions lib/ublksrv_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 569b0c6

Please sign in to comment.