e2fsprogs: create open() and stat() helpers
PATCH v2 1/5 e2fsprogs: create open() and stat() helpers
In many places we are using #ifdef HAVE_OPEN64 to determine if we can use open64() but that's ugly. This commit creates two new helpers ext2fs_open_file() for open() and ext2fs_stat() for stat(). Also we need new typedef ext2fs_struct_stat for struct stat.
---
v2: This is the actually the first version of the patch
lib/ext2fs/ext2fs.h | 38 ++++++++++++++++++++++++++++++++++++++ lib/ext2fs/getsectsize.c | 12 ++---------- lib/ext2fs/getsize.c | 6 +----- lib/ext2fs/unix_io.c | 10 +++------- misc/e2image.c | 18 +++--------------- misc/util.c | 10 ++-------- resize/main.c | 6 +----- 7 files changed, 50 insertions(+), 50 deletions(-)
lib/ext2fs/ext2fs.h +38 -0
@@ -584,6 +584,12 @@ typedef struct ext2_icount *ext2_icount_t;#define EXT2FS_NUM_B2C (fs, blks) (((blks) + EXT2FS_CLUSTER_MASK(fs)) >> \ (fs)->cluster_ratio_bits) +#ifdef HAVE_OPEN64 +typedef struct stat64 ext2fs_struct_stat ; +#else +typedef struct stat ext2fs_struct_stat ; +#endif +/* * function prototypes */
@@ -1388,6 +1394,8 @@ extern blk_t ext2fs_inode_data_blocks(ext2_filsys fs, struct ext2_inode *inode);extern unsigned int ext2fs_div_ceil (unsigned int a,unsigned int b);extern __u64 ext2fs_div64_ceil (__u64 a,__u64 b); +extern int ext2fs_open_file (const char *pathname,int flags, ...); +extern int ext2fs_stat (const char *path,ext2fs_struct_stat *buf);/* * The actual inlined functions definitions themselves...
@@ -1638,6 +1646,36 @@ _INLINE_ __u64 ext2fs_div64_ceil(__u64 a, __u64 b)return ((a -1 ) / b) +1 ; } +_INLINE_ int ext2fs_open_file(const char *pathname, int flags, ...) +{ +va_list args; +mode_t mode; + +va_start (args, flags); + mode =va_arg (args, mode_t); +va_end (args); + + if (mode) +#ifdef HAVE_OPEN64 +return open64 (pathname, flags, mode); + else + return open64(pathname, flags); +#else +return open (pathname, flags, mode); + else + return open(pathname, flags); +#endif +} + +_INLINE_ int ext2fs_stat(const char *path, ext2fs_struct_stat *buf) +{ +#ifdef HAVE_OPEN64 +return stat64 (path, buf); +#else +return open (path, buf); +#endif +} +#undef _INLINE_#endif
lib/ext2fs/getsectsize.c +2 -10
@@ -45,11 +45,7 @@ errcode_t ext2fs_get_device_sectsize(const char *file, int *sectsize) {int fd; -#ifdef HAVE_OPEN64 - fd =open64 (file,O_RDONLY ); -#else - fd =open (file,O_RDONLY ); -#endif + fd =ext2fs_open_file (file,O_RDONLY );if (fd <0 )return errno;
@@ -71,11 +67,7 @@ errcode_t ext2fs_get_device_phys_sectsize(const char *file, int *sectsize) {int fd; -#ifdef HAVE_OPEN64 - fd =open64 (file,O_RDONLY ); -#else - fd =open (file,O_RDONLY ); -#endif + fd =ext2fs_open_file (file,O_RDONLY );if (fd <0 )return errno;
lib/ext2fs/getsize.c +1 -5
@@ -159,11 +159,7 @@ errcode_t ext2fs_get_device_size2(const char *file, int blocksize,char ch;#endif /* HAVE_SYS_DISKLABEL_H */ -#ifdef HAVE_OPEN64 - fd =open64 (file,O_RDONLY ); -#else - fd =open (file,O_RDONLY ); -#endif + fd =ext2fs_open_file (file,O_RDONLY );if (fd <0 )return errno;
lib/ext2fs/unix_io.c +3 -7
@@ -441,7 +441,7 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel)struct unix_private_data *data =NULL ;errcode_t retval;int open_flags, zeroes =0 ; -struct stat st; +ext2fs_struct_stat st;#ifdef __linux__struct utsname ut;#endif
@@ -482,11 +482,7 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel)#endif data->flags = flags; -#ifdef HAVE_OPEN64 - data->dev =open64 (io->name, open_flags); -#else - data->dev =open (io->name, open_flags); -#endif + data->dev =ext2fs_open_file (io->name, open_flags);if (data->dev <0 ) { retval = errno; goto cleanup;
@@ -552,7 +548,7 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel) (ut.release[2] == '4') && (ut.release[3] == '.') && (ut.release[4] == '1') && (ut.release[5] >= '0') && (ut.release[5] < '8')) && - (fstat(data->dev, &st) == 0) && + (ext2fs_stat(io->name, &st) == 0) && (S_ISBLK(st.st_mode))) {struct rlimit rlim;
misc/e2image.c +3 -15
@@ -1176,11 +1176,7 @@ static void install_image(char *device, char *image_fn, int type)exit (1 ); } -#ifdef HAVE_OPEN64 - fd =open64 (image_fn,O_RDONLY ); -#else - fd =open (image_fn,O_RDONLY ); -#endif + fd =ext2fs_open_file (image_fn,O_RDONLY );if (fd <0 ) {perror (image_fn);exit (1 );
@@ -1212,11 +1208,7 @@ static void install_image(char *device, char *image_fn, int type)static struct ext2_qcow2_hdr *check_qcow2_image (int *fd,char *name) { -#ifdef HAVE_OPEN64 - *fd =open64 (name,O_RDONLY ,0600 ); -#else - *fd =open (name,O_RDONLY ,0600 ); -#endif + *fd =ext2fs_open_file (name,O_RDONLY ,0600 );if (*fd <0 )return NULL ;
@@ -1300,11 +1292,7 @@ skip_device:if (strcmp (image_fn,"-" ) ==0 ) fd =1 ;else { -#ifdef HAVE_OPEN64 - fd =open64 (image_fn,O_CREAT |O_TRUNC |O_WRONLY ,0600 ); -#else - fd =open (image_fn,O_CREAT |O_TRUNC |O_WRONLY ,0600 ); -#endif + fd =ext2fs_open_file (image_fn,O_CREAT |O_TRUNC |O_WRONLY ,0600 );if (fd <0 ) {com_err (program_name, errno,_ ("while trying to open %s" ), argv[optind+1 ]);
misc/util.c +2 -8
@@ -79,15 +79,9 @@ void proceed_question(void)void check_plausibility (const char *device) {int val; -#ifdef HAVE_OPEN64 -struct stat64 s; +ext2fs_struct_stat s; - val =stat64 (device, &s); -#else -struct stat s; - - val =stat (device, &s); -#endif + val =ext2fs_stat (device, &s);if (val ==-1 ) { fprintf(stderr, _("Could not stat %s --- %s\n"),
resize/main.c +1 -5
@@ -256,11 +256,7 @@ int main (int argc, char ** argv) len =2 * len; } -#ifdef HAVE_OPEN64 - fd =open64 (device_name,O_RDWR ); -#else - fd =open (device_name,O_RDWR ); -#endif + fd =ext2fs_open_file (device_name,O_RDWR );if (fd <0 ) {com_err ("open" , errno,_ ("while opening %s" ), device_name);
Signature · 1 line
1.7.4.4
PATCH v2 2/5 e2fsprogs: Use punch hole as "discard" on regular files
If e2fsprogs tools (mke2fs, e2fsck) is run on regular file instead of on block device, we can use punch hole instead of regular discard command which would not work on regular file anyway. This gives us several advantages. First of all when e2fsck is run with '-E discard' parameter it will punch out all ununsed space from the image, hence trimming down the file system image. And secondly, when creating an file system on regular file (with '-E discard' which is default), we can use punch hole to clear the file content, hence we can skip inode table initialization, because reads from sparse area returns zeros. This will result in faster file system creation (without the need to specify lazy_itable_init) and smaller images.
This commit also fixes some tests that would fail due to mke2fs showing discard progress, hence the output would differ.
---
v2: fix tests for case there is no punch hole support
add ifdefs to cover no punch hole or fallocate support
lib/ext2fs/ext2_io.h | 1 + lib/ext2fs/unix_io.c | 53 ++++++++++++++++++++++++++++++++++++------ misc/mke2fs.c | 10 ++++++- tests/f_resize_inode/script | 1 + tests/m_bigjournal/script | 2 +- tests/run_mke2fs | 2 +- 6 files changed, 57 insertions(+), 12 deletions(-)
lib/ext2fs/ext2_io.h +1 -0
@@ -30,6 +30,7 @@ typedef struct struct_io_stats *io_stats;#define CHANNEL_FLAGS_WRITETHROUGH 0x01#define CHANNEL_FLAGS_DISCARD_ZEROES 0x02 +#define CHANNEL_FLAGS_BLOCK_DEVICE 0x04#define io_channel_discard_zeroes_data (i) (i->flags & CHANNEL_FLAGS_DISCARD_ZEROES)
lib/ext2fs/unix_io.c +45 -8
84 lines not on this page · raw message
misc/mke2fs.c +8 -2
@@ -2073,12 +2073,18 @@ static int mke2fs_discard_device(ext2_filsys fs)struct ext2fs_numeric_progress_struct progress;blk64_t blocks =ext2fs_blocks_count (fs->super);blk64_t count =DISCARD_STEP_MB ; -blk64_t cur =0 ; +blk64_t cur;int retval =0 ; - retval =io_channel_discard (fs->io,0 ,0 ); +/* +* Let's try if discard really works on the device, so +* we do not print numeric progress resulting in failure +* afterwards. +*/ + retval =io_channel_discard (fs->io,0 , fs->blocksize);if (retval)return retval; + cur = fs->blocksize; count *= (1024 *1024 ); count /= fs->blocksize;
tests/f_resize_inode/script +1 -0
@@ -15,6 +15,7 @@ dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1 echo mke2fs -F -O resize_inode -o Linux -b 1024 -g 1024 test.img 16384 > $OUT $MKE2FS -F -O resize_inode -o Linux -b 1024 -g 1024 $TMPFILE 16384 2>&1 \ | sed -e '1d' | grep -v "automatically checked" | + grep -v 'Discarding device blocks' | grep -v "whichever comes first" >> $OUT $FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1
tests/m_bigjournal/script +1 -1
@@ -1,4 +1,4 @@ DESCRIPTION="journal over 4GB in size" FS_SIZE=11000000 -MKE2FS_OPTS="-t ext4 -G 512 -N 1280 -J size=5000 -q -E lazy_journal_init,lazy_itable_init" +MKE2FS_OPTS="-t ext4 -G 512 -N 1280 -J size=5000 -q -E lazy_journal_init,lazy_itable_init,nodiscard" . $cmd_dir/run_mke2fs
tests/run_mke2fs +1 -1
@@ -9,7 +9,7 @@ MKE2FS_SKIP_PROGRESS=true MKE2FS_SKIP_CHECK_MSG=true export MKE2FS_SKIP_PROGRESS MKE2FS_SKIP_CHECK_MSG > $TMPFILE -PREP_CMD='$MKE2FS -F -o Linux $MKE2FS_OPTS $TMPFILE $FS_SIZE 2>&1 | sed -e 1d | tr -d \\015 > $OUT1 ; $DEBUGFS -R features $TMPFILE 2>&1 | sed -e 1d | tr -d \\015 >> $OUT1 ; echo " " >> $OUT1' +PREP_CMD='$MKE2FS -F -o Linux $MKE2FS_OPTS $TMPFILE $FS_SIZE 2>&1 | sed -e 1d | grep -v "Discarding device blocks" | tr -d \\015 > $OUT1 ; $DEBUGFS -R features $TMPFILE 2>&1 | sed -e 1d | tr -d \\015 >> $OUT1 ; echo " " >> $OUT1' AFTER_CMD='$DUMPE2FS $TMPFILE 2>&1 | sed -f $cmd_dir/filter_dumpe2fs | tr -d \\015 >> $OUT1' . $cmd_dir/run_e2fsck unset FS_SIZE MKE2FS_OPTS MKE2FS_SKIP_PROGRESS
Signature · 1 line
1.7.4.4
Ted Ts'o
AppliedRe: [PATCH 2/5 v2] e2fsprogs: Use punch hole as "discard" on regular files
Quoted 12 lines · Lukas Czerner
If e2fsprogs tools (mke2fs, e2fsck) is run on regular file instead of on block device, we can use punch hole instead of regular discard command which would not work on regular file anyway. This gives us several advantages. First of all when e2fsck is run with '-E discard' parameter it will punch out all ununsed space from the image, hence trimming down the file system image. And secondly, when creating an file system on regular file (with '-E discard' which is default), we can use punch hole to clear the file content, hence we can skip inode table initialization, because reads from sparse area returns zeros. This will result in faster file system creation (without the need to specify
lazy_itable_init) and smaller images.
Quoted 4 lines
This commit also fixes some tests that would fail due to mke2fs showing discard progress, hence the output would differ.
Signed-off-by Lukas Czerner <[email protected]>
Applied to the next branch, thanks. (I combined the following patch which added the configure.in test for linux/falloc.h, since it's needed by this patch.)
- Ted
PATCH v2 3/5 configure.in: add check for linux/falloc.h header
In reply to Lukas CzernerWe need to check if we have linux/falloc.h header in the system so we can do fallocate on images.
---
v2: This is the actually the first version of the patch
configure | 368 ++++++++++++++++++++++++++++++---------------------------- configure.in | 2 +- 2 files changed, 190 insertions(+), 180 deletions(-)
configure +189 -179
@@ -1,11 +1,11 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.65. +# Generated by GNU Autoconf 2.66. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. # # # This configure script is free software; the Free Software Foundation
@@ -316,7 +316,7 @@ $as_echo X"$as_dir" | test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p
@@ -356,19 +356,19 @@ else fi # as_fn_arith -# as_fn_error ERROR [LINENO LOG_FD] -# --------------------------------- +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with status $?, using 1 if that was 0. +# script with STATUS, using 1 if that was 0. as_fn_error () { - as_status=$?; test $as_status -eq 0 && as_status=1 - if test "$3"; then - as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $1" >&2 + $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error
@@ -530,7 +530,7 @@ test -n "$DJDIR" || exec 7<&0 </dev/null exec 6>&1 # Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
@@ -934,7 +934,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in
@@ -960,7 +960,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in
@@ -1164,7 +1164,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in
@@ -1180,7 +1180,7 @@ do ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in
@@ -1210,8 +1210,8 @@ do | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) as_fn_error "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information." + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" ;; *=*)
@@ -1219,7 +1219,7 @@ Try \`$0 --help' for more information." # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error "invalid variable name: \`$ac_envvar'" ;; + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;;
@@ -1237,13 +1237,13 @@ done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error "missing argument to $ac_option" + as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; - fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi
@@ -1266,7 +1266,7 @@ do [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac - as_fn_error "expected an absolute directory name for --$ac_var: $ac_val" + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host'
@@ -1280,8 +1280,8 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi
@@ -1296,9 +1296,9 @@ test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error "working directory cannot be determined" + as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error "pwd does not report name of working directory" + as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified.
@@ -1337,11 +1337,11 @@ else fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error "cannot find sources ($ac_unique_file) in $srcdir" + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg" + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then
@@ -1381,7 +1381,7 @@ Configuration: --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages + -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files
@@ -1557,9 +1557,9 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure -generated by GNU Autoconf 2.65 +generated by GNU Autoconf 2.66 -Copyright (C) 2009 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF
@@ -1699,10 +1699,10 @@ fi ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + if eval "test \"\${$3+set}\"" = set; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3
@@ -1765,7 +1765,7 @@ $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler"
@@ -1829,7 +1829,7 @@ ac_fn_c_check_header_compile () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -1860,7 +1860,7 @@ ac_fn_c_check_type () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=no"
@@ -1913,7 +1913,7 @@ ac_fn_c_check_func () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2159,7 +2159,7 @@ ac_fn_c_check_member () as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } -if { as_var=$4; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${$4+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2207,15 +2207,18 @@ $as_echo "$ac_res" >&6; } } # ac_fn_c_check_member -# ac_fn_c_check_decl LINENO SYMBOL VAR -# ------------------------------------ -# Tests whether SYMBOL is declared, setting cache variable VAR accordingly. +# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES +# --------------------------------------------- +# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +# accordingly. ac_fn_c_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $2 is declared" >&5 -$as_echo_n "checking whether $2 is declared... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + as_decl_name=`echo $2|sed 's/ *(.*//'` + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +$as_echo_n "checking whether $as_decl_name is declared... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2224,8 +2227,12 @@ $4 int main () { -#ifndef $2 - (void) $2; +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif #endif ;
@@ -2250,7 +2257,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.65. Invocation command line was +generated by GNU Autoconf 2.66. Invocation command line was $ $0 $@
@@ -2360,11 +2367,9 @@ trap 'exit_status=$? { echo - cat <<\_ASBOX -## ---------------- ## + $as_echo "## ---------------- ## ## Cache variables. ## -## ---------------- ## -_ASBOX +## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, (
@@ -2398,11 +2403,9 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; ) echo - cat <<\_ASBOX -## ----------------- ## + $as_echo "## ----------------- ## ## Output variables. ## -## ----------------- ## -_ASBOX +## ----------------- ##" echo for ac_var in $ac_subst_vars do
@@ -2415,11 +2418,9 @@ _ASBOX echo if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------------- ## + $as_echo "## ------------------- ## ## File substitutions. ## -## ------------------- ## -_ASBOX +## ------------------- ##" echo for ac_var in $ac_subst_files do
@@ -2433,11 +2434,9 @@ _ASBOX fi if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## + $as_echo "## ----------- ## ## confdefs.h. ## -## ----------- ## -_ASBOX +## ----------- ##" echo cat confdefs.h echo
@@ -2492,7 +2491,12 @@ _ACEOF ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - ac_site_file1=$CONFIG_SITE + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site
@@ -2507,7 +2511,11 @@ do { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } fi done
@@ -2586,7 +2594,7 @@ if $ac_cache_corrupted; then $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ##
@@ -2602,16 +2610,22 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in config "$srcdir"/config; do - for ac_t in install-sh install.sh shtool; do - if test -f "$ac_dir/$ac_t"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/$ac_t -c" - break 2 - fi - done + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi done if test -z "$ac_aux_dir"; then - as_fn_error "cannot find install-sh, install.sh, or shtool in config \"$srcdir\"/config" "$LINENO" 5 + as_fn_error $? "cannot find install-sh, install.sh, or shtool in config \"$srcdir\"/config" "$LINENO" 5 fi # These three variables are undocumented and unsupported,
@@ -2685,7 +2699,7 @@ $as_echo "Release date is ${E2FSPROGS_MONTH}, ${E2FSPROGS_YEAR}" >&6; } # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; }
@@ -2696,16 +2710,16 @@ else test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && - as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5 + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; -*) as_fn_error "invalid value of canonical build" "$LINENO" 5;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-'
@@ -2730,7 +2744,7 @@ else ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi
@@ -2738,7 +2752,7 @@ fi $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; -*) as_fn_error "invalid value of canonical host" "$LINENO" 5;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-'
@@ -3055,8 +3069,8 @@ fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "no acceptable C compiler found in \$PATH -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
@@ -3170,9 +3184,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "C compiler cannot create executables -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; }
@@ -3214,8 +3227,8 @@ done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
@@ -3272,9 +3285,9 @@ $as_echo "$ac_try_echo"; } >&5 else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot run C compiled programs. +as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. -See \`config.log' for more details." "$LINENO" 5; } +See \`config.log' for more details" "$LINENO" 5; } fi fi fi
@@ -3325,8 +3338,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of object files: cannot compile -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi
@@ -3602,19 +3615,19 @@ fi # Check whether --with-cc was given. if test "${with_cc+set}" = set; then : - withval=$with_cc; as_fn_error "--with-cc no longer supported; use CC= instead" "$LINENO" 5 + withval=$with_cc; as_fn_error $? "--with-cc no longer supported; use CC= instead" "$LINENO" 5 fi # Check whether --with-ccopts was given. if test "${with_ccopts+set}" = set; then : - withval=$with_ccopts; as_fn_error "--with-ccopts no longer supported; use CFLAGS= instead" "$LINENO" 5 + withval=$with_ccopts; as_fn_error $? "--with-ccopts no longer supported; use CFLAGS= instead" "$LINENO" 5 fi # Check whether --with-ldopts was given. if test "${with_ldopts+set}" = set; then : - withval=$with_ldopts; as_fn_error "--with-ldopts no longer supported; use LDFLAGS= instead" "$LINENO" 5 + withval=$with_ldopts; as_fn_error $? "--with-ldopts no longer supported; use LDFLAGS= instead" "$LINENO" 5 fi ac_ext=c
@@ -3917,8 +3930,8 @@ fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "no acceptable C compiler found in \$PATH -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
@@ -4284,8 +4297,8 @@ if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." "$LINENO" 5; } +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c
@@ -4346,7 +4359,7 @@ esac done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then - as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP
@@ -4412,7 +4425,7 @@ esac done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then - as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP
@@ -4544,8 +4557,7 @@ do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF
@@ -5046,7 +5058,7 @@ if test "${enable_libuuid+set}" = set; then : enableval=$enable_libuuid; if test "$enableval" = "no" then if test -z "$PKG_CONFIG"; then - as_fn_error "pkg-config not installed; please install it." "$LINENO" 5 + as_fn_error $? "pkg-config not installed; please install it." "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_generate in -luuid" >&5
@@ -5089,7 +5101,7 @@ if test "x$ac_cv_lib_uuid_uuid_generate" = x""yes; then : LIBUUID=`$PKG_CONFIG --libs uuid`; STATIC_LIBUUID=`$PKG_CONFIG --static --libs uuid` else - as_fn_error "external uuid library not found" "$LINENO" 5 + as_fn_error $? "external uuid library not found" "$LINENO" 5 fi UUID_CMT=#
@@ -5253,7 +5265,7 @@ if test "${enable_libblkid+set}" = set; then : enableval=$enable_libblkid; if test "$enableval" = "no" then if test -z "$PKG_CONFIG"; then - as_fn_error "pkg-config not installed; please install it." "$LINENO" 5 + as_fn_error $? "pkg-config not installed; please install it." "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for blkid_get_cache in -lblkid" >&5
@@ -5296,7 +5308,7 @@ if test "x$ac_cv_lib_blkid_blkid_get_cache" = x""yes; then : LIBBLKID=`$PKG_CONFIG --libs blkid`; STATIC_LIBBLKID=`$PKG_CONFIG --static --libs blkid` else - as_fn_error "external blkid library not found" "$LINENO" 5 + as_fn_error $? "external blkid library not found" "$LINENO" 5 fi BLKID_CMT=#
@@ -5600,7 +5612,7 @@ _ACEOF $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF
@@ -5608,7 +5620,7 @@ SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;;
@@ -6784,8 +6796,7 @@ if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -eval as_val=\$$as_ac_var - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define CRAY_STACKSEG_END $ac_func
@@ -6855,8 +6866,7 @@ do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF
@@ -7519,7 +7529,7 @@ else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi -test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5 +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if test "${acl_cv_prog_gnu_ld+set}" = set; then :
@@ -7973,8 +7983,7 @@ stdlib.h string.h unistd.h sys/param.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF
@@ -7990,8 +7999,7 @@ __fsetlocking do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -eval as_val=\$$as_ac_var - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF
@@ -9205,7 +9213,7 @@ $as_echo "#define HAVE_DCGETTEXT 1" >>confdefs.h $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then : +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF
@@ -9213,7 +9221,7 @@ SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;;
@@ -9573,7 +9581,7 @@ esac done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then - as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP
@@ -10086,12 +10094,11 @@ fi done fi -for ac_header in dirent.h errno.h getopt.h malloc.h mntent.h paths.h semaphore.h setjmp.h signal.h stdarg.h stdint.h stdlib.h termios.h termio.h unistd.h utime.h linux/fd.h linux/major.h net/if_dl.h netinet/in.h sys/disklabel.h sys/file.h sys/ioctl.h sys/mkdev.h sys/mman.h sys/prctl.h sys/queue.h sys/resource.h sys/select.h sys/socket.h sys/sockio.h sys/stat.h sys/syscall.h sys/sysmacros.h sys/time.h sys/types.h sys/un.h sys/wait.h +for ac_header in dirent.h errno.h getopt.h malloc.h mntent.h paths.h semaphore.h setjmp.h signal.h stdarg.h stdint.h stdlib.h termios.h termio.h unistd.h utime.h linux/fd.h linux/major.h net/if_dl.h netinet/in.h sys/disklabel.h sys/file.h sys/ioctl.h sys/mkdev.h sys/mman.h sys/prctl.h sys/queue.h sys/resource.h sys/select.h sys/socket.h sys/sockio.h sys/stat.h sys/syscall.h sys/sysmacros.h sys/time.h sys/types.h sys/un.h sys/wait.h linux/falloc.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF
@@ -10109,8 +10116,7 @@ ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " #endif " -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF
@@ -10203,9 +10209,8 @@ else if test "$ac_cv_type_short" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (short) -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "cannot compute sizeof (short) +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_short=0 fi
@@ -10237,9 +10242,8 @@ else if test "$ac_cv_type_int" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (int) -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "cannot compute sizeof (int) +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_int=0 fi
@@ -10271,9 +10275,8 @@ else if test "$ac_cv_type_long" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (long) -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "cannot compute sizeof (long) +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long=0 fi
@@ -10305,9 +10308,8 @@ else if test "$ac_cv_type_long_long" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "cannot compute sizeof (long long) -See \`config.log' for more details." "$LINENO" 5; }; } +as_fn_error 77 "cannot compute sizeof (long long) +See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long_long=0 fi
@@ -10552,7 +10554,7 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) - as_fn_error "unknown endianness + as_fn_error $? "unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac
@@ -10727,8 +10729,7 @@ for ac_func in chflags getrusage llseek lseek64 open64 fstat64 ftruncate64 getmn do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -eval as_val=\$$as_ac_var - if test "x$as_val" = x""yes; then : +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF
@@ -11245,6 +11246,7 @@ DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= +U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
@@ -11407,19 +11409,19 @@ export LANGUAGE (unset CDPATH) >/dev/null 2>&1 && unset CDPATH -# as_fn_error ERROR [LINENO LOG_FD] -# --------------------------------- +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with status $?, using 1 if that was 0. +# script with STATUS, using 1 if that was 0. as_fn_error () { - as_status=$?; test $as_status -eq 0 && as_status=1 - if test "$3"; then - as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $1" >&2 + $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error
@@ -11615,7 +11617,7 @@ $as_echo X"$as_dir" | test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p
@@ -11669,7 +11671,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by $as_me, which was -generated by GNU Autoconf 2.65. Invocation command line was +generated by GNU Autoconf 2.66. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS
@@ -11726,10 +11728,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.65, +configured by $0, generated by GNU Autoconf 2.66, with options \\"\$ac_cs_config\\" -Copyright (C) 2009 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it."
@@ -11782,7 +11784,7 @@ do ac_cs_silent=: ;; # This is an error. - -*) as_fn_error "unrecognized option: \`$1' + -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1"
@@ -11845,7 +11847,7 @@ do "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; "$outlist") CONFIG_FILES="$CONFIG_FILES $outlist" ;; - *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done
@@ -11882,7 +11884,7 @@ $debug || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") -} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES.
@@ -11916,7 +11918,7 @@ if test "x$ac_cr" = x; then fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\r' + ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi
@@ -11933,7 +11935,7 @@ _ACEOF echo "_ACEOF" } >conf$$files.sh && . ./conf$$files.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 rm -f conf$$files.sh {
@@ -11941,18 +11943,18 @@ rm -f conf$$files.sh echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi
@@ -12047,20 +12049,28 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then else cat fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ - || as_fn_error "could not setup config files machinery" "$LINENO" 5 + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// s/^[^=]*=[ ]*$// }' fi
@@ -12078,7 +12088,7 @@ do esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac
@@ -12106,7 +12116,7 @@ do [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'"
@@ -12133,7 +12143,7 @@ $as_echo "$as_me: creating $ac_file" >&6;} case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac
@@ -12269,22 +12279,22 @@ if $ac_cs_awk_getline; then else $AWK -f "$tmp/subs.awk" | $SHELL fi >$tmp/out \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&5 +which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&2;} +which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
@@ -12414,7 +12424,7 @@ _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || - as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5 + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status.
@@ -12435,7 +12445,7 @@ if test "$no_create" != yes; then exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit $? + $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
configure.in +1 -1
@@ -747,7 +747,7 @@ if test $cross_compiling = no; then else AC_CHECK_PROGS(BUILD_CC, gcc cc) fi -AC_CHECK_HEADERS(dirent.h errno.h getopt.h malloc.h mntent.h paths.h semaphore.h setjmp.h signal.h stdarg.h stdint.h stdlib.h termios.h termio.h unistd.h utime.h linux/fd.h linux/major.h net/if_dl.h netinet/in.h sys/disklabel.h sys/file.h sys/ioctl.h sys/mkdev.h sys/mman.h sys/prctl.h sys/queue.h sys/resource.h sys/select.h sys/socket.h sys/sockio.h sys/stat.h sys/syscall.h sys/sysmacros.h sys/time.h sys/types.h sys/un.h sys/wait.h) +AC_CHECK_HEADERS(dirent.h errno.h getopt.h malloc.h mntent.h paths.h semaphore.h setjmp.h signal.h stdarg.h stdint.h stdlib.h termios.h termio.h unistd.h utime.h linux/fd.h linux/major.h net/if_dl.h netinet/in.h sys/disklabel.h sys/file.h sys/ioctl.h sys/mkdev.h sys/mman.h sys/prctl.h sys/queue.h sys/resource.h sys/select.h sys/socket.h sys/sockio.h sys/stat.h sys/syscall.h sys/sysmacros.h sys/time.h sys/types.h sys/un.h sys/wait.h linux/falloc.h) AC_CHECK_HEADERS(sys/disk.h sys/mount.h,,, [[ #if HAVE_SYS_QUEUE_H
Signature · 1 line
1.7.4.4
PATCH v2 4/5 e2fsck: do not attempt to discard if -n was specified
In reply to Lukas CzernerIf '-n' option is specified there should be no changes made to the file system hence we should not attempt to discard the file system. This commit adds a check into the e2fsck_discard_blocks() condition so it skip discard if E2F_OPT_NO flag is set.
---
v2: This is the actually the first version of the patch
e2fsck/pass5.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
e2fsck/pass5.c +3 -4
@@ -87,7 +87,8 @@ static void e2fsck_discard_blocks(e2fsck_t ctx, io_manager manager,if (ext2fs_test_changed (ctx->fs)) ctx->options &= ~E2F_OPT_DISCARD ; -if ((ctx->options &E2F_OPT_DISCARD ) && +if (!(ctx->options &E2F_OPT_NO ) && + (ctx->options &E2F_OPT_DISCARD ) && (io_channel_discard (fs->io, start, count))) ctx->options &= ~E2F_OPT_DISCARD ; }
@@ -331,11 +332,9 @@ redo_counts:if (first_free > i) first_free = i; }else { -if ((i > first_free) && - (ctx->options &E2F_OPT_DISCARD )) { +if (i > first_free)e2fsck_discard_blocks (ctx, manager, first_free, (i - first_free)); - } first_free =ext2fs_blocks_count (fs->super); } blocks ++;
Signature · 1 line
1.7.4.4
Ted Ts'o
AppliedRe: [PATCH 4/5 v2] e2fsck: do not attempt to discard if -n was specified
Quoted 6 lines · Lukas Czerner
If '-n' option is specified there should be no changes made to the file system hence we should not attempt to discard the file system. This commit adds a check into the
e2fsck_discard_blocks()condition so it skip discard ifE2F_OPT_NOflag is set.Signed-off-by Lukas Czerner <[email protected]>
Thanks, applied to the next branch.
- Ted
PATCH v2 5/5 tests: Print out list of failed tests
In reply to Lukas CzernerCurrently we need to grep, list or just search for failed tests when running 'make check' which is annoying. This commit simply prints out the list of failed test names at the end of the output.
---
v2: This is the actually the first version of the patch
tests/test_script.in | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-)
tests/test_script.in +9 -1
@@ -78,4 +78,12 @@ num_failed=`ls *.failed 2>/dev/null | wc -l` echo "$num_ok tests succeeded $num_failed tests failed" -test "$num_failed" -eq 0 || exit 1 +test "$num_failed" -eq 0 && exit 0 + +echo -n "Tests failed: " +for fname in $(ls *.failed); do + echo -n "${fname%%.failed} " +done +echo "" + +exit 1
Signature · 1 line
1.7.4.4
Ted Ts'o
AppliedRe: [PATCH 5/5 v2] tests: Print out list of failed tests
Quoted 5 lines · Lukas Czerner
Currently we need to grep, list or just search for failed tests when running 'make check' which is annoying. This commit simply prints out the list of failed test names at the end of the output.
Signed-off-by Lukas Czerner <[email protected]>
Thanks, applied to the next branch.
- Ted
Quoted 4 lines · Lukas Czerner
In many places we are using #ifdef
HAVE_OPEN64to determine if we can useopen64()but that's ugly. This commit creates two new helpersext2fs_open_file()foropen()andext2fs_stat()forstat(). Also we need new typedefext2fs_struct_statfor struct stat.
Hi Ted,
ping on the whole series.
Thanks!
-Lukas
Quoted 242 lines
Signed-off-by Lukas Czerner <[email protected]>---
v2: This is the actually the first version of the patchlib/ext2fs/ext2fs.h | 38 ++++++++++++++++++++++++++++++++++++++ lib/ext2fs/getsectsize.c | 12 ++---------- lib/ext2fs/getsize.c | 6 +----- lib/ext2fs/unix_io.c | 10 +++------- misc/e2image.c | 18 +++--------------- misc/util.c | 10 ++-------- resize/main.c | 6 +----- 7 files changed, 50 insertions(+), 50 deletions(-)lib/ext2fs/ext2fs.h +38
-0@@ -584,6 +584,12 @@ typedef struct ext2_icount *ext2_icount_t;#define EXT2FS_NUM_B2C (fs, blks) (((blks) + EXT2FS_CLUSTER_MASK(fs)) >> \ (fs)->cluster_ratio_bits) +#ifdef HAVE_OPEN64 +typedef struct stat64 ext2fs_struct_stat ; +#else +typedef struct stat ext2fs_struct_stat ; +#endif +/* * function prototypes */ @@ -1388,6 +1394,8 @@ extern blk_t ext2fs_inode_data_blocks(ext2_filsys fs, struct ext2_inode *inode);extern unsigned int ext2fs_div_ceil (unsigned int a,unsigned int b);extern __u64 ext2fs_div64_ceil (__u64 a,__u64 b); +extern int ext2fs_open_file (const char *pathname,int flags, ...); +extern int ext2fs_stat (const char *path,ext2fs_struct_stat *buf);/* * The actual inlined functions definitions themselves... @@ -1638,6 +1646,36 @@ _INLINE_ __u64 ext2fs_div64_ceil(__u64 a, __u64 b)return ((a -1 ) / b) +1 ; } +_INLINE_ int ext2fs_open_file(const char *pathname, int flags, ...) +{ +va_list args; +mode_t mode; + +va_start (args, flags); + mode =va_arg (args, mode_t); +va_end (args); + + if (mode) +#ifdef HAVE_OPEN64 +return open64 (pathname, flags, mode); + else + return open64(pathname, flags); +#else +return open (pathname, flags, mode); + else + return open(pathname, flags); +#endif +} + +_INLINE_ int ext2fs_stat(const char *path, ext2fs_struct_stat *buf) +{ +#ifdef HAVE_OPEN64 +return stat64 (path, buf); +#else +return open (path, buf); +#endif +} +#undef _INLINE_#endif lib/ext2fs/getsectsize.c +2
-10@@ -45,11 +45,7 @@ errcode_t ext2fs_get_device_sectsize(const char *file, int *sectsize) {int fd; -#ifdef HAVE_OPEN64 - fd =open64 (file,O_RDONLY ); -#else - fd =open (file,O_RDONLY ); -#endif + fd =ext2fs_open_file (file,O_RDONLY );if (fd <0 )return errno;@@ -71,11 +67,7 @@ errcode_t ext2fs_get_device_phys_sectsize(const char *file, int *sectsize) {int fd; -#ifdef HAVE_OPEN64 - fd =open64 (file,O_RDONLY ); -#else - fd =open (file,O_RDONLY ); -#endif + fd =ext2fs_open_file (file,O_RDONLY );if (fd <0 )return errno;lib/ext2fs/getsize.c +1
-5@@ -159,11 +159,7 @@ errcode_t ext2fs_get_device_size2(const char *file, int blocksize,char ch;#endif /* HAVE_SYS_DISKLABEL_H */ -#ifdef HAVE_OPEN64 - fd =open64 (file,O_RDONLY ); -#else - fd =open (file,O_RDONLY ); -#endif + fd =ext2fs_open_file (file,O_RDONLY );if (fd <0 )return errno;lib/ext2fs/unix_io.c +3
-7@@ -441,7 +441,7 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel)struct unix_private_data *data =NULL ;errcode_t retval;int open_flags, zeroes =0 ; -struct stat st; +ext2fs_struct_stat st;#ifdef __linux__struct utsname ut;#endif @@ -482,11 +482,7 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel)#endif data->flags = flags; -#ifdef HAVE_OPEN64 - data->dev =open64 (io->name, open_flags); -#else - data->dev =open (io->name, open_flags); -#endif + data->dev =ext2fs_open_file (io->name, open_flags);if (data->dev <0 ) { retval = errno; goto cleanup;@@ -552,7 +548,7 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel) (ut.release[2] == '4') && (ut.release[3] == '.') && (ut.release[4] == '1') && (ut.release[5] >= '0') && (ut.release[5] < '8')) && - (fstat(data->dev, &st) == 0) && + (ext2fs_stat(io->name, &st) == 0) && (S_ISBLK(st.st_mode))) {struct rlimit rlim;misc/e2image.c +3
-15@@ -1176,11 +1176,7 @@ static void install_image(char *device, char *image_fn, int type)exit (1 ); } -#ifdef HAVE_OPEN64 - fd =open64 (image_fn,O_RDONLY ); -#else - fd =open (image_fn,O_RDONLY ); -#endif + fd =ext2fs_open_file (image_fn,O_RDONLY );if (fd <0 ) {perror (image_fn);exit (1 );@@ -1212,11 +1208,7 @@ static void install_image(char *device, char *image_fn, int type)static struct ext2_qcow2_hdr *check_qcow2_image (int *fd,char *name) { -#ifdef HAVE_OPEN64 - *fd =open64 (name,O_RDONLY ,0600 ); -#else - *fd =open (name,O_RDONLY ,0600 ); -#endif + *fd =ext2fs_open_file (name,O_RDONLY ,0600 );if (*fd <0 )return NULL ;@@ -1300,11 +1292,7 @@ skip_device:if (strcmp (image_fn,"-" ) ==0 ) fd =1 ;else { -#ifdef HAVE_OPEN64 - fd =open64 (image_fn,O_CREAT |O_TRUNC |O_WRONLY ,0600 ); -#else - fd =open (image_fn,O_CREAT |O_TRUNC |O_WRONLY ,0600 ); -#endif + fd =ext2fs_open_file (image_fn,O_CREAT |O_TRUNC |O_WRONLY ,0600 );if (fd <0 ) {com_err (program_name, errno,_ ("while trying to open %s" ), argv[optind+1 ]);misc/util.c +2
-8@@ -79,15 +79,9 @@ void proceed_question(void)void check_plausibility (const char *device) {int val; -#ifdef HAVE_OPEN64 -struct stat64 s; +ext2fs_struct_stat s; - val =stat64 (device, &s); -#else -struct stat s; - - val =stat (device, &s); -#endif + val =ext2fs_stat (device, &s);if (val ==-1 ) { fprintf(stderr, _("Could not stat %s --- %s\n"),resize/main.c +1
-5@@ -256,11 +256,7 @@ int main (int argc, char ** argv) len =2 * len; } -#ifdef HAVE_OPEN64 - fd =open64 (device_name,O_RDWR ); -#else - fd =open (device_name,O_RDWR ); -#endif + fd =ext2fs_open_file (device_name,O_RDWR );if (fd <0 ) {com_err ("open" , errno,_ ("while opening %s" ), device_name);
Ted Ts'o
AppliedQuoted 6 lines · Lukas Czerner
In many places we are using #ifdef
HAVE_OPEN64to determine if we can useopen64()but that's ugly. This commit creates two new helpersext2fs_open_file()foropen()andext2fs_stat()forstat(). Also we need new typedefext2fs_struct_statfor struct stat.Signed-off-by Lukas Czerner <[email protected]>
Applied to the next branch, thanks.
- Ted