Skip to content

Commit

Permalink
Split fuse code into rshim_fuse.c
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
lsun100 committed Mar 12, 2020
1 parent 68c5160 commit b42d9a0
Show file tree
Hide file tree
Showing 8 changed files with 1,328 additions and 1,381 deletions.
52 changes: 0 additions & 52 deletions Makefile.freebsd

This file was deleted.

3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ internal rshim registers.
Require FreeBSD 12.0+ with packages autoconf, automake, gmake, libepoll-shim,
libpciaccess, libpci, pkgconf.

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

*) Usage

Expand Down
19 changes: 13 additions & 6 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ AC_ARG_ENABLE([pcie],

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

AC_ARG_ENABLE([fuse],
AS_HELP_STRING([--enable-fuse], [Enable fuse / cuse (default is yes) ]),
[build_fuse=$enableval], [build_fuse=yes])

AM_CONDITIONAL([BUILD_RSHIM_FUSE], [test "x$build_fuse" = "xyes"])

case $host in
*-linux*)
AC_MSG_RESULT([Linux])
Expand Down Expand Up @@ -56,13 +62,14 @@ AS_IF([test "x$build_usb" = "xyes"], [
AC_CHECK_FUNCS([libusb_get_port_numbers libusb_get_device_address])
])

PKG_CHECK_MODULES(fuse, fuse, [], [AC_MSG_ERROR([Can't find fuse])])
if test $backend = freebsd; then
AC_SUBST(CPPFLAGS, "$CPPFLAGS -DHAVE_RSHIM_CUSE")
AC_CHECK_LIB(cuse, cuse_dev_create)
else
AC_SUBST(CPPFLAGS, "$CPPFLAGS -DFUSE_USE_VERSION=30 -DHAVE_RSHIM_FUSE")
AS_IF([test "x$build_usb" = "xyes"], [
PKG_CHECK_MODULES(fuse, fuse, [], [AC_MSG_ERROR([Can't find fuse])])
if test $backend = freebsd; then
AC_CHECK_LIB(cuse, cuse_dev_create)
else
AC_SUBST(CPPFLAGS, "$CPPFLAGS -DFUSE_USE_VERSION=30")
fi
])

if test $backend = freebsd; then
AC_CHECK_HEADERS([libepoll-shim/sys/epoll.h],[],[AC_MSG_ERROR([Missing libepoll-shim])])
Expand Down
3 changes: 3 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@ bfrshim_LDFLAGS += $(libpci_LIBS)
endif

# FUSE / CUSE
if BUILD_RSHIM_FUSE
bfrshim_SOURCES += rshim_fuse.c
bfrshim_CPPFLAGS += $(fuse_CFLAGS)
bfrshim_LDFLAGS += $(fuse_LIBS)
endif
Loading

0 comments on commit b42d9a0

Please sign in to comment.