LIBQUOTA = @STATIC_LIBQUOTA@
LIBBLKID = @LIBBLKID@ @PRIVATE_LIBS_CMT@ $(LIBUUID)
LIBINTL = @LIBINTL@
+SYSLIBS = @LIBS@
DEPLIBSS = $(LIB)/libss@LIB_EXT@
DEPLIBCOM_ERR = $(LIB)/libcom_err@LIB_EXT@
DEPLIBUUID = @DEPLIBUUID@
+WITH_DIET_LIBC=
+
+# Check whether --with-diet-libc was given.
+if test "${with_diet_libc+set}" = set; then :
+ withval=$with_diet_libc; CC="diet cc -nostdinc"
+WITH_DIET_LIBC=yes
+if test -z "$LIBS"
+then
+ LIBS="-lcompat"
+else
+ LIBS="$LIBS -lcompat"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: CC=$CC" >&5
+$as_echo "CC=$CC" >&6; }
+fi
# 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
fi
-WITH_DIET_LIBC=
-
-# Check whether --with-diet-libc was given.
-if test "${with_diet_libc+set}" = set; then :
- withval=$with_diet_libc; CC="diet cc -nostdinc"
-WITH_DIET_LIBC=yes
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: CC=$CC" >&5
-$as_echo "CC=$CC" >&6; }
-fi
# Check whether --with-cc was given.
if test "${with_cc+set}" = set; then :
fi
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Enabling e4defrag support by default" >&5
+ if test -z "$WITH_DIET_LIBC"
+then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Enabling e4defrag support by default" >&5
$as_echo "Enabling e4defrag support by default" >&6; }
-DEFRAG_CMT=
+ DEFRAG_CMT=
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Disabling e4defrag support by default" >&5
+$as_echo "Disabling e4defrag support by default" >&6; }
+ DEFRAG_CMT="#"
+fi
fi
fi
+ac_fn_c_check_member "$LINENO" "struct stat" "st_atim" "ac_cv_member_struct_stat_st_atim" "$ac_includes_default"
+if test "x$ac_cv_member_struct_stat_st_atim" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_ATIM 1
+_ACEOF
+
+
+fi
+
ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "#include <sys/types.h>
"
if test "x$ac_cv_type_ssize_t" = xyes; then :
fi
fi
-for ac_func in __secure_getenv backtrace blkid_probe_get_topology chflags fallocate fallocate64 fchown fdatasync fstat64 ftruncate64 getdtablesize getmntinfo getpwuid_r getrlimit getrusage jrand48 llseek lseek64 mallinfo mbstowcs memalign mmap msync nanosleep open64 pathconf posix_fadvise posix_memalign prctl secure_getenv setmntent setresgid setresuid srandom strcasecmp strdup strnlen strptime strtoull sync_file_range sysconf usleep utime valloc
+for ac_func in __secure_getenv backtrace blkid_probe_get_topology chflags fadvise64 fallocate fallocate64 fchown fdatasync fstat64 ftruncate64 futimes getcwd getdtablesize getmntinfo getpwuid_r getrlimit getrusage jrand48 llseek lseek64 mallinfo mbstowcs memalign mempcpy mmap msync nanosleep open64 pathconf posix_fadvise posix_fadvise64 posix_memalign prctl secure_getenv setmntent setresgid setresuid srandom stpcpy strcasecmp strdup strnlen strptime strtoull sync_file_range sysconf usleep utime valloc
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"
if test "$USE_INCLUDED_LIBINTL" = "yes" ; then
INCLUDES=$INCLUDES' -I$(top_builddir)/intl -I$(top_srcdir)/intl'
fi
+if test -n "$WITH_DIET_LIBC" ; then
+ INCLUDES="$INCLUDES -D_REENTRANT"
+fi
if test $cross_compiling = no; then
- BUILD_CFLAGS="$CFLAGS $CPPFLAGS"
+ BUILD_CFLAGS="$CFLAGS $CPPFLAGS $INCLUDES -DHAVE_CONFIG_H"
BUILD_LDFLAGS="$LDFLAGS"
else
BUILD_CFLAGS=
AC_SUBST(E2FSPROGS_DAY)
AC_SUBST(E2FSPROGS_VERSION)
AC_SUBST(E2FSPROGS_PKGVER)
-AC_CANONICAL_HOST
-dnl
-dnl Check to see if libdl exists for the sake of dlopen
-dnl
-DLOPEN_LIB=''
-AC_CHECK_LIB(dl, dlopen,
-[DLOPEN_LIB=-ldl
-AC_DEFINE(HAVE_DLOPEN, 1, [Define to 1 if dlopen/libdl exists])])
-AC_SUBST(DLOPEN_LIB)
dnl
dnl Use diet libc
dnl
[ --with-diet-libc use diet libc],
CC="diet cc -nostdinc"
WITH_DIET_LIBC=yes
+if test -z "$LIBS"
+then
+ LIBS="-lcompat"
+else
+ LIBS="$LIBS -lcompat"
+fi
AC_MSG_RESULT(CC=$CC))dnl
dnl
+AC_CANONICAL_HOST
+dnl
+dnl Check to see if libdl exists for the sake of dlopen
+dnl
+DLOPEN_LIB=''
+AC_CHECK_LIB(dl, dlopen,
+[DLOPEN_LIB=-ldl
+AC_DEFINE(HAVE_DLOPEN, 1, [Define to 1 if dlopen/libdl exists])])
+AC_SUBST(DLOPEN_LIB)
+dnl
AC_ARG_WITH([cc],
AC_HELP_STRING([--with-cc],[no longer supported, use CC= instead]),
AC_MSG_ERROR([--with-cc no longer supported; use CC= instead]))
AC_MSG_RESULT([Enabling e4defrag support])
fi
,
-AC_MSG_RESULT([Enabling e4defrag support by default])
-DEFRAG_CMT=
+if test -z "$WITH_DIET_LIBC"
+then
+ AC_MSG_RESULT([Enabling e4defrag support by default])
+ DEFRAG_CMT=
+else
+ AC_MSG_RESULT([Disabling e4defrag support by default])
+ DEFRAG_CMT="#"
+fi
)
AC_SUBST(DEFRAG_CMT)
dnl
AC_CHECK_MEMBER(struct dirent.d_reclen,[AC_DEFINE(HAVE_RECLEN_DIRENT, 1,
[Define to 1 if dirent has d_reclen])],,
[#include <dirent.h>])
+AC_CHECK_MEMBERS([struct stat.st_atim])
dnl Check to see if ssize_t was declared
AC_CHECK_TYPE(ssize_t,[AC_DEFINE(HAVE_TYPE_SSIZE_T, 1,
[Define to 1 if ssize_t declared])],,
backtrace
blkid_probe_get_topology
chflags
+ fadvise64
fallocate
fallocate64
fchown
fdatasync
fstat64
ftruncate64
+ futimes
+ getcwd
getdtablesize
getmntinfo
getpwuid_r
mallinfo
mbstowcs
memalign
+ mempcpy
mmap
msync
nanosleep
open64
pathconf
posix_fadvise
+ posix_fadvise64
posix_memalign
prctl
secure_getenv
setresgid
setresuid
srandom
+ stpcpy
strcasecmp
strdup
strnlen
if test "$USE_INCLUDED_LIBINTL" = "yes" ; then
INCLUDES=$INCLUDES' -I$(top_builddir)/intl -I$(top_srcdir)/intl'
fi
+if test -n "$WITH_DIET_LIBC" ; then
+ INCLUDES="$INCLUDES -D_REENTRANT"
+fi
AC_SUBST(INCLUDES)
dnl
dnl Build CFLAGS
dnl
if test $cross_compiling = no; then
- BUILD_CFLAGS="$CFLAGS $CPPFLAGS"
+ BUILD_CFLAGS="$CFLAGS $CPPFLAGS $INCLUDES -DHAVE_CONFIG_H"
BUILD_LDFLAGS="$LDFLAGS"
else
BUILD_CFLAGS=
-- Theodore Y. Ts'o <tytso@mit.edu> Mon, 28 Dec 2013 23:25:42 -0400
+e2fsprogs (1.42.9-2) unstable; urgency=low
+
+ * Fix lintian warning: debian-changelog-has-wrong-weekday
+ * Fix lintian warning: non-standard-dir-perm by using dh_strip's
+ --dbg-package option instead of manually managing the debug files
+ * Fix printf type format mismatch in e2image
+ * Improved debugfs's error reporting when parsing block numbers
+ * Use consistent configure options across the multiple e2fsprogs
+ builds; this means that e2fsck.static will now use the blkid library
+ shipped with util-linux, instead of the internal one shipped with
+ the e2fsprogs sources.
+
+ -- Theodore Y. Ts'o <tytso@mit.edu> Mon, 30 Dec 2013 16:56:50 -0500
+
e2fsprogs (1.42.9-1) unstable; urgency=low
* New upstream version
* Updated/fixed various man pages. (Closes: #586218, #669730,
#698076, #731329)
- -- Theodore Y. Ts'o <tytso@mit.edu> Tue, 28 Dec 2013 23:18:36 -0500
->>>>>>> maint
+ -- Theodore Y. Ts'o <tytso@mit.edu> Sat, 28 Dec 2013 23:18:36 -0500
e2fsprogs (1.42.8-1) unstable; urgency=low
hard disks on Debian and other Linux systems.
.
This package contains programs for creating, checking, and maintaining
- ext2/3/4-based file systems.
+ ext2/3/4-based file systems. It also includes the "badbocks" program,
+ which can be used to scan for bad blocks on a disk or other storage device.
Package: e2fsprogs-dbg
Section: debug
BF_CFLAGS = -Os -fomit-frame-pointer
-COMMON_CONF_FLAGS = --disable-e2initrd-helper --enable-elf-shlibs \
- --enable-quota --infodir=/usr/share/info
ifeq ($(UTIL_LINUX_NG),yes)
-COMMON_CONF_FLAGS += --disable-fsck --disable-libblkid \
+UTIL_CONF_FLAGS ?= --disable-fsck --disable-libblkid \
--disable-libuuid --disable-uuidd
else
-COMMON_CONF_FLAGS += --enable-fsck
+UTIL_CONF_FLAGS ?= --enable-fsck --enable-libblkid \
+ --enable-libuuid --enable-uuidd
endif
ifneq ($(strip $(DEB_HOST_MULTIARCH)),)
BACKTRACE_CONF_FLAGS ?= $(shell if ${debdir}/scripts/test-backtrace ; then echo --disable-backtrace ; fi)
-STD_CONF_FLAGS ?= --enable-symlink-install $(MULTIARCH_CONF) $(BACKTRACE_CONF_FLAGS)
+COMMON_CONF_FLAGS = --disable-e2initrd-helper --enable-quota \
+ --infodir=/usr/share/info --enable-symlink-install \
+ $(MULTIARCH_CONF) $(BACKTRACE_CONF_FLAGS) $(UTIL_CONF_FLAGS)
-BF_CONF_FLAGS ?= --disable-nls --disable-imager --disable-testio-debug \
- --disable-uuidd --disable-tls --disable-debugfs
+STD_CONF_FLAGS ?= --enable-elf-shlibs
+
+BF_CONF_FLAGS ?= --enable-elf-shlibs --disable-nls --disable-imager \
+ --disable-testio-debug --disable-uuidd --disable-tls --disable-debugfs
STATIC_CONF_FLAGS ?= --disable-nls --disable-imager \
--disable-uuidd --disable-tls
WITH_DIET_LIBC =
else
M4_ARGS+=-DDIETLIBC
-WITH_DIET_LIBC = --with-diet-libc
+WITH_DIET_LIBC = --with-diet-libc --enable-libuuid --enable-libblkid
endif
ifneq ($(BUILD_E2FSCK_STATIC),no)
mkdir -p ${stdbuilddir}
ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
cd ${stdbuilddir} && AWK=/usr/bin/awk \
- ${topdir}/configure ${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS} ${EXTRA_CONF_FLAGS} \
- CFLAGS="${CFLAGS}" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
+ ${topdir}/configure ${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS} \
+ ${EXTRA_CONF_FLAGS} CFLAGS="${CFLAGS}" CPPFLAGS="$(CPPFLAGS)" \
+ LDFLAGS="$(LDFLAGS)"
else
cd ${stdbuilddir} && AWK=/usr/bin/awk CC="${DEB_HOST_GNU_TYPE}-gcc" \
- ${topdir}/configure ${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS} ${EXTRA_CONF_FLAGS} \
- --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) \
- CFLAGS="${CFLAGS}" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
+ ${topdir}/configure ${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS} \
+ ${EXTRA_CONF_FLAGS} --build=$(DEB_BUILD_GNU_TYPE) \
+ --host=$(DEB_HOST_GNU_TYPE) CFLAGS="${CFLAGS}" \
+ CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
endif
# specially-built MIPS libs
ifneq ($(ismips),)
mkdir -p ${mipsbuilddir} ${mipsbuilddir64}
cd ${mipsbuilddir} && AWK=/usr/bin/awk \
- ${topdir}/configure ${MIPS_NOPIC_CONF_FLAGS} \
- CFLAGS="${CFLAGS}" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
+ ${topdir}/configure ${COMMON_CONF_FLAGS} \
+ ${MIPS_NOPIC_CONF_FLAGS} CFLAGS="${CFLAGS}" \
+ CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
cd ${mipsbuilddir64} && AWK=/usr/bin/awk \
- ${topdir}/configure ${MIPS_NOPIC_CONF_FLAGS} \
- CFLAGS="${CFLAGS}" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
+ ${topdir}/configure ${COMMON_CONF_FLAGS} \
+ ${MIPS_NOPIC_CONF_FLAGS} CFLAGS="${CFLAGS}" \
+ CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
endif
mkdir -p ${STAMPSDIR}
mkdir -p ${bfbuilddir}
ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
cd ${bfbuilddir} && AWK=/usr/bin/awk \
- ${topdir}/configure ${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS} ${EXTRA_CONF_FLAGS} \
- CFLAGS="${CFLAGS} ${BF_CFLAGS}" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
+ ${topdir}/configure ${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS} \
+ ${EXTRA_CONF_FLAGS} CFLAGS="${CFLAGS} ${BF_CFLAGS}" \
+ CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
else
cd ${bfbuilddir} && AWK=/usr/bin/awk CC="${DEB_HOST_GNU_TYPE}-gcc" \
- ${topdir}/configure ${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS} ${EXTRA_CONF_FLAGS} \
- --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) \
- CFLAGS="${CFLAGS}" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
+ ${topdir}/configure ${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS} \
+ ${EXTRA_CONF_FLAGS} --build=$(DEB_BUILD_GNU_TYPE) \
+ --host=$(DEB_HOST_GNU_TYPE) CFLAGS="${CFLAGS}" \
+ CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
endif
mkdir -p ${STAMPSDIR}
touch ${CFGBFSTAMP}
ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
if type diet > /dev/null 2>&1 ; then \
cd ${staticbuilddir} && AWK=/usr/bin/awk \
- ${topdir}/configure ${STATIC_CONF_FLAGS} ${EXTRA_CONF_FLAGS} \
- ${WITH_DIET_LIBC} CFLAGS="${CFLAGS}" \
+ ${topdir}/configure ${COMMON_CONF_FLAGS} ${STATIC_CONF_FLAGS} \
+ ${EXTRA_CONF_FLAGS} ${WITH_DIET_LIBC} CFLAGS="${CFLAGS}" \
CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"; \
else \
cd ${staticbuilddir} && AWK=/usr/bin/awk \
- ${topdir}/configure ${STATIC_CONF_FLAGS} ${EXTRA_CONF_FLAGS} \
+ ${topdir}/configure ${COMMON_CONF_FLAGS} \
+ ${STATIC_CONF_FLAGS} ${EXTRA_CONF_FLAGS} \
CFLAGS="${CFLAGS}" CPPFLAGS="$(CPPFLAGS)" \
LDFLAGS="$(LDFLAGS)"; \
fi
else
cd ${staticbuilddir} && AWK=/usr/bin/awk CC="${DEB_HOST_GNU_TYPE}-gcc" \
- ${topdir}/configure ${COMMON_CONF_FLAGS} ${STATIC_CONF_FLAGS} ${EXTRA_CONF_FLAGS} \
- --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) \
- CFLAGS="${CFLAGS}" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
+ ${topdir}/configure ${COMMON_CONF_FLAGS} ${STATIC_CONF_FLAGS} \
+ ${EXTRA_CONF_FLAGS} --build=$(DEB_BUILD_GNU_TYPE) \
+ --host=$(DEB_HOST_GNU_TYPE) CFLAGS="${CFLAGS}" \
+ CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
endif
mkdir -p ${STAMPSDIR}
touch ${CFGSTATICSTAMP}
endif
dh_fixperms
+ dh_strip -pe2fsprogs --dbg-package=e2fsprogs-dbg
+ dh_strip -pe2fsck-static --dbg-package=e2fsprogs-dbg
ifneq ($(ismips),)
- dh_strip -k -Xlib64ext2fs-nopic.a
+ dh_strip -pe2fslibs --dbg-package=e2fslibs-dbg -Xlib64ext2fs-nopic.a
else
- dh_strip -k
-endif
-
- # debug package stuff
- rm -rf ${udebdir}/usr
-ifneq ($(UTIL_LINUX_NG),yes)
- rm -rf ${blkidudebdir}/usr
- rm -rf ${uuidudebdir}/usr
-endif
-
-ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
- mkdir -p ${debugdir}/$(USRLIB)
- mv ${maindir}/usr/lib/debug ${debugdir}/$(USRLIB)
- rm -rf ${maindir}/usr/lib/debug
-
-ifneq ($(BUILD_E2FSCK_STATIC),no)
- mv ${e2fsckstaticdir}/usr/lib/debug/sbin/* \
- ${debugdir}/$(USRLIB)/debug
- rm -rf ${e2fsckstaticdir}/usr/lib
+ dh_strip -pe2fslibs --dbg-package=e2fslibs-dbg
endif
-
+ dh_strip -plibss${SS_SOVERSION} --dbg-package=libss${SS_SOVERSION}-dbg
+ dh_strip -plibcomerr${COMERR_SOVERSION} \
+ --dbg-package=libcomerr${COMERR_SOVERSION}-dbg
ifneq ($(UTIL_LINUX_NG),yes)
- mkdir -p ${uuidruntimedbgdir}/$(USRLIB)
- mv ${uuidruntimedir}/usr/lib/debug ${uuidruntimedbgdir}/$(USRLIB)
- rmdir ${uuidruntimedir}/usr/lib
-endif
-
- mkdir -p ${libext2dbgdir}/$(USRLIB)
- mv ${libext2dir}/usr/lib/debug ${libext2dbgdir}/$(USRLIB)
- rmdir ${libext2dir}/usr/lib
-
- mkdir -p ${libcomerrdbgdir}/$(USRLIB)
- mv ${libcomerrdir}/usr/lib/debug ${libcomerrdbgdir}/$(USRLIB)
- rmdir ${libcomerrdir}/usr/lib
-
- mkdir -p ${libssdbgdir}/$(USRLIB)
- mv ${libssdir}/usr/lib/debug ${libssdbgdir}/$(USRLIB)
- rmdir ${libssdir}/usr/lib
-
-ifneq ($(UTIL_LINUX_NG),yes)
- mkdir -p ${libuuiddbgdir}/$(USRLIB)
- mv ${libuuiddir}/usr/lib/debug ${libuuiddbgdir}/$(USRLIB)
- rmdir ${libuuiddir}/usr/lib
-
- mkdir -p ${libblkiddbgdir}/$(USRLIB)
- mv ${libblkiddir}/usr/lib/debug ${libblkiddbgdir}/$(USRLIB)
- rmdir ${libblkiddir}/usr/lib
-endif
+ dh_strip -plibblkid${BLKID_SOVERSION} \
+ --dbg-package=libblkid${BLKID_SOVERSION}-dbg
+ dh_strip -plibuuid${UUID_SOVERSION} --dbg-package=libuuid${UUID_SOVERSION}-dbg
endif
+ dh_strip
# dpkg symbol handling
ifneq (,$(findstring update-symbols,$(DEB_BUILD_OPTIONS)))
$(srcdir)/filefrag.c $(srcdir)/extent_inode.c $(srcdir)/zap.c
LIBS= $(LIBEXT2FS) $(LIBE2P) $(LIBSS) $(LIBCOM_ERR) $(LIBBLKID) \
- $(LIBUUID)
+ $(LIBUUID) $(SYSLIBS)
DEPLIBS= $(LIBEXT2FS) $(LIBE2P) $(DEPLIBSS) $(DEPLIBCOM_ERR) \
$(DEPLIBBLKID) $(DEPLIBUUID)
STATIC_LIBS= $(STATIC_LIBEXT2FS) $(STATIC_LIBSS) $(STATIC_LIBCOM_ERR) \
- $(STATIC_LIBBLKID) $(STATIC_LIBUUID) $(STATIC_LIBE2P)
+ $(STATIC_LIBBLKID) $(STATIC_LIBUUID) $(STATIC_LIBE2P) $(SYSLIBS)
STATIC_DEPLIBS= $(STATIC_LIBEXT2FS) $(DEPSTATIC_LIBSS) \
$(DEPSTATIC_LIBCOM_ERR) $(DEPSTATIC_LIBUUID) \
$(DEPSTATIC_LIBE2P)
return;
break;
case 's':
- err = strtoblk(argv[0], optarg, &superblock);
+ err = strtoblk(argv[0], optarg,
+ "superblock block number", &superblock);
if (err)
return;
break;
return;
memset(¶m, 0, sizeof(struct ext2_super_block));
- err = strtoblk(argv[0], argv[2], &blocks);
+ err = strtoblk(argv[0], argv[2], "blocks count", &blocks);
if (err)
return;
ext2fs_blocks_count_set(¶m, blocks);
ino = string_to_inode(argv[1]);
if (!ino)
return;
- err = strtoblk(argv[0], argv[2], &blk);
+ err = strtoblk(argv[0], argv[2], "logical block", &blk);
if (err)
return;
ino = string_to_inode(argv[1]);
if (!ino)
return;
- err = strtoblk(argv[0], argv[2], &start);
+ err = strtoblk(argv[0], argv[2], "logical block", &start);
if (err)
return;
if (argc == 4) {
- err = strtoblk(argv[0], argv[3], &end);
+ err = strtoblk(argv[0], argv[3], "logical block", &end);
if (err)
return;
} else
"block size", 0);
break;
case 's':
- retval = strtoblk(argv[0], optarg, &superblock);
+ retval = strtoblk(argv[0], optarg,
+ "superblock block number",
+ &superblock);
if (retval)
return 1;
break;
const char *descr, int *err);
extern unsigned long long parse_ulonglong(const char *str, const char *cmd,
const char *descr, int *err);
-extern int strtoblk(const char *cmd, const char *str, blk64_t *ret);
+extern int strtoblk(const char *cmd, const char *str, const char *errmsg,
+ blk64_t *ret);
extern int common_args_process(int argc, char *argv[], int min_argc,
int max_argc, const char *cmd,
const char *usage, int flags);
return;
}
- err = strtoblk(argv[0], argv[1], &extent.e_lblk);
+ err = strtoblk(argv[0], argv[1], "logical block", &extent.e_lblk);
if (err)
return;
- extent.e_len = parse_ulong(argv[2], argv[0], "logical block", &err);
+ extent.e_len = parse_ulong(argv[2], argv[0], "length", &err);
if (err)
return;
- err = strtoblk(argv[0], argv[3], &extent.e_pblk);
+ err = strtoblk(argv[0], argv[3], "physical block", &extent.e_pblk);
if (err)
return;
return;
}
- err = strtoblk(cmd, argv[1], &extent.e_lblk);
+ err = strtoblk(cmd, argv[1], "logical block", &extent.e_lblk);
if (err)
return;
- extent.e_len = parse_ulong(argv[2], cmd,
- "length", &err);
+ extent.e_len = parse_ulong(argv[2], cmd, "length", &err);
if (err)
return;
- err = strtoblk(cmd, argv[3], &extent.e_pblk);
+ err = strtoblk(cmd, argv[3], "physical block", &extent.e_pblk);
if (err)
return;
return;
}
- err = strtoblk(cmd, argv[1], &logical);
+ err = strtoblk(cmd, argv[1], "logical block", &logical);
if (err)
return;
- err = strtoblk(cmd, argv[2], &physical);
+ err = strtoblk(cmd, argv[2], "physical block", &physical);
if (err)
return;
"block [level]", 0))
return;
- if (strtoblk(argv[0], argv[1], &blk))
+ if (strtoblk(argv[0], argv[1], NULL, &blk))
return;
if (argc == 3) {
}
for (i=1; i < argc; i++) {
- if (strtoblk(argv[0], argv[i], &bw.barray[i-1].blk))
+ if (strtoblk(argv[0], argv[i], NULL, &bw.barray[i-1].blk))
goto error_out;
}
static int read_journal_block(const char *cmd, struct journal_source *source,
- off_t offset, char *buf, int size,
- unsigned int *got)
+ off_t offset, char *buf, unsigned int size)
{
int retval;
+ unsigned int got;
if (source->where == JOURNAL_IS_EXTERNAL) {
if (lseek(source->fd, offset, SEEK_SET) < 0) {
retval = errno;
- com_err(cmd, retval, "while seeking in reading journal");
- return retval;
+ goto seek_err;
}
retval = read(source->fd, buf, size);
- if (retval >= 0) {
- *got = retval;
- retval = 0;
- } else
+ if (retval < 0) {
retval = errno;
+ goto read_err;
+ }
+ got = retval;
+ retval = 0;
} else {
retval = ext2fs_file_lseek(source->file, offset,
EXT2_SEEK_SET, NULL);
if (retval) {
+ seek_err:
com_err(cmd, retval, "while seeking in reading journal");
return retval;
}
-
- retval = ext2fs_file_read(source->file, buf, size, got);
+ retval = ext2fs_file_read(source->file, buf, size, &got);
+ if (retval) {
+ read_err:
+ com_err(cmd, retval, "while reading journal");
+ return retval;
+ }
}
-
- if (retval)
- com_err(cmd, retval, "while reading journal");
- else if (*got != (unsigned int) size) {
- com_err(cmd, 0, "short read (read %d, expected %d) "
- "while reading journal", *got, size);
+ if (got != size) {
+ com_err(cmd, 0, "short read (read %u, expected %u) "
+ "while reading journal", got, size);
retval = -1;
}
-
return retval;
}
char buf[8192];
journal_superblock_t *jsb;
unsigned int blocksize = 1024;
- unsigned int got;
int retval;
__u32 magic, sequence, blocktype;
journal_header_t *header;
unsigned int blocknr = 0;
/* First, check to see if there's an ext2 superblock header */
- retval = read_journal_block(cmdname, source, 0,
- buf, 2048, &got);
+ retval = read_journal_block(cmdname, source, 0, buf, 2048);
if (retval)
return;
/* Next, read the journal superblock */
retval = read_journal_block(cmdname, source, blocknr*blocksize,
- jsb_buffer, 1024, &got);
+ jsb_buffer, 1024);
if (retval)
return;
while (1) {
retval = read_journal_block(cmdname, source,
blocknr*blocksize, buf,
- blocksize, &got);
- if (retval || got != blocksize)
+ blocksize);
+ if (retval)
return;
header = (journal_header_t *) buf;
int blocksize,
tid_t transaction)
{
- unsigned int got;
int retval;
char buf[8192];
retval = read_journal_block("logdump", source,
blocksize * log_blocknr,
- buf, blocksize, &got);
+ buf, blocksize);
if (retval)
return;
/*
* This function will convert a string to a block number. It returns
- * 0 on success, 1 on failure.
+ * 0 on success, 1 on failure. On failure, it outputs either an optionally
+ * specified error message or a default.
*/
-int strtoblk(const char *cmd, const char *str, blk64_t *ret)
+int strtoblk(const char *cmd, const char *str, const char *errmsg,
+ blk64_t *ret)
{
blk64_t blk;
int err;
- blk = parse_ulonglong(str, cmd, "block number", &err);
+ if (errmsg == NULL)
+ blk = parse_ulonglong(str, cmd, "block number", &err);
+ else
+ blk = parse_ulonglong(str, cmd, errmsg, &err);
*ret = blk;
- if (err)
- com_err(cmd, 0, "Invalid block number: %s", str);
return err;
}
"<block> [count]", CHECK_FS_BITMAPS))
return 1;
- if (strtoblk(argv[0], argv[1], block))
+ if (strtoblk(argv[0], argv[1], NULL, block))
return 1;
if (*block == 0) {
com_err(argv[0], 0, "Invalid block number 0");
}
if (argc > 2) {
- err = strtoblk(argv[0], argv[2], count);
+ err = strtoblk(argv[0], argv[2], "count", count);
if (err)
return 1;
}
FMANPAGES= e2fsck.conf.5
LIBS= $(LIBQUOTA) $(LIBEXT2FS) $(LIBCOM_ERR) $(LIBBLKID) $(LIBUUID) \
- $(LIBINTL) $(LIBE2P)
+ $(LIBINTL) $(LIBE2P) $(SYSLIBS)
DEPLIBS= $(DEPLIBQUOTA) $(LIBEXT2FS) $(DEPLIBCOM_ERR) $(DEPLIBBLKID) \
$(DEPLIBUUID) $(DEPLIBE2P)
STATIC_LIBS= $(STATIC_LIBQUOTA) $(STATIC_LIBEXT2FS) $(STATIC_LIBCOM_ERR) \
- $(STATIC_LIBBLKID) $(STATIC_LIBUUID) $(LIBINTL) $(STATIC_LIBE2P)
+ $(STATIC_LIBBLKID) $(STATIC_LIBUUID) $(LIBINTL) $(STATIC_LIBE2P) \
+ $(SYSLIBS)
STATIC_DEPLIBS= $(DEPSTATIC_LIBQUOTA) $(STATIC_LIBEXT2FS) \
$(DEPSTATIC_LIBCOM_ERR) $(DEPSTATIC_LIBBLKID) \
$(DEPSTATIC_LIBUUID) $(DEPSTATIC_LIBE2P)
PROFILED_LIBS= $(PROFILED_LIBQUOTA) $(PROFILED_LIBEXT2FS) \
$(PROFILED_LIBCOM_ERR) $(PROFILED_LIBBLKID) $(PROFILED_LIBUUID) \
- $(PROFILED_LIBE2P) $(LIBINTL)
+ $(PROFILED_LIBE2P) $(LIBINTL) $(SYSLIBS)
PROFILED_DEPLIBS= $(DEPPROFILED_LIBQUOTA) $(PROFILED_LIBEXT2FS) \
$(DEPPROFILED_LIBCOM_ERR) $(DEPPROFILED_LIBBLKID) \
$(DEPPROFILED_LIBUUID) $(DEPPROFILED_LIBE2P)
$(DEPLIBCOM_ERR)
$(Q) $(CC) $(BUILD_LDFLAGS) $(ALL_CFLAGS) -o tst_problem \
$(srcdir)/problem.c -DUNITTEST $(LIBEXT2FS) $(LIBCOM_ERR) \
- $(LIBINTL)
+ $(LIBINTL) $(SYSLIBS)
tst_refcount: ea_refcount.c $(DEPLIBCOM_ERR)
$(E) " LD $@"
$(Q) $(CC) -o tst_refcount $(srcdir)/ea_refcount.c \
- $(ALL_CFLAGS) -DTEST_PROGRAM $(LIBCOM_ERR) $(LIBEXT2FS)
+ $(ALL_CFLAGS) -DTEST_PROGRAM $(LIBCOM_ERR) $(LIBEXT2FS) \
+ $(SYSLIBS)
tst_logfile: $(srcdir)/logfile.c
$(E) " LD $@"
$(Q) $(CC) -o tst_logfile $(srcdir)/logfile.c $(ALL_CFLAGS) \
- -DTEST_PROGRAM
+ -DTEST_PROGRAM $(SYSLIBS)
tst_region: region.c $(DEPLIBCOM_ERR)
$(E) " LD $@"
$(Q) $(CC) -o tst_region $(srcdir)/region.c \
- $(ALL_CFLAGS) -DTEST_PROGRAM $(LIBCOM_ERR)
+ $(ALL_CFLAGS) -DTEST_PROGRAM $(LIBCOM_ERR) $(SYSLIBS)
check:: tst_refcount tst_region tst_problem
LD_LIBRARY_PATH=$(LIB) DYLD_LIBRARY_PATH=$(LIB) ./tst_refcount
Historically this was usually due to some distributions
having buggy init scripts and/or installers that didn't
correctly detect this case and take appropriate
-countermeasures. However, it's still possible, despite the
-best efforts of init script and installer authors to not be
-able to detect this misconfiguration, usually due to a
+countermeasures. Unfortunately, this is occasionally
+true even today, usually due to a
buggy or misconfigured virtualization manager or the
installer not having access to a network time server
during the installation process. So by default, we allow
/* Superblock corrupt */
{ PR_0_SB_CORRUPT,
- N_("\nThe @S could not be read or does not describe a correct ext2\n"
- "@f. If the @v is valid and it really contains an ext2\n"
+ N_("\nThe @S could not be read or does not describe a valid ext2/ext3/ext4\n"
+ "@f. If the @v is valid and it really contains an ext2/ext3/ext4\n"
"@f (and not swap or ufs or something else), then the @S\n"
"is corrupt, and you might try running e2fsck with an alternate @S:\n"
- " e2fsck -b %S <@v>\n\n"),
+ " e2fsck -b 8193 <@v>\n"
+ " or\n"
+ " e2fsck -b 32768 <@v>\n\n"),
PROMPT_NONE, PR_FATAL },
/* Filesystem size is wrong */
for (fs = files; !PROFILE_LAST_FILESPEC(*fs); fs++) {
if (array)
free_list(array);
+ array = NULL;
retval = get_dirlist(*fs, &array);
if (retval == 0) {
if (!array)
ext2_ino_t to_ino, int qtype)
{
struct ext2_inode inode;
+ errcode_t retval;
char qf_name[QUOTA_NAME_LEN];
/* We need the inode bitmap to be loaded */
if (ext2fs_read_bitmaps(fs))
return;
- if (ext2fs_read_inode(fs, from_ino, &inode))
+ retval = ext2fs_read_inode(fs, from_ino, &inode);
+ if (retval) {
+ com_err("ext2fs_read_inode", retval, _("in move_quota_inode"));
return;
+ }
inode.i_links_count = 1;
inode.i_mode = LINUX_S_IFREG | 0600;
EXT3_FEATURE_INCOMPAT_EXTENTS)
inode.i_flags |= EXT4_EXTENTS_FL;
- ext2fs_write_new_inode(fs, to_ino, &inode);
+ retval = ext2fs_write_new_inode(fs, to_ino, &inode);
+ if (retval) {
+ com_err("ext2fs_write_new_inode", retval,
+ _("in move_quota_inode"));
+ return;
+ }
+
/* unlink the old inode */
quota_get_qf_name(qtype, QFMT_VFS_V1, qf_name);
ext2fs_unlink(fs, EXT2_ROOT_INO, qf_name, from_ino, 0);
@ifNotGNUmake@ E = @E@
@ifNotGNUmake@ Q = @Q@
+@ifGNUmake@ CHECK=sparse
+@ifGNUmake@ CHECK_OPTS=-Wsparse-all -Wno-transparent-union -Wno-return-void -Wno-undef -Wno-non-pointer-null
+@ifGNUmake@ ifeq ("$(C)", "2")
+@ifGNUmake@ CHECK_CMD=$(CHECK) $(CHECK_OPTS) -Wbitwise -D__CHECK_ENDIAN__
+@ifGNUmake@ else
+@ifGNUmake@ ifeq ("$(C)", "1")
+@ifGNUmake@ CHECK_CMD=$(CHECK) $(CHECK_OPTS)
+@ifGNUmake@ else
+@ifGNUmake@ CHECK_CMD=@true
+@ifGNUmake@ endif
+@ifGNUmake@ endif
+
+@ifNotGNUmake@ CHECK_CMD=@true
+
l = @INTL_LIBTOOL_SUFFIX_PREFIX@
AR = ar
(block sizes larger than 2K will be null padded) */
for (bs = 1; bs < 16; bs++) {
isosb = (struct iso_volume_descriptor *)
- get_buffer(probe, bs*2048+32768, sizeof(isosb));
+ get_buffer(probe, bs*2048+32768, sizeof(*isosb));
if (!isosb)
return 1;
if (isosb->vd_id[0])
if (j > 1) {
isosb = (struct iso_volume_descriptor *)
get_buffer(probe, j*bs*2048+32768,
- sizeof(isosb));
+ sizeof(*isosb));
if (!isosb)
return 1;
}
off = (alloc_first_block * 512) +
(embed_first_block * alloc_block_size);
buf = get_buffer(probe, off + (id->bim_kboff * 1024),
- sizeof(sbd));
+ sizeof(*sbd));
if (!buf)
return 1;
return 1;
}
- for (i=0, b=1, p=uuid, q= (char *) label->pv_uuid; i <= 32;
+ for (i=0, b=1, p=uuid, q= (char *) label->pv_uuid; i < LVM2_ID_LEN;
i++, b <<= 1) {
if (b & 0x4444440)
*p++ = '-';
/* Define to 1 if Ext2 ioctls present */
#undef HAVE_EXT2_IOCTLS
+/* Define to 1 if you have the `fadvise64' function. */
+#undef HAVE_FADVISE64
+
/* Define to 1 if you have the `fallocate' function. */
#undef HAVE_FALLOCATE
/* Define to 1 if you have the `ftruncate64' function. */
#undef HAVE_FTRUNCATE64
+/* Define to 1 if you have the `futimes' function. */
+#undef HAVE_FUTIMES
+
/* Define to 1 if you have the `fwprintf' function. */
#undef HAVE_FWPRINTF
/* Define to 1 if you have the <linux/fd.h> header file. */
#undef HAVE_LINUX_FD_H
+/* Define to 1 if you have the <linux/loop.h> header file. */
+#undef HAVE_LINUX_LOOP_H
+
/* Define to 1 if you have the <linux/major.h> header file. */
#undef HAVE_LINUX_MAJOR_H
/* Define to 1 if you have the `posix_fadvise' function. */
#undef HAVE_POSIX_FADVISE
+/* Define to 1 if you have the `posix_fadvise64' function. */
+#undef HAVE_POSIX_FADVISE64
+
/* Define to 1 if you have the `posix_memalign' function. */
#undef HAVE_POSIX_MEMALIGN
/* Define to 1 if you have the `strtoull' function. */
#undef HAVE_STRTOULL
+/* Define to 1 if `st_atim' is a member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_ATIM
+
/* Define to 1 if you have the `sync_file_range' function. */
#undef HAVE_SYNC_FILE_RANGE
tst_badblocks: tst_badblocks.o $(STATIC_LIBEXT2FS) $(DEPSTATIC_LIBCOM_ERR)
$(E) " LD $@"
$(Q) $(CC) -o tst_badblocks tst_badblocks.o $(STATIC_LIBEXT2FS) \
- $(STATIC_LIBCOM_ERR)
+ $(STATIC_LIBCOM_ERR) $(SYSLIBS)
tst_icount: $(srcdir)/icount.c $(STATIC_LIBEXT2FS) $(DEPSTATIC_LIBCOM_ERR)
$(E) " LD $@"
$(Q) $(CC) -o tst_icount $(srcdir)/icount.c -DDEBUG $(ALL_CFLAGS) \
- $(STATIC_LIBEXT2FS) $(STATIC_LIBCOM_ERR)
+ $(STATIC_LIBEXT2FS) $(STATIC_LIBCOM_ERR) $(SYSLIBS)
tst_iscan: tst_iscan.o $(STATIC_LIBEXT2FS) $(DEPSTATIC_LIBCOM_ERR)
$(E) " LD $@"
$(Q) $(CC) -o tst_iscan tst_iscan.o $(STATIC_LIBEXT2FS) \
- $(STATIC_LIBCOM_ERR)
+ $(STATIC_LIBCOM_ERR) $(SYSLIBS)
tst_getsize: tst_getsize.o $(STATIC_LIBEXT2FS) $(DEPSTATIC_LIBCOM_ERR)
$(E) " LD $@"
$(Q) $(CC) -o tst_getsize tst_getsize.o $(STATIC_LIBEXT2FS) \
- $(STATIC_LIBCOM_ERR)
+ $(STATIC_LIBCOM_ERR) $(SYSLIBS)
tst_ismounted: $(srcdir)/ismounted.c $(STATIC_LIBEXT2FS) \
$(DEPSTATIC_LIBCOM_ERR)
$(E) " LD $@"
$(Q) $(CC) -o tst_ismounted $(srcdir)/ismounted.c \
$(STATIC_LIBEXT2FS) -DDEBUG $(ALL_CFLAGS) \
- $(STATIC_LIBCOM_ERR)
+ $(STATIC_LIBCOM_ERR) $(SYSLIBS)
tst_byteswap: tst_byteswap.o $(STATIC_LIBEXT2FS) $(DEPSTATIC_LIBCOM_ERR)
$(E) " LD $@"
$(Q) $(CC) -o tst_byteswap tst_byteswap.o $(STATIC_LIBEXT2FS) \
- $(STATIC_LIBCOM_ERR)
+ $(STATIC_LIBCOM_ERR) $(SYSLIBS)
tst_bitops: tst_bitops.o $(STATIC_LIBEXT2FS) $(DEPSTATIC_LIBCOM_ERR)
$(E) " LD $@"
$(Q) $(CC) -o tst_bitops tst_bitops.o $(ALL_CFLAGS) \
- $(STATIC_LIBEXT2FS) $(STATIC_LIBCOM_ERR)
+ $(STATIC_LIBEXT2FS) $(STATIC_LIBCOM_ERR) $(SYSLIBS)
tst_getsectsize: tst_getsectsize.o $(STATIC_LIBEXT2FS) $(DEPSTATIC_LIBCOM_ERR)
$(E) " LD $@"
$(Q) $(CC) -o tst_sectgetsize tst_getsectsize.o \
- $(STATIC_LIBEXT2FS) $(STATIC_LIBCOM_ERR)
+ $(STATIC_LIBEXT2FS) $(STATIC_LIBCOM_ERR) $(SYSLIBS)
tst_types.o: $(srcdir)/tst_types.c ext2_types.h
tst_types: tst_types.o ext2_types.h
$(E) " LD $@"
- $(Q) $(CC) -o tst_types tst_types.o
+ $(Q) $(CC) -o tst_types tst_types.o $(SYSLIBS)
tst_super_size.o: $(srcdir)/tst_super_size.c $(srcdir)/ext2_fs.h
tst_super_size: tst_super_size.o
$(E) " LD $@"
- $(Q) $(CC) -o tst_super_size tst_super_size.o
+ $(Q) $(CC) -o tst_super_size tst_super_size.o $(SYSLIBS)
tst_fs_struct.o: $(srcdir)/tst_fs_struct.c $(srcdir)/ext2fs.h
tst_fs_struct: tst_fs_struct.o
$(E) " LD $@"
- $(Q) $(CC) -o tst_fs_struct tst_fs_struct.o
+ $(Q) $(CC) -o tst_fs_struct tst_fs_struct.o $(SYSLIBS)
tst_inode_size.o: $(srcdir)/tst_inode_size.c $(srcdir)/ext2_fs.h
tst_inode_size: tst_inode_size.o
$(E) " LD $@"
- $(Q) $(CC) -o tst_inode_size tst_inode_size.o
+ $(Q) $(CC) -o tst_inode_size tst_inode_size.o $(SYSLIBS)
ext2_tdbtool: tdbtool.o
$(E) " LD $@"
- $(Q) $(CC) -o ext2_tdbtool tdbtool.o tdb.o
+ $(Q) $(CC) -o ext2_tdbtool tdbtool.o tdb.o $(SYSLIBS)
extent_dbg.c: $(srcdir)/extent_dbg.ct
$(E) " MK_CMDS $<"
$(DEPSTATIC_LIBSS) $(DEPSTATIC_LIBCOM_ERR)
$(E) " LD $@"
$(Q) $(CC) -o $@ tst_bitmaps.o tst_bitmaps_cmd.o $(ALL_CFLAGS) \
- $(STATIC_LIBEXT2FS) $(STATIC_LIBSS) $(STATIC_LIBCOM_ERR)
+ $(STATIC_LIBEXT2FS) $(STATIC_LIBSS) $(STATIC_LIBCOM_ERR) \
+ $(SYSLIBS)
tst_extents: $(srcdir)/extent.c $(DEBUG_OBJS) $(DEPSTATIC_LIBSS) \
$(STATIC_LIBE2P) $(DEPLIBUUID) $(DEPLIBBLKID) $(DEPSTATIC_LIBCOM_ERR)
$(Q) $(CC) -o tst_extents $(srcdir)/extent.c \
$(ALL_CFLAGS) -DDEBUG $(DEBUG_OBJS) $(STATIC_LIBSS) \
$(STATIC_LIBE2P) $(STATIC_LIBEXT2FS) $(LIBBLKID) $(LIBUUID) \
- $(STATIC_LIBCOM_ERR) -I $(top_srcdir)/debugfs
+ $(STATIC_LIBCOM_ERR) $(SYSLIBS) -I $(top_srcdir)/debugfs
tst_inline: $(srcdir)/inline.c $(STATIC_LIBEXT2FS) $(DEPSTATIC_LIBCOM_ERR)
$(E) " LD $@"
$(Q) $(CC) -o tst_inline $(srcdir)/inline.c $(ALL_CFLAGS) -DDEBUG \
- $(STATIC_LIBEXT2FS) $(STATIC_LIBCOM_ERR)
+ $(STATIC_LIBEXT2FS) $(STATIC_LIBCOM_ERR) $(SYSLIBS)
tst_csum: csum.c $(STATIC_LIBEXT2FS) $(DEPSTATIC_LIBCOM_ERR) $(STATIC_LIBE2P) \
$(top_srcdir)/lib/e2p/e2p.h
$(E) " LD $@"
$(Q) $(CC) -o tst_csum $(srcdir)/csum.c -DDEBUG \
$(ALL_CFLAGS) $(STATIC_LIBEXT2FS) $(STATIC_LIBCOM_ERR) \
- $(STATIC_LIBE2P)
+ $(STATIC_LIBE2P) $(SYSLIBS)
tst_crc32c: $(srcdir)/crc32c.c $(STATIC_LIBEXT2FS) $(DEPSTATIC_LIBCOM_ERR)
$(Q) $(CC) $(BUILD_LDFLAGS) $(ALL_CFLAGS) -o tst_crc32c $(srcdir)/crc32c.c \
- -DUNITTEST $(STATIC_LIBEXT2FS) $(STATIC_LIBCOM_ERR)
+ -DUNITTEST $(STATIC_LIBEXT2FS) $(STATIC_LIBCOM_ERR) \
+ $(SYSLIBS)
mkjournal: mkjournal.c $(STATIC_LIBEXT2FS) $(DEPLIBCOM_ERR)
$(E) " LD $@"
- $(Q) $(CC) -o mkjournal $(srcdir)/mkjournal.c -DDEBUG $(STATIC_LIBEXT2FS) $(LIBCOM_ERR) $(ALL_CFLAGS)
+ $(Q) $(CC) -o mkjournal $(srcdir)/mkjournal.c -DDEBUG \
+ $(STATIC_LIBEXT2FS) $(LIBCOM_ERR) $(ALL_CFLAGS) $(SYSLIBS)
check:: tst_bitops tst_badblocks tst_iscan tst_types tst_icount \
tst_super_size tst_types tst_inode_size tst_csum tst_crc32c tst_bitmaps \
}
/* Resize the output image to the filesystem size */
- if (ext2fs_llseek(raw_fd, img.image_size - 1, SEEK_SET) < 0)
- return errno;
+ if (ext2fs_llseek(raw_fd, img.image_size - 1, SEEK_SET) < 0) {
+ ret = errno;
+ goto out;
+ }
((char *)copy_buf)[0] = 0;
size = write(raw_fd, copy_buf, 1);
if (channel->flags & CHANNEL_FLAGS_BLOCK_DEVICE) {
#ifdef BLKDISCARD
- __uint64_t range[2];
+ __u64 range[2];
- range[0] = (__uint64_t)(block) * channel->block_size;
- range[1] = (__uint64_t)(count) * channel->block_size;
+ range[0] = (__u64)(block) * channel->block_size;
+ range[1] = (__u64)(count) * channel->block_size;
ret = ioctl(data->dev, BLKDISCARD, &range);
#else
#ifndef __QUOTA_COMMON_H__
#define __QUOTA_COMMON_H__
+#if EXT2_FLAT_INCLUDES
+#include "e2_types.h"
+#else
+#include <ext2fs/ext2_types.h>
+#endif /* EXT2_FLAT_INCLUDES */
+
+
#ifndef __attribute__
# if !defined __GNUC__ || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__
# define __attribute__(x)
/* Header in all newer quotafiles */
struct disk_dqheader {
- u_int32_t dqh_magic;
- u_int32_t dqh_version;
+ __u32 dqh_magic;
+ __u32 dqh_version;
} __attribute__ ((packed));
/**
}
/* Read given block */
-static void read_blk(struct quota_handle *h, uint blk, dqbuf_t buf)
+static void read_blk(struct quota_handle *h, unsigned int blk, dqbuf_t buf)
{
int err;
}
/* Write block */
-static int write_blk(struct quota_handle *h, uint blk, dqbuf_t buf)
+static int write_blk(struct quota_handle *h, unsigned int blk, dqbuf_t buf)
{
int err;
}
/* Put given block to free list */
-static void put_free_dqblk(struct quota_handle *h, dqbuf_t buf, uint blk)
+static void put_free_dqblk(struct quota_handle *h, dqbuf_t buf,
+ unsigned int blk)
{
struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;
struct qtree_mem_dqinfo *info = &h->qh_info.u.v2_mdqi.dqi_qtree;
}
/* Remove given block from the list of blocks with free entries */
-static void remove_free_dqentry(struct quota_handle *h, dqbuf_t buf, uint blk)
+static void remove_free_dqentry(struct quota_handle *h, dqbuf_t buf,
+ unsigned int blk)
{
dqbuf_t tmpbuf = getdqbuf();
struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;
- uint nextblk = ext2fs_le32_to_cpu(dh->dqdh_next_free), prevblk =
+ unsigned int nextblk = ext2fs_le32_to_cpu(dh->dqdh_next_free), prevblk =
ext2fs_le32_to_cpu(dh->dqdh_prev_free);
}
/* Insert given block to the beginning of list with free entries */
-static void insert_free_dqentry(struct quota_handle *h, dqbuf_t buf, uint blk)
+static void insert_free_dqentry(struct quota_handle *h, dqbuf_t buf,
+ unsigned int blk)
{
dqbuf_t tmpbuf = getdqbuf();
struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;
}
/* Find space for dquot */
-static uint find_free_dqentry(struct quota_handle *h, struct dquot *dquot,
- int *err)
+static unsigned int find_free_dqentry(struct quota_handle *h,
+ struct dquot *dquot, int *err)
{
int blk, i;
struct qt_disk_dqdbheader *dh;
/* Insert reference to structure into the trie */
static int do_insert_tree(struct quota_handle *h, struct dquot *dquot,
- uint * treeblk, int depth)
+ unsigned int * treeblk, int depth)
{
dqbuf_t buf;
int newson = 0, newact = 0;
- u_int32_t *ref;
- uint newblk;
+ __u32 *ref;
+ unsigned int newblk;
int ret = 0;
log_debug("inserting in tree: treeblk=%u, depth=%d", *treeblk, depth);
read_blk(h, *treeblk, buf);
}
- ref = (u_int32_t *) buf;
+ ref = (__u32 *) buf;
newblk = ext2fs_le32_to_cpu(ref[get_index(dquot->dq_id, depth)]);
if (!newblk)
newson = 1;
/* Wrapper for inserting quota structure into tree */
static void dq_insert_tree(struct quota_handle *h, struct dquot *dquot)
{
- uint tmp = QT_TREEOFF;
+ unsigned int tmp = QT_TREEOFF;
if (do_insert_tree(h, dquot, &tmp, 0) < 0)
log_err("Cannot write quota (id %u): %s",
- (uint) dquot->dq_id, strerror(errno));
+ (unsigned int) dquot->dq_id, strerror(errno));
}
/* Write dquot to file */
if (ret) {
errno = ENOMEM;
log_err("Quota write failed (id %u): %s",
- (uint)dquot->dq_id, strerror(errno));
+ (unsigned int)dquot->dq_id, strerror(errno));
return;
}
if (ret > 0)
errno = ENOSPC;
log_err("Quota write failed (id %u): %s",
- (uint)dquot->dq_id, strerror(errno));
+ (unsigned int)dquot->dq_id, strerror(errno));
}
ext2fs_free_mem(&ddquot);
}
/* Free dquot entry in data block */
-static void free_dqentry(struct quota_handle *h, struct dquot *dquot, uint blk)
+static void free_dqentry(struct quota_handle *h, struct dquot *dquot,
+ unsigned int blk)
{
struct qt_disk_dqdbheader *dh;
struct qtree_mem_dqinfo *info = &h->qh_info.u.v2_mdqi.dqi_qtree;
if (dquot->dq_dqb.u.v2_mdqb.dqb_off >> QT_BLKSIZE_BITS != blk)
log_err("Quota structure has offset to other block (%u) "
"than it should (%u).", blk,
- (uint) (dquot->dq_dqb.u.v2_mdqb.dqb_off >>
+ (unsigned int) (dquot->dq_dqb.u.v2_mdqb.dqb_off >>
QT_BLKSIZE_BITS));
read_blk(h, blk, buf);
/* Remove reference to dquot from tree */
static void remove_tree(struct quota_handle *h, struct dquot *dquot,
- uint * blk, int depth)
+ unsigned int * blk, int depth)
{
dqbuf_t buf = getdqbuf();
- uint newblk;
- u_int32_t *ref = (u_int32_t *) buf;
+ unsigned int newblk;
+ __u32 *ref = (__u32 *) buf;
if (!buf)
return;
/* Delete dquot from tree */
void qtree_delete_dquot(struct dquot *dquot)
{
- uint tmp = QT_TREEOFF;
+ unsigned int tmp = QT_TREEOFF;
if (!dquot->dq_dqb.u.v2_mdqb.dqb_off) /* Even not allocated? */
return;
/* Find entry in block */
static ext2_loff_t find_block_dqentry(struct quota_handle *h,
- struct dquot *dquot, uint blk)
+ struct dquot *dquot, unsigned int blk)
{
struct qtree_mem_dqinfo *info = &h->qh_info.u.v2_mdqi.dqi_qtree;
dqbuf_t buf = getdqbuf();
/* Find entry for given id in the tree */
static ext2_loff_t find_tree_dqentry(struct quota_handle *h,
struct dquot *dquot,
- uint blk, int depth)
+ unsigned int blk, int depth)
{
dqbuf_t buf = getdqbuf();
ext2_loff_t ret = 0;
- u_int32_t *ref = (u_int32_t *) buf;
+ __u32 *ref = (__u32 *) buf;
if (!buf)
return -ENOMEM;
#define set_bit(bmp, ind) ((bmp)[(ind) >> 3] |= (1 << ((ind) & 7)))
#define get_bit(bmp, ind) ((bmp)[(ind) >> 3] & (1 << ((ind) & 7)))
-static int report_block(struct dquot *dquot, uint blk, char *bitmap,
+static int report_block(struct dquot *dquot, unsigned int blk, char *bitmap,
int (*process_dquot) (struct dquot *, void *),
void *data)
{
return entries;
}
-static void check_reference(struct quota_handle *h, uint blk)
+static void check_reference(struct quota_handle *h, unsigned int blk)
{
if (blk >= h->qh_info.u.v2_mdqi.dqi_qtree.dqi_blocks)
log_err("Illegal reference (%u >= %u) in %s quota file. "
type2name(h->qh_type));
}
-static int report_tree(struct dquot *dquot, uint blk, int depth, char *bitmap,
+static int report_tree(struct dquot *dquot, unsigned int blk, int depth,
+ char *bitmap,
int (*process_dquot) (struct dquot *, void *),
void *data)
{
int entries = 0, i;
dqbuf_t buf = getdqbuf();
- u_int32_t *ref = (u_int32_t *) buf;
+ __u32 *ref = (__u32 *) buf;
if (!buf)
return 0;
return entries;
}
-static uint find_set_bits(char *bmp, int blocks)
+static unsigned int find_set_bits(char *bmp, int blocks)
{
- uint i, used = 0;
+ unsigned int i, used = 0;
for (i = 0; i < blocks; i++)
if (get_bit(bmp, i))
#include <sys/types.h>
-typedef u_int32_t qid_t; /* Type in which we store ids in memory */
+typedef __u32 qid_t; /* Type in which we store ids in memory */
#define QT_TREEOFF 1 /* Offset of tree in file in blocks */
#define QT_TREEDEPTH 4 /* Depth of quota tree */
* so there will be space for exactly 21 quota-entries in a block
*/
struct qt_disk_dqdbheader {
- u_int32_t dqdh_next_free; /* Number of next block with free
+ __u32 dqdh_next_free; /* Number of next block with free
* entry */
- u_int32_t dqdh_prev_free; /* Number of previous block with free
+ __u32 dqdh_prev_free; /* Number of previous block with free
* entry */
- u_int16_t dqdh_entries; /* Number of valid entries in block */
- u_int16_t dqdh_pad1;
- u_int32_t dqdh_pad2;
+ __u16 dqdh_entries; /* Number of valid entries in block */
+ __u16 dqdh_pad1;
+ __u32 dqdh_pad2;
} __attribute__ ((packed));
struct dquot;
#define V2_VERSION 1
struct v2_disk_dqheader {
- u_int32_t dqh_magic; /* Magic number identifying file */
- u_int32_t dqh_version; /* File version */
+ __u32 dqh_magic; /* Magic number identifying file */
+ __u32 dqh_version; /* File version */
} __attribute__ ((packed));
/* Flags for version specific files */
/* Header with type and version specific information */
struct v2_disk_dqinfo {
- u_int32_t dqi_bgrace; /* Time before block soft limit becomes
+ __u32 dqi_bgrace; /* Time before block soft limit becomes
* hard limit */
- u_int32_t dqi_igrace; /* Time before inode soft limit becomes
+ __u32 dqi_igrace; /* Time before inode soft limit becomes
* hard limit */
- u_int32_t dqi_flags; /* Flags for quotafile (DQF_*) */
- u_int32_t dqi_blocks; /* Number of blocks in file */
- u_int32_t dqi_free_blk; /* Number of first free block in the list */
- u_int32_t dqi_free_entry; /* Number of block with at least one
+ __u32 dqi_flags; /* Flags for quotafile (DQF_*) */
+ __u32 dqi_blocks; /* Number of blocks in file */
+ __u32 dqi_free_blk; /* Number of first free block in the list */
+ __u32 dqi_free_entry; /* Number of block with at least one
* free entry */
} __attribute__ ((packed));
struct v2r1_disk_dqblk {
- u_int32_t dqb_id; /* id this quota applies to */
- u_int32_t dqb_pad;
- u_int64_t dqb_ihardlimit; /* absolute limit on allocated inodes */
- u_int64_t dqb_isoftlimit; /* preferred inode limit */
- u_int64_t dqb_curinodes; /* current # allocated inodes */
- u_int64_t dqb_bhardlimit; /* absolute limit on disk space
+ __u32 dqb_id; /* id this quota applies to */
+ __u32 dqb_pad;
+ __u64 dqb_ihardlimit; /* absolute limit on allocated inodes */
+ __u64 dqb_isoftlimit; /* preferred inode limit */
+ __u64 dqb_curinodes; /* current # allocated inodes */
+ __u64 dqb_bhardlimit; /* absolute limit on disk space
* (in QUOTABLOCK_SIZE) */
- u_int64_t dqb_bsoftlimit; /* preferred limit on disk space
+ __u64 dqb_bsoftlimit; /* preferred limit on disk space
* (in QUOTABLOCK_SIZE) */
- u_int64_t dqb_curspace; /* current space occupied (in bytes) */
- u_int64_t dqb_btime; /* time limit for excessive disk use */
- u_int64_t dqb_itime; /* time limit for excessive inode use */
+ __u64 dqb_curspace; /* current space occupied (in bytes) */
+ __u64 dqb_btime; /* time limit for excessive disk use */
+ __u64 dqb_itime; /* time limit for excessive inode use */
} __attribute__ ((packed));
#endif
test_ss: test_ss.o test_cmd.o $(DEPLIBSS) $(DEPLIBCOM_ERR)
$(E) " LD $@"
$(Q) $(CC) -o $@ test_ss.o test_cmd.o $(ALL_CFLAGS) \
- $(LIBSS) $(LIBCOM_ERR)
+ $(LIBSS) $(LIBCOM_ERR) $(SYSLIBS)
check:: all test_ss
$(E) " RUN TEST test_ss"
{
register int sci_idx;
register ss_data *new_table;
- register ss_data **table;
+ register ss_data **table, **rt;
*code_ptr = 0;
table = _ss_table;
for (sci_idx = 1; table[sci_idx] != (ss_data *)NULL; sci_idx++)
;
- table = (ss_data **) realloc((char *)table,
- ((unsigned)sci_idx+2)*size);
- if (table == NULL) {
- *code_ptr = errno;
+ rt = (ss_data **) realloc((char *)table, ((unsigned)sci_idx+2)*size);
+ if (rt == NULL) {
+ *code_ptr = ENOMEM;
+ free(table);
return 0;
}
table[sci_idx+1] = (ss_data *) NULL;
$(srcdir)/ismounted.c $(srcdir)/../e2fsck/profile.c \
$(srcdir)/e2undo.c $(srcdir)/e2freefrag.c
-LIBS= $(LIBEXT2FS) $(LIBCOM_ERR)
+LIBS= $(LIBEXT2FS) $(LIBCOM_ERR)
DEPLIBS= $(LIBEXT2FS) $(DEPLIBCOM_ERR)
PROFILED_LIBS= $(PROFILED_LIBEXT2FS) $(PROFILED_LIBCOM_ERR)
PROFILED_DEPLIBS= $(PROFILED_LIBEXT2FS) $(DEPPROFILED_LIBCOM_ERR)
-STATIC_LIBS= $(STATIC_LIBEXT2FS) $(STATIC_LIBCOM_ERR)
+STATIC_LIBS= $(STATIC_LIBEXT2FS) $(STATIC_LIBCOM_ERR)
STATIC_DEPLIBS= $(STATIC_LIBEXT2FS) $(DEPSTATIC_LIBCOM_ERR)
LIBS_E2P= $(LIBE2P) $(LIBCOM_ERR)
findsuper: findsuper.o
$(E) " LD $@"
- $(Q) $(CC) $(ALL_LDFLAGS) -o findsuper findsuper.o $(LIBS)
+ $(Q) $(CC) $(ALL_LDFLAGS) -o findsuper findsuper.o $(LIBS) $(SYSLIBS)
partinfo: partinfo.o
$(E) " LD $@"
e2initrd_helper: e2initrd_helper.o $(DEPLIBS) $(DEPLIBBLKID) $(LIBEXT2FS)
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -o e2initrd_helper e2initrd_helper.o $(LIBS) \
- $(LIBBLKID) $(LIBEXT2FS) $(LIBINTL)
+ $(LIBBLKID) $(LIBEXT2FS) $(LIBINTL) $(SYSLIBS)
tune2fs: $(TUNE2FS_OBJS) $(DEPLIBS) $(DEPLIBS_E2P) $(DEPLIBBLKID) \
$(DEPLIBUUID) $(DEPLIBQUOTA) $(LIBEXT2FS)
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -o tune2fs $(TUNE2FS_OBJS) $(LIBS) \
$(LIBBLKID) $(LIBUUID) $(LIBQUOTA) $(LIBEXT2FS) $(LIBS_E2P) \
- $(LIBINTL)
+ $(LIBINTL) $(SYSLIBS)
tune2fs.static: $(TUNE2FS_OBJS) $(STATIC_DEPLIBS) $(STATIC_LIBE2P) $(DEPSTATIC_LIBBLKID)
$(E) " LD $@"
$(Q) $(CC) $(LDFLAGS_STATIC) -o tune2fs.static $(TUNE2FS_OBJS) \
$(STATIC_LIBS) $(STATIC_LIBBLKID) $(STATIC_LIBUUID) \
- $(STATIC_LIBQUOTA) $(STATIC_LIBE2P) $(LIBINTL)
+ $(STATIC_LIBQUOTA) $(STATIC_LIBE2P) $(LIBINTL) $(SYSLIBS)
tune2fs.profiled: $(TUNE2FS_OBJS) $(PROFILED_DEPLIBS) \
$(PROFILED_E2P) $(DEPPROFILED_LIBBLKID) $(DEPPROFILED_LIBUUID) \
$(Q) $(CC) $(ALL_LDFLAGS) -g -pg -o tune2fs.profiled \
$(PROFILED_TUNE2FS_OBJS) $(PROFILED_LIBBLKID) \
$(PROFILED_LIBUUID) $(PROFILED_LIBQUOTA) $(PROFILED_LIBE2P) \
- $(LIBINTL) $(PROFILED_LIBS)
+ $(LIBINTL) $(PROFILED_LIBS) $(SYSLIBS)
blkid: $(BLKID_OBJS) $(DEPLIBBLKID) $(LIBEXT2FS)
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -o blkid $(BLKID_OBJS) $(LIBBLKID) $(LIBINTL) \
- $(LIBEXT2FS)
+ $(LIBEXT2FS) $(SYSLIBS)
blkid.static: $(BLKID_OBJS) $(STATIC_DEPLIBS) $(DEPSTATIC_LIBBLKID)
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -o blkid.static $(BLKID_OBJS) $(STATIC_LIBS) \
- $(STATIC_LIBBLKID) $(LIBINTL)
+ $(STATIC_LIBBLKID) $(LIBINTL) $(SYSLIBS)
blkid.profiled: $(BLKID_OBJS) $(DEPPROFILED_LIBBLKID) \
$(PROFILED_LIBEXT2FS)
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -g -pg -o blkid.profiled $(PROFILED_BLKID_OBJS) \
- $(PROFILED_LIBBLKID) $(LIBINTL) $(PROFILED_LIBEXT2FS)
+ $(PROFILED_LIBBLKID) $(LIBINTL) $(PROFILED_LIBEXT2FS) $(SYSLIBS)
e2image: $(E2IMAGE_OBJS) $(DEPLIBS)
$(E) " LD $@"
- $(Q) $(CC) $(ALL_LDFLAGS) -o e2image $(E2IMAGE_OBJS) $(LIBS) $(LIBINTL)
+ $(Q) $(CC) $(ALL_LDFLAGS) -o e2image $(E2IMAGE_OBJS) $(LIBS) \
+ $(LIBINTL) $(SYSLIBS)
e2image.profiled: $(E2IMAGE_OBJS) $(PROFILED_DEPLIBS)
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -g -pg -o e2image.profiled \
- $(PROFILED_E2IMAGE_OBJS) $(PROFILED_LIBS) $(LIBINTL)
+ $(PROFILED_E2IMAGE_OBJS) $(PROFILED_LIBS) $(LIBINTL) $(SYSLIBS)
e2undo: $(E2UNDO_OBJS) $(DEPLIBS)
$(E) " LD $@"
- $(Q) $(CC) $(ALL_LDFLAGS) -o e2undo $(E2UNDO_OBJS) $(LIBS) $(LIBINTL)
+ $(Q) $(CC) $(ALL_LDFLAGS) -o e2undo $(E2UNDO_OBJS) $(LIBS) \
+ $(LIBINTL) $(SYSLIBS)
e2undo.profiled: $(E2UNDO_OBJS) $(PROFILED_DEPLIBS)
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -g -pg -o e2undo.profiled \
- $(PROFILED_E2UNDO_OBJS) $(PROFILED_LIBS) $(LIBINTL)
+ $(PROFILED_E2UNDO_OBJS) $(PROFILED_LIBS) $(LIBINTL) $(SYSLIBS)
e4defrag: $(E4DEFRAG_OBJS) $(DEPLIBS)
$(E) " LD $@"
- $(Q) $(CC) $(ALL_LDFLAGS) -o e4defrag $(E4DEFRAG_OBJS) $(LIBS)
+ $(Q) $(CC) $(ALL_LDFLAGS) -o e4defrag $(E4DEFRAG_OBJS) $(LIBS) \
+ $(SYSLIBS)
e4defrag.profiled: $(E4DEFRAG_OBJS) $(PROFILED_DEPLIBS)
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -g -pg -o e4defrag.profiled \
- $(PROFILED_E4DEFRAG_OBJS) $(PROFILED_LIBS)
+ $(PROFILED_E4DEFRAG_OBJS) $(PROFILED_LIBS) $(SYSLIBS)
base_device: base_device.c
$(E) " LD $@"
$(Q) $(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) $(srcdir)/base_device.c \
- -DDEBUG -o base_device
+ -DDEBUG -o base_device $(SYSLIBS)
check:: base_device
./base_device < $(srcdir)/base_device.tst > base_device.out
mklost+found: $(MKLPF_OBJS)
$(E) " LD $@"
- $(Q) $(CC) $(ALL_LDFLAGS) -o mklost+found $(MKLPF_OBJS) $(LIBINTL)
+ $(Q) $(CC) $(ALL_LDFLAGS) -o mklost+found $(MKLPF_OBJS) \
+ $(LIBINTL) $(SYSLIBS)
mke2fs: $(MKE2FS_OBJS) $(DEPLIBS) $(LIBE2P) $(DEPLIBBLKID) $(DEPLIBUUID) \
$(DEPLIBQUOTA) $(LIBEXT2FS)
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -o mke2fs $(MKE2FS_OBJS) $(LIBS) $(LIBBLKID) \
- $(LIBUUID) $(LIBQUOTA) $(LIBEXT2FS) $(LIBE2P) $(LIBINTL)
+ $(LIBUUID) $(LIBQUOTA) $(LIBEXT2FS) $(LIBE2P) $(LIBINTL) \
+ $(SYSLIBS)
mke2fs.static: $(MKE2FS_OBJS) $(STATIC_DEPLIBS) $(STATIC_LIBE2P) $(DEPSTATIC_LIBUUID) \
$(DEPSTATIC_LIBQUOTA) $(DEPSTATIC_LIBBLKID)
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -static -o mke2fs.static $(MKE2FS_OBJS) \
$(STATIC_LIBQUOTA) $(STATIC_LIBS) $(STATIC_LIBE2P) \
- $(STATIC_LIBBLKID) $(STATIC_LIBUUID) $(LIBINTL)
+ $(STATIC_LIBBLKID) $(STATIC_LIBUUID) $(LIBINTL) $(SYSLIBS)
mke2fs.profiled: $(MKE2FS_OBJS) $(PROFILED_DEPLIBS) \
$(PROFILED_LIBE2P) $(PROFILED_DEPLIBBLKID) $(PROFILED_DEPLIBUUID) \
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -g -pg -o mke2fs.profiled \
$(PROFILED_MKE2FS_OBJS) $(PROFILED_LIBBLKID) \
- $(PROFILED_LIBUUID) $(PROFILED_LIBQUOTA) $(PROFILED_LIBE2P) $(LIBINTL) \
- $(PROFILED_LIBS)
+ $(PROFILED_LIBUUID) $(PROFILED_LIBQUOTA) $(PROFILED_LIBE2P) \
+ $(LIBINTL) $(PROFILED_LIBS) $(SYSLIBS)
chattr: $(CHATTR_OBJS) $(DEPLIBS_E2P)
$(E) " LD $@"
- $(Q) $(CC) $(ALL_LDFLAGS) -o chattr $(CHATTR_OBJS) $(LIBS_E2P) $(LIBINTL)
+ $(Q) $(CC) $(ALL_LDFLAGS) -o chattr $(CHATTR_OBJS) $(LIBS_E2P) \
+ $(LIBINTL) $(SYSLIBS)
lsattr: $(LSATTR_OBJS) $(DEPLIBS_E2P)
$(E) " LD $@"
- $(Q) $(CC) $(ALL_LDFLAGS) -o lsattr $(LSATTR_OBJS) $(LIBS_E2P) $(LIBINTL)
+ $(Q) $(CC) $(ALL_LDFLAGS) -o lsattr $(LSATTR_OBJS) $(LIBS_E2P) \
+ $(LIBINTL) $(SYSLIBS)
uuidgen: $(UUIDGEN_OBJS) $(DEPLIBUUID)
$(E) " LD $@"
- $(Q) $(CC) $(ALL_LDFLAGS) -o uuidgen $(UUIDGEN_OBJS) $(LIBUUID) $(LIBINTL)
+ $(Q) $(CC) $(ALL_LDFLAGS) -o uuidgen $(UUIDGEN_OBJS) $(LIBUUID) \
+ $(LIBINTL) $(SYSLIBS)
uuidgen.profiled: $(UUIDGEN_OBJS) $(PROFILED_DEPLIBUUID)
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -g -pg -o uuidgen.profiled \
- $(PROFILED_UUIDGEN_OBJS) $(PROFILED_LIBUUID) $(LIBINTL)
+ $(PROFILED_UUIDGEN_OBJS) $(PROFILED_LIBUUID) $(LIBINTL) \
+ $(SYSLIBS)
uuidd: $(UUIDD_OBJS) $(DEPLIBUUID)
$(E) " LD $@"
- $(Q) $(CC) $(ALL_LDFLAGS) -o uuidd $(UUIDD_OBJS) $(LIBUUID) $(LIBINTL)
+ $(Q) $(CC) $(ALL_LDFLAGS) -o uuidd $(UUIDD_OBJS) $(LIBUUID) \
+ $(LIBINTL) $(SYSLIBS)
uuidd.profiled: $(UUIDD_OBJS) $(PROFILED_DEPLIBUUID)
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -g -pg -o uuidd.profiled $(PROFILED_UUIDD_OBJS) \
- $(PROFILED_LIBUUID) $(LIBINTL)
+ $(PROFILED_LIBUUID) $(LIBINTL) $(SYSLIBS)
dumpe2fs: $(DUMPE2FS_OBJS) $(DEPLIBS) $(DEPLIBS_E2P) $(DEPLIBUUID)
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -o dumpe2fs $(DUMPE2FS_OBJS) $(LIBS) \
- $(LIBS_E2P) $(LIBUUID) $(LIBINTL)
+ $(LIBS_E2P) $(LIBUUID) $(LIBINTL) $(SYSLIBS)
dumpe2fs.profiled: $(DUMPE2FS_OBJS) $(PROFILED_DEPLIBS) \
$(PROFILED_LIBE2P) $(PROFILED_DEPLIBUUID)
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -g -pg -o dumpe2fs.profiled \
$(PROFILED_DUMPE2FS_OBJS) $(PROFILED_LIBS) \
- $(PROFILED_LIBE2P) $(PROFILED_LIBUUID) $(LIBINTL)
+ $(PROFILED_LIBE2P) $(PROFILED_LIBUUID) $(LIBINTL) $(SYSLIBS)
fsck: $(FSCK_OBJS) $(DEPLIBBLKID)
$(E) " LD $@"
- $(Q) $(CC) $(ALL_LDFLAGS) -o fsck $(FSCK_OBJS) $(LIBBLKID) $(LIBINTL)
+ $(Q) $(CC) $(ALL_LDFLAGS) -o fsck $(FSCK_OBJS) $(LIBBLKID) \
+ $(LIBINTL) $(SYSLIBS)
fsck.profiled: $(FSCK_OBJS) $(PROFILED_DEPLIBBLKID)
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -g -pg -o fsck.profiled $(PROFILED_FSCK_OBJS) \
- $(PROFILED_LIBBLKID) $(LIBINTL)
+ $(PROFILED_LIBBLKID) $(LIBINTL) $(SYSLIBS)
badblocks: $(BADBLOCKS_OBJS) $(DEPLIBS)
$(E) " LD $@"
- $(Q) $(CC) $(ALL_LDFLAGS) -o badblocks $(BADBLOCKS_OBJS) $(LIBS) $(LIBINTL)
+ $(Q) $(CC) $(ALL_LDFLAGS) -o badblocks $(BADBLOCKS_OBJS) $(LIBS) \
+ $(LIBINTL) $(SYSLIBS)
badblocks.profiled: $(BADBLOCKS_OBJS) $(PROFILED_DEPLIBS)
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -g -pg -o badblocks.profiled \
- $(PROFILED_BADBLOCKS_OBJS) $(PROFILED_LIBS) $(LIBINTL)
+ $(PROFILED_BADBLOCKS_OBJS) $(PROFILED_LIBS) $(LIBINTL) \
+ $(SYSLIBS)
logsave: logsave.o
$(E) " LD $@"
- $(Q) $(CC) $(ALL_LDFLAGS) -o logsave logsave.o
+ $(Q) $(CC) $(ALL_LDFLAGS) -o logsave logsave.o $(SYSLIBS)
logsave.profiled: logsave.o
$(E) " LD $@"
- $(Q) $(CC) $(ALL_LDFLAGS) -g -pg -o logsave.profiled profiled/logsave.o
+ $(Q) $(CC) $(ALL_LDFLAGS) -g -pg -o logsave.profiled \
+ profiled/logsave.o $(SYSLIBS)
e2freefrag: $(E2FREEFRAG_OBJS)
$(E) " LD $@"
- $(Q) $(CC) $(ALL_LDFLAGS) -o e2freefrag $(E2FREEFRAG_OBJS) $(LIBS)
+ $(Q) $(CC) $(ALL_LDFLAGS) -o e2freefrag $(E2FREEFRAG_OBJS) \
+ $(LIBS) $(SYSLIBS)
e2freefrag.profiled: $(E2FREEFRAG_OBJS) $(PROFILED_DEPLIBS)
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -g -pg -o e2freefrag.profiled \
- $(PROFILED_E2FREEFRAG_OBJS) $(PROFILED_LIBS)
+ $(PROFILED_E2FREEFRAG_OBJS) $(PROFILED_LIBS) $(SYSLIBS)
filefrag: $(FILEFRAG_OBJS)
$(E) " LD $@"
- $(Q) $(CC) $(ALL_LDFLAGS) -o filefrag $(FILEFRAG_OBJS)
+ $(Q) $(CC) $(ALL_LDFLAGS) -o filefrag $(FILEFRAG_OBJS) $(SYSLIBS)
filefrag.profiled: $(FILEFRAG_OBJS)
$(E) " LD $@"
tst_ismounted: $(srcdir)/ismounted.c $(STATIC_LIBEXT2FS) $(DEPLIBCOM_ERR)
$(E) " LD $@"
$(CC) -o tst_ismounted $(srcdir)/ismounted.c -DDEBUG $(ALL_CFLAGS) \
- $(LIBCOM_ERR)
+ $(LIBCOM_ERR) $(SYSLIBS)
tune2fs.8: $(DEP_SUBSTITUTE) $(srcdir)/tune2fs.8.in
$(E) " SUBST $@"
printf(_("Writing block %llu\n"), (unsigned long long) block);
if (fd != 1)
seek_relative(fd, blocksize);
- return;
+ goto free_and_return;
}
count = write(fd, buf, blocksize);
if (count != blocksize) {
exit(1);
}
+free_and_return:
if (free_buf)
ext2fs_free_mem(&buf);
}
bscount = print_progress(total_written,
meta_blocks_count);
duration = time(NULL) - start_time;
- if (duration > 5) {
+ if (duration > 5 && total_written) {
time_t est = (duration * meta_blocks_count /
total_written) - duration;
char buff[30];
if (show_progress) {
time_t duration = time(NULL) - start_time;
char buff[30];
- while (bscount--)
- fputc('\b', stderr);
+ fputc('\r', stderr);
strftime(buff, 30, "%T", gmtime(&duration));
- fprintf(stderr, _("\b\b\b\b\b\b\b\bCopied %llu / %llu "
- "blocks (%llu%%) in %s at %.2f MB/s \n"),
- total_written, meta_blocks_count,
- calc_percent(total_written, meta_blocks_count), buff,
- calc_rate(total_written, fs->blocksize, duration));
+ fprintf(stderr, _("Copied %llu / %llu blocks (%d%%) in %s "),
+ total_written, meta_blocks_count,
+ calc_percent(total_written, meta_blocks_count), buff);
+ if (duration)
+ fprintf(stderr, _("at %.2f MB/s"),
+ calc_rate(total_written, fs->blocksize, duration));
+ fputs(" \n", stderr);
}
#ifdef HAVE_FTRUNCATE64
if (sparse) {
retval = ext2fs_image_inode_read(fs, fd, 0);
if (retval) {
- com_err(image_fn, 0, "while restoring the image table");
+ com_err(image_fn, 0, _("while restoring the image table"));
exit(1);
}
}
if (fd != 1) {
if (fstat(fd, &st)) {
- com_err(program_name, 0, "Can not stat output\n");
+ com_err(program_name, 0, _("Can not stat output\n"));
exit(1);
}
if (S_ISBLK(st.st_mode))
#include <unistd.h>
#include <ext2fs/ext2_types.h>
#include <ext2fs/ext2fs.h>
-#include <linux/fs.h>
#include <sys/ioctl.h>
#include <ext2fs/fiemap.h>
#include <sys/mman.h>
static struct frag_statistic_ino frag_rank[SHOW_FRAG_FILES];
-/* Local definitions of some syscalls glibc may not yet have */
-
-#ifndef HAVE_POSIX_FADVISE
-#warning Using locally defined posix_fadvise interface.
-
-#ifndef __NR_fadvise64_64
-#error Your kernel headers dont define __NR_fadvise64_64
+/*
+ * We prefer posix_fadvise64 when available, as it allows 64bit offset on
+ * 32bit systems
+ */
+#if defined(HAVE_POSIX_FADVISE64)
+#define posix_fadvise posix_fadvise64
+#elif defined(HAVE_FADVISE64)
+#define posix_fadvise fadvise64
+#elif !defined(HAVE_POSIX_FADVISE)
+#error posix_fadvise not available!
#endif
/*
- * fadvise() - Give advice about file access.
- *
- * @fd: defrag target file's descriptor.
- * @offset: file offset.
- * @len: area length.
- * @advise: process flag.
+ * Local definitions of some syscalls glibc may not yet have
*/
-static int posix_fadvise(int fd, loff_t offset, size_t len, int advise)
-{
- return syscall(__NR_fadvise64_64, fd, offset, len, advise);
-}
-#endif /* ! HAVE_FADVISE64_64 */
-
#ifndef HAVE_SYNC_FILE_RANGE
#warning Using locally defined sync_file_range interface.
]
[
.B \-O
-.IR feature [,...]
+[^]\fIfeature\fR[,...]
]
[
.B \-q
This allows the block allocator to prevent read-modify-write of the
parity in a RAID stripe if possible when the data is written.
.TP
+.BI offset= offset
+Create the filesystem at an offset from the beginning of the device or
+file. This can be useful when creating disk images for virtual machines.
+.TP
.BI resize= max-online-resize
Reserve enough space so that the block group descriptor table can grow
to support a filesystem that has
.B mke2fs
executable was compiled for.
.TP
-.B "\-O \fIfeature\fR[,...]"
+.B "\-O \fR[^]\fIfeature\fR[,...]"
Create a filesystem with the given features (filesystem options),
overriding the default filesystem options. The features that are
enabled by default are specified by the
.sp
The filesystem feature set is comprised of a list of features, separated
by commas, that are to be enabled. To disable a feature, simply
-prefix the feature name with a caret ('^') or a minus ('-') character.
+prefix the feature name with a caret ('^') character.
Features with dependencies will not be removed successfully.
The pseudo-filesystem feature "none" will clear all filesystem features.
.TP
static char *bad_blocks_filename = NULL;
static __u32 fs_stride;
static int quotatype = -1; /* Initialize both user and group quotas by default */
+static __u64 offset;
static struct ext2_super_block fs_param;
static char *fs_uuid = NULL;
continue;
}
param->s_desc_size = desc_size;
+ } else if (strcmp(token, "offset") == 0) {
+ if (!arg) {
+ r_usage++;
+ badopt = token;
+ continue;
+ }
+ offset = strtoull(arg, &p, 0);
+ if (*p) {
+ fprintf(stderr, _("Invalid offset: %s\n"),
+ arg);
+ r_usage++;
+ continue;
+ }
} else if (strcmp(token, "mmp_update_interval") == 0) {
if (!arg) {
r_usage++;
"and may take an argument which\n"
"\tis set off by an equals ('=') sign.\n\n"
"Valid extended options are:\n"
+ "\tmmp_update_interval=<interval>\n"
"\tstride=<RAID per-disk data chunk in blocks>\n"
"\tstripe-width=<RAID stride * data disks in blocks>\n"
+ "\toffset=<offset to create the file system>\n"
"\tresize=<resize maximum size in blocks>\n"
"\tlazy_itable_init=<0 to disable, 1 to enable>\n"
"\tlazy_journal_init=<0 to disable, 1 to enable>\n"
int flags;
int old_bitmaps;
io_manager io_ptr;
- char tdb_string[40];
+ char opt_string[40];
char *hash_alg_str;
int itable_zeroed = 0;
}
}
- sprintf(tdb_string, "tdb_data_size=%d", fs->blocksize <= 4096 ?
+ sprintf(opt_string, "tdb_data_size=%d", fs->blocksize <= 4096 ?
32768 : fs->blocksize * 8);
- io_channel_set_options(fs->io, tdb_string);
+ io_channel_set_options(fs->io, opt_string);
+ if (offset) {
+ sprintf(opt_string, "offset=%llu", offset);
+ io_channel_set_options(fs->io, opt_string);
+ }
if (fs_param.s_flags & EXT2_FLAGS_TEST_FILESYS)
fs->super->s_flags |= EXT2_FLAGS_TEST_FILESYS;
$(srcdir)/resource_track.c \
$(srcdir)/sim_progress.c
-LIBS= $(LIBE2P) $(LIBEXT2FS) $(LIBCOM_ERR) $(LIBINTL)
+LIBS= $(LIBE2P) $(LIBEXT2FS) $(LIBCOM_ERR) $(LIBINTL) $(SYSLIBS)
DEPLIBS= $(LIBE2P) $(LIBEXT2FS) $(DEPLIBCOM_ERR)
STATIC_LIBS= $(STATIC_LIBE2P) $(STATIC_LIBEXT2FS) $(STATIC_LIBCOM_ERR) \
- $(LIBINTL)
+ $(LIBINTL) $(SYSLIBS)
DEPSTATIC_LIBS= $(STATIC_LIBE2P) $(STATIC_LIBEXT2FS) $(DEPSTATIC_LIBCOM_ERR)
.c.o:
} else
fputs("# Syntax error\n", out);
}
+ if (extent)
+ ext2fs_free_extent_table(extent);
}
#ifdef __GNUC__
../e2fsck/e2fsck: Superblock invalid, trying backup blocks...
../e2fsck/e2fsck: The ext2 superblock is corrupt while trying to open test.img
-The superblock could not be read or does not describe a correct ext2
-filesystem. If the device is valid and it really contains an ext2
+The superblock could not be read or does not describe a valid ext2/ext3/ext4
+filesystem. If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
+ or
+ e2fsck -b 32768 <device>
Exit status is 8
SRCS= $(srcdir)/test_rel.c
-LIBS= $(LIBEXT2FS) $(LIBSS) $(LIBCOM_ERR)
+LIBS= $(LIBEXT2FS) $(LIBSS) $(LIBCOM_ERR) $(SYSLIBS)
DEPLIBS= $(LIBEXT2FS) $(DEPLIBSS) $(DEPLIBCOM_ERR)
.c.o:
all:: $(PROGS) gen-tarball
+dirpaths.h:
+ $(E) " CREATE dirpaths.h"
+ $(Q) echo "/* fake dirpaths.h for config.h */" > dirpaths.h
+
+subst.o: dirpaths.h
+
subst: subst.o
$(E) " LD $@"
$(Q) $(BUILD_CC) $(BUILD_LDFLAGS) -o subst subst.o
clean:
$(RM) -f $(PROGS) \#* *.s *.o *.a *~ core *.tar.gz gen-tarball \
- copy-sparse
+ copy-sparse dirpaths.h
mostlyclean: clean
*
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <fcntl.h>
#include <time.h>
#include <utime.h>
/*
* Return 0 if the files are different, 1 if the files are the same.
*/
-static int compare_file(const char *outfn, const char *newfn)
+static int compare_file(FILE *old_f, FILE *new_f)
{
- FILE *old_f, *new_f;
char oldbuf[2048], newbuf[2048], *oldcp, *newcp;
int retval;
- old_f = fopen(outfn, "r");
- if (!old_f)
- return 0;
- new_f = fopen(newfn, "r");
- if (!new_f) {
- fclose(old_f);
- return 0;
- }
-
while (1) {
oldcp = fgets(oldbuf, sizeof(oldbuf), old_f);
newcp = fgets(newbuf, sizeof(newbuf), new_f);
break;
}
}
- fclose(old_f);
- fclose(new_f);
return retval;
}
{
char line[2048];
int c;
- FILE *in, *out;
+ int fd;
+ FILE *in, *out, *old = NULL;
char *outfn = NULL, *newfn = NULL;
int verbose = 0;
int adjust_timestamp = 0;
+ int got_atime = 0;
struct stat stbuf;
- struct utimbuf ut;
+ struct timeval tv[2];
while ((c = getopt (argc, argv, "f:tv")) != EOF) {
switch (c) {
}
strcpy(newfn, outfn);
strcat(newfn, ".new");
- out = fopen(newfn, "w");
- if (!out) {
+ fd = open(newfn, O_CREAT|O_TRUNC|O_RDWR, 0444);
+ if (fd < 0) {
perror(newfn);
exit(1);
}
+ out = fdopen(fd, "w+");
+ if (!out) {
+ perror("fdopen");
+ exit(1);
+ }
+
+ fd = open(outfn, O_RDONLY);
+ if (fd > 0) {
+ /* save the original atime, if possible */
+ if (fstat(fd, &stbuf) == 0) {
+#if HAVE_STRUCT_STAT_ST_ATIM
+ tv[0].tv_sec = stbuf.st_atim.tv_sec;
+ tv[0].tv_usec = stbuf.st_atim.tv_nsec / 1000;
+#else
+ tv[0].tv_sec = stbuf.st_atime;
+ tv[0].tv_usec = 0;
+#endif
+ got_atime = 1;
+ }
+ old = fdopen(fd, "r");
+ if (!old)
+ close(fd);
+ }
} else {
out = stdout;
outfn = 0;
fputs(line, out);
}
fclose(in);
- fclose(out);
if (outfn) {
- struct stat st;
- if (compare_file(outfn, newfn)) {
+ fflush(out);
+ rewind(out);
+ if (old && compare_file(old, out)) {
if (verbose)
printf("No change, keeping %s.\n", outfn);
if (adjust_timestamp) {
- if (stat(outfn, &stbuf) == 0) {
- if (verbose)
- printf("Updating modtime for %s\n", outfn);
- ut.actime = stbuf.st_atime;
- ut.modtime = time(0);
- if (utime(outfn, &ut) < 0)
- perror("utime");
+ if (verbose)
+ printf("Updating modtime for %s\n", outfn);
+ if (gettimeofday(&tv[1], NULL) < 0) {
+ perror("gettimeofday");
+ exit(1);
}
+ if (got_atime == 0)
+ tv[0] = tv[1];
+ else if (verbose)
+ printf("Using original atime\n");
+#ifdef HAVE_FUTIMES
+ if (futimes(fileno(old), tv) < 0)
+ perror("futimes");
+#else
+ if (utimes(outfn, tv) < 0)
+ perror("utimes");
+#endif
}
- unlink(newfn);
+ fclose(out);
+ if (unlink(newfn) < 0)
+ perror("unlink");
} else {
if (verbose)
printf("Creating or replacing %s.\n", outfn);
- rename(newfn, outfn);
+ fclose(out);
+ if (old)
+ fclose(old);
+ old = NULL;
+ if (rename(newfn, outfn) < 0) {
+ perror("rename");
+ exit(1);
+ }
}
- /* set read-only to alert user it is a generated file */
- if (stat(outfn, &st) == 0)
- chmod(outfn, st.st_mode & ~0222);
}
+ if (old)
+ fclose(old);
return (0);
}