Merge branch 'maint' into next

Conflicts:
	lib/ext2fs/ext2fs.h
This commit is contained in:
Theodore Ts'o 2012-09-09 22:52:26 -04:00
commit 0e7e7c8ef8
11 changed files with 160 additions and 59 deletions

34
configure vendored
View File

@ -825,6 +825,7 @@ with_ldopts
with_root_prefix
enable_maintainer_mode
enable_symlink_install
enable_relative_symlinks
enable_symlink_relative_symlinks
enable_symlink_build
enable_verbose_makecmds
@ -1483,6 +1484,7 @@ Optional Features:
--enable-maintainer-mode enable makefile rules useful for maintainers
--enable-symlink-install use symlinks when installing instead of hard links
--enable-relative-symlinks use relative symlinks when installing
--enable-symlink-build use symlinks while building instead of hard links
--enable-verbose-makecmds enable verbose make command output
--enable-compression enable EXPERIMENTAL compression support
@ -4435,23 +4437,43 @@ $as_echo "Disabling symlinks for install by default" >&6; }
fi
# Check whether --enable-symlink-relative-symlinks was given.
if test "${enable_symlink_relative_symlinks+set}" = set; then :
enableval=$enable_symlink_relative_symlinks; if test "$enableval" = "no"
relative_symlink_defined=
# Check whether --enable-relative-symlinks was given.
if test "${enable_relative_symlinks+set}" = set; then :
enableval=$enable_relative_symlinks; if test "$enableval" = "no"
then
SYMLINK_RELATIVE=
relative_symlink_defined=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Disabling relative symlinks for install" >&5
$as_echo "Disabling relative symlinks for install" >&6; }
else
SYMLINK_RELATIVE=--relative
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Enabling symlinks for install" >&5
$as_echo "Enabling symlinks for install" >&6; }
relative_symlink_defined=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Enabling relative symlinks for install" >&5
$as_echo "Enabling relative symlinks for install" >&6; }
fi
fi
# Check whether --enable-symlink-relative-symlinks was given.
if test "${enable_symlink_relative_symlinks+set}" = set; then :
enableval=$enable_symlink_relative_symlinks; if test "$enableval" = "no"
then
SYMLINK_RELATIVE=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Disabling relative symlinks for install" >&5
$as_echo "Disabling relative symlinks for install" >&6; }
else
SYMLINK_RELATIVE=--relative
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Enabling relative symlinks for install" >&5
$as_echo "Enabling relative symlinks for install" >&6; }
fi
else
SYMLINK_RELATIVE=
if test -z "$relative_symlink_defined"
then
SYMLINK_RELATIVE=
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Disabling relative symlinks for install by default" >&5
$as_echo "Disabling relative symlinks for install by default" >&6; }
fi
fi

View File

@ -170,19 +170,34 @@ AC_SUBST(LINK_INSTALL_FLAGS)
dnl
dnl handle --enable-relative-symlinks
dnl
AC_ARG_ENABLE([symlink-relative-symlinks],
relative_symlink_defined=
AC_ARG_ENABLE([relative-symlinks],
[ --enable-relative-symlinks use relative symlinks when installing],
if test "$enableval" = "no"
then
SYMLINK_RELATIVE=
relative_symlink_defined=yes
AC_MSG_RESULT([Disabling relative symlinks for install])
else
SYMLINK_RELATIVE=--relative
AC_MSG_RESULT([Enabling symlinks for install])
relative_symlink_defined=yes
AC_MSG_RESULT([Enabling relative symlinks for install])
fi)
AC_ARG_ENABLE([symlink-relative-symlinks],,
if test "$enableval" = "no"
then
SYMLINK_RELATIVE=yes
AC_MSG_RESULT([Disabling relative symlinks for install])
else
SYMLINK_RELATIVE=--relative
AC_MSG_RESULT([Enabling relative symlinks for install])
fi
,
if test -z "$relative_symlink_defined"
then
SYMLINK_RELATIVE=
AC_MSG_RESULT([Disabling relative symlinks for install by default])
fi
)
AC_SUBST(SYMLINK_RELATIVE)
dnl

View File

@ -75,20 +75,31 @@ typedef __u64 __be64;
* We use the standard libext2fs portability tricks for inline
* functions.
*/
#ifdef NO_INLINE_FUNCS
extern lkmem_cache_t * do_cache_create(int len);
extern void do_cache_destroy(lkmem_cache_t *cache);
extern size_t journal_tag_bytes(journal_t *journal);
#endif
#if (defined(E2FSCK_INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
#ifdef E2FSCK_INCLUDE_INLINE_FUNCS
#define _INLINE_ extern
#if (__STDC_VERSION__ >= 199901L)
#define _INLINE_ extern inline
#else
#define _INLINE_ inline
#endif
#else /* !E2FSCK_INCLUDE_INLINE FUNCS */
#if (__STDC_VERSION__ >= 199901L)
#define _INLINE_ inline
#else /* not C99 */
#ifdef __GNUC__
#define _INLINE_ extern __inline__
#else /* For Watcom C */
#define _INLINE_ extern inline
#endif
#endif
#endif /* __GNUC__ */
#endif /* __STDC_VERSION__ >= 199901L */
#endif /* E2FSCK_INCLUDE_INLINE_FUNCS */
_INLINE_ lkmem_cache_t * do_cache_create(int len)
{

View File

@ -358,33 +358,33 @@ tst_bitmaps_cmd.c: tst_bitmaps_cmd.ct
$(Q) DIR=$(srcdir) $(MK_CMDS) $(srcdir)/tst_bitmaps_cmd.ct
tst_bitmaps: tst_bitmaps.o tst_bitmaps_cmd.o $(STATIC_LIBEXT2FS) $(DEPLIBSS) \
$(DEPLIBCOM_ERR)
$(DEPSTATIC_LIBCOM_ERR)
$(E) " LD $@"
$(Q) $(CC) -o $@ tst_bitmaps.o tst_bitmaps_cmd.o $(ALL_CFLAGS) \
$(STATIC_LIBEXT2FS) $(LIBSS) $(LIBCOM_ERR)
$(STATIC_LIBEXT2FS) $(LIBSS) $(STATIC_LIBCOM_ERR)
tst_extents: $(srcdir)/extent.c extent_dbg.c $(DEBUG_OBJS) $(DEPLIBSS) \
$(LIBE2P) $(DEPLIBUUID) $(DEPLIBBLKID) $(DEPLIBCOM_ERR)
$(LIBE2P) $(DEPLIBUUID) $(DEPLIBBLKID) $(DEPSTATIC_LIBCOM_ERR)
$(E) " LD $@"
$(Q) $(CC) -o tst_extents $(srcdir)/extent.c extent_dbg.c \
$(ALL_CFLAGS) -DDEBUG $(DEBUG_OBJS) $(LIBSS) $(LIBE2P) \
$(STATIC_LIBEXT2FS) $(LIBBLKID) $(LIBUUID) $(LIBCOM_ERR) \
$(STATIC_LIBEXT2FS) $(LIBBLKID) $(LIBUUID) $(STATIC_LIBCOM_ERR) \
-I $(top_srcdir)/debugfs
tst_inline: $(srcdir)/inline.c $(STATIC_LIBEXT2FS) $(DEPLIBCOM_ERR)
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) $(LIBCOM_ERR)
$(STATIC_LIBEXT2FS) $(STATIC_LIBCOM_ERR)
tst_csum: csum.c $(STATIC_LIBEXT2FS) $(DEPLIBCOM_ERR) \
tst_csum: csum.c $(STATIC_LIBEXT2FS) $(DEPSTATIC_LIBCOM_ERR) \
$(top_srcdir)/lib/e2p/e2p.h
$(E) " LD $@"
$(Q) $(CC) -o tst_csum $(srcdir)/csum.c -DDEBUG \
$(ALL_CFLAGS) $(STATIC_LIBEXT2FS) $(LIBCOM_ERR) $(LIBE2P)
$(ALL_CFLAGS) $(STATIC_LIBEXT2FS) $(STATIC_LIBCOM_ERR) $(LIBE2P)
tst_crc32c: $(srcdir)/crc32c.c
tst_crc32c: $(srcdir)/crc32c.c $(STATIC_LIBEXT2FS) $(DEPSTATIC_LIBCOM_ERR)
$(Q) $(CC) $(BUILD_LDFLAGS) $(ALL_CFLAGS) -o tst_crc32c $(srcdir)/crc32c.c \
-DUNITTEST
-DUNITTEST $(STATIC_LIBEXT2FS) $(STATIC_LIBCOM_ERR)
mkjournal: mkjournal.c $(STATIC_LIBEXT2FS) $(DEPLIBCOM_ERR)
$(E) " LD $@"

View File

@ -10,20 +10,6 @@
* %End-Header%
*/
extern int ext2fs_set_bit(unsigned int nr,void * addr);
extern int ext2fs_clear_bit(unsigned int nr, void * addr);
extern int ext2fs_test_bit(unsigned int nr, const void * addr);
extern void ext2fs_fast_set_bit(unsigned int nr,void * addr);
extern void ext2fs_fast_clear_bit(unsigned int nr, void * addr);
extern int ext2fs_set_bit64(__u64 nr,void * addr);
extern int ext2fs_clear_bit64(__u64 nr, void * addr);
extern int ext2fs_test_bit64(__u64 nr, const void * addr);
extern void ext2fs_fast_set_bit64(__u64 nr,void * addr);
extern void ext2fs_fast_clear_bit64(__u64 nr, void * addr);
extern __u16 ext2fs_swab16(__u16 val);
extern __u32 ext2fs_swab32(__u32 val);
extern __u64 ext2fs_swab64(__u64 val);
#ifdef WORDS_BIGENDIAN
#define ext2fs_cpu_to_le64(x) ext2fs_swab64((x))
#define ext2fs_le64_to_cpu(x) ext2fs_swab64((x))
@ -67,6 +53,7 @@ extern void ext2fs_warn_bitmap(errcode_t errcode, unsigned long arg,
extern void ext2fs_warn_bitmap2(ext2fs_generic_bitmap bitmap,
int code, unsigned long arg);
#ifdef NO_INLINE_FUNCS
extern int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block);
extern int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
blk_t block);
@ -95,6 +82,15 @@ extern ext2_ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap);
extern blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap);
extern ext2_ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap);
extern void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num);
extern void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num);
extern int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num);
#endif
/* These functions routines moved to gen_bitmap.c */
extern void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num);
extern void ext2fs_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
@ -103,15 +99,6 @@ extern int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num);
extern int ext2fs_test_inode_bitmap_range(ext2fs_inode_bitmap bitmap,
ino_t inode, int num);
extern void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num);
extern void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num);
extern int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num);
extern void ext2fs_set_bitmap_padding(ext2fs_generic_bitmap map);
/* These routines moved to gen_bitmap.c (actually, some of the above, too) */
extern int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap,
__u32 bitno);
extern int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap,
@ -120,11 +107,13 @@ extern int ext2fs_test_generic_bitmap(ext2fs_generic_bitmap bitmap,
blk_t bitno);
extern int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num);
extern void ext2fs_set_bitmap_padding(ext2fs_generic_bitmap map);
extern __u32 ext2fs_get_generic_bitmap_start(ext2fs_generic_bitmap bitmap);
extern __u32 ext2fs_get_generic_bitmap_end(ext2fs_generic_bitmap bitmap);
/* 64-bit versions */
#ifdef NO_INLINE_FUNCS
extern int ext2fs_mark_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t block);
extern int ext2fs_unmark_block_bitmap2(ext2fs_block_bitmap bitmap,
@ -174,6 +163,8 @@ extern void ext2fs_fast_mark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
extern void ext2fs_fast_unmark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
blk64_t block,
unsigned int num);
#endif
/* These routines moved to gen_bitmap64.c */
extern void ext2fs_clear_generic_bmap(ext2fs_generic_bitmap bitmap);
extern errcode_t ext2fs_compare_generic_bmap(errcode_t neq,
@ -218,14 +209,22 @@ extern errcode_t ext2fs_find_first_zero_generic_bmap(ext2fs_generic_bitmap bitma
#if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
#ifdef INCLUDE_INLINE_FUNCS
#define _INLINE_ extern
#if (__STDC_VERSION__ >= 199901L)
#define _INLINE_ extern inline
#else
#define _INLINE_ inline
#endif
#else /* !INCLUDE_INLINE FUNCS */
#if (__STDC_VERSION__ >= 199901L)
#define _INLINE_ inline
#else /* not C99 */
#ifdef __GNUC__
#define _INLINE_ extern __inline__
#else /* For Watcom C */
#define _INLINE_ extern inline
#endif
#endif
#endif /* __GNUC__ */
#endif /* __STDC_VERSION__ >= 199901L */
#endif /* INCLUDE_INLINE_FUNCS */
/*
* Fast bit set/clear functions that doesn't need to return the
@ -678,3 +677,23 @@ _INLINE_ void ext2fs_fast_unmark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
#undef _INLINE_
#endif
#ifndef _EXT2_HAVE_ASM_BITOPS_
extern int ext2fs_set_bit(unsigned int nr,void * addr);
extern int ext2fs_clear_bit(unsigned int nr, void * addr);
extern int ext2fs_test_bit(unsigned int nr, const void * addr);
#endif
extern int ext2fs_set_bit64(__u64 nr,void * addr);
extern int ext2fs_clear_bit64(__u64 nr, void * addr);
extern int ext2fs_test_bit64(__u64 nr, const void * addr);
#ifdef NO_INLINE_FUNCS
extern void ext2fs_fast_set_bit(unsigned int nr,void * addr);
extern void ext2fs_fast_clear_bit(unsigned int nr, void * addr);
extern void ext2fs_fast_set_bit64(__u64 nr,void * addr);
extern void ext2fs_fast_clear_bit64(__u64 nr, void * addr);
extern __u16 ext2fs_swab16(__u16 val);
extern __u32 ext2fs_swab32(__u32 val);
extern __u64 ext2fs_swab64(__u64 val);
#endif

View File

@ -1320,6 +1320,11 @@ extern errcode_t ext2fs_icount_store(ext2_icount_t icount, ext2_ino_t ino,
extern ext2_ino_t ext2fs_get_icount_size(ext2_icount_t icount);
errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *);
/* inline.c */
extern errcode_t ext2fs_get_memalign(unsigned long size,
unsigned long align, void *ptr);
/* inode.c */
extern errcode_t ext2fs_flush_icache(ext2_filsys fs);
extern errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan,
@ -1487,6 +1492,11 @@ extern void ext2fs_swap_inode(ext2_filsys fs,struct ext2_inode *t,
struct ext2_inode *f, int hostorder);
extern void ext2fs_swap_mmp(struct mmp_struct *mmp);
/* unix_io.c */
extern int ext2fs_open_file(const char *pathname, int flags, mode_t mode);
extern int ext2fs_stat(const char *path, ext2fs_struct_stat *buf);
extern int ext2fs_fstat(int fd, ext2fs_struct_stat *buf);
/* valid_blk.c */
extern int ext2fs_inode_has_valid_blocks(struct ext2_inode *inode);
extern int ext2fs_inode_has_valid_blocks2(ext2_filsys fs,
@ -1504,10 +1514,9 @@ extern errcode_t ext2fs_write_bb_FILE(ext2_badblocks_list bb_list,
/* inline functions */
#ifdef NO_INLINE_FUNCS
extern void ext2fs_init_csum_seed(ext2_filsys fs);
extern errcode_t ext2fs_get_mem(unsigned long size, void *ptr);
extern errcode_t ext2fs_get_memalign(unsigned long size,
unsigned long align, void *ptr);
extern errcode_t ext2fs_get_memzero(unsigned long size, void *ptr);
extern errcode_t ext2fs_get_array(unsigned long count,
unsigned long size, void *ptr);
@ -1534,9 +1543,7 @@ extern blk_t ext2fs_inode_data_blocks(ext2_filsys fs,
struct ext2_inode *inode);
extern unsigned int ext2fs_div_ceil(unsigned int a, unsigned int b);
extern __u64 ext2fs_div64_ceil(__u64 a, __u64 b);
extern int ext2fs_open_file(const char *pathname, int flags, mode_t mode);
extern int ext2fs_stat(const char *path, ext2fs_struct_stat *buf);
extern int ext2fs_fstat(int fd, ext2fs_struct_stat *buf);
#endif
/*
* The actual inlined functions definitions themselves...
@ -1548,11 +1555,15 @@ extern int ext2fs_fstat(int fd, ext2fs_struct_stat *buf);
#ifdef INCLUDE_INLINE_FUNCS
#define _INLINE_ extern
#else
#if (__STDC_VERSION__ >= 199901L)
#define _INLINE_ inline
#else
#ifdef __GNUC__
#define _INLINE_ extern __inline__
#else /* For Watcom C */
#define _INLINE_ extern inline
#endif
#endif /* __GNUC__ */
#endif /* __STDC_VERSION__ >= 199901L */
#endif
_INLINE_ void ext2fs_init_csum_seed(ext2_filsys fs)

View File

@ -101,6 +101,7 @@ errcode_t ext2fs_initialize(const char *name, int flags,
unsigned reserved_inos;
char *buf = 0;
char c;
double reserved_ratio;
if (!param || !ext2fs_blocks_count(param))
return EXT2_ET_INVALID_ARGUMENT;
@ -391,6 +392,14 @@ ipg_retry:
if (rem && (rem < overhead+50)) {
ext2fs_blocks_count_set(super, ext2fs_blocks_count(super) -
rem);
/*
* If blocks count is changed, we need to recalculate
* reserved blocks count not to exceed 50%.
*/
reserved_ratio = 100.0 * ext2fs_r_blocks_count(param) /
ext2fs_blocks_count(param);
ext2fs_r_blocks_count_set(super, reserved_ratio *
ext2fs_blocks_count(super) / 100.0);
goto retry;
}

View File

@ -264,14 +264,22 @@ typedef struct journal_superblock_s
#if (defined(E2FSCK_INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
#ifdef E2FSCK_INCLUDE_INLINE_FUNCS
#define _INLINE_ extern
#if (__STDC_VERSION__ >= 199901L)
#define _INLINE_ extern inline
#else
#define _INLINE_ inline
#endif
#else /* !E2FSCK_INCLUDE_INLINE FUNCS */
#if (__STDC_VERSION__ >= 199901L)
#define _INLINE_ inline
#else /* not C99 */
#ifdef __GNUC__
#define _INLINE_ extern __inline__
#else /* For Watcom C */
#define _INLINE_ extern inline
#endif
#endif
#endif /* __GNUC__ */
#endif /* __STDC_VERSION__ >= 199901L */
#endif /* INCLUDE_INLINE_FUNCS */
/*
* helper functions to deal with 32 or 64bit block numbers.

View File

@ -588,13 +588,13 @@ int main(int argc, char **argv)
blocks = parse_ulong(optarg, argv[0],
"number of blocks", &err);
if (err)
return;
exit(1);
break;
case 'i':
inodes = parse_ulong(optarg, argv[0],
"number of blocks", &err);
if (err)
return;
exit(1);
break;
case 'l': /* Legacy bitmaps */
flags = 0;
@ -603,7 +603,7 @@ int main(int argc, char **argv)
type = parse_ulong(optarg, argv[0],
"bitmap backend type", &err);
if (err)
return;
exit(1);
break;
case 'R':
request = optarg;

View File

@ -18,7 +18,10 @@
struct ext2_inode_large inode;
#ifndef offsetof
#define offsetof(type, member) __builtin_offsetof(type, member)
#endif
#define check_field(x, s) cur_offset = do_field(#x, s, sizeof(inode.x), \
offsetof(struct ext2_inode_large, x), \
cur_offset)

View File

@ -21,7 +21,10 @@
struct sb_struct sb;
#ifndef offsetof
#define offsetof(type, member) __builtin_offsetof (type, member)
#endif
#define check_field(x, s) cur_offset = do_field(#x, s, sizeof(sb.x), \
offsetof(struct sb_struct, x), \
cur_offset)