diff --git a/Makefile.in b/Makefile.in index 8b28ec0314ca..0f3e496541d9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -979,7 +979,7 @@ deb-modules: deb-local rpm-modules arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \ pkg1=$${name}-$${version}_$${release}.$${arch}.rpm; \ pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \ - fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2; \ + fakeroot $(ALIEN) --keep-version --scripts --to-deb $$pkg1 $$pkg2; \ $(RM) $$pkg1 $$pkg2 deb-utils: deb-local rpm-utils @@ -990,7 +990,7 @@ deb-utils: deb-local rpm-utils pkg2=$${name}-devel-$${version}.$${arch}.rpm; \ pkg3=$${name}-test-$${version}.$${arch}.rpm; \ pkg4=$${name}-dracut-$${version}.$${arch}.rpm; \ - fakeroot $(ALIEN) --scripts --to-deb $$pkg1 $$pkg2 $$pkg3 $$pkg4; \ + fakeroot $(ALIEN) --keep-version --scripts --to-deb $$pkg1 $$pkg2 $$pkg3 $$pkg4; \ $(RM) $$pkg1 $$pkg2 $$pkg3 $$pkg4 deb: deb-modules deb-utils @@ -1010,7 +1010,7 @@ tgz-modules: tgz-local rpm-modules arch=`$(RPM) -qp $${name}-$${version}.src.rpm --qf %{arch} | tail -1`; \ pkg1=$${name}-$${version}_$${release}.$${arch}.rpm; \ pkg2=$${name}-devel-$${version}_$${release}.$${arch}.rpm; \ - fakeroot $(ALIEN) --scripts --to-tgz $$pkg1 $$pkg2; \ + fakeroot $(ALIEN) --keep-version --scripts --to-tgz $$pkg1 $$pkg2; \ $(RM) $$pkg1 $$pkg2 tgz-utils: tgz-local rpm-utils @@ -1020,7 +1020,7 @@ tgz-utils: tgz-local rpm-utils pkg1=$${name}-$${version}.$${arch}.rpm; \ pkg2=$${name}-devel-$${version}.$${arch}.rpm; \ pkg3=$${name}-test-$${version}.$${arch}.rpm; \ - fakeroot $(ALIEN) --scripts --to-tgz $$pkg1 $$pkg2 $$pkg3; \ + fakeroot $(ALIEN) --keep-version --scripts --to-tgz $$pkg1 $$pkg2 $$pkg3; \ $(RM) $$pkg1 $$pkg2 $$pkg3 tgz: tgz-modules tgz-utils diff --git a/cmd/zvol_id/Makefile.in b/cmd/zvol_id/Makefile.in index 83fc24f71b52..c3256b36f6c4 100644 --- a/cmd/zvol_id/Makefile.in +++ b/cmd/zvol_id/Makefile.in @@ -106,11 +106,11 @@ depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) + $(CPPFLAGS) $(AM_CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) + $(AM_CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; @@ -119,7 +119,7 @@ am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) @@ -433,20 +433,20 @@ distclean-compile: @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< zvol_id_main.o: $(top_srcdir)/cmd/zvol_id/zvol_id_main.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT zvol_id_main.o -MD -MP -MF $(DEPDIR)/zvol_id_main.Tpo -c -o zvol_id_main.o `test -f '$(top_srcdir)/cmd/zvol_id/zvol_id_main.c' || echo '$(srcdir)/'`$(top_srcdir)/cmd/zvol_id/zvol_id_main.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) -MT zvol_id_main.o -MD -MP -MF $(DEPDIR)/zvol_id_main.Tpo -c -o zvol_id_main.o `test -f '$(top_srcdir)/cmd/zvol_id/zvol_id_main.c' || echo '$(srcdir)/'`$(top_srcdir)/cmd/zvol_id/zvol_id_main.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zvol_id_main.Tpo $(DEPDIR)/zvol_id_main.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/cmd/zvol_id/zvol_id_main.c' object='zvol_id_main.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o zvol_id_main.o `test -f '$(top_srcdir)/cmd/zvol_id/zvol_id_main.c' || echo '$(srcdir)/'`$(top_srcdir)/cmd/zvol_id/zvol_id_main.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) -c -o zvol_id_main.o `test -f '$(top_srcdir)/cmd/zvol_id/zvol_id_main.c' || echo '$(srcdir)/'`$(top_srcdir)/cmd/zvol_id/zvol_id_main.c zvol_id_main.obj: $(top_srcdir)/cmd/zvol_id/zvol_id_main.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT zvol_id_main.obj -MD -MP -MF $(DEPDIR)/zvol_id_main.Tpo -c -o zvol_id_main.obj `if test -f '$(top_srcdir)/cmd/zvol_id/zvol_id_main.c'; then $(CYGPATH_W) '$(top_srcdir)/cmd/zvol_id/zvol_id_main.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/cmd/zvol_id/zvol_id_main.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) -MT zvol_id_main.obj -MD -MP -MF $(DEPDIR)/zvol_id_main.Tpo -c -o zvol_id_main.obj `if test -f '$(top_srcdir)/cmd/zvol_id/zvol_id_main.c'; then $(CYGPATH_W) '$(top_srcdir)/cmd/zvol_id/zvol_id_main.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/cmd/zvol_id/zvol_id_main.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zvol_id_main.Tpo $(DEPDIR)/zvol_id_main.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/cmd/zvol_id/zvol_id_main.c' object='zvol_id_main.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o zvol_id_main.obj `if test -f '$(top_srcdir)/cmd/zvol_id/zvol_id_main.c'; then $(CYGPATH_W) '$(top_srcdir)/cmd/zvol_id/zvol_id_main.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/cmd/zvol_id/zvol_id_main.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) -c -o zvol_id_main.obj `if test -f '$(top_srcdir)/cmd/zvol_id/zvol_id_main.c'; then $(CYGPATH_W) '$(top_srcdir)/cmd/zvol_id/zvol_id_main.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/cmd/zvol_id/zvol_id_main.c'; fi` mostlyclean-libtool: -rm -f *.lo diff --git a/config/kernel.m4 b/config/kernel.m4 index 10a2cdbcff18..2739d3bf869b 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -35,16 +35,12 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [ ZFS_AC_KERNEL_SHOW_OPTIONS ZFS_AC_KERNEL_FSYNC ZFS_AC_KERNEL_EVICT_INODE - ZFS_AC_KERNEL_NR_CACHED_OBJECTS - ZFS_AC_KERNEL_FREE_CACHED_OBJECTS ZFS_AC_KERNEL_INSERT_INODE_LOCKED ZFS_AC_KERNEL_D_OBTAIN_ALIAS ZFS_AC_KERNEL_CHECK_DISK_SIZE_CHANGE ZFS_AC_KERNEL_TRUNCATE_SETSIZE ZFS_AC_KERNEL_6ARGS_SECURITY_INODE_INIT_SECURITY - ZFS_AC_KERNEL_CALLBACK_SECURITY_INODE_INIT_SECURITY ZFS_AC_KERNEL_MOUNT_NODEV - ZFS_AC_KERNEL_SHRINK ZFS_AC_KERNEL_BDI ZFS_AC_KERNEL_BDI_SETUP_AND_REGISTER ZFS_AC_KERNEL_SET_NLINK diff --git a/configure b/configure index e5004b57ace2..d66b6b6cf815 100755 --- a/configure +++ b/configure @@ -813,6 +813,10 @@ LINUX NO_UNUSED_BUT_SET_VARIABLE ZFS_CONFIG TARGET_ASM_DIR +DEFAULT_INIT_SCRIPT +DEFAULT_INIT_DIR +DEFAULT_PACKAGE +VENDOR MAKEPKG_VERSION MAKEPKG HAVE_MAKEPKG @@ -834,10 +838,6 @@ HAVE_RPMBUILD RPM_VERSION RPM HAVE_RPM -DEFAULT_INIT_SCRIPT -DEFAULT_INIT_DIR -DEFAULT_PACKAGE -VENDOR am__fastdepCCAS_FALSE am__fastdepCCAS_TRUE CCASDEPMODE @@ -11671,83 +11671,6 @@ $as_echo "$ZFS_META_LICENSE" >&6; } - { $as_echo "$as_me:$LINENO: checking linux distribution" >&5 -$as_echo_n "checking linux distribution... " >&6; } - if test -f /etc/redhat-release ; then - VENDOR=redhat ; - elif test -f /etc/fedora-release ; then - VENDOR=fedora ; - elif test -f /etc/gentoo-release ; then - VENDOR=gentoo ; - elif test -f /etc/debian_version ; then - VENDOR=debian ; - elif test -f /etc/SuSE-release ; then - VENDOR=sles ; - elif test -f /etc/slackware-version ; then - VENDOR=slackware ; - elif test -f /etc/arch-release ; then - VENDOR=arch ; - elif test -f /etc/lsb-release ; then - VENDOR=ubuntu ; - elif test -f /etc/lunar.release ; then - VENDOR=lunar ; - else - VENDOR= ; - fi - { $as_echo "$as_me:$LINENO: result: $VENDOR" >&5 -$as_echo "$VENDOR" >&6; } - - - { $as_echo "$as_me:$LINENO: checking default package type" >&5 -$as_echo_n "checking default package type... " >&6; } - case "$VENDOR" in - redhat) DEFAULT_PACKAGE=rpm ;; - fedora) DEFAULT_PACKAGE=rpm ;; - ubuntu) DEFAULT_PACKAGE=deb ;; - debian) DEFAULT_PACKAGE=deb ;; - sles) DEFAULT_PACKAGE=rpm ;; - slackware) DEFAULT_PACKAGE=tgz ;; - gentoo) DEFAULT_PACKAGE=tgz ;; - lunar) DEFAULT_PACKAGE=tgz ;; - arch) DEFAULT_PACKAGE=arch;; - *) DEFAULT_PACKAGE=rpm ;; - esac - - { $as_echo "$as_me:$LINENO: result: $DEFAULT_PACKAGE" >&5 -$as_echo "$DEFAULT_PACKAGE" >&6; } - - - { $as_echo "$as_me:$LINENO: checking default init directory" >&5 -$as_echo_n "checking default init directory... " >&6; } - case "$VENDOR" in - arch) DEFAULT_INIT_DIR=$sysconfdir/rc.d ;; - *) DEFAULT_INIT_DIR=$sysconfdir/init.d ;; - esac - - { $as_echo "$as_me:$LINENO: result: $DEFAULT_INIT_DIR" >&5 -$as_echo "$DEFAULT_INIT_DIR" >&6; } - - - { $as_echo "$as_me:$LINENO: checking default init script type" >&5 -$as_echo_n "checking default init script type... " >&6; } - case "$VENDOR" in - redhat) DEFAULT_INIT_SCRIPT=redhat ;; - fedora) DEFAULT_INIT_SCRIPT=fedora ;; - ubuntu) DEFAULT_INIT_SCRIPT=lsb ;; - debian) DEFAULT_INIT_SCRIPT=lsb ;; - sles) DEFAULT_INIT_SCRIPT=lsb ;; - slackware) DEFAULT_INIT_SCRIPT=lsb ;; - gentoo) DEFAULT_INIT_SCRIPT=gentoo ;; - lunar) DEFAULT_INIT_SCRIPT=lunar ;; - arch) DEFAULT_INIT_SCRIPT=arch ;; - *) DEFAULT_INIT_SCRIPT=lsb ;; - esac - - { $as_echo "$as_me:$LINENO: result: $DEFAULT_INIT_SCRIPT" >&5 -$as_echo "$DEFAULT_INIT_SCRIPT" >&6; } - - - RPM=rpm RPMBUILD=rpmbuild @@ -11870,8 +11793,6 @@ fi - if test "$VENDOR" = "arch"; then - PACMAN=pacman MAKEPKG=makepkg @@ -11923,7 +11844,82 @@ fi -fi + + { $as_echo "$as_me:$LINENO: checking linux distribution" >&5 +$as_echo_n "checking linux distribution... " >&6; } + if test -f /etc/redhat-release ; then + VENDOR=redhat ; + elif test -f /etc/fedora-release ; then + VENDOR=fedora ; + elif test -f /etc/gentoo-release ; then + VENDOR=gentoo ; + elif test -f /etc/debian_version ; then + VENDOR=debian ; + elif test -f /etc/SuSE-release ; then + VENDOR=sles ; + elif test -f /etc/slackware-version ; then + VENDOR=slackware ; + elif test -f /etc/arch-release ; then + VENDOR=arch ; + elif test -f /etc/lsb-release ; then + VENDOR=ubuntu ; + elif test -f /etc/lunar.release ; then + VENDOR=lunar ; + else + VENDOR= ; + fi + { $as_echo "$as_me:$LINENO: result: $VENDOR" >&5 +$as_echo "$VENDOR" >&6; } + + + { $as_echo "$as_me:$LINENO: checking default package type" >&5 +$as_echo_n "checking default package type... " >&6; } + case "$VENDOR" in + redhat) DEFAULT_PACKAGE=rpm ;; + fedora) DEFAULT_PACKAGE=rpm ;; + ubuntu) DEFAULT_PACKAGE=deb ;; + debian) DEFAULT_PACKAGE=deb ;; + sles) DEFAULT_PACKAGE=rpm ;; + slackware) DEFAULT_PACKAGE=tgz ;; + gentoo) DEFAULT_PACKAGE=tgz ;; + lunar) DEFAULT_PACKAGE=tgz ;; + arch) DEFAULT_PACKAGE=arch;; + *) DEFAULT_PACKAGE=rpm ;; + esac + + { $as_echo "$as_me:$LINENO: result: $DEFAULT_PACKAGE" >&5 +$as_echo "$DEFAULT_PACKAGE" >&6; } + + + { $as_echo "$as_me:$LINENO: checking default init directory" >&5 +$as_echo_n "checking default init directory... " >&6; } + case "$VENDOR" in + arch) DEFAULT_INIT_DIR=$sysconfdir/rc.d ;; + *) DEFAULT_INIT_DIR=$sysconfdir/init.d ;; + esac + + { $as_echo "$as_me:$LINENO: result: $DEFAULT_INIT_DIR" >&5 +$as_echo "$DEFAULT_INIT_DIR" >&6; } + + + { $as_echo "$as_me:$LINENO: checking default init script type" >&5 +$as_echo_n "checking default init script type... " >&6; } + case "$VENDOR" in + redhat) DEFAULT_INIT_SCRIPT=redhat ;; + fedora) DEFAULT_INIT_SCRIPT=fedora ;; + ubuntu) DEFAULT_INIT_SCRIPT=lsb ;; + debian) DEFAULT_INIT_SCRIPT=lsb ;; + sles) DEFAULT_INIT_SCRIPT=lsb ;; + slackware) DEFAULT_INIT_SCRIPT=lsb ;; + gentoo) DEFAULT_INIT_SCRIPT=gentoo ;; + lunar) DEFAULT_INIT_SCRIPT=lunar ;; + arch) DEFAULT_INIT_SCRIPT=arch ;; + *) DEFAULT_INIT_SCRIPT=lsb ;; + esac + + { $as_echo "$as_me:$LINENO: result: $DEFAULT_INIT_SCRIPT" >&5 +$as_echo "$DEFAULT_INIT_SCRIPT" >&6; } + @@ -14847,226 +14843,88 @@ fi - { $as_echo "$as_me:$LINENO: checking whether sops->nr_cached_objects() exists" >&5 -$as_echo_n "checking whether sops->nr_cached_objects() exists... " >&6; } + { $as_echo "$as_me:$LINENO: checking whether symbol insert_inode_locked is exported" >&5 +$as_echo_n "checking whether symbol insert_inode_locked is exported... " >&6; } + grep -q -E '[[:space:]]insert_inode_locked[[:space:]]' \ + $LINUX_OBJ/$LINUX_SYMBOLS 2>/dev/null + rc=$? + if test $rc -ne 0; then + export=0 + for file in fs/inode.c; do + grep -q -E "EXPORT_SYMBOL.*(insert_inode_locked)" "$LINUX/$file" 2>/dev/null + rc=$? + if test $rc -eq 0; then -cat confdefs.h - <<_ACEOF >conftest.c -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ + export=1 + break; +fi - #include + done + if test $export -eq 0; then -int -main (void) -{ + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } - int (*nr_cached_objects)(struct super_block *) - __attribute__ ((unused)) = NULL; - struct super_operations sops __attribute__ ((unused)) = { - .nr_cached_objects = nr_cached_objects, - }; - ; - return 0; -} +else + + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } +cat >>confdefs.h <<\_ACEOF +#define HAVE_INSERT_INODE_LOCKED 1 _ACEOF - rm -Rf build && mkdir -p build - echo "obj-m := conftest.o" >build/Makefile - if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then +fi + + +else { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } cat >>confdefs.h <<\_ACEOF -#define HAVE_NR_CACHED_OBJECTS 1 +#define HAVE_INSERT_INODE_LOCKED 1 _ACEOF -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +fi - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } -fi + { $as_echo "$as_me:$LINENO: checking whether symbol d_obtain_alias is exported" >&5 +$as_echo_n "checking whether symbol d_obtain_alias is exported... " >&6; } + grep -q -E '[[:space:]]d_obtain_alias[[:space:]]' \ + $LINUX_OBJ/$LINUX_SYMBOLS 2>/dev/null + rc=$? + if test $rc -ne 0; then - rm -Rf build + export=0 + for file in fs/dcache.c; do + grep -q -E "EXPORT_SYMBOL.*(d_obtain_alias)" "$LINUX/$file" 2>/dev/null + rc=$? + if test $rc -eq 0; then + export=1 + break; +fi + done + if test $export -eq 0; then - { $as_echo "$as_me:$LINENO: checking whether sops->free_cached_objects() exists" >&5 -$as_echo_n "checking whether sops->free_cached_objects() exists... " >&6; } + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } -cat confdefs.h - <<_ACEOF >conftest.c -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ +else - - #include - -int -main (void) -{ - - void (*free_cached_objects)(struct super_block *, int) - __attribute__ ((unused)) = NULL; - struct super_operations sops __attribute__ ((unused)) = { - .free_cached_objects = free_cached_objects, - }; - - ; - return 0; -} - -_ACEOF - - - rm -Rf build && mkdir -p build - echo "obj-m := conftest.o" >build/Makefile - if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<\_ACEOF -#define HAVE_FREE_CACHED_OBJECTS 1 -_ACEOF - - -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } - - - -fi - - rm -Rf build - - - - - { $as_echo "$as_me:$LINENO: checking whether symbol insert_inode_locked is exported" >&5 -$as_echo_n "checking whether symbol insert_inode_locked is exported... " >&6; } - grep -q -E '[[:space:]]insert_inode_locked[[:space:]]' \ - $LINUX_OBJ/$LINUX_SYMBOLS 2>/dev/null - rc=$? - if test $rc -ne 0; then - - export=0 - for file in fs/inode.c; do - grep -q -E "EXPORT_SYMBOL.*(insert_inode_locked)" "$LINUX/$file" 2>/dev/null - rc=$? - if test $rc -eq 0; then - - export=1 - break; - -fi - - done - if test $export -eq 0; then - - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } - - -else - - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<\_ACEOF -#define HAVE_INSERT_INODE_LOCKED 1 -_ACEOF - - -fi - - -else - - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<\_ACEOF -#define HAVE_INSERT_INODE_LOCKED 1 -_ACEOF - - -fi - - - - - { $as_echo "$as_me:$LINENO: checking whether symbol d_obtain_alias is exported" >&5 -$as_echo_n "checking whether symbol d_obtain_alias is exported... " >&6; } - grep -q -E '[[:space:]]d_obtain_alias[[:space:]]' \ - $LINUX_OBJ/$LINUX_SYMBOLS 2>/dev/null - rc=$? - if test $rc -ne 0; then - - export=0 - for file in fs/dcache.c; do - grep -q -E "EXPORT_SYMBOL.*(d_obtain_alias)" "$LINUX/$file" 2>/dev/null - rc=$? - if test $rc -eq 0; then - - export=1 - break; - -fi - - done - if test $export -eq 0; then - - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } - - -else - - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } cat >>confdefs.h <<\_ACEOF #define HAVE_D_OBTAIN_ALIAS 1 @@ -15217,14 +15075,7 @@ int main (void) { - struct inode *ip __attribute__ ((unused)) = NULL; - struct inode *dip __attribute__ ((unused)) = NULL; - const struct qstr *str __attribute__ ((unused)) = NULL; - char *name __attribute__ ((unused)) = NULL; - void *value __attribute__ ((unused)) = NULL; - size_t len __attribute__ ((unused)) = 0; - - security_inode_init_security(ip, dip, str, &name, &value, &len); + security_inode_init_security(NULL,NULL,NULL,NULL,NULL,NULL); ; return 0; @@ -15264,79 +15115,6 @@ $as_echo "no" >&6; } -fi - - rm -Rf build - - - EXTRA_KCFLAGS="$tmp_flags" - - - { $as_echo "$as_me:$LINENO: checking whether security_inode_init_security wants callback" >&5 -$as_echo_n "checking whether security_inode_init_security wants callback... " >&6; } - tmp_flags="$EXTRA_KCFLAGS" - EXTRA_KCFLAGS="-Werror" - - -cat confdefs.h - <<_ACEOF >conftest.c -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - - - #include - -int -main (void) -{ - - struct inode *ip __attribute__ ((unused)) = NULL; - struct inode *dip __attribute__ ((unused)) = NULL; - const struct qstr *str __attribute__ ((unused)) = NULL; - initxattrs func __attribute__ ((unused)) = NULL; - - security_inode_init_security(ip, dip, str, func, NULL); - - ; - return 0; -} - -_ACEOF - - - rm -Rf build && mkdir -p build - echo "obj-m := conftest.o" >build/Makefile - if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<\_ACEOF -#define HAVE_CALLBACK_SECURITY_INODE_INIT_SECURITY 1 -_ACEOF - - -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } - - - fi rm -Rf build @@ -15393,79 +15171,7 @@ cat >>confdefs.h <<\_ACEOF _ACEOF -fi - - - - - { $as_echo "$as_me:$LINENO: checking whether super_block has s_shrink" >&5 -$as_echo_n "checking whether super_block has s_shrink... " >&6; } - - -cat confdefs.h - <<_ACEOF >conftest.c -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - - - #include - -int -main (void) -{ - - int (*shrink)(struct shrinker *, struct shrink_control *sc) - __attribute__ ((unused)) = NULL; - struct super_block sb __attribute__ ((unused)) = { - .s_shrink.shrink = shrink, - .s_shrink.seeks = DEFAULT_SEEKS, - .s_shrink.batch = 0, - }; - - ; - return 0; -} - -_ACEOF - - - rm -Rf build && mkdir -p build - echo "obj-m := conftest.o" >build/Makefile - if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<\_ACEOF -#define HAVE_SHRINK 1 -_ACEOF - - - -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } - - - -fi - - rm -Rf build +fi @@ -20043,144 +19749,6 @@ fi - { $as_echo "$as_me:$LINENO: checking whether sops->nr_cached_objects() exists" >&5 -$as_echo_n "checking whether sops->nr_cached_objects() exists... " >&6; } - - -cat confdefs.h - <<_ACEOF >conftest.c -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - - - #include - -int -main (void) -{ - - int (*nr_cached_objects)(struct super_block *) - __attribute__ ((unused)) = NULL; - struct super_operations sops __attribute__ ((unused)) = { - .nr_cached_objects = nr_cached_objects, - }; - - ; - return 0; -} - -_ACEOF - - - rm -Rf build && mkdir -p build - echo "obj-m := conftest.o" >build/Makefile - if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<\_ACEOF -#define HAVE_NR_CACHED_OBJECTS 1 -_ACEOF - - -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } - - - -fi - - rm -Rf build - - - - - { $as_echo "$as_me:$LINENO: checking whether sops->free_cached_objects() exists" >&5 -$as_echo_n "checking whether sops->free_cached_objects() exists... " >&6; } - - -cat confdefs.h - <<_ACEOF >conftest.c -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - - - #include - -int -main (void) -{ - - void (*free_cached_objects)(struct super_block *, int) - __attribute__ ((unused)) = NULL; - struct super_operations sops __attribute__ ((unused)) = { - .free_cached_objects = free_cached_objects, - }; - - ; - return 0; -} - -_ACEOF - - - rm -Rf build && mkdir -p build - echo "obj-m := conftest.o" >build/Makefile - if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<\_ACEOF -#define HAVE_FREE_CACHED_OBJECTS 1 -_ACEOF - - -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } - - - -fi - - rm -Rf build - - - - { $as_echo "$as_me:$LINENO: checking whether symbol insert_inode_locked is exported" >&5 $as_echo_n "checking whether symbol insert_inode_locked is exported... " >&6; } grep -q -E '[[:space:]]insert_inode_locked[[:space:]]' \ @@ -20413,14 +19981,7 @@ int main (void) { - struct inode *ip __attribute__ ((unused)) = NULL; - struct inode *dip __attribute__ ((unused)) = NULL; - const struct qstr *str __attribute__ ((unused)) = NULL; - char *name __attribute__ ((unused)) = NULL; - void *value __attribute__ ((unused)) = NULL; - size_t len __attribute__ ((unused)) = 0; - - security_inode_init_security(ip, dip, str, &name, &value, &len); + security_inode_init_security(NULL,NULL,NULL,NULL,NULL,NULL); ; return 0; @@ -20460,79 +20021,6 @@ $as_echo "no" >&6; } -fi - - rm -Rf build - - - EXTRA_KCFLAGS="$tmp_flags" - - - { $as_echo "$as_me:$LINENO: checking whether security_inode_init_security wants callback" >&5 -$as_echo_n "checking whether security_inode_init_security wants callback... " >&6; } - tmp_flags="$EXTRA_KCFLAGS" - EXTRA_KCFLAGS="-Werror" - - -cat confdefs.h - <<_ACEOF >conftest.c -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - - - #include - -int -main (void) -{ - - struct inode *ip __attribute__ ((unused)) = NULL; - struct inode *dip __attribute__ ((unused)) = NULL; - const struct qstr *str __attribute__ ((unused)) = NULL; - initxattrs func __attribute__ ((unused)) = NULL; - - security_inode_init_security(ip, dip, str, func, NULL); - - ; - return 0; -} - -_ACEOF - - - rm -Rf build && mkdir -p build - echo "obj-m := conftest.o" >build/Makefile - if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<\_ACEOF -#define HAVE_CALLBACK_SECURITY_INODE_INIT_SECURITY 1 -_ACEOF - - -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } - - - fi rm -Rf build @@ -20594,78 +20082,6 @@ fi - { $as_echo "$as_me:$LINENO: checking whether super_block has s_shrink" >&5 -$as_echo_n "checking whether super_block has s_shrink... " >&6; } - - -cat confdefs.h - <<_ACEOF >conftest.c -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - - - #include - -int -main (void) -{ - - int (*shrink)(struct shrinker *, struct shrink_control *sc) - __attribute__ ((unused)) = NULL; - struct super_block sb __attribute__ ((unused)) = { - .s_shrink.shrink = shrink, - .s_shrink.seeks = DEFAULT_SEEKS, - .s_shrink.batch = 0, - }; - - ; - return 0; -} - -_ACEOF - - - rm -Rf build && mkdir -p build - echo "obj-m := conftest.o" >build/Makefile - if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<\_ACEOF -#define HAVE_SHRINK 1 -_ACEOF - - - -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } - - - -fi - - rm -Rf build - - - - { $as_echo "$as_me:$LINENO: checking whether super_block has s_bdi" >&5 $as_echo_n "checking whether super_block has s_bdi... " >&6; } diff --git a/lib/libshare/Makefile.am b/lib/libshare/Makefile.am index 1439b33ac804..1e60fc5d56ff 100644 --- a/lib/libshare/Makefile.am +++ b/lib/libshare/Makefile.am @@ -8,6 +8,10 @@ noinst_LTLIBRARIES = libshare.la libshare_la_SOURCES = \ $(top_srcdir)/lib/libshare/libshare.c \ - $(top_srcdir)/lib/libshare/nfs.c \ $(top_srcdir)/lib/libshare/libshare_impl.h \ - $(top_srcdir)/lib/libshare/nfs.h + $(top_srcdir)/lib/libshare/nfs.c \ + $(top_srcdir)/lib/libshare/nfs.h \ + $(top_srcdir)/lib/libshare/smb.c \ + $(top_srcdir)/lib/libshare/smb.h + +libshare_la_LDFLAGS = -version-info 1:0:0 diff --git a/lib/libshare/Makefile.in b/lib/libshare/Makefile.in index 665f0596eca3..fea9d08b6970 100644 --- a/lib/libshare/Makefile.in +++ b/lib/libshare/Makefile.in @@ -95,7 +95,7 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libshare_la_LIBADD = -am_libshare_la_OBJECTS = libshare.lo nfs.lo +am_libshare_la_OBJECTS = libshare.lo nfs.lo smb.lo libshare_la_OBJECTS = $(am_libshare_la_OBJECTS) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) @@ -317,9 +317,13 @@ AM_CFLAGS = -Wall -Wstrict-prototypes -fno-strict-aliasing \ noinst_LTLIBRARIES = libshare.la libshare_la_SOURCES = \ $(top_srcdir)/lib/libshare/libshare.c \ - $(top_srcdir)/lib/libshare/nfs.c \ $(top_srcdir)/lib/libshare/libshare_impl.h \ - $(top_srcdir)/lib/libshare/nfs.h + $(top_srcdir)/lib/libshare/nfs.c \ + $(top_srcdir)/lib/libshare/nfs.h \ + $(top_srcdir)/lib/libshare/smb.c \ + $(top_srcdir)/lib/libshare/smb.h + +libshare_la_LDFLAGS = -version-info 1:0:0 all: all-am @@ -375,6 +379,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libshare.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nfs.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smb.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -416,6 +421,15 @@ nfs.lo: $(top_srcdir)/lib/libshare/nfs.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nfs.lo `test -f '$(top_srcdir)/lib/libshare/nfs.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libshare/nfs.c +smb.lo: $(top_srcdir)/lib/libshare/smb.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT smb.lo -MD -MP -MF $(DEPDIR)/smb.Tpo -c -o smb.lo `test -f '$(top_srcdir)/lib/libshare/smb.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libshare/smb.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/smb.Tpo $(DEPDIR)/smb.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/libshare/smb.c' object='smb.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o smb.lo `test -f '$(top_srcdir)/lib/libshare/smb.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/libshare/smb.c + + mostlyclean-libtool: -rm -f *.lo diff --git a/lib/libshare/README_smb.txt b/lib/libshare/README_smb.txt new file mode 100644 index 000000000000..ee9eb984c0c5 --- /dev/null +++ b/lib/libshare/README_smb.txt @@ -0,0 +1,42 @@ +This is basic information about the 'sharesmb' option in ZFS +On Linux by Turbo Fredriksson . + +REQUIRENMENTS +============================================================ +1. Samba (doh! :) + * I'm using version 3.3.3, but any 3.x should + probably work. Please update the tracker with + info.. + +2. Samba will need to listen to 'localhost' (127.0.0.1), + because that is hardcoded into the zfs module/libraries. + +3. Some configuration settings in samba: + + usershare max shares = 100 + usershare owner only = False + + First one is not strictly necessary if you don't have more than + 100 volumes you'd like to share. + + Second one is if you want to allow non-root users to share + volumes they do NOT own. For a non-user to be able to share + a volume, he/she will have to have write access to the /dev/zfs + device node. + +4. A ZFS filesystem or more to export. + + +TESTING +============================================================ +Once configuration in samba have been done, test that this +works with the following commands (in this case, my ZFS +filesystem is called 'share/Test1'): + + net -U root -S 127.0.0.1 usershare add Test1 /share/Test1 "Comment: /share/Test1" "Everyone:F" + net usershare list | grep -i test + net -U root -S 127.0.0.1 usershare delete Test1 + +The first command will create a user share that gives +everyone full access. To limit the access below that, +use normal UNIX commands (chmod, chown etc). diff --git a/lib/libshare/libshare.c b/lib/libshare/libshare.c index c34e83919402..77aa8e917a4f 100644 --- a/lib/libshare/libshare.c +++ b/lib/libshare/libshare.c @@ -36,6 +36,15 @@ #include #include "libshare_impl.h" #include "nfs.h" +#include "smb.h" + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif static sa_share_impl_t find_share(sa_handle_impl_t handle, const char *sharepath); @@ -55,6 +64,15 @@ static int update_zfs_shares(sa_handle_impl_t impl_handle, const char *proto); static int fstypes_count; static sa_fstype_t *fstypes; +boolean_t +file_is_executable(char *file_name) +{ + if ((access(file_name, X_OK)) == 0) + /* File found */ + return TRUE; + return FALSE; +} + sa_fstype_t * register_fstype(const char *name, const sa_share_ops_t *ops) { @@ -103,6 +121,7 @@ __attribute__((constructor)) static void libshare_init(void) { libshare_nfs_init(); + libshare_smb_init(); /* * This bit causes /etc/dfs/sharetab to be updated before libzfs gets a diff --git a/lib/libshare/libshare_impl.h b/lib/libshare/libshare_impl.h index dfcec2ff9775..3f7413115341 100644 --- a/lib/libshare/libshare_impl.h +++ b/lib/libshare/libshare_impl.h @@ -68,3 +68,4 @@ typedef struct sa_handle_impl { } *sa_handle_impl_t; sa_fstype_t *register_fstype(const char *name, const sa_share_ops_t *ops); +boolean_t file_is_executable(char *); diff --git a/lib/libshare/smb.c b/lib/libshare/smb.c new file mode 100644 index 000000000000..2fe7bffdf17e --- /dev/null +++ b/lib/libshare/smb.c @@ -0,0 +1,467 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 Turbo Fredriksson + * + * This is an addition to the zfs device driver to add, modify and remove SMB + * shares using the 'net share' command that comes with Samba. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "libshare_impl.h" +#include "smb.h" + +/* The maximum SMB share name seems to be 254 characters, though good references are hard to find. */ +#define SMB_NAME_MAX 255 + +typedef struct smb_share_s { + char name[SMB_NAME_MAX]; /* Share name */ + char path[PATH_MAX]; /* Share path */ + char comment[255]; /* Share's comment */ + boolean_t guest_ok; /* 'y' or 'n' */ + + struct smb_share_s *next; +} smb_share_t; + +static sa_fstype_t *smb_fstype; +boolean_t smb_available; +smb_share_t *smb_shares; + +#define SHARE_DIR "/var/lib/samba/usershares" +#define NET_CMD_PATH "/usr/bin/net" + +int smb_retrieve_shares(void); + +int +smb_enable_share_one(const char *sharename, const char *sharepath) +{ + char *argv[10]; + char name[SMB_NAME_MAX], comment[SMB_NAME_MAX]; + int rc; + +#ifdef DEBUG + fprintf(stderr, " smb_enable_share_one(%s, %s)\n", + sharename, sharepath); +#endif + + /* Support ZFS share name regexp '[[:alnum:]_-.: ]' */ + strncpy(name, sharename, sizeof(name)); + name [sizeof(name)-1] = '\0'; + + char *pos = name; + if( pos == NULL ) + return SA_SYSTEM_ERR; + + while( *pos != '\0' ) { + switch( *pos ) { + case '/': + case '-': + case ':': + case ' ': + *pos = '_'; + } + ++pos; + } + + /* CMD: net -S 127.0.0.1 usershare add Test1 /share/Test1 "Comment" "Everyone:F" */ + snprintf(comment, sizeof (comment), "Comment: %s", sharepath); + + if (!file_is_executable(NET_CMD_PATH)) { + fprintf(stderr, "ERROR: %s: Does not exists or is not executable.\n", NET_CMD_PATH); + return SA_SYSTEM_ERR; + } + argv[0] = NET_CMD_PATH; + argv[1] = "-S"; + argv[2] = "127.0.0.1"; + argv[3] = "usershare"; + argv[4] = "add"; + argv[5] = name; + argv[6] = sharepath; + argv[7] = comment; + argv[8] = "Everyone:F"; + argv[9] = NULL; + +#ifdef DEBUG + int i; + fprintf(stderr, " CMD: "); + for (i=0; argv[i] != NULL; i++) { + fprintf(stderr, "%s ", argv[i]); + } + fprintf(stderr, "\n"); +#endif + + rc = libzfs_run_process(argv[0], argv, 0); + if (rc < 0) + return SA_SYSTEM_ERR; + + /* Reload the share file */ + smb_retrieve_shares(); + + return 0; +} + +int +smb_enable_share(sa_share_impl_t impl_share) +{ + char *shareopts; + +#ifdef DEBUG + fprintf(stderr, "smb_enable_share(): dataset=%s, path=%s\n", + impl_share->dataset, impl_share->sharepath); +#endif + + if (!smb_available) { +#ifdef DEBUG + fprintf(stderr, " smb_enable_share(): -> !smb_available\n"); +#endif + return SA_SYSTEM_ERR; + } + + shareopts = FSINFO(impl_share, smb_fstype)->shareopts; + if (shareopts == NULL) { /* on/off */ +#ifdef DEBUG + fprintf(stderr, " smb_enable_share(): -> SA_SYSTEM_ERR\n"); +#endif + return SA_SYSTEM_ERR; + } + + if (strcmp(shareopts, "off") == 0) { +#ifdef DEBUG + fprintf(stderr, " smb_enable_share(): -> off (0)\n"); +#endif + return (0); + } + + /* Magic: Enable (i.e., 'create new') share */ + return smb_enable_share_one(impl_share->dataset, + impl_share->sharepath); +} + +int +smb_disable_share_one(const char *sharename) +{ + int rc = SA_OK; + char *argv[6]; + +#ifdef DEBUG + fprintf(stderr, " smb_disable_share_one()\n"); +#endif + + /* CMD: net -S 127.0.0.1 usershare delete Test1 */ + if (!file_is_executable(NET_CMD_PATH)) { + fprintf(stderr, "ERROR: %s: Does not exists or is not executable.\n", NET_CMD_PATH); + return SA_SYSTEM_ERR; + } + argv[0] = NET_CMD_PATH; + argv[1] = "usershare"; + argv[2] = "delete"; + argv[3] = strdup(sharename); + argv[4] = NULL; + +#ifdef DEBUG + int i; + fprintf(stderr, " CMD: "); + for (i=0; argv[i] != NULL; i++) { + fprintf(stderr, "%s ", argv[i]); + } + fprintf(stderr, "\n"); +#endif + + rc = libzfs_run_process(argv[0], argv, 0); + if (rc < 0) + return SA_SYSTEM_ERR; + + return rc; +} + +int +smb_disable_share(sa_share_impl_t impl_share) +{ + smb_share_t *shares = smb_shares; + +#ifdef DEBUG + fprintf(stderr, " smb_disable_share(): dataset=%s, path=%s\n", + impl_share->dataset, impl_share->sharepath); +#endif + + while (shares != NULL) { + if (strcmp(impl_share->sharepath, shares->path) == 0) + return smb_disable_share_one(shares->name); + + shares = shares->next; + } + + /* Reload the share file */ + smb_retrieve_shares(); + + return 0; +} + +static boolean_t +smb_is_share_active(sa_share_impl_t impl_share) +{ + smb_share_t *shares = smb_shares; + +#ifdef DEBUG + fprintf(stderr, " smb_is_share_active(): dataset=%s, path=%s\n", + impl_share->dataset, impl_share->sharepath); +#endif + + while (shares != NULL) { + if (strcmp(impl_share->sharepath, shares->path) == 0) + return B_TRUE; + + shares = shares->next; + } + + return B_FALSE; +} + +static int +smb_validate_shareopts(const char *shareopts) +{ + /* TODO: implement */ + return 0; +} + +static int +smb_update_shareopts(sa_share_impl_t impl_share, const char *resource, + const char *shareopts) +{ + char *shareopts_dup; + boolean_t needs_reshare = B_FALSE; + char *old_shareopts; +#ifdef DEBUG + fprintf(stderr, "smb_update_shareopts()\n"); +#endif + + FSINFO(impl_share, smb_fstype)->active = smb_is_share_active(impl_share); + + old_shareopts = FSINFO(impl_share, smb_fstype)->shareopts; + + if (FSINFO(impl_share, smb_fstype)->active && old_shareopts != NULL && + strcmp(old_shareopts, shareopts) != 0) { + needs_reshare = B_TRUE; + smb_disable_share(impl_share); + } + + shareopts_dup = strdup(shareopts); + + if (shareopts_dup == NULL) + return SA_NO_MEMORY; + + if (old_shareopts != NULL) + free(old_shareopts); + + FSINFO(impl_share, smb_fstype)->shareopts = shareopts_dup; + + if (needs_reshare) + smb_enable_share(impl_share); + + return 0; +} + +static void +smb_clear_shareopts(sa_share_impl_t impl_share) +{ +#ifdef DEBUG + fprintf(stderr, "smb_clear_shareopts()\n"); +#endif + free(FSINFO(impl_share, smb_fstype)->shareopts); + FSINFO(impl_share, smb_fstype)->shareopts = NULL; +} + +static const sa_share_ops_t smb_shareops = { + .enable_share = smb_enable_share, + .disable_share = smb_disable_share, + + .validate_shareopts = smb_validate_shareopts, + .update_shareopts = smb_update_shareopts, + .clear_shareopts = smb_clear_shareopts, +}; + +int +smb_retrieve_shares(void) +{ + int rc = SA_OK; + char file_path[PATH_MAX], line[512], *token, *key, *value, *dup_value, *c; + char *path = NULL, *comment = NULL, *name = NULL, *guest_ok = NULL; + DIR *shares_dir; + FILE *share_file_fp; + struct dirent *directory; + struct stat eStat; + smb_share_t *shares, *new_shares = NULL; + +#ifdef DEBUG + fprintf(stderr, " smb_retrieve_shares()\n"); +#endif + + /* opendir(), stat() */ + shares_dir = opendir(SHARE_DIR); + if (shares_dir == NULL) { + fprintf(stderr, "ERROR: smb.c:smb_retrieve_shares()/opendir()\n"); + return SA_SYSTEM_ERR; + } + + /* Go through the directory, looking for shares */ + while ((directory = readdir(shares_dir))) { + if (directory->d_name[0] == '.') + continue; + +#ifdef DEBUG + fprintf(stderr, " %s\n", directory->d_name); +#endif + snprintf(file_path, sizeof (file_path), + "%s/%s", SHARE_DIR, directory->d_name); + + if (stat(file_path, &eStat) == -1) { + fprintf(stderr, "ERROR: smb.c:smb_retrieve_shares()/stat()\n"); + + rc = SA_SYSTEM_ERR; + goto out; + } + + if (!S_ISREG(eStat.st_mode)) + continue; + + if ((share_file_fp = fopen(file_path, "r")) == NULL) { + fprintf(stderr, "ERROR: smb.c:smb_retrieve_shares()/fopen()\n"); + + rc = SA_SYSTEM_ERR; + goto out; + } + + name = strdup(directory->d_name); + if (name == NULL) { + rc = SA_NO_MEMORY; + goto out; + } + + while (fgets(line, sizeof(line), share_file_fp)) { + if (line[0] == '#') + continue; + + /* Trim trailing new-line character(s). */ + while (line[strlen(line) - 1] == '\r' || + line[strlen(line) - 1] == '\n') + line[strlen(line) - 1] = '\0'; +// for (c = line; *c; c++) { +// if (*c == '\r' || *c == '\n') { +// c = '\0'; +// break; +// } +// } + +#ifdef DEBUG + fprintf(stderr, " %s ", line); +#endif + + /* Split the line in two, separated by '=' */ + token = strchr(line, '='); + if (token == NULL) + continue; + + key = line; + value = token + 1; + *token = '\0'; + + dup_value = strdup(value); + if (dup_value == NULL) { + rc = SA_NO_MEMORY; + goto out; + } + + if (strcmp(key, "path") == 0) + path = dup_value; + if (strcmp(key, "comment") == 0) + comment = dup_value; + if (strcmp(key, "guest_ok") == 0) + guest_ok = dup_value; + + if (path == NULL || comment == NULL || guest_ok == NULL) + continue; /* Incomplete share definition */ + else { + shares = (smb_share_t *)malloc(sizeof (smb_share_t)); + if (shares == NULL) { + rc = SA_NO_MEMORY; + goto out; + } + + strncpy(shares->name, name, sizeof (shares->name)); + shares->name [sizeof(shares->name)-1] = '\0'; + + strncpy(shares->path, path, sizeof (shares->path)); + shares->path [sizeof(shares->path)-1] = '\0'; + + strncpy(shares->comment, comment, sizeof (shares->comment)); + shares->comment [sizeof(shares->comment)-1] = '\0'; + + shares->guest_ok = atoi(guest_ok); + + shares->next = new_shares; + new_shares = shares; + + name = NULL; + path = NULL; + comment = NULL; + guest_ok = NULL; + } + } + +out: + if (share_file_fp != NULL) + fclose(share_file_fp); + + free(name); + free(path); + free(comment); + free(guest_ok); + } + closedir(shares_dir); + + smb_shares = new_shares; + + return rc; +} + +void +libshare_smb_init(void) +{ +#ifdef DEBUG + fprintf(stderr, "libshare_smb_init()\n"); +#endif + smb_available = (smb_retrieve_shares() == SA_OK); + + smb_fstype = register_fstype("smb", &smb_shareops); +} diff --git a/lib/libshare/smb.h b/lib/libshare/smb.h new file mode 100644 index 000000000000..cb9018317c6c --- /dev/null +++ b/lib/libshare/smb.h @@ -0,0 +1,26 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2011 Turbo Fredriksson . + */ + +void libshare_smb_init(void); diff --git a/module/zfs/zpl_super.c b/module/zfs/zpl_super.c index 0e6e9360ff45..8c6c606977eb 100644 --- a/module/zfs/zpl_super.c +++ b/module/zfs/zpl_super.c @@ -209,120 +209,34 @@ zpl_kill_sb(struct super_block *sb) kill_anon_super(sb); } -#ifdef HAVE_SHRINK -/* - * Linux 3.1 - 3.x API - * - * The Linux 3.1 API introduced per-sb cache shrinkers to replace the - * global ones. This allows us a mechanism to cleanly target a specific - * zfs file system when the dnode and inode caches grow too large. - * - * In addition, the 3.0 kernel added the iterate_supers_type() helper - * function which is used to safely walk all of the zfs file systems. - */ -static void -zpl_prune_sb(struct super_block *sb, void *arg) -{ - int objects = 0; - int error; - - error = -zfs_sb_prune(sb, *(unsigned long *)arg, &objects); - ASSERT3S(error, <=, 0); - - return; -} - -void -zpl_prune_sbs(int64_t bytes_to_scan, void *private) -{ - unsigned long nr_to_scan = (bytes_to_scan / sizeof(znode_t)); - - iterate_supers_type(&zpl_fs_type, zpl_prune_sb, &nr_to_scan); - kmem_reap(); -} -#else -/* - * Linux 2.6.x - 3.0 API - * - * These are best effort interfaces are provided by the SPL to induce - * the Linux VM subsystem to reclaim a fraction of the both dnode and - * inode caches. Ideally, we want to just target the zfs file systems - * however our only option is to reclaim from them all. - */ -void -zpl_prune_sbs(int64_t bytes_to_scan, void *private) -{ - unsigned long nr_to_scan = (bytes_to_scan / sizeof(znode_t)); - - shrink_dcache_memory(nr_to_scan, GFP_KERNEL); - shrink_icache_memory(nr_to_scan, GFP_KERNEL); - kmem_reap(); -} -#endif /* HAVE_SHRINK */ - -#ifdef HAVE_NR_CACHED_OBJECTS -static int -zpl_nr_cached_objects(struct super_block *sb) -{ - zfs_sb_t *zsb = sb->s_fs_info; - int nr; - - mutex_enter(&zsb->z_znodes_lock); - nr = zsb->z_nr_znodes; - mutex_exit(&zsb->z_znodes_lock); - - return (nr); -} -#endif /* HAVE_NR_CACHED_OBJECTS */ - -#ifdef HAVE_FREE_CACHED_OBJECTS -/* - * Attempt to evict some meta data from the cache. The ARC operates in - * terms of bytes while the Linux VFS uses objects. Now because this is - * just a best effort eviction and the exact values aren't critical so we - * extrapolate from an object count to a byte size using the znode_t size. - */ -static void -zpl_free_cached_objects(struct super_block *sb, int nr_to_scan) -{ - arc_adjust_meta(nr_to_scan * sizeof(znode_t), B_FALSE); -} -#endif /* HAVE_FREE_CACHED_OBJECTS */ - const struct super_operations zpl_super_operations = { - .alloc_inode = zpl_inode_alloc, - .destroy_inode = zpl_inode_destroy, - .dirty_inode = NULL, - .write_inode = NULL, - .drop_inode = NULL, + .alloc_inode = zpl_inode_alloc, + .destroy_inode = zpl_inode_destroy, + .dirty_inode = NULL, + .write_inode = NULL, + .drop_inode = NULL, #ifdef HAVE_EVICT_INODE - .evict_inode = zpl_evict_inode, + .evict_inode = zpl_evict_inode, #else - .clear_inode = zpl_clear_inode, - .delete_inode = zpl_inode_delete, + .clear_inode = zpl_clear_inode, + .delete_inode = zpl_inode_delete, #endif /* HAVE_EVICT_INODE */ - .put_super = zpl_put_super, - .write_super = NULL, - .sync_fs = zpl_sync_fs, - .statfs = zpl_statfs, - .remount_fs = zpl_remount_fs, - .show_options = zpl_show_options, - .show_stats = NULL, -#ifdef HAVE_NR_CACHED_OBJECTS - .nr_cached_objects = zpl_nr_cached_objects, -#endif /* HAVE_NR_CACHED_OBJECTS */ -#ifdef HAVE_FREE_CACHED_OBJECTS - .free_cached_objects = zpl_free_cached_objects, -#endif /* HAVE_FREE_CACHED_OBJECTS */ + .put_super = zpl_put_super, + .write_super = NULL, + .sync_fs = zpl_sync_fs, + .statfs = zpl_statfs, + .remount_fs = zpl_remount_fs, + .show_options = zpl_show_options, + .show_stats = NULL, }; struct file_system_type zpl_fs_type = { - .owner = THIS_MODULE, - .name = ZFS_DRIVER, + .owner = THIS_MODULE, + .name = ZFS_DRIVER, #ifdef HAVE_MOUNT_NODEV - .mount = zpl_mount, + .mount = zpl_mount, #else - .get_sb = zpl_get_sb, + .get_sb = zpl_get_sb, #endif /* HAVE_MOUNT_NODEV */ - .kill_sb = zpl_kill_sb, + .kill_sb = zpl_kill_sb, };