Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add macros UBLK_CONTROL and UBLKC_PREFIX #75

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,24 @@ else
AC_MSG_RESULT([no])
fi

ublk_control=/dev/ublk-control
AC_ARG_WITH(
[ublk_control],
[AS_HELP_STRING([--with-ublk_control], [Set the ublk control device. Defaults to /dev/ublk-control.])],
[ublk_control="$withval"]
[],
)
AC_DEFINE_UNQUOTED([UBLK_CONTROL], ["${ublk_control}"], [ublk control device.])

ublkc_prefix=/dev
AC_ARG_WITH(
[ublkc_prefix],
[AS_HELP_STRING([--with-ublkc_prefix], [Set the directory prefix for ublkc devices. Defaults to /dev.])],
[ublkc_prefix="$withval"]
[],
)
AC_DEFINE_UNQUOTED([UBLKC_PREFIX], ["${ublkc_prefix}"], [prefix for ublkc devices.])

AC_CHECK_PROGS([DOXYGEN], [doxygen])
if test -z "$DOXYGEN"; then
AC_MSG_WARN([Doxygen not found - continue without Doxygen support])
Expand Down
6 changes: 5 additions & 1 deletion 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 UBLKC_PREFIX
#define UBLKC_DEV UBLKC_PREFIX "/ublkc"
#else
#define UBLKC_DEV "/dev/ublkc"
#endif
#define UBLKC_PATH_MAX 32

#ifdef __cplusplus
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 UBLK_CONTROL
#define CTRL_DEV UBLK_CONTROL
#else
#define CTRL_DEV "/dev/ublk-control"
#endif

#define CTRL_CMD_HAS_DATA 1
#define CTRL_CMD_HAS_BUF 2
Expand Down
Loading