mirror of https://github.com/vitalif/e2fsprogs
Merge branch 'maint' into next
commit
dcb8e1fa04
|
@ -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
|
PROG_SUBDIRS=e2fsck $(DEBUGFS_DIR) misc $(RESIZE_DIR) tests/progs po
|
||||||
SUBDIRS=util $(LIB_SUBDIRS) $(PROG_SUBDIRS) tests
|
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
|
lib/ext2fs/ext2_types.h lib/blkid/blkid_types.h lib/uuid/uuid_types.h
|
||||||
|
|
||||||
TAR=tar
|
TAR=tar
|
||||||
|
@ -34,6 +34,7 @@ subs: $(DEP_SUBSTITUTE)
|
||||||
then $(MAKE) $$i || exit $$? ; fi ; done
|
then $(MAKE) $$i || exit $$? ; fi ; done
|
||||||
@(if test -d lib/et ; then cd lib/et && $(MAKE) compile_et; fi)
|
@(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/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
|
progs: all-progs-recursive
|
||||||
libs: all-libs-recursive
|
libs: all-libs-recursive
|
||||||
|
|
|
@ -243,8 +243,13 @@ option is given set the owner, group and permissions information on
|
||||||
to match
|
to match
|
||||||
.IR filespec .
|
.IR filespec .
|
||||||
.TP
|
.TP
|
||||||
.B dump_mmp
|
.BI dump_mmp " [mmp_block]"
|
||||||
Display the multiple-mount protection (mmp) field values.
|
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
|
.TP
|
||||||
.BI dx_hash " [-h hash_alg] [-s hash_seed] filename"
|
.BI dx_hash " [-h hash_alg] [-s hash_seed] filename"
|
||||||
Calculate the directory hash of
|
Calculate the directory hash of
|
||||||
|
|
|
@ -2262,12 +2262,31 @@ void do_symlink(int argc, char *argv[])
|
||||||
void do_dump_mmp(int argc EXT2FS_ATTR((unused)), char *argv[])
|
void do_dump_mmp(int argc EXT2FS_ATTR((unused)), char *argv[])
|
||||||
{
|
{
|
||||||
struct mmp_struct *mmp_s;
|
struct mmp_struct *mmp_s;
|
||||||
|
unsigned long long mmp_block;
|
||||||
time_t t;
|
time_t t;
|
||||||
errcode_t retval = 0;
|
errcode_t retval = 0;
|
||||||
|
|
||||||
if (check_fs_open(argv[0]))
|
if (check_fs_open(argv[0]))
|
||||||
return;
|
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) {
|
if (current_fs->mmp_buf == NULL) {
|
||||||
retval = ext2fs_get_mem(current_fs->blocksize,
|
retval = ext2fs_get_mem(current_fs->blocksize,
|
||||||
¤t_fs->mmp_buf);
|
¤t_fs->mmp_buf);
|
||||||
|
@ -2279,10 +2298,10 @@ void do_dump_mmp(int argc EXT2FS_ATTR((unused)), char *argv[])
|
||||||
|
|
||||||
mmp_s = current_fs->mmp_buf;
|
mmp_s = current_fs->mmp_buf;
|
||||||
|
|
||||||
retval = ext2fs_mmp_read(current_fs, current_fs->super->s_mmp_block,
|
retval = ext2fs_mmp_read(current_fs, mmp_block, current_fs->mmp_buf);
|
||||||
current_fs->mmp_buf);
|
|
||||||
if (retval) {
|
if (retval) {
|
||||||
com_err(argv[0], retval, "reading MMP block.\n");
|
com_err(argv[0], retval, "reading MMP block %llu.\n",
|
||||||
|
mmp_block);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1441,10 +1441,19 @@ static struct blkid_magic type_array[] = {
|
||||||
{ "iso9660", 32, 1, 5, "CD001", probe_iso9660 },
|
{ "iso9660", 32, 1, 5, "CD001", probe_iso9660 },
|
||||||
{ "iso9660", 32, 9, 5, "CDROM", probe_iso9660 },
|
{ "iso9660", 32, 9, 5, "CDROM", probe_iso9660 },
|
||||||
{ "jfs", 32, 0, 4, "JFS1", probe_jfs },
|
{ "jfs", 32, 0, 4, "JFS1", probe_jfs },
|
||||||
{ "zfs", 8, 0, 8, "\0\0\x02\xf5\xb0\x07\xb1\x0c", probe_zfs },
|
/* ZFS has 128 root blocks (#4 is the first used), check only 6 of them */
|
||||||
{ "zfs", 8, 0, 8, "\x0c\xb1\x07\xb0\xf5\x02\0\0", probe_zfs },
|
{ "zfs", 128, 0, 8, "\0\0\0\0\0\xba\xb1\x0c", probe_zfs },
|
||||||
{ "zfs", 264, 0, 8, "\0\0\x02\xf5\xb0\x07\xb1\x0c", probe_zfs },
|
{ "zfs", 128, 0, 8, "\x0c\xb1\xba\0\0\0\0\0", probe_zfs },
|
||||||
{ "zfs", 264, 0, 8, "\x0c\xb1\x07\xb0\xf5\x02\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, "BD", probe_hfsplus },
|
||||||
{ "hfsplus", 1, 0, 2, "H+", probe_hfsplus },
|
{ "hfsplus", 1, 0, 2, "H+", probe_hfsplus },
|
||||||
{ "hfsplus", 1, 0, 2, "HX", probe_hfsplus },
|
{ "hfsplus", 1, 0, 2, "HX", probe_hfsplus },
|
||||||
|
|
|
@ -41,32 +41,34 @@
|
||||||
#define OPEN_FLAGS (O_RDONLY|O_NONBLOCK)
|
#define OPEN_FLAGS (O_RDONLY|O_NONBLOCK)
|
||||||
#endif
|
#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 HAVE_EXT2_IOCTLS
|
||||||
#if !APPLE_DARWIN
|
# if !APPLE_DARWIN
|
||||||
int fd, r, ver, save_errno = 0;
|
int fd, save_errno = 0;
|
||||||
|
|
||||||
fd = open (name, OPEN_FLAGS);
|
fd = open(name, OPEN_FLAGS);
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
return -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;
|
save_errno = errno;
|
||||||
*version = ver;
|
close(fd);
|
||||||
close (fd);
|
if (rc == -1)
|
||||||
if (save_errno)
|
|
||||||
errno = save_errno;
|
errno = save_errno;
|
||||||
return r;
|
# else /* APPLE_DARWIN */
|
||||||
#else
|
rc = syscall(SYS_fsctl, name, EXT2_IOC_GETVERSION, &ver, 0);
|
||||||
int ver=-1, err;
|
# endif /* !APPLE_DARWIN */
|
||||||
err = syscall(SYS_fsctl, name, EXT2_IOC_GETVERSION, &ver, 0);
|
|
||||||
*version = ver;
|
|
||||||
return(err);
|
|
||||||
#endif
|
|
||||||
#else /* ! HAVE_EXT2_IOCTLS */
|
#else /* ! HAVE_EXT2_IOCTLS */
|
||||||
extern int errno;
|
extern int errno;
|
||||||
|
|
||||||
errno = EOPNOTSUPP;
|
errno = EOPNOTSUPP;
|
||||||
return -1;
|
|
||||||
#endif /* ! HAVE_EXT2_IOCTLS */
|
#endif /* ! HAVE_EXT2_IOCTLS */
|
||||||
|
if (rc == 0)
|
||||||
|
*version = ver;
|
||||||
|
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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_H
|
||||||
#define HAVE_UTIME
|
#define HAVE_UTIME
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef __FreeBSD__
|
||||||
#define _XOPEN_SOURCE 600
|
#define _XOPEN_SOURCE 600
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
@ -187,7 +187,7 @@ int main(int argc, char *argv[])
|
||||||
if (print_jnl_copies)
|
if (print_jnl_copies)
|
||||||
printf(_("[*] probably superblock written in the ext3 "
|
printf(_("[*] probably superblock written in the ext3 "
|
||||||
"journal superblock,\n\tso start/end/grp wrong\n"));
|
"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 &&
|
for (; lseek64(fd, sk, SEEK_SET) != -1 &&
|
||||||
read(fd, &ext2, 512) == 512; sk += skiprate) {
|
read(fd, &ext2, 512) == 512; sk += skiprate) {
|
||||||
static unsigned char last_uuid[16] = "blah";
|
static unsigned char last_uuid[16] = "blah";
|
||||||
|
@ -230,6 +230,9 @@ int main(int argc, char *argv[])
|
||||||
WHY("free_inodes_count > inodes_count (%u > %u)\n",
|
WHY("free_inodes_count > inodes_count (%u > %u)\n",
|
||||||
ext2.s_free_inodes_count, ext2.s_inodes_count);
|
ext2.s_free_inodes_count, ext2.s_inodes_count);
|
||||||
|
|
||||||
|
if (ext2.s_mkfs_time != 0)
|
||||||
|
tm = ext2.s_mkfs_time;
|
||||||
|
else
|
||||||
tm = ext2.s_mtime;
|
tm = ext2.s_mtime;
|
||||||
s = ctime(&tm);
|
s = ctime(&tm);
|
||||||
s[24] = 0;
|
s[24] = 0;
|
||||||
|
|
|
@ -103,7 +103,7 @@ static int list_attributes (const char * name)
|
||||||
name);
|
name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
printf ("%5lu ", generation);
|
printf ("%-10lu ", generation);
|
||||||
}
|
}
|
||||||
if (pf_options & PFOPT_LONG) {
|
if (pf_options & PFOPT_LONG) {
|
||||||
printf("%-28s ", name);
|
printf("%-28s ", name);
|
||||||
|
|
|
@ -25,6 +25,9 @@
|
||||||
#ifdef HAVE_ERRNO_H
|
#ifdef HAVE_ERRNO_H
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
#ifdef HAVE_LINUX_MAJOR_H
|
#ifdef HAVE_LINUX_MAJOR_H
|
||||||
#include <linux/major.h>
|
#include <linux/major.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -35,10 +35,16 @@ mke2fs.conf: $(srcdir)/mke2fs.conf.in
|
||||||
|
|
||||||
.PHONY : test_pre test_post check always_run
|
.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
|
$(TESTS):: test_one always_run
|
||||||
@./test_one $@
|
@./test_one $@
|
||||||
|
|
||||||
|
foo:
|
||||||
|
echo $(TESTS)
|
||||||
|
|
||||||
test_pre:
|
test_pre:
|
||||||
@$(RM) -f *.failed
|
@$(RM) -f *.failed
|
||||||
@echo "Running e2fsprogs test suite..."
|
@echo "Running e2fsprogs test suite..."
|
||||||
|
|
|
@ -19,8 +19,12 @@
|
||||||
#ifdef HAVE_SYS_TIME_H
|
#ifdef HAVE_SYS_TIME_H
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_SYS_STAT_H
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <utime.h>
|
#include <utime.h>
|
||||||
|
|
Loading…
Reference in New Issue