Merge branch 'maint' into next

This commit is contained in:
Theodore Ts'o 2019-02-10 21:50:26 -05:00
commit a935b93dca
12 changed files with 102 additions and 63 deletions

84
configure vendored
View File

@ -13113,12 +13113,13 @@ _ACEOF
fi fi
if test -n "$BLKID_CMT"; then if test -n "$BLKID_CMT"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing blkid_probe_all" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for blkid_probe_get_topology in -lblkid" >&5
$as_echo_n "checking for library containing blkid_probe_all... " >&6; } $as_echo_n "checking for blkid_probe_get_topology in -lblkid... " >&6; }
if ${ac_cv_search_blkid_probe_all+:} false; then : if ${ac_cv_lib_blkid_blkid_probe_get_topology+:} false; then :
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
else else
ac_func_search_save_LIBS=$LIBS ac_check_lib_save_LIBS=$LIBS
LIBS="-lblkid $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
@ -13128,44 +13129,69 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
#endif #endif
char blkid_probe_all (); char blkid_probe_get_topology ();
int int
main () main ()
{ {
return blkid_probe_all (); return blkid_probe_get_topology ();
; ;
return 0; return 0;
} }
_ACEOF _ACEOF
for ac_lib in '' blkid; do if ac_fn_c_try_link "$LINENO"; then :
if test -z "$ac_lib"; then ac_cv_lib_blkid_blkid_probe_get_topology=yes
ac_res="none required" else
else ac_cv_lib_blkid_blkid_probe_get_topology=no
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_blkid_probe_all=$ac_res
fi fi
rm -f core conftest.err conftest.$ac_objext \ rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest$ac_exeext conftest.$ac_ext
if ${ac_cv_search_blkid_probe_all+:} false; then : LIBS=$ac_check_lib_save_LIBS
break
fi fi
done { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_blkid_blkid_probe_get_topology" >&5
if ${ac_cv_search_blkid_probe_all+:} false; then : $as_echo "$ac_cv_lib_blkid_blkid_probe_get_topology" >&6; }
if test "x$ac_cv_lib_blkid_blkid_probe_get_topology" = xyes; then :
$as_echo "#define HAVE_BLKID_PROBE_GET_TOPOLOGY 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for blkid_probe_enable_partitions in -lblkid" >&5
$as_echo_n "checking for blkid_probe_enable_partitions in -lblkid... " >&6; }
if ${ac_cv_lib_blkid_blkid_probe_enable_partitions+:} false; then :
$as_echo_n "(cached) " >&6
else else
ac_cv_search_blkid_probe_all=no ac_check_lib_save_LIBS=$LIBS
LIBS="-lblkid $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char blkid_probe_enable_partitions ();
int
main ()
{
return blkid_probe_enable_partitions ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_blkid_blkid_probe_enable_partitions=yes
else
ac_cv_lib_blkid_blkid_probe_enable_partitions=no
fi fi
rm conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext \
LIBS=$ac_func_search_save_LIBS conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_blkid_probe_all" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_blkid_blkid_probe_enable_partitions" >&5
$as_echo "$ac_cv_search_blkid_probe_all" >&6; } $as_echo "$ac_cv_lib_blkid_blkid_probe_enable_partitions" >&6; }
ac_res=$ac_cv_search_blkid_probe_all if test "x$ac_cv_lib_blkid_blkid_probe_enable_partitions" = xyes; then :
if test "$ac_res" != no; then : $as_echo "#define HAVE_BLKID_PROBE_ENABLE_PARTITIONS 1" >>confdefs.h
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
fi fi
@ -13173,7 +13199,7 @@ fi
if test -n "$DLOPEN_LIB" ; then if test -n "$DLOPEN_LIB" ; then
ac_cv_func_dlopen=yes ac_cv_func_dlopen=yes
fi fi
for ac_func in __secure_getenv add_key backtrace blkid_probe_get_topology blkid_probe_enable_partitions chflags dlopen fadvise64 fallocate fallocate64 fchown fcntl fdatasync fstat64 fsync ftruncate64 futimes getcwd getdtablesize gethostname getmntinfo getpwuid_r getrlimit getrusage jrand48 keyctl llistxattr llseek lseek64 mallinfo mbstowcs memalign mempcpy mmap msync nanosleep open64 pathconf posix_fadvise posix_fadvise64 posix_memalign prctl pread pwrite pread64 pwrite64 secure_getenv setmntent setresgid setresuid snprintf srandom stpcpy strcasecmp strdup strnlen strptime strtoull sync_file_range sysconf usleep utime utimes valloc for ac_func in __secure_getenv add_key backtrace chflags dlopen fadvise64 fallocate fallocate64 fchown fcntl fdatasync fstat64 fsync ftruncate64 futimes getcwd getdtablesize gethostname getmntinfo getpwuid_r getrlimit getrusage jrand48 keyctl llistxattr llseek lseek64 mallinfo mbstowcs memalign mempcpy mmap msync nanosleep open64 pathconf posix_fadvise posix_fadvise64 posix_memalign prctl pread pwrite pread64 pwrite64 secure_getenv setmntent setresgid setresuid snprintf srandom stpcpy strcasecmp strdup strnlen strptime strtoull sync_file_range sysconf usleep utime utimes valloc
do : do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"

View File

@ -1114,11 +1114,14 @@ AC_CHECK_MEMBER(struct sockaddr.sa_len,
[#include <sys/types.h> [#include <sys/types.h>
#include <sys/socket.h>]) #include <sys/socket.h>])
dnl dnl
dnl This will add -lblkid to the AC_CHECK_FUNCS search if we are using dnl If we are using the system-provided blkid library, check for
dnl the system-provided blkid library dnl the functions added after migrating that library to util-linux
dnl dnl
if test -n "$BLKID_CMT"; then if test -n "$BLKID_CMT"; then
AC_SEARCH_LIBS([blkid_probe_all], [blkid]) AC_CHECK_LIB(blkid, blkid_probe_get_topology,
AC_DEFINE(HAVE_BLKID_PROBE_GET_TOPOLOGY, 1))
AC_CHECK_LIB(blkid, blkid_probe_enable_partitions,
AC_DEFINE(HAVE_BLKID_PROBE_ENABLE_PARTITIONS, 1))
fi fi
dnl dnl
if test -n "$DLOPEN_LIB" ; then if test -n "$DLOPEN_LIB" ; then
@ -1128,8 +1131,6 @@ AC_CHECK_FUNCS(m4_flatten([
__secure_getenv __secure_getenv
add_key add_key
backtrace backtrace
blkid_probe_get_topology
blkid_probe_enable_partitions
chflags chflags
dlopen dlopen
fadvise64 fadvise64

View File

@ -81,9 +81,10 @@ static errcode_t set_selinux_xattr(ext2_filsys fs, ext2_ino_t ino,
retval = selabel_lookup(params->sehnd, &secontext, params->filename, retval = selabel_lookup(params->sehnd, &secontext, params->filename,
inode.i_mode); inode.i_mode);
if (retval < 0) { if (retval < 0) {
com_err(__func__, retval, int saved_errno = errno;
com_err(__func__, errno,
_("searching for label \"%s\""), params->filename); _("searching for label \"%s\""), params->filename);
return retval; return saved_errno;
} }
retval = ino_add_xattr(fs, ino, "security." XATTR_SELINUX_SUFFIX, retval = ino_add_xattr(fs, ino, "security." XATTR_SELINUX_SUFFIX,
@ -187,7 +188,7 @@ static errcode_t set_timestamp(ext2_filsys fs, ext2_ino_t ino,
} }
retval = lstat(src_filename, &stat); retval = lstat(src_filename, &stat);
if (retval < 0) { if (retval < 0) {
com_err(__func__, retval, com_err(__func__, errno,
_("while lstat file %s"), src_filename); _("while lstat file %s"), src_filename);
goto end; goto end;
} }
@ -339,18 +340,19 @@ errcode_t android_configure_fs(ext2_filsys fs, char *src_dir, char *target_out,
if (nopt > 0) { if (nopt > 0) {
sehnd = selabel_open(SELABEL_CTX_FILE, seopts, nopt); sehnd = selabel_open(SELABEL_CTX_FILE, seopts, nopt);
if (!sehnd) { if (!sehnd) {
com_err(__func__, -EINVAL, int saved_errno = errno;
com_err(__func__, errno,
_("while opening file contexts \"%s\""), _("while opening file contexts \"%s\""),
seopts[0].value); seopts[0].value);
return -EINVAL; return saved_errno;
} }
} }
#else #else
sehnd = selinux_android_file_context_handle(); sehnd = selinux_android_file_context_handle();
if (!sehnd) { if (!sehnd) {
com_err(__func__, -EINVAL, com_err(__func__, EINVAL,
_("while opening android file_contexts")); _("while opening android file_contexts"));
return -EINVAL; return EINVAL;
} }
#endif #endif

View File

@ -848,7 +848,7 @@ void internal_dump_inode(FILE *out, const char *prefix,
if (is_large_inode && large_inode->i_extra_isize >= 32) if (is_large_inode && large_inode->i_extra_isize >= 32)
fprintf(out, " Project: %5d", large_inode->i_projid); fprintf(out, " Project: %5d", large_inode->i_projid);
fputs(" Size: ", out); fputs(" Size: ", out);
if (LINUX_S_ISREG(inode->i_mode)) if (LINUX_S_ISREG(inode->i_mode) || LINUX_S_ISDIR(inode->i_mode))
fprintf(out, "%llu\n", EXT2_I_SIZE(inode)); fprintf(out, "%llu\n", EXT2_I_SIZE(inode));
else else
fprintf(out, "%d\n", inode->i_size); fprintf(out, "%d\n", inode->i_size);

View File

@ -152,9 +152,6 @@ static int list_dir_proc(ext2_ino_t dir EXT2FS_ATTR((unused)),
fprintf(ls->f, "(%d) %5d %5d ", fprintf(ls->f, "(%d) %5d %5d ",
ext2fs_dirent_file_type(dirent), ext2fs_dirent_file_type(dirent),
inode_uid(inode), inode_gid(inode)); inode_uid(inode), inode_gid(inode));
if (LINUX_S_ISDIR(inode.i_mode))
fprintf(ls->f, "%5d", inode.i_size);
else
fprintf(ls->f, "%5llu", EXT2_I_SIZE(&inode)); fprintf(ls->f, "%5llu", EXT2_I_SIZE(&inode));
fprintf(ls->f, " %s ", datestr); fprintf(ls->f, " %s ", datestr);
print_filename(ls->f, dirent, options); print_filename(ls->f, dirent, options);

View File

@ -44,6 +44,7 @@ cc_defaults {
e2fsck_libs = [ e2fsck_libs = [
"libext2fs", "libext2fs",
"libext2_blkid", "libext2_blkid",
"libext2_com_err",
"libext2_uuid", "libext2_uuid",
"libext2_quota", "libext2_quota",
"libext2_e2p", "libext2_e2p",

View File

@ -3647,9 +3647,12 @@ static int process_block(ext2_filsys fs,
} }
} }
if (p->is_dir && blockcnt > (1 << (21 - fs->super->s_log_block_size))) if (p->is_dir && !ext2fs_has_feature_largedir(fs->super) &&
blockcnt > (1 << (21 - fs->super->s_log_block_size)))
problem = PR_1_TOOBIG_DIR; problem = PR_1_TOOBIG_DIR;
if (p->is_reg && p->num_blocks+1 >= p->max_blocks) if (p->is_dir && p->num_blocks + 1 >= p->max_blocks)
problem = PR_1_TOOBIG_DIR;
if (p->is_reg && p->num_blocks + 1 >= p->max_blocks)
problem = PR_1_TOOBIG_REG; problem = PR_1_TOOBIG_REG;
if (!p->is_dir && !p->is_reg && blockcnt > 0) if (!p->is_dir && !p->is_reg && blockcnt > 0)
problem = PR_1_TOOBIG_SYMLINK; problem = PR_1_TOOBIG_SYMLINK;

View File

@ -91,24 +91,14 @@ cc_library {
"test_io.c", "test_io.c",
], ],
shared_libs: [ shared_libs: [
"libext2_com_err",
"libsparse", "libsparse",
"libz", "libz",
], ],
whole_static_libs: [
"libext2_com_err"
],
cflags: ["-Wno-unused-parameter"], cflags: ["-Wno-unused-parameter"],
target: { target: {
host: {
// Consider removing this library as a whole for the host. It is not
// in the android side.
whole_static_libs: ["libext2_com_err"],
},
android: { android: {
shared_libs: [ shared_libs: [ "libext2_uuid" ],
"libext2_com_err",
"libext2_uuid",
],
}, },
windows: { windows: {
enabled: true, enabled: true,

View File

@ -21,6 +21,7 @@ cc_library {
shared_libs: [ shared_libs: [
"libext2fs", "libext2fs",
"libext2_blkid", "libext2_blkid",
"libext2_com_err",
], ],
target: { target: {

View File

@ -21,8 +21,9 @@ cc_library {
], ],
cflags: ["-Wno-error=format-extra-args"], cflags: ["-Wno-error=format-extra-args"],
shared_libs: [ shared_libs: [
"libext2_quota",
"libext2fs", "libext2fs",
"libext2_com_err",
"libext2_quota",
], ],
system_shared_libs: ["libc", "libdl"], system_shared_libs: ["libc", "libdl"],
export_include_dirs: ["."], export_include_dirs: ["."],
@ -118,6 +119,7 @@ cc_defaults {
tune2fs_libs = [ tune2fs_libs = [
"libext2_blkid", "libext2_blkid",
"libext2_com_err",
"libext2_quota", "libext2_quota",
"libext2_uuid", "libext2_uuid",
"libext2_e2p", "libext2_e2p",
@ -271,3 +273,18 @@ cc_binary {
], ],
system_shared_libs: ["libc", "libdl"], system_shared_libs: ["libc", "libdl"],
} }
//##########################################################################
// Build filefrag
cc_binary {
name: "filefrag",
host_supported: true,
defaults: ["e2fsprogs-defaults"],
srcs: ["filefrag.c"],
shared_libs: [
"libext2fs",
],
system_shared_libs: ["libc", "libdl"],
}

View File

@ -438,7 +438,7 @@ static errcode_t copy_file_chunk(ext2_filsys fs, int fd, ext2_file_t e2_file,
ptr += blen; ptr += blen;
continue; continue;
} }
err = ext2fs_file_lseek(e2_file, off + bpos, err = ext2fs_file_llseek(e2_file, off + bpos,
EXT2_SEEK_SET, NULL); EXT2_SEEK_SET, NULL);
if (err) if (err)
goto fail; goto fail;
@ -480,8 +480,8 @@ static errcode_t try_lseek_copy(ext2_filsys fs, int fd, struct stat *statbuf,
if (hole < 0) if (hole < 0)
return EXT2_ET_UNIMPLEMENTED; return EXT2_ET_UNIMPLEMENTED;
data_blk = data & ~(fs->blocksize - 1); data_blk = data & ~(off_t)(fs->blocksize - 1);
hole_blk = (hole + (fs->blocksize - 1)) & ~(fs->blocksize - 1); hole_blk = (hole + (off_t)(fs->blocksize - 1)) & ~(off_t)(fs->blocksize - 1);
err = copy_file_chunk(fs, fd, e2_file, data_blk, hole_blk, buf, err = copy_file_chunk(fs, fd, e2_file, data_blk, hole_blk, buf,
zerobuf); zerobuf);
if (err) if (err)

View File

@ -15,6 +15,7 @@ cc_binary {
], ],
shared_libs: [ shared_libs: [
"libext2fs", "libext2fs",
"libext2_com_err",
"libext2_e2p", "libext2_e2p",
"libext2_uuid", "libext2_uuid",
"libext2_blkid", "libext2_blkid",