From 180d3f74e4738ee107e269cbb949481075dd789a Mon Sep 17 00:00:00 2001 From: wdenk Date: Sun, 4 Jan 2004 16:28:35 +0000 Subject: * Fix problems caused by Robert Schwebel's cramfs patch * Patch by Scott McNutt, 02 Jan 2004: Add support for the Nios Active Serial Memory Interface (ASMI) on Cyclone devices * Patch by Andrea Marson, 16 Dec 2003: Add support for the PPChameleon ME and HI modules * Patch by Yuli Barcohen, 22 Dec 2003: Add support for Motorola DUET ADS board (MPC87x/88x) --- fs/cramfs/cramfs.c | 33 +----------- fs/cramfs/cramfs_fs.h | 133 ------------------------------------------------- fs/jffs2/jffs2_1pass.c | 2 +- 3 files changed, 3 insertions(+), 165 deletions(-) delete mode 100644 fs/cramfs/cramfs_fs.h (limited to 'fs') diff --git a/fs/cramfs/cramfs.c b/fs/cramfs/cramfs.c index 1e35104..98ff567 100644 --- a/fs/cramfs/cramfs.c +++ b/fs/cramfs/cramfs.c @@ -31,8 +31,9 @@ #include #include +#include #include -#include "cramfs_fs.h" +#include /* These two macros may change in future, to provide better st_ino semantics. */ @@ -198,36 +199,6 @@ int cramfs_load (char *loadoffset, struct part_info *info, char *filename) (unsigned long) loadoffset); } -static char *mkmodestr (unsigned long mode, char *str) -{ - static const char *l = "xwr"; - int mask = 1, i; - char c; - - switch (mode & S_IFMT) { - case S_IFDIR: str[0] = 'd'; break; - case S_IFBLK: str[0] = 'b'; break; - case S_IFCHR: str[0] = 'c'; break; - case S_IFIFO: str[0] = 'f'; break; - case S_IFLNK: str[0] = 'l'; break; - case S_IFSOCK: str[0] = 's'; break; - case S_IFREG: str[0] = '-'; break; - default: str[0] = '?'; break; - } - - for (i = 0; i < 9; i++) { - c = l[i % 3]; - str[9 - i] = (mode & mask) ? c : '-'; - mask = mask << 1; - } - - if (mode & S_ISUID) str[3] = (mode & S_IXUSR) ? 's' : 'S'; - if (mode & S_ISGID) str[6] = (mode & S_IXGRP) ? 's' : 'S'; - if (mode & S_ISVTX) str[9] = (mode & S_IXOTH) ? 't' : 'T'; - str[10] = '\0'; - return str; -} - static int cramfs_list_inode (struct part_info *info, unsigned long offset) { struct cramfs_inode *inode = (struct cramfs_inode *) diff --git a/fs/cramfs/cramfs_fs.h b/fs/cramfs/cramfs_fs.h deleted file mode 100644 index 78cc9ec..0000000 --- a/fs/cramfs/cramfs_fs.h +++ /dev/null @@ -1,133 +0,0 @@ -#ifndef __CRAMFS_FS_H -#define __CRAMFS_FS_H - -/* Uncompression interfaces to the underlying zlib */ -int cramfs_uncompress_block (void *dst, void *src, int srclen); -int cramfs_uncompress_init (void); - -#define CRAMFS_MAGIC 0x28cd3d45 /* some random number */ -#define CRAMFS_SIGNATURE "Compressed ROMFS" - -/* - * Width of various bitfields in struct cramfs_inode. - * Primarily used to generate warnings in mkcramfs. - */ -#define CRAMFS_MODE_WIDTH 16 -#define CRAMFS_UID_WIDTH 16 -#define CRAMFS_SIZE_WIDTH 24 -#define CRAMFS_GID_WIDTH 8 -#define CRAMFS_NAMELEN_WIDTH 6 -#define CRAMFS_OFFSET_WIDTH 26 - -/* - * Since inode.namelen is a unsigned 6-bit number, the maximum cramfs - * path length is 63 << 2 = 252. - */ -#define CRAMFS_MAXPATHLEN (((1 << CRAMFS_NAMELEN_WIDTH) - 1) << 2) - -/* - * Reasonably terse representation of the inode data. - */ -struct cramfs_inode { - u32 mode:CRAMFS_MODE_WIDTH, uid:CRAMFS_UID_WIDTH; - /* SIZE for device files is i_rdev */ - u32 size:CRAMFS_SIZE_WIDTH, gid:CRAMFS_GID_WIDTH; - /* NAMELEN is the length of the file name, divided by 4 and - rounded up. (cramfs doesn't support hard links.) */ - /* OFFSET: For symlinks and non-empty regular files, this - contains the offset (divided by 4) of the file data in - compressed form (starting with an array of block pointers; - see README). For non-empty directories it is the offset - (divided by 4) of the inode of the first file in that - directory. For anything else, offset is zero. */ - u32 namelen:CRAMFS_NAMELEN_WIDTH, offset:CRAMFS_OFFSET_WIDTH; -}; - -struct cramfs_info { - u32 crc; - u32 edition; - u32 blocks; - u32 files; -}; - -/* - * Superblock information at the beginning of the FS. - */ -struct cramfs_super { - u32 magic; /* 0x28cd3d45 - random number */ - u32 size; /* length in bytes */ - u32 flags; /* feature flags */ - u32 future; /* reserved for future use */ - u8 signature[16]; /* "Compressed ROMFS" */ - struct cramfs_info fsid; /* unique filesystem info */ - u8 name[16]; /* user-defined name */ - struct cramfs_inode root; /* root inode data */ -}; - -/* - * Feature flags - * - * 0x00000000 - 0x000000ff: features that work for all past kernels - * 0x00000100 - 0xffffffff: features that don't work for past kernels - */ -#define CRAMFS_FLAG_FSID_VERSION_2 0x00000001 /* fsid version #2 */ -#define CRAMFS_FLAG_SORTED_DIRS 0x00000002 /* sorted dirs */ -#define CRAMFS_FLAG_HOLES 0x00000100 /* support for holes */ -#define CRAMFS_FLAG_WRONG_SIGNATURE 0x00000200 /* reserved */ -#define CRAMFS_FLAG_SHIFTED_ROOT_OFFSET 0x00000400 /* shifted root fs */ - -/* - * Valid values in super.flags. Currently we refuse to mount - * if (flags & ~CRAMFS_SUPPORTED_FLAGS). Maybe that should be - * changed to test super.future instead. - */ -#define CRAMFS_SUPPORTED_FLAGS ( 0x000000ff \ - | CRAMFS_FLAG_HOLES \ - | CRAMFS_FLAG_WRONG_SIGNATURE \ - | CRAMFS_FLAG_SHIFTED_ROOT_OFFSET ) - -/* - * Since cramfs is little-endian, provide macros to swab the bitfields. - */ - -#ifndef __BYTE_ORDER -#if defined(__LITTLE_ENDIAN) && !defined(__BIG_ENDIAN) -#define __BYTE_ORDER __LITTLE_ENDIAN -#elif defined(__BIG_ENDIAN) && !defined(__LITTLE_ENDIAN) -#define __BYTE_ORDER __BIG_ENDIAN -#else -#error "unable to define __BYTE_ORDER" -#endif -#endif /* not __BYTE_ORDER */ - -#if __BYTE_ORDER == __LITTLE_ENDIAN -#define CRAMFS_16(x) (x) -#define CRAMFS_24(x) (x) -#define CRAMFS_32(x) (x) -#define CRAMFS_GET_NAMELEN(x) ((x)->namelen) -#define CRAMFS_GET_OFFSET(x) ((x)->offset) -#define CRAMFS_SET_OFFSET(x,y) ((x)->offset = (y)) -#define CRAMFS_SET_NAMELEN(x,y) ((x)->namelen = (y)) -#elif __BYTE_ORDER == __BIG_ENDIAN -#ifdef __KERNEL__ -#define CRAMFS_16(x) swab16(x) -#define CRAMFS_24(x) ((swab32(x)) >> 8) -#define CRAMFS_32(x) swab32(x) -#else /* not __KERNEL__ */ -#define CRAMFS_16(x) bswap_16(x) -#define CRAMFS_24(x) ((bswap_32(x)) >> 8) -#define CRAMFS_32(x) bswap_32(x) -#endif /* not __KERNEL__ */ -#define CRAMFS_GET_NAMELEN(x) (((u8*)(x))[8] & 0x3f) -#define CRAMFS_GET_OFFSET(x) ((CRAMFS_24(((u32*)(x))[2] & 0xffffff) << 2) |\ - ((((u32*)(x))[2] & 0xc0000000) >> 30)) -#define CRAMFS_SET_NAMELEN(x,y) (((u8*)(x))[8] = (((0x3f & (y))) | \ - (0xc0 & ((u8*)(x))[8]))) -#define CRAMFS_SET_OFFSET(x,y) (((u32*)(x))[2] = (((y) & 3) << 30) | \ - CRAMFS_24((((y) & 0x03ffffff) >> 2)) | \ - (((u32)(((u8*)(x))[8] & 0x3f)) << 24)) -#else -#error "__BYTE_ORDER must be __LITTLE_ENDIAN or __BIG_ENDIAN" -#endif - -#endif /* not __CRAMFS_FS_H */ diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c index fb69bee..8a23c83 100644 --- a/fs/jffs2/jffs2_1pass.c +++ b/fs/jffs2/jffs2_1pass.c @@ -512,7 +512,7 @@ jffs2_1pass_find_inode(struct b_lists * pL, const char *name, u32 pino) return inode; } -static char *mkmodestr(unsigned long mode, char *str) +char *mkmodestr(unsigned long mode, char *str) { static const char *l = "xwr"; int mask = 1, i; -- cgit v1.1