Merge branch 'maint' into next

debian
Theodore Ts'o 2016-03-06 20:37:49 -05:00
commit dcb8e1fa04
11 changed files with 85 additions and 31 deletions

View File

@ -19,7 +19,7 @@ LIB_SUBDIRS=lib/et lib/ss lib/e2p $(UUID_LIB_SUBDIR) $(BLKID_LIB_SUBDIR) $(SUPPO
PROG_SUBDIRS=e2fsck $(DEBUGFS_DIR) misc $(RESIZE_DIR) tests/progs po
SUBDIRS=util $(LIB_SUBDIRS) $(PROG_SUBDIRS) tests
SUBS= util/subst.conf lib/config.h lib/dirpaths.h \
SUBS= util/subst.conf lib/config.h $(top_builddir)/lib/dirpaths.h \
lib/ext2fs/ext2_types.h lib/blkid/blkid_types.h lib/uuid/uuid_types.h
TAR=tar
@ -34,6 +34,7 @@ subs: $(DEP_SUBSTITUTE)
then $(MAKE) $$i || exit $$? ; fi ; done
@(if test -d lib/et ; then cd lib/et && $(MAKE) compile_et; fi)
@(if test -d lib/ext2fs ; then cd lib/ext2fs && $(MAKE) ext2_err.h; fi)
@(if test -d lib/support ; then cd lib/support && $(MAKE) prof_err.h; fi)
progs: all-progs-recursive
libs: all-libs-recursive

View File

@ -243,8 +243,13 @@ option is given set the owner, group and permissions information on
to match
.IR filespec .
.TP
.B dump_mmp
Display the multiple-mount protection (mmp) field values.
.BI dump_mmp " [mmp_block]"
Display the multiple-mount protection (mmp) field values. If
.I mmp_block
is specified then verify and dump the MMP values from the given block
number, otherwise use the
.B s_mmp_block
field in the superblock to locate and use the existing MMP block.
.TP
.BI dx_hash " [-h hash_alg] [-s hash_seed] filename"
Calculate the directory hash of

View File

@ -2262,12 +2262,31 @@ void do_symlink(int argc, char *argv[])
void do_dump_mmp(int argc EXT2FS_ATTR((unused)), char *argv[])
{
struct mmp_struct *mmp_s;
unsigned long long mmp_block;
time_t t;
errcode_t retval = 0;
if (check_fs_open(argv[0]))
return;
if (argc > 1) {
char *end = NULL;
mmp_block = strtoull(argv[1], &end, 0);
if (end == argv[0] || mmp_block == 0) {
fprintf(stderr, "%s: invalid MMP block '%s' given\n",
argv[0], argv[1]);
return;
}
} else {
mmp_block = current_fs->super->s_mmp_block;
}
if (mmp_block == 0) {
fprintf(stderr, "%s: MMP: not active on this filesystem.\n",
argv[0]);
return;
}
if (current_fs->mmp_buf == NULL) {
retval = ext2fs_get_mem(current_fs->blocksize,
&current_fs->mmp_buf);
@ -2279,10 +2298,10 @@ void do_dump_mmp(int argc EXT2FS_ATTR((unused)), char *argv[])
mmp_s = current_fs->mmp_buf;
retval = ext2fs_mmp_read(current_fs, current_fs->super->s_mmp_block,
current_fs->mmp_buf);
retval = ext2fs_mmp_read(current_fs, mmp_block, current_fs->mmp_buf);
if (retval) {
com_err(argv[0], retval, "reading MMP block.\n");
com_err(argv[0], retval, "reading MMP block %llu.\n",
mmp_block);
return;
}

View File

@ -1441,10 +1441,19 @@ static struct blkid_magic type_array[] = {
{ "iso9660", 32, 1, 5, "CD001", probe_iso9660 },
{ "iso9660", 32, 9, 5, "CDROM", probe_iso9660 },
{ "jfs", 32, 0, 4, "JFS1", probe_jfs },
{ "zfs", 8, 0, 8, "\0\0\x02\xf5\xb0\x07\xb1\x0c", probe_zfs },
{ "zfs", 8, 0, 8, "\x0c\xb1\x07\xb0\xf5\x02\0\0", probe_zfs },
{ "zfs", 264, 0, 8, "\0\0\x02\xf5\xb0\x07\xb1\x0c", probe_zfs },
{ "zfs", 264, 0, 8, "\x0c\xb1\x07\xb0\xf5\x02\0\0", probe_zfs },
/* ZFS has 128 root blocks (#4 is the first used), check only 6 of them */
{ "zfs", 128, 0, 8, "\0\0\0\0\0\xba\xb1\x0c", probe_zfs },
{ "zfs", 128, 0, 8, "\x0c\xb1\xba\0\0\0\0\0", probe_zfs },
{ "zfs", 132, 0, 8, "\0\0\0\0\0\xba\xb1\x0c", probe_zfs },
{ "zfs", 132, 0, 8, "\x0c\xb1\xba\0\0\0\0\0", probe_zfs },
{ "zfs", 136, 0, 8, "\0\0\0\0\0\xba\xb1\x0c", probe_zfs },
{ "zfs", 136, 0, 8, "\x0c\xb1\xba\0\0\0\0\0", probe_zfs },
{ "zfs", 384, 0, 8, "\0\0\0\0\0\xba\xb1\x0c", probe_zfs },
{ "zfs", 384, 0, 8, "\x0c\xb1\xba\0\0\0\0\0", probe_zfs },
{ "zfs", 388, 0, 8, "\0\0\0\0\0\xba\xb1\x0c", probe_zfs },
{ "zfs", 388, 0, 8, "\x0c\xb1\xba\0\0\0\0\0", probe_zfs },
{ "zfs", 392, 0, 8, "\0\0\0\0\0\xba\xb1\x0c", probe_zfs },
{ "zfs", 392, 0, 8, "\x0c\xb1\xba\0\0\0\0\0", probe_zfs },
{ "hfsplus", 1, 0, 2, "BD", probe_hfsplus },
{ "hfsplus", 1, 0, 2, "H+", probe_hfsplus },
{ "hfsplus", 1, 0, 2, "HX", probe_hfsplus },

View File

@ -41,32 +41,34 @@
#define OPEN_FLAGS (O_RDONLY|O_NONBLOCK)
#endif
int fgetversion (const char * name, unsigned long * version)
int fgetversion(const char *name, unsigned long *version)
{
unsigned int ver = -1;
int rc = -1;
#if HAVE_EXT2_IOCTLS
#if !APPLE_DARWIN
int fd, r, ver, save_errno = 0;
# if !APPLE_DARWIN
int fd, save_errno = 0;
fd = open (name, OPEN_FLAGS);
fd = open(name, OPEN_FLAGS);
if (fd == -1)
return -1;
r = ioctl (fd, EXT2_IOC_GETVERSION, &ver);
if (r == -1)
rc = ioctl(fd, EXT2_IOC_GETVERSION, &ver);
if (rc == -1)
save_errno = errno;
*version = ver;
close (fd);
if (save_errno)
close(fd);
if (rc == -1)
errno = save_errno;
return r;
#else
int ver=-1, err;
err = syscall(SYS_fsctl, name, EXT2_IOC_GETVERSION, &ver, 0);
*version = ver;
return(err);
#endif
# else /* APPLE_DARWIN */
rc = syscall(SYS_fsctl, name, EXT2_IOC_GETVERSION, &ver, 0);
# endif /* !APPLE_DARWIN */
#else /* ! HAVE_EXT2_IOCTLS */
extern int errno;
errno = EOPNOTSUPP;
return -1;
#endif /* ! HAVE_EXT2_IOCTLS */
if (rc == 0)
*version = ver;
return rc;
}

View File

@ -36,7 +36,9 @@ Last Changed Date: 2007-06-22 13:36:10 -0400 (Fri, 22 Jun 2007)
#define HAVE_UTIME_H
#define HAVE_UTIME
#endif
#ifndef __FreeBSD__
#define _XOPEN_SOURCE 600
#endif
#include "config.h"
#include <unistd.h>

View File

@ -187,7 +187,7 @@ int main(int argc, char *argv[])
if (print_jnl_copies)
printf(_("[*] probably superblock written in the ext3 "
"journal superblock,\n\tso start/end/grp wrong\n"));
printf(_("byte_offset byte_start byte_end fs_blocks blksz grp last_mount_time sb_uuid label\n"));
printf(_("byte_offset byte_start byte_end fs_blocks blksz grp mkfs/mount_time sb_uuid label\n"));
for (; lseek64(fd, sk, SEEK_SET) != -1 &&
read(fd, &ext2, 512) == 512; sk += skiprate) {
static unsigned char last_uuid[16] = "blah";
@ -230,7 +230,10 @@ int main(int argc, char *argv[])
WHY("free_inodes_count > inodes_count (%u > %u)\n",
ext2.s_free_inodes_count, ext2.s_inodes_count);
tm = ext2.s_mtime;
if (ext2.s_mkfs_time != 0)
tm = ext2.s_mkfs_time;
else
tm = ext2.s_mtime;
s = ctime(&tm);
s[24] = 0;
bsize = 1 << (ext2.s_log_block_size + 10);

View File

@ -103,7 +103,7 @@ static int list_attributes (const char * name)
name);
return -1;
}
printf ("%5lu ", generation);
printf ("%-10lu ", generation);
}
if (pf_options & PFOPT_LONG) {
printf("%-28s ", name);

View File

@ -25,6 +25,9 @@
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_LINUX_MAJOR_H
#include <linux/major.h>
#endif

View File

@ -35,10 +35,16 @@ mke2fs.conf: $(srcdir)/mke2fs.conf.in
.PHONY : test_pre test_post check always_run
TESTS=$(wildcard $(srcdir)/[a-z]_*)
always_run:
TESTS != echo $(srcdir)/[a-z]_*
$(TESTS):: test_one always_run
@./test_one $@
foo:
echo $(TESTS)
test_pre:
@$(RM) -f *.failed
@echo "Running e2fsprogs test suite..."

View File

@ -19,8 +19,12 @@
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#include <fcntl.h>
#include <time.h>
#include <utime.h>