--- a/e2fsck/jfs_user.h +++ a/e2fsck/jfs_user.h @@ -70,25 +70,34 @@ typedef unsigned int __be32; */ #include -/* - * We use the standard libext2fs portability tricks for inline - * functions. - */ -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); - +#if defined (__GNUC__) && !defined (__GNUC_STDC_INLINE__) && !defined (__GNUC_GNU_INLINE__) +# define __GNUC_GNU_INLINE__ 1 /* GCCs earlier than 4.1.3 don't define this */ +#endif +#define STORAGE_CLASS extern #if (defined(E2FSCK_INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS)) #ifdef E2FSCK_INCLUDE_INLINE_FUNCS #define _INLINE_ extern #else -#ifdef __GNUC__ +#if defined(__GNUC_GNU_INLINE__) #define _INLINE_ extern __inline__ +#elif defined(__GNUC_STDC_INLINE__) || \ + (defined(__STDC__) && __STDC_VERSION__ >= 199901L) +#undef STORAGE_CLASS +#define STORAGE_CLASS inline +#define _INLINE_ inline #else /* For Watcom C */ #define _INLINE_ extern inline #endif #endif +/* + * We use the standard libext2fs portability tricks for inline + * functions. + */ +STORAGE_CLASS lkmem_cache_t * do_cache_create(int len); +STORAGE_CLASS void do_cache_destroy(lkmem_cache_t *cache); +STORAGE_CLASS size_t journal_tag_bytes(journal_t *journal); + _INLINE_ lkmem_cache_t * do_cache_create(int len) { lkmem_cache_t *new_cache; @@ -114,6 +123,7 @@ _INLINE_ size_t journal_tag_bytes(journal_t *journal) return JBD_TAG_SIZE32; } +#undef STORAGE_CLASS #undef _INLINE_ #endif --- a/lib/ext2fs/bitops.h +++ a/lib/ext2fs/bitops.h @@ -13,15 +13,34 @@ * Linus Torvalds. */ +#if defined (__GNUC__) && !defined (__GNUC_STDC_INLINE__) && !defined (__GNUC_GNU_INLINE__) +# define __GNUC_GNU_INLINE__ 1 /* GCCs earlier than 4.1.3 don't define this */ +#endif +#define STORAGE_CLASS extern +#if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS)) +#ifdef INCLUDE_INLINE_FUNCS +#define _INLINE_ extern +#else +#if defined(__GNUC_GNU_INLINE__) +#define _INLINE_ extern __inline__ +#elif defined(__GNUC_STDC_INLINE__) || \ + (defined(__STDC__) && __STDC_VERSION__ >= 199901L) +#undef STORAGE_CLASS +#define STORAGE_CLASS inline +#define _INLINE_ inline +#else /* For Watcom C */ +#define _INLINE_ extern inline +#endif +#endif -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 __u16 ext2fs_swab16(__u16 val); -extern __u32 ext2fs_swab32(__u32 val); -extern __u64 ext2fs_swab64(__u64 val); +STORAGE_CLASS int ext2fs_set_bit(unsigned int nr,void * addr); +STORAGE_CLASS int ext2fs_clear_bit(unsigned int nr, void * addr); +STORAGE_CLASS int ext2fs_test_bit(unsigned int nr, const void * addr); +STORAGE_CLASS void ext2fs_fast_set_bit(unsigned int nr,void * addr); +STORAGE_CLASS void ext2fs_fast_clear_bit(unsigned int nr, void * addr); +STORAGE_CLASS __u16 ext2fs_swab16(__u16 val); +STORAGE_CLASS __u32 ext2fs_swab32(__u32 val); +STORAGE_CLASS __u64 ext2fs_swab64(__u64 val); #ifdef WORDS_BIGENDIAN #define ext2fs_cpu_to_le64(x) ext2fs_swab64((x)) @@ -62,61 +81,61 @@ 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); -extern int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block); -extern int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap, +STORAGE_CLASS int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block); +STORAGE_CLASS int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block); -extern int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block); +STORAGE_CLASS int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block); -extern int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode); -extern int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, +STORAGE_CLASS int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode); +STORAGE_CLASS int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode); -extern int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode); +STORAGE_CLASS int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode); -extern void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap, +STORAGE_CLASS void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block); -extern void ext2fs_fast_unmark_block_bitmap(ext2fs_block_bitmap bitmap, +STORAGE_CLASS void ext2fs_fast_unmark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block); -extern int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap, +STORAGE_CLASS int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block); -extern void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, +STORAGE_CLASS void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode); -extern void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, +STORAGE_CLASS void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode); -extern int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap, +STORAGE_CLASS int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode); -extern blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap); -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); +STORAGE_CLASS blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap); +STORAGE_CLASS ext2_ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap); +STORAGE_CLASS blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap); +STORAGE_CLASS ext2_ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap); -extern void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap bitmap, +STORAGE_CLASS 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, +STORAGE_CLASS void ext2fs_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap, blk_t block, int num); -extern int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap, +STORAGE_CLASS 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, +STORAGE_CLASS 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, +STORAGE_CLASS 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, +STORAGE_CLASS 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, +STORAGE_CLASS 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); +STORAGE_CLASS void ext2fs_set_bitmap_padding(ext2fs_generic_bitmap map); /* These routines moved to gen_bitmap.c */ -extern int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap, +STORAGE_CLASS int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap, __u32 bitno); -extern int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap, +STORAGE_CLASS int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap, blk_t bitno); -extern int ext2fs_test_generic_bitmap(ext2fs_generic_bitmap bitmap, +STORAGE_CLASS int ext2fs_test_generic_bitmap(ext2fs_generic_bitmap bitmap, blk_t bitno); -extern int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap, +STORAGE_CLASS int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap, blk_t block, int num); -extern __u32 ext2fs_get_generic_bitmap_start(ext2fs_generic_bitmap bitmap); -extern __u32 ext2fs_get_generic_bitmap_end(ext2fs_generic_bitmap bitmap); +STORAGE_CLASS __u32 ext2fs_get_generic_bitmap_start(ext2fs_generic_bitmap bitmap); +STORAGE_CLASS __u32 ext2fs_get_generic_bitmap_end(ext2fs_generic_bitmap bitmap); /* * The inline routines themselves... @@ -134,17 +153,6 @@ extern __u32 ext2fs_get_generic_bitmap_end(ext2fs_generic_bitmap bitmap); #endif #endif /* NO_INLINE_FUNCS */ -#if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS)) -#ifdef INCLUDE_INLINE_FUNCS -#define _INLINE_ extern -#else -#ifdef __GNUC__ -#define _INLINE_ extern __inline__ -#else /* For Watcom C */ -#define _INLINE_ extern inline -#endif -#endif - /* * Fast bit set/clear functions that doesn't need to return the * previous bit value. @@ -423,6 +431,7 @@ _INLINE_ void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap, { ext2fs_unmark_block_bitmap_range(bitmap, block, num); } + +#undef STORAGE_CLASS #undef _INLINE_ #endif - --- a/lib/ext2fs/ext2fs.h +++ a/lib/ext2fs/ext2fs.h @@ -241,7 +241,7 @@ struct struct_ext2_filsys { #if EXT2_FLAT_INCLUDES #include "e2_bitops.h" #else -#include +#include "bitops.h" #endif /* @@ -1143,50 +1143,59 @@ extern errcode_t ext2fs_write_bb_FILE(ext2_badblocks_list bb_list, unsigned int flags, FILE *f); - -/* inline functions */ -extern errcode_t ext2fs_get_mem(unsigned long size, void *ptr); -extern errcode_t ext2fs_get_array(unsigned long count, unsigned long size, void *ptr); -extern errcode_t ext2fs_free_mem(void *ptr); -extern errcode_t ext2fs_resize_mem(unsigned long old_size, - unsigned long size, void *ptr); -extern void ext2fs_mark_super_dirty(ext2_filsys fs); -extern void ext2fs_mark_changed(ext2_filsys fs); -extern int ext2fs_test_changed(ext2_filsys fs); -extern void ext2fs_mark_valid(ext2_filsys fs); -extern void ext2fs_unmark_valid(ext2_filsys fs); -extern int ext2fs_test_valid(ext2_filsys fs); -extern void ext2fs_mark_ib_dirty(ext2_filsys fs); -extern void ext2fs_mark_bb_dirty(ext2_filsys fs); -extern int ext2fs_test_ib_dirty(ext2_filsys fs); -extern int ext2fs_test_bb_dirty(ext2_filsys fs); -extern int ext2fs_group_of_blk(ext2_filsys fs, blk_t blk); -extern int ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino); -extern blk_t ext2fs_group_first_block(ext2_filsys fs, dgrp_t group); -extern blk_t ext2fs_group_last_block(ext2_filsys fs, dgrp_t group); -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); - /* * The actual inlined functions definitions themselves... * * If NO_INLINE_FUNCS is defined, then we won't try to do inline * functions at all! */ +#if defined (__GNUC__) && !defined (__GNUC_STDC_INLINE__) && !defined (__GNUC_GNU_INLINE__) +# define __GNUC_GNU_INLINE__ 1 /* GCCs earlier than 4.1.3 don't define this */ +#endif +#define STORAGE_CLASS extern #if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS)) #ifdef INCLUDE_INLINE_FUNCS #define _INLINE_ extern #else -#ifdef __GNUC__ +#if defined(__GNUC_GNU_INLINE__) #define _INLINE_ extern __inline__ +#elif defined(__GNUC_STDC_INLINE__) || \ + (defined(__STDC__) && __STDC_VERSION__ >= 199901L) +#undef STORAGE_CLASS +#define STORAGE_CLASS inline +#define _INLINE_ inline #else /* For Watcom C */ #define _INLINE_ extern inline #endif #endif +/* inline functions */ +STORAGE_CLASS errcode_t ext2fs_get_mem(unsigned long size, void *ptr); +STORAGE_CLASS errcode_t ext2fs_get_array(unsigned long count, unsigned long size, void *ptr); +STORAGE_CLASS errcode_t ext2fs_free_mem(void *ptr); +STORAGE_CLASS errcode_t ext2fs_resize_mem(unsigned long old_size, + unsigned long size, void *ptr); +STORAGE_CLASS void ext2fs_mark_super_dirty(ext2_filsys fs); +STORAGE_CLASS void ext2fs_mark_changed(ext2_filsys fs); +STORAGE_CLASS int ext2fs_test_changed(ext2_filsys fs); +STORAGE_CLASS void ext2fs_mark_valid(ext2_filsys fs); +STORAGE_CLASS void ext2fs_unmark_valid(ext2_filsys fs); +STORAGE_CLASS int ext2fs_test_valid(ext2_filsys fs); +STORAGE_CLASS void ext2fs_mark_ib_dirty(ext2_filsys fs); +STORAGE_CLASS void ext2fs_mark_bb_dirty(ext2_filsys fs); +STORAGE_CLASS int ext2fs_test_ib_dirty(ext2_filsys fs); +STORAGE_CLASS int ext2fs_test_bb_dirty(ext2_filsys fs); +STORAGE_CLASS int ext2fs_group_of_blk(ext2_filsys fs, blk_t blk); +STORAGE_CLASS int ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino); +STORAGE_CLASS blk_t ext2fs_group_first_block(ext2_filsys fs, dgrp_t group); +STORAGE_CLASS blk_t ext2fs_group_last_block(ext2_filsys fs, dgrp_t group); +STORAGE_CLASS blk_t ext2fs_inode_data_blocks(ext2_filsys fs, + struct ext2_inode *inode); +STORAGE_CLASS unsigned int ext2fs_div_ceil(unsigned int a, unsigned int b); + #ifndef EXT2_CUSTOM_MEMORY_ROUTINES #include + /* * Allocate memory */ @@ -1374,6 +1383,8 @@ _INLINE_ unsigned int ext2fs_div_ceil(unsigned int a, unsigned int b) return 0; return ((a - 1) / b) + 1; } + +#undef STORAGE_CLASS #undef _INLINE_ #endif