Skip to content

Commit b42d9a0

Browse files
committed
Split fuse code into rshim_fuse.c
This commit splits the fuse/cuse code into rshim_fuse.c. So fuse is just one way to implement the boot/console/networking services. Other user interfaces, like networking or CLI, could be added when needed. This commit also unifies the build process for Linux and FreeBSD, and adds '--enable-fuse' in the configure options. Signed-off-by: Liming Sun <[email protected]>
1 parent 68c5160 commit b42d9a0

File tree

8 files changed

+1328
-1381
lines changed

8 files changed

+1328
-1381
lines changed

Makefile.freebsd

Lines changed: 0 additions & 52 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ internal rshim registers.
1919
Require FreeBSD 12.0+ with packages autoconf, automake, gmake, libepoll-shim,
2020
libpciaccess, libpci, pkgconf.
2121

22-
Follow the same steps as build in Linux, or use 'gmake -f Makefile.freebsd'
23-
to build it. Use 'gmake install' to install it.
22+
Follow the same steps above to build it. Use 'gmake install' to install it.
2423

2524
*) Usage
2625

configure.ac

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ AC_ARG_ENABLE([pcie],
2929

3030
AM_CONDITIONAL([BUILD_RSHIM_PCIE], [test "x$build_pcie" = "xyes"])
3131

32+
AC_ARG_ENABLE([fuse],
33+
AS_HELP_STRING([--enable-fuse], [Enable fuse / cuse (default is yes) ]),
34+
[build_fuse=$enableval], [build_fuse=yes])
35+
36+
AM_CONDITIONAL([BUILD_RSHIM_FUSE], [test "x$build_fuse" = "xyes"])
37+
3238
case $host in
3339
*-linux*)
3440
AC_MSG_RESULT([Linux])
@@ -56,13 +62,14 @@ AS_IF([test "x$build_usb" = "xyes"], [
5662
AC_CHECK_FUNCS([libusb_get_port_numbers libusb_get_device_address])
5763
])
5864

59-
PKG_CHECK_MODULES(fuse, fuse, [], [AC_MSG_ERROR([Can't find fuse])])
60-
if test $backend = freebsd; then
61-
AC_SUBST(CPPFLAGS, "$CPPFLAGS -DHAVE_RSHIM_CUSE")
62-
AC_CHECK_LIB(cuse, cuse_dev_create)
63-
else
64-
AC_SUBST(CPPFLAGS, "$CPPFLAGS -DFUSE_USE_VERSION=30 -DHAVE_RSHIM_FUSE")
65+
AS_IF([test "x$build_usb" = "xyes"], [
66+
PKG_CHECK_MODULES(fuse, fuse, [], [AC_MSG_ERROR([Can't find fuse])])
67+
if test $backend = freebsd; then
68+
AC_CHECK_LIB(cuse, cuse_dev_create)
69+
else
70+
AC_SUBST(CPPFLAGS, "$CPPFLAGS -DFUSE_USE_VERSION=30")
6571
fi
72+
])
6673

6774
if test $backend = freebsd; then
6875
AC_CHECK_HEADERS([libepoll-shim/sys/epoll.h],[],[AC_MSG_ERROR([Missing libepoll-shim])])

src/Makefile.am

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,8 @@ bfrshim_LDFLAGS += $(libpci_LIBS)
2323
endif
2424

2525
# FUSE / CUSE
26+
if BUILD_RSHIM_FUSE
27+
bfrshim_SOURCES += rshim_fuse.c
2628
bfrshim_CPPFLAGS += $(fuse_CFLAGS)
2729
bfrshim_LDFLAGS += $(fuse_LIBS)
30+
endif

0 commit comments

Comments
 (0)