diff options
author | john.levon@sun.com <john.levon@sun.com> | 2007-02-20 14:54:04 -0800 |
---|---|---|
committer | john.levon@sun.com <john.levon@sun.com> | 2007-02-20 14:54:04 -0800 |
commit | 78b20c695389df112985986f53738f80fdb813d3 (patch) | |
tree | e2883eb9672c48f144ef5e70a19aebacc1e74298 /tools/libfsimage/ext2fs | |
parent | 180211a7532d1a7b2f71dc8a6267bedcef86a3c8 (diff) | |
download | xen-78b20c695389df112985986f53738f80fdb813d3.tar.gz xen-78b20c695389df112985986f53738f80fdb813d3.tar.bz2 xen-78b20c695389df112985986f53738f80fdb813d3.zip |
Add iso9660 support to libfsimage.
Signed-off-by: John Levon <john.levon@sun.com>
Diffstat (limited to 'tools/libfsimage/ext2fs')
-rw-r--r-- | tools/libfsimage/ext2fs/fsys_ext2fs.c | 89 |
1 files changed, 1 insertions, 88 deletions
diff --git a/tools/libfsimage/ext2fs/fsys_ext2fs.c b/tools/libfsimage/ext2fs/fsys_ext2fs.c index 4a8f595f43..7a25c55022 100644 --- a/tools/libfsimage/ext2fs/fsys_ext2fs.c +++ b/tools/libfsimage/ext2fs/fsys_ext2fs.c @@ -191,7 +191,7 @@ struct ext2_dir_entry /* ext2/super.c */ -#define log2(n) ffz(~(n)) +#define log2(n) grub_log2(n) #define EXT2_SUPER_MAGIC 0xEF53 /* include/linux/ext2_fs.h */ #define EXT2_ROOT_INO 2 /* include/linux/ext2_fs.h */ @@ -232,93 +232,6 @@ struct ext2_dir_entry #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -#if defined(__i386__) || defined(__x86_64__) -/* include/asm-i386/bitops.h */ -/* - * ffz = Find First Zero in word. Undefined if no zero exists, - * so code should check against ~0UL first.. - */ -#ifdef __amd64 -#define BSF "bsfq" -#else -#define BSF "bsfl" -#endif -static __inline__ unsigned long -ffz (unsigned long word) -{ - __asm__ (BSF " %1,%0" -: "=r" (word) -: "r" (~word)); - return word; -} - -#elif defined(__ia64__) - -typedef unsigned long __u64; - -#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) -# define ia64_popcnt(x) __builtin_popcountl(x) -#else -# define ia64_popcnt(x) \ - ({ \ - __u64 ia64_intri_res; \ - asm ("popcnt %0=%1" : "=r" (ia64_intri_res) : "r" (x)); \ - ia64_intri_res; \ - }) -#endif - -static __inline__ unsigned long -ffz (unsigned long word) -{ - unsigned long result; - - result = ia64_popcnt(word & (~word - 1)); - return result; -} - -#elif defined(__powerpc__) - -#ifdef __powerpc64__ -#define PPC_CNTLZL "cntlzd" -#else -#define PPC_CNTLZL "cntlzw" -#endif -#define BITS_PER_LONG (sizeof(long) * 8) - -static __inline__ int -__ilog2(unsigned long x) -{ - int lz; - - asm (PPC_CNTLZL " %0,%1" : "=r" (lz) : "r" (x)); - return BITS_PER_LONG - 1 - lz; -} - -static __inline__ unsigned long -ffz (unsigned long word) -{ - if ((word = ~word) == 0) - return BITS_PER_LONG; - return __ilog2(word & -word); -} - -#else /* Unoptimized */ - -static __inline__ unsigned long -ffz (unsigned long word) -{ - unsigned long result; - - result = 0; - while(word & 1) - { - result++; - word >>= 1; - } - return result; -} -#endif - /* check filesystem types and read superblock into memory buffer */ int ext2fs_mount (fsi_file_t *ffi, const char *options) |