ext2-* options are renamed to fs-*

This commit is contained in:
Gerhard Rieger 2020-12-28 12:37:49 +01:00
parent f34e8a4dc1
commit beed38655f
15 changed files with 346 additions and 223 deletions

View file

@ -41,6 +41,10 @@ Porting:
ai_protocol=0 and try again
Test: SCTP_SERVICENAME
Per file filesystem options were still name ext2-* and depended on
<linux/ext2_fs.h>. Now they are called fs-* and depend on <linux/fs.h>.
These fs-* options are also available on old systems with ext2_fs.h
Testing:
test.sh now produces a list of tests that could not be performed for
any reason. This helps to analyse these cases.
@ -231,6 +235,9 @@ Cosmetics:
New features:
Permit combined -d options as -dd etc.
porting:
ext2 options are now fs options.
####################### V 1.7.3.2:
corrections:

View file

@ -51,7 +51,7 @@ XIOSRCS = xioinitialize.c xiohelp.c xioparam.c xiodiag.c xioopen.c xioopts.c \
xio-socks.c xio-proxy.c xio-udp.c \
xio-progcall.c xio-exec.c xio-system.c xio-termios.c xio-readline.c \
xio-pty.c xio-openssl.c xio-streams.c\
xio-ascii.c xiolockfile.c xio-tcpwrap.c xio-ext2.c xio-tun.c
xio-ascii.c xiolockfile.c xio-tcpwrap.c xio-fs.c xio-tun.c
XIOOBJS = $(XIOSRCS:.c=.o)
UTLSRCS = error.c dalan.c procan.c procan-cdefs.c hostan.c fdname.c sysutils.c utils.c nestlex.c vsnprintf_r.c snprinterr.c @FILAN@ sycls.c @SSLCLS@
UTLOBJS = $(UTLSRCS:.c=.o)
@ -69,7 +69,7 @@ HFILES = sycls.h sslcls.h error.h dalan.h procan.h filan.h hostan.h sysincludes.
xio-socks.h xio-proxy.h xio-progcall.h xio-exec.h \
xio-system.h xio-termios.h xio-readline.h \
xio-pty.h xio-openssl.h xio-streams.h \
xio-ascii.h xiolockfile.h xio-tcpwrap.h xio-ext2.h xio-tun.h
xio-ascii.h xiolockfile.h xio-tcpwrap.h xio-fs.h xio-tun.h
DOCFILES = README README.FIPS CHANGES FILES EXAMPLES PORTING SECURITY DEVELOPMENT doc/socat.yo doc/socat.1 doc/socat.html doc/xio.help FAQ BUGREPORTS COPYING COPYING.OpenSSL doc/dest-unreach.css doc/socat-openssltunnel.html doc/socat-multicast.html doc/socat-tun.html doc/socat-genericsocket.html

View file

@ -633,7 +633,7 @@
#undef WITH_READLINE
#undef WITH_TUN
#undef WITH_PTY
#undef WITH_EXT2
#undef WITH_FS
#undef WITH_OPENSSL
#undef WITH_OPENSSL_METHOD
#undef WITH_RES_DEPRECATED /* AAONLY,PRIMARY */

View file

@ -405,13 +405,13 @@ AC_ARG_ENABLE(pty, [ --disable-pty disable pty support],
esac],
[AC_DEFINE(WITH_PTY) AC_MSG_RESULT(yes)])
AC_MSG_CHECKING(whether to include ext2 fs attributes support)
AC_ARG_ENABLE(ext2, [ --disable-ext2 disable ext2 fs attributes support],
AC_MSG_CHECKING(whether to include fs attributes support)
AC_ARG_ENABLE(fs, [ --disable-fs disable fs attributes support],
[case "$enableval" in
no) AC_MSG_RESULT(no);;
*) AC_DEFINE(WITH_EXT2) AC_MSG_RESULT(yes);;
*) AC_DEFINE(WITH_FS) AC_MSG_RESULT(yes);;
esac],
[AC_DEFINE(WITH_EXT2) AC_MSG_RESULT(yes)])
[AC_DEFINE(WITH_FS) AC_MSG_RESULT(yes)])
AC_MSG_CHECKING(whether to include readline support)
AC_ARG_ENABLE(readline, [ --disable-readline disable readline support],

View file

@ -1663,22 +1663,22 @@ label(OPTION_FTRUNCATE)dit(bf(tt(ftruncate=<offset>)))
link(off64_t)(TYPE_OFF64)]. Please note that a missing value defaults to 1,
not 0.
label(OPTION_EXT2_SECRM_FL)dit(bf(tt(secrm=<bool>)))
label(OPTION_EXT2_UNRM)dit(bf(tt(unrm=<bool>)))
label(OPTION_EXT2_COMPR)dit(bf(tt(compr=<bool>)))
label(OPTION_EXT2_SYNC)dit(bf(tt(ext2-sync=<bool>)))
label(OPTION_EXT2_IMMUTABLE)dit(bf(tt(immutable=<bool>)))
label(OPTION_EXT2_APPEND)dit(bf(tt(ext2-append=<bool>)))
label(OPTION_EXT2_NODUMP)dit(bf(tt(nodump=<bool>)))
label(OPTION_EXT2_NOATIME)dit(bf(tt(ext2-noatime=<bool>)))
label(OPTION_EXT2_JOURNAL_DATA)dit(bf(tt(journal-data=<bool>)))
label(OPTION_EXT2_NOTAIL)dit(bf(tt(notail=<bool>)))
label(OPTION_EXT2_DIRSYNC)dit(bf(tt(dirsync=<bool>)))
label(OPTION_FS_SECRM_FL)dit(bf(tt(secrm=<bool>)))
label(OPTION_FS_UNRM)dit(bf(tt(unrm=<bool>)))
label(OPTION_FS_COMPR)dit(bf(tt(compr=<bool>)))
label(OPTION_FS_SYNC)dit(bf(tt(fs-sync=<bool>)))
label(OPTION_FS_IMMUTABLE)dit(bf(tt(immutable=<bool>)))
label(OPTION_FS_APPEND)dit(bf(tt(fs-append=<bool>)))
label(OPTION_FS_NODUMP)dit(bf(tt(nodump=<bool>)))
label(OPTION_FS_NOATIME)dit(bf(tt(fs-noatime=<bool>)))
label(OPTION_FS_JOURNAL_DATA)dit(bf(tt(journal-data=<bool>)))
label(OPTION_FS_NOTAIL)dit(bf(tt(notail=<bool>)))
label(OPTION_FS_DIRSYNC)dit(bf(tt(dirsync=<bool>)))
These options change non standard file attributes on operating systems and
file systems that support these features, like Linux with ext2fs,
ext3fs, or reiserfs. See man 1 chattr for information on these options.
Please note that there might be a race condition between creating the file
and applying these options.
file systems that support these features, like Linux with ext2fs and
successors, xfs, or reiserfs. See man 1 chattr for information on these
options. Please note that there might be a race condition between creating
the file and applying these options.
enddit()
startdit()enddit()nl()

View file

@ -167,7 +167,7 @@
#include <regex.h>
#endif
#if HAVE_LINUX_FS_H
#include <linux/fs.h> /* somewhere required for ext2_fs.h */
#include <linux/fs.h> /* Linux filesystem definitions */
#endif
#if HAVE_LINUX_EXT2_FS_H
#include <linux/ext2_fs.h> /* Linux ext2 filesystem definitions */

14
test.sh
View file

@ -8232,17 +8232,17 @@ fi ;; # NUMCOND, feats
esac
N=$((N+1))
NAME=EXT2_NOATIME
NAME=FS_NOATIME
case "$TESTS" in
*%$N%*|*%functions%*|*%ext2%*|*%noatime%*|*%$NAME%*)
TEST="$NAME: extended file system options using ext2fs noatime option"
# idea: create a file with ext2-noatime option; one second later create a file
*%$N%*|*%functions%*|*%fs%*|*%noatime%*|*%$NAME%*)
TEST="$NAME: extended file system options using fs noatime option"
# idea: create a file with fs-noatime option; one second later create a file
# without this option (using touch); one second later read from the first file.
# Then we check which file has the later ATIME stamp. For this check we use
# "ls -ltu" because it is more portable than "test ... -nt ..."
if ! eval $NUMCOND; then :;
elif ! testoptions ext2-noatime >/dev/null; then
$PRINTF "test $F_n $TEST... ${YELLOW}ext2-noatime not available${NORMAL}\n" $N
elif ! testoptions fs-noatime >/dev/null; then
$PRINTF "test $F_n $TEST... ${YELLOW}fs-noatime not available${NORMAL}\n" $N
numCANT=$((numCANT+1))
listCANT="$listCANT $N"
else
@ -8254,7 +8254,7 @@ ts1="$ts"
da="test$N $(date) $RANDOM"
$PRINTF "test $F_n $TEST... " $N
CMD0="$TRACE $SOCAT $opts -u /dev/null create:\"${tf}1\""
CMD="$TRACE $SOCAT $opts -u /dev/null create:\"${tf}1\",ext2-noatime"
CMD="$TRACE $SOCAT $opts -u /dev/null create:\"${tf}1\",fs-noatime"
# check if this is a capable FS; lsattr does other things on AIX, thus socat
$CMD0 2>"${te}0"
if [ $? -ne 0 ]; then

View file

@ -1,91 +0,0 @@
/* source: xio-ext2.c */
/* Copyright Gerhard Rieger and contributors (see file CHANGES) */
/* Published under the GNU General Public License V.2, see file COPYING */
/* this file contains the source for handling Linux ext2fs options
they can also be set with chattr(1) and viewed with lsattr(1) */
#include "xiosysincludes.h"
#include "xioopen.h"
#include "xio-ext2.h"
#if WITH_EXT2
/****** FD options ******/
#ifdef EXT2_SECRM_FL
/* secure deletion, chattr 's' */
const struct optdesc opt_ext2_secrm = { "ext2-secrm", "secrm", OPT_EXT2_SECRM, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, EXT2_IOC_GETFLAGS, EXT2_IOC_SETFLAGS, EXT2_SECRM_FL };
#endif /* EXT2_SECRM_FL */
#ifdef EXT2_UNRM_FL
/* undelete, chattr 'u' */
const struct optdesc opt_ext2_unrm = { "ext2-unrm", "unrm", OPT_EXT2_UNRM, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, EXT2_IOC_GETFLAGS, EXT2_IOC_SETFLAGS, EXT2_UNRM_FL };
#endif /* EXT2_UNRM_FL */
#ifdef EXT2_COMPR_FL
/* compress file, chattr 'c' */
const struct optdesc opt_ext2_compr = { "ext2-compr", "compr", OPT_EXT2_COMPR, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, EXT2_IOC_GETFLAGS, EXT2_IOC_SETFLAGS, EXT2_COMPR_FL };
#endif /* EXT2_COMPR_FL */
#ifdef EXT2_SYNC_FL
/* synchronous update, chattr 'S' */
const struct optdesc opt_ext2_sync = { "ext2-sync", "sync", OPT_EXT2_SYNC, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, EXT2_IOC_GETFLAGS, EXT2_IOC_SETFLAGS, EXT2_SYNC_FL };
#endif /* EXT2_SYNC_FL */
#ifdef EXT2_IMMUTABLE_FL
/* immutable file, chattr 'i' */
const struct optdesc opt_ext2_immutable = { "ext2-immutable", "immutable", OPT_EXT2_IMMUTABLE, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, EXT2_IOC_GETFLAGS, EXT2_IOC_SETFLAGS, EXT2_IMMUTABLE_FL };
#endif /* EXT2_IMMUTABLE_FL */
#ifdef EXT2_APPEND_FL
/* writes to file may only append, chattr 'a' */
const struct optdesc opt_ext2_append = { "ext2-append", "append", OPT_EXT2_APPEND, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, EXT2_IOC_GETFLAGS, EXT2_IOC_SETFLAGS, EXT2_APPEND_FL };
#endif /* EXT2_APPEND_FL */
#ifdef EXT2_NODUMP_FL
/* do not dump file, chattr 'd' */
const struct optdesc opt_ext2_nodump = { "ext2-nodump", "nodump", OPT_EXT2_NODUMP, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, EXT2_IOC_GETFLAGS, EXT2_IOC_SETFLAGS, EXT2_NODUMP_FL };
#endif /* EXT2_NODUMP_FL */
#ifdef EXT2_NOATIME_FL
/* do not update atime, chattr 'A' */
const struct optdesc opt_ext2_noatime = { "ext2-noatime", "noatime", OPT_EXT2_NOATIME, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, EXT2_IOC_GETFLAGS, EXT2_IOC_SETFLAGS, EXT2_NOATIME_FL };
#endif /* EXT2_NOATIME_FL */
/* EXT2_DIRTY_FL ??? */
/* EXT2_COMPRBLK_FL one ore more compress clusters */
/* EXT2_NOCOMPR_FL access raw compressed data */
/* EXT2_ECOMPR_FL compression error */
/* EXT2_BTREE_FL btree format dir */
/* EXT2_INDEX_FL hash indexed directory */
/* EXT2_IMAGIC ??? */
#ifdef EXT2_JOURNAL_DATA_FL
/* file data should be journaled, chattr 'j' */
const struct optdesc opt_ext2_journal_data = { "ext2-journal-data", "journal-data", OPT_EXT2_JOURNAL_DATA, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, EXT2_IOC_GETFLAGS, EXT2_IOC_SETFLAGS, EXT2_JOURNAL_DATA_FL };
#endif /* EXT2_JOURNAL_DATA_FL */
#ifdef EXT2_NOTAIL_FL
/* file tail should not be merged, chattr 't' */
const struct optdesc opt_ext2_notail = { "ext2-notail", "notail", OPT_EXT2_NOTAIL, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, EXT2_IOC_GETFLAGS, EXT2_IOC_SETFLAGS, EXT2_NOTAIL_FL };
#endif /* EXT2_NOTAIL_FL */
#ifdef EXT2_DIRSYNC_FL
/* synchronous directory modifications, chattr 'D' */
const struct optdesc opt_ext2_dirsync = { "ext2-dirsync", "dirsync", OPT_EXT2_DIRSYNC, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, EXT2_IOC_GETFLAGS, EXT2_IOC_SETFLAGS, EXT2_DIRSYNC_FL };
#endif /* EXT2_DIRSYNC_FL */
#ifdef EXT2_TOPDIR_FL
/* top of directory hierarchies, chattr 'T' */
const struct optdesc opt_ext2_topdir = { "ext2-topdir", "topdir", OPT_EXT2_TOPDIR, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, EXT2_IOC_GETFLAGS, EXT2_IOC_SETFLAGS, EXT2_TOPDIR_FL };
#endif /* EXT2_TOPDIR_FL */
/* EXTENTS inode uses extents */
#endif /* WITH_EXT2 */

View file

@ -1,21 +0,0 @@
/* source: xio-ext2.h */
/* Copyright Gerhard Rieger and contributors (see file CHANGES) */
/* Published under the GNU General Public License V.2, see file COPYING */
#ifndef __xio_ext2_h_included
#define __xio_ext2_h_included 1
extern const struct optdesc opt_ext2_secrm;
extern const struct optdesc opt_ext2_unrm;
extern const struct optdesc opt_ext2_compr;
extern const struct optdesc opt_ext2_sync;
extern const struct optdesc opt_ext2_immutable;
extern const struct optdesc opt_ext2_append;
extern const struct optdesc opt_ext2_nodump;
extern const struct optdesc opt_ext2_noatime;
extern const struct optdesc opt_ext2_journal_data;
extern const struct optdesc opt_ext2_notail;
extern const struct optdesc opt_ext2_dirsync;
extern const struct optdesc opt_ext2_topdir;
#endif /* !defined(__xio_ext2_h_included) */

134
xio-fs.c Normal file
View file

@ -0,0 +1,134 @@
/* source: xio-fs.c */
/* Copyright Gerhard Rieger and contributors (see file CHANGES) */
/* Published under the GNU General Public License V.2, see file COPYING */
/* this file contains the source for handling Linux fs options
they can also be set with chattr(1) and viewed with lsattr(1) */
#include "xiosysincludes.h"
#include "xioopen.h"
#include "xio-fs.h"
#if WITH_FS
/****** FD options ******/
#if defined(EXT2_IOC_GETFLAGS) && !defined(FS_IOC_GETFLAGS)
# define FS_IOC_GETFLAGS EXT2_IOC_GETFLAGS
#endif
#if defined(EXT2_IOC_SETFLAGS) && !defined(FS_IOC_SETFLAGS)
# define FS_IOC_SETFLAGS EXT2_IOC_SETFLAGS
#endif
#if defined(EXT2_SECRM_FL) && !defined(FS_SECRM_FL)
# define FS_SECRM_FL EXT2_SECRM_FL
#endif
#ifdef FS_SECRM_FL
/* secure deletion, chattr 's' */
const struct optdesc opt_fs_secrm = { "fs-secrm", "secrm", OPT_FS_SECRM, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, FS_IOC_GETFLAGS, FS_IOC_SETFLAGS, FS_SECRM_FL };
#endif
#if defined(EXT2_UNRM_FL) && !defined(FS_UNRM_FL)
# define FS_UNRM_FL EXT2_UNRM_FL
#endif
#ifdef FS_UNRM_FL
/* undelete, chattr 'u' */
const struct optdesc opt_fs_unrm = { "fs-unrm", "unrm", OPT_FS_UNRM, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, FS_IOC_GETFLAGS, FS_IOC_SETFLAGS, FS_UNRM_FL };
#endif /* FS_UNRM_FL */
#if defined(EXT2_COMPR_FL) && !defined(FS_COMPR_FL)
# define FS_COMPR_FL EXT2_COMPR_FL
#endif
#ifdef FS_COMPR_FL
/* compress file, chattr 'c' */
const struct optdesc opt_fs_compr = { "fs-compr", "compr", OPT_FS_COMPR, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, FS_IOC_GETFLAGS, FS_IOC_SETFLAGS, FS_COMPR_FL };
#endif /* FS_COMPR_FL */
#if defined(EXT2_SYNC_FL) && !defined(FS_SYNC_FL)
# define FS_SYNC_FL EXT2_SYNC_FL
#endif
#ifdef FS_SYNC_FL
/* synchronous update, chattr 'S' */
const struct optdesc opt_fs_sync = { "fs-sync", "sync", OPT_FS_SYNC, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, FS_IOC_GETFLAGS, FS_IOC_SETFLAGS, FS_SYNC_FL };
#endif /* FS_SYNC_FL */
#if defined(EXT2_IMMUTABLE_FL) && !defined(FS_IMMUTABLE_FL)
# define FS_IMMUTABLE_FL EXT2_IMMUTABLE_FL
#endif
#ifdef FS_IMMUTABLE_FL
/* immutable file, chattr 'i' */
const struct optdesc opt_fs_immutable = { "fs-immutable", "immutable", OPT_FS_IMMUTABLE, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, FS_IOC_GETFLAGS, FS_IOC_SETFLAGS, FS_IMMUTABLE_FL };
#endif /* FS_IMMUTABLE_FL */
#if defined(EXT2_APPEND_FL) && !defined(FS_APPEND_FL)
# define FS_APPEND_FL EXT2_APPEND_FL
#endif
#ifdef FS_APPEND_FL
/* writes to file may only append, chattr 'a' */
const struct optdesc opt_fs_append = { "fs-append", "append", OPT_FS_APPEND, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, FS_IOC_GETFLAGS, FS_IOC_SETFLAGS, FS_APPEND_FL };
#endif /* FS_APPEND_FL */
#if defined(EXT2_NODUMP_FL) && !defined(FS_NODUMP_FL)
# define FS_NODUMP_FL EXT2_NODUMP_FL
#endif
#ifdef FS_NODUMP_FL
/* do not dump file, chattr 'd' */
const struct optdesc opt_fs_nodump = { "fs-nodump", "nodump", OPT_FS_NODUMP, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, FS_IOC_GETFLAGS, FS_IOC_SETFLAGS, FS_NODUMP_FL };
#endif /* FS_NODUMP_FL */
#if defined(EXT2_NOATIME_FL) && !defined(FS_NOATIME_FL)
# define FS_NOATIME_FL EXT2_NOATIME_FL
#endif
#ifdef FS_NOATIME_FL
/* do not update atime, chattr 'A' */
const struct optdesc opt_fs_noatime = { "fs-noatime", "noatime", OPT_FS_NOATIME, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, FS_IOC_GETFLAGS, FS_IOC_SETFLAGS, FS_NOATIME_FL };
#endif /* FS_NOATIME_FL */
/* FS_DIRTY_FL ??? */
/* FS_COMPRBLK_FL one ore more compress clusters */
/* FS_NOCOMPR_FL access raw compressed data */
/* FS_ECOMPR_FL compression error */
/* FS_BTREE_FL btree format dir */
/* FS_INDEX_FL hash indexed directory */
/* FS_IMAGIC ??? */
#if defined(EXT2_JOURNAL_DATA_FL) && !defined(FS_JOURNAL_DATA_FL)
# define FS_JOURNAL_DATA_FL EXT2_JOURNAL_DATA_FL
#endif
#ifdef FS_JOURNAL_DATA_FL
/* file data should be journaled, chattr 'j' */
const struct optdesc opt_fs_journal_data = { "fs-journal-data", "journal-data", OPT_FS_JOURNAL_DATA, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, FS_IOC_GETFLAGS, FS_IOC_SETFLAGS, FS_JOURNAL_DATA_FL };
#endif /* FS_JOURNAL_DATA_FL */
#if defined(EXT2_NOTAIL_FL) && !defined(FS_NOTAIL_FL)
# define FS_NOTAIL_FL EXT2_NOTAIL_FL
#endif
#ifdef FS_NOTAIL_FL
/* file tail should not be merged, chattr 't' */
const struct optdesc opt_fs_notail = { "fs-notail", "notail", OPT_FS_NOTAIL, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, FS_IOC_GETFLAGS, FS_IOC_SETFLAGS, FS_NOTAIL_FL };
#endif /* FS_NOTAIL_FL */
#if defined(EXT2_DIRSYNC_FL) && !defined(FS_DIRSYNC_FL)
# define FS_DIRSYNC_FL EXT2_DIRSYNC_FL
#endif
#ifdef FS_DIRSYNC_FL
/* synchronous directory modifications, chattr 'D' */
const struct optdesc opt_fs_dirsync = { "fs-dirsync", "dirsync", OPT_FS_DIRSYNC, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, FS_IOC_GETFLAGS, FS_IOC_SETFLAGS, FS_DIRSYNC_FL };
#endif /* FS_DIRSYNC_FL */
#if defined(EXT2_TOPDIR_FL) && !defined(FS_TOPDIR_FL)
# define FS_TOPDIR_FL EXT2_TOPDIR_FL
#endif
#ifdef FS_TOPDIR_FL
/* top of directory hierarchies, chattr 'T' */
const struct optdesc opt_fs_topdir = { "fs-topdir", "topdir", OPT_FS_TOPDIR, GROUP_REG, PH_FD, TYPE_BOOL, OFUNC_IOCTL_MASK_LONG, FS_IOC_GETFLAGS, FS_IOC_SETFLAGS, FS_TOPDIR_FL };
#endif /* FS_TOPDIR_FL */
/* EXTENTS inode uses extents */
#endif /* WITH_FS */

58
xio-fs.h Normal file
View file

@ -0,0 +1,58 @@
/* source: xio-fs.h */
/* Copyright Gerhard Rieger and contributors (see file CHANGES) */
/* Published under the GNU General Public License V.2, see file COPYING */
#ifndef __xio_fs_h_included
#define __xio_fs_h_included 1
#if defined(EXT2_SECRM_FL) && !defined(FS_SECRM_FL)
# define FS_SECRM_FL EXT2_SECRM_FL
#endif
#if defined(EXT2_UNRM_FL) && !defined(FS_UNRM_FL)
# define FS_UNRM_FL EXT2_UNRM_FL
#endif
#if defined(EXT2_COMPR_FL) && !defined(FS_COMPR_FL)
# define FS_COMPR_FL EXT2_COMPR_FL
#endif
#if defined(EXT2_SYNC_FL) && !defined(FS_SYNC_FL)
# define FS_SYNC_FL EXT2_SYNC_FL
#endif
#if defined(EXT2_IMMUTABLE_FL) && !defined(FS_IMMUTABLE_FL)
# define FS_IMMUTABLE_FL EXT2_IMMUTABLE_FL
#endif
#if defined(EXT2_APPEND_FL) && !defined(FS_APPEND_FL)
# define FS_APPEND_FL EXT2_APPEND_FL
#endif
#if defined(EXT2_NODUMP_FL) && !defined(FS_NODUMP_FL)
# define FS_NODUMP_FL EXT2_NODUMP_FL
#endif
#if defined(EXT2_NOATIME_FL) && !defined(FS_NOATIME_FL)
# define FS_NOATIME_FL EXT2_NOATIME_FL
#endif
#if defined(EXT2_JOURNAL_DATA_FL) && !defined(FS_JOURNAL_DATA_FL)
# define FS_JOURNAL_DATA_FL EXT2_JOURNAL_DATA_FL
#endif
#if defined(EXT2_NOTAIL_FL) && !defined(FS_NOTAIL_FL)
# define FS_NOTAIL_FL EXT2_NOTAIL_FL
#endif
#if defined(EXT2_DIRSYNC_FL) && !defined(FS_DIRSYNC_FL)
# define FS_DIRSYNC_FL EXT2_DIRSYNC_FL
#endif
#if defined(EXT2_TOPDIR_FL) && !defined(FS_TOPDIR_FL)
# define FS_TOPDIR_FL EXT2_TOPDIR_FL
#endif
extern const struct optdesc opt_fs_secrm;
extern const struct optdesc opt_fs_unrm;
extern const struct optdesc opt_fs_compr;
extern const struct optdesc opt_fs_sync;
extern const struct optdesc opt_fs_immutable;
extern const struct optdesc opt_fs_append;
extern const struct optdesc opt_fs_nodump;
extern const struct optdesc opt_fs_noatime;
extern const struct optdesc opt_fs_journal_data;
extern const struct optdesc opt_fs_notail;
extern const struct optdesc opt_fs_dirsync;
extern const struct optdesc opt_fs_topdir;
#endif /* !defined(__xio_fs_h_included) */

View file

@ -359,7 +359,7 @@ int xiogetaddrinfo(const char *node, const char *service,
/* this is not a typical IP6 resolver function - but Linux
"man gethostbyname" says that the only supported address type with
this function is AF_INET _at present_, so maybe this fallback will
be useful somewhere sometimesin a future even for IP6 */
be useful somewhere sometimes in a future even for IP6 */
if (family == PF_UNSPEC) {
#if WITH_IP4 && WITH_IP6
family = xioopts.default_ip=='6'?PF_INET6:PF_INET;

View file

@ -41,7 +41,7 @@
#include "xio-pty.h"
#include "xio-openssl.h"
#include "xio-tcpwrap.h"
#include "xio-ext2.h"
#include "xio-fs.h"
#include "xio-tun.h"
#include "xio-streams.h"

170
xioopts.c
View file

@ -293,8 +293,8 @@ const struct optname optionnames[] = {
IF_ANY ("close", &opt_end_close)
IF_OPENSSL("cn", &opt_openssl_commonname)
IF_OPENSSL("commonname", &opt_openssl_commonname)
#if WITH_EXT2 && defined(EXT2_COMPR_FL)
IF_ANY ("compr", &opt_ext2_compr)
#if WITH_FS && defined(FS_COMPR_FL)
IF_ANY ("compr", &opt_fs_compr)
#endif
#if OPENSSL_VERSION_NUMBER >= 0x00908000L && !defined(OPENSSL_NO_COMP)
IF_OPENSSL("compress", &opt_openssl_compress)
@ -382,8 +382,8 @@ const struct optname optionnames[] = {
#ifdef O_DIRECTORY
IF_OPEN ("directory", &opt_o_directory)
#endif
#if WITH_EXT2 && defined(EXT2_DIRSYNC_FL)
IF_ANY ("dirsync", &opt_ext2_dirsync)
#if WITH_FS && defined(FS_DIRSYNC_FL)
IF_ANY ("dirsync", &opt_fs_dirsync)
#endif
#ifdef VDISCARD
IF_TERMIOS("discard", &opt_vdiscard)
@ -422,77 +422,77 @@ const struct optname optionnames[] = {
IF_SOCKET ("error", &opt_so_error)
IF_ANY ("escape", &opt_escape)
IF_OPEN ("excl", &opt_o_excl)
#if WITH_EXT2 && defined(EXT2_APPEND_FL)
IF_ANY ("ext2-append", &opt_ext2_append)
#if WITH_FS && defined(FS_APPEND_FL)
IF_ANY ("ext2-append", &opt_fs_append)
#endif
#if WITH_EXT2 && defined(EXT2_COMPR_FL)
IF_ANY ("ext2-compr", &opt_ext2_compr)
#if WITH_FS && defined(FS_COMPR_FL)
IF_ANY ("ext2-compr", &opt_fs_compr)
#endif
#if WITH_EXT2 && defined(EXT2_DIRSYNC_FL)
IF_ANY ("ext2-dirsync", &opt_ext2_dirsync)
#if WITH_FS && defined(FS_DIRSYNC_FL)
IF_ANY ("ext2-dirsync", &opt_fs_dirsync)
#endif
#if WITH_EXT2 && defined(EXT2_IMMUTABLE_FL)
IF_ANY ("ext2-immutable", &opt_ext2_immutable)
#if WITH_FS && defined(FS_IMMUTABLE_FL)
IF_ANY ("ext2-immutable", &opt_fs_immutable)
#endif
#if WITH_EXT2 && defined(EXT2_JOURNAL_DATA_FL)
IF_ANY ("ext2-journal-data", &opt_ext2_journal_data)
#if WITH_FS && defined(FS_JOURNAL_DATA_FL)
IF_ANY ("ext2-journal-data", &opt_fs_journal_data)
#endif
#if WITH_EXT2 && defined(EXT2_NOATIME_FL)
IF_ANY ("ext2-noatime", &opt_ext2_noatime)
#if WITH_FS && defined(FS_NOATIME_FL)
IF_ANY ("ext2-noatime", &opt_fs_noatime)
#endif
#if WITH_EXT2 && defined(EXT2_NODUMP_FL)
IF_ANY ("ext2-nodump", &opt_ext2_nodump)
#if WITH_FS && defined(FS_NODUMP_FL)
IF_ANY ("ext2-nodump", &opt_fs_nodump)
#endif
#if WITH_EXT2 && defined(EXT2_NOTAIL_FL)
IF_ANY ("ext2-notail", &opt_ext2_notail)
#if WITH_FS && defined(FS_NOTAIL_FL)
IF_ANY ("ext2-notail", &opt_fs_notail)
#endif
#if WITH_EXT2 && defined(EXT2_SECRM_FL)
IF_ANY ("ext2-secrm", &opt_ext2_secrm)
#if WITH_FS && defined(FS_SECRM_FL)
IF_ANY ("ext2-secrm", &opt_fs_secrm)
#endif
#if WITH_EXT2 && defined(EXT2_SYNC_FL)
IF_ANY ("ext2-sync", &opt_ext2_sync)
#if WITH_FS && defined(FS_SYNC_FL)
IF_ANY ("ext2-sync", &opt_fs_sync)
#endif
#if WITH_EXT2 && defined(EXT2_TOPDIR_FL)
IF_ANY ("ext2-topdir", &opt_ext2_topdir)
#if WITH_FS && defined(FS_TOPDIR_FL)
IF_ANY ("ext2-topdir", &opt_fs_topdir)
#endif
#if WITH_EXT2 && defined(EXT2_UNRM_FL)
IF_ANY ("ext2-unrm", &opt_ext2_unrm)
#if WITH_FS && defined(FS_UNRM_FL)
IF_ANY ("ext2-unrm", &opt_fs_unrm)
#endif
#if WITH_EXT2 && defined(EXT2_APPEND_FL)
IF_ANY ("ext3-append", &opt_ext2_append)
#if WITH_FS && defined(FS_APPEND_FL)
IF_ANY ("ext3-append", &opt_fs_append)
#endif
#if WITH_EXT2 && defined(EXT2_COMPR_FL)
IF_ANY ("ext3-compr", &opt_ext2_compr)
#if WITH_FS && defined(FS_COMPR_FL)
IF_ANY ("ext3-compr", &opt_fs_compr)
#endif
#if WITH_EXT2 && defined(EXT2_DIRSYNC_FL)
IF_ANY ("ext3-dirsync", &opt_ext2_dirsync)
#if WITH_FS && defined(FS_DIRSYNC_FL)
IF_ANY ("ext3-dirsync", &opt_fs_dirsync)
#endif
#if WITH_EXT2 && defined(EXT2_IMMUTABLE_FL)
IF_ANY ("ext3-immutable", &opt_ext2_immutable)
#if WITH_FS && defined(FS_IMMUTABLE_FL)
IF_ANY ("ext3-immutable", &opt_fs_immutable)
#endif
#if WITH_EXT2 && defined(EXT2_JOURNAL_DATA_FL)
IF_ANY ("ext3-journal-data", &opt_ext2_journal_data)
#if WITH_FS && defined(FS_JOURNAL_DATA_FL)
IF_ANY ("ext3-journal-data", &opt_fs_journal_data)
#endif
#if WITH_EXT2 && defined(EXT2_NOATIME_FL)
IF_ANY ("ext3-noatime", &opt_ext2_noatime)
#if WITH_FS && defined(FS_NOATIME_FL)
IF_ANY ("ext3-noatime", &opt_fs_noatime)
#endif
#if WITH_EXT2 && defined(EXT2_NODUMP_FL)
IF_ANY ("ext3-nodump", &opt_ext2_nodump)
#if WITH_FS && defined(FS_NODUMP_FL)
IF_ANY ("ext3-nodump", &opt_fs_nodump)
#endif
#if WITH_EXT2 && defined(EXT2_NOTAIL_FL)
IF_ANY ("ext3-notail", &opt_ext2_notail)
#if WITH_FS && defined(FS_NOTAIL_FL)
IF_ANY ("ext3-notail", &opt_fs_notail)
#endif
#if WITH_EXT2 && defined(EXT2_SECRM_FL)
IF_ANY ("ext3-secrm", &opt_ext2_secrm)
#if WITH_FS && defined(FS_SECRM_FL)
IF_ANY ("ext3-secrm", &opt_fs_secrm)
#endif
#if WITH_EXT2 && defined(EXT2_SYNC_FL)
IF_ANY ("ext3-sync", &opt_ext2_sync)
#if WITH_FS && defined(FS_SYNC_FL)
IF_ANY ("ext3-sync", &opt_fs_sync)
#endif
#if WITH_EXT2 && defined(EXT2_TOPDIR_FL)
IF_ANY ("ext3-topdir", &opt_ext2_topdir)
#if WITH_FS && defined(FS_TOPDIR_FL)
IF_ANY ("ext3-topdir", &opt_fs_topdir)
#endif
#if WITH_EXT2 && defined(EXT2_UNRM_FL)
IF_ANY ("ext3-unrm", &opt_ext2_unrm)
#if WITH_FS && defined(FS_UNRM_FL)
IF_ANY ("ext3-unrm", &opt_fs_unrm)
#endif
IF_ANY ("f-setlk", &opt_f_setlk_wr)
IF_ANY ("f-setlk-rd", &opt_f_setlk_rd)
@ -534,6 +534,42 @@ const struct optname optionnames[] = {
#ifdef IP_FREEBIND
IF_IP ("freebind", &opt_ip_freebind)
#endif
#if WITH_FS && defined(FS_APPEND_FL)
IF_ANY ("fs-append", &opt_fs_append)
#endif
#if WITH_FS && defined(FS_COMPR_FL)
IF_ANY ("fs-compr", &opt_fs_compr)
#endif
#if WITH_FS && defined(FS_DIRSYNC_FL)
IF_ANY ("fs-dirsync", &opt_fs_dirsync)
#endif
#if WITH_FS && defined(FS_IMMUTABLE_FL)
IF_ANY ("fs-immutable", &opt_fs_immutable)
#endif
#if WITH_FS && defined(FS_JOURNAL_DATA_FL)
IF_ANY ("fs-journal-data", &opt_fs_journal_data)
#endif
#if WITH_FS && defined(FS_NOATIME_FL)
IF_ANY ("fs-noatime", &opt_fs_noatime)
#endif
#if WITH_FS && defined(FS_NODUMP_FL)
IF_ANY ("fs-nodump", &opt_fs_nodump)
#endif
#if WITH_FS && defined(FS_NOTAIL_FL)
IF_ANY ("fs-notail", &opt_fs_notail)
#endif
#if WITH_FS && defined(FS_SECRM_FL)
IF_ANY ("fs-secrm", &opt_fs_secrm)
#endif
#if WITH_FS && defined(FS_SYNC_FL)
IF_ANY ("fs-sync", &opt_fs_sync)
#endif
#if WITH_FS && defined(FS_TOPDIR_FL)
IF_ANY ("fs-topdir", &opt_fs_topdir)
#endif
#if WITH_FS && defined(FS_UNRM_FL)
IF_ANY ("fs-unrm", &opt_fs_unrm)
#endif
#if HAVE_FTRUNCATE64
IF_ANY ("ftruncate", &opt_ftruncate64)
#else
@ -608,8 +644,8 @@ const struct optname optionnames[] = {
IF_IP ("igntc", &opt_res_igntc)
#endif /* HAVE_RESOLV_H */
IF_TERMIOS("imaxbel", &opt_imaxbel)
#if WITH_EXT2 && defined(EXT2_IMMUTABLE_FL)
IF_ANY ("immutable", &opt_ext2_immutable)
#if WITH_FS && defined(FS_IMMUTABLE_FL)
IF_ANY ("immutable", &opt_fs_immutable)
#endif
#ifdef TCP_INFO /* Linux 2.4.0 */
IF_TCP ("info", &opt_tcp_info)
@ -803,9 +839,9 @@ const struct optname optionnames[] = {
#ifdef IPV6_JOIN_GROUP
IF_IP6 ("join-group", &opt_ipv6_join_group)
#endif
#if WITH_EXT2 && defined(EXT2_JOURNAL_DATA_FL)
IF_ANY ("journal", &opt_ext2_journal_data)
IF_ANY ("journal-data", &opt_ext2_journal_data)
#if WITH_FS && defined(FS_JOURNAL_DATA_FL)
IF_ANY ("journal", &opt_fs_journal_data)
IF_ANY ("journal-data", &opt_fs_journal_data)
#endif
IF_SOCKET ("keepalive", &opt_so_keepalive)
#ifdef TCP_KEEPCNT /* Linux 2.4.0 */
@ -930,8 +966,8 @@ const struct optname optionnames[] = {
#ifdef TCP_NODELAY
IF_TCP ("nodelay", &opt_tcp_nodelay)
#endif
#if WITH_EXT2 && defined(EXT2_NODUMP_FL)
IF_ANY ("nodump", &opt_ext2_nodump)
#if WITH_FS && defined(FS_NODUMP_FL)
IF_ANY ("nodump", &opt_fs_nodump)
#endif
#if HAVE_REGEX_H
IF_READLINE("noecho", &opt_noecho)
@ -1310,8 +1346,8 @@ const struct optname optionnames[] = {
#ifdef SCTP_NODELAY
IF_SCTP ("sctp-nodelay", &opt_sctp_nodelay)
#endif
#if WITH_EXT2 && defined(EXT2_SECRM_FL)
IF_ANY ("secrm", &opt_ext2_secrm)
#if WITH_FS && defined(FS_SECRM_FL)
IF_ANY ("secrm", &opt_fs_secrm)
#endif
#ifdef SO_SECURITY_AUTHENTICATION
IF_SOCKET ("security-authentication", &opt_so_security_authentication)
@ -1510,8 +1546,8 @@ const struct optname optionnames[] = {
IF_PTY ("symbolic-link", &opt_symbolic_link)
#ifdef O_SYNC
IF_OPEN ("sync", &opt_o_sync)
#elif EXT2_SYNC_FL
IF_ANY ("sync", &opt_ext2_sync)
#elif FS_SYNC_FL
IF_ANY ("sync", &opt_fs_sync)
#endif
#ifdef TCP_SYNCNT
IF_TCP ("syncnt", &opt_tcp_syncnt)
@ -1634,8 +1670,8 @@ const struct optname optionnames[] = {
IF_SOCKET ("timestamp", &opt_so_timestamp)
#endif
IF_TERMIOS("tiocsctty", &opt_tiocsctty)
#if WITH_EXT2 && defined(EXT2_TOPDIR_FL)
IF_ANY ("topdir", &opt_ext2_topdir)
#if WITH_FS && defined(FS_TOPDIR_FL)
IF_ANY ("topdir", &opt_fs_topdir)
#endif
IF_IP ("tos", &opt_ip_tos)
IF_TERMIOS("tostop", &opt_tostop)
@ -1664,8 +1700,8 @@ const struct optname optionnames[] = {
IF_NAMED ("unlink-close", &opt_unlink_close)
IF_NAMED ("unlink-early", &opt_unlink_early)
IF_NAMED ("unlink-late", &opt_unlink_late)
#if WITH_EXT2 && defined(EXT2_UNRM_FL)
IF_ANY ("unrm", &opt_ext2_unrm)
#if WITH_FS && defined(FS_UNRM_FL)
IF_ANY ("unrm", &opt_fs_unrm)
#endif
IF_TUN ("up", &opt_iff_up)
#ifdef SO_USE_IFBUFS

View file

@ -275,18 +275,6 @@ enum e_optcode {
#endif
OPT_END_CLOSE, /* xfd.stream.howtoend = END_CLOSE */
OPT_ESCAPE,
OPT_EXT2_SECRM,
OPT_EXT2_UNRM,
OPT_EXT2_COMPR,
OPT_EXT2_SYNC,
OPT_EXT2_IMMUTABLE,
OPT_EXT2_APPEND,
OPT_EXT2_NODUMP,
OPT_EXT2_NOATIME,
OPT_EXT2_JOURNAL_DATA,
OPT_EXT2_NOTAIL,
OPT_EXT2_DIRSYNC,
OPT_EXT2_TOPDIR,
OPT_FDIN,
OPT_FDOUT,
#ifdef FFDLY
@ -309,6 +297,18 @@ enum e_optcode {
/*0 OPT_FORCE,*/
OPT_FOREVER,
OPT_FORK,
OPT_FS_APPEND,
OPT_FS_COMPR,
OPT_FS_DIRSYNC,
OPT_FS_IMMUTABLE,
OPT_FS_JOURNAL_DATA,
OPT_FS_NOATIME,
OPT_FS_NODUMP,
OPT_FS_NOTAIL,
OPT_FS_SECRM,
OPT_FS_SYNC,
OPT_FS_TOPDIR,
OPT_FS_UNRM,
OPT_FTRUNCATE32, /* ftruncate() */
OPT_FTRUNCATE64, /* ftruncate64() */
OPT_F_SETLKW_RD, /* fcntl with struct flock - read-lock, wait */