diff -urN linux.orig/fs/Config.in linux/fs/Config.in --- linux.orig/fs/Config.in Fri Oct 27 04:23:18 2000 +++ linux/fs/Config.in Fri Oct 27 03:57:52 2000 @@ -29,6 +29,10 @@ int 'JFFS debugging verbosity (0 = quiet, 3 = noisy)' CONFIG_JFFS_FS_VERBOSE 0 fi tristate 'Compressed ROM file system support' CONFIG_CRAMFS +dep_mbool 'Linear addressing for CRAMFS' CONFIG_CRAMFS_LINEAR_ADDRESSING $CONFIG_CRAMFS +if [ "$CONFIG_CRAMFS_LINEAR_ADDRESSING" != "n" ] ; then + hex 'Starting address for CRAMFS filesystem' CONFIG_CRAMFS_LA_ADDRESS bf200008 +fi tristate 'Simple RAM-based file system support' CONFIG_RAMFS tristate 'ISO 9660 CDROM file system support' CONFIG_ISO9660_FS diff -urN linux.orig/fs/cramfs/inode.c linux/fs/cramfs/inode.c --- linux.orig/fs/cramfs/inode.c Fri Oct 27 04:22:36 2000 +++ linux/fs/cramfs/inode.c Fri Oct 27 04:30:18 2000 @@ -11,6 +11,20 @@ * The actual compression is based on zlib, see the other files. */ +/* Linear Addressing code + * + * Copyright (C) 2000 Shane Nay. + * + * Allows you to have a linearly addressed cramfs filesystem. + * Saves the need for buffer, and the munging of the buffer. + * Savings a bit over 32k with default PAGE_SIZE, BUFFER_SIZE + * etc. Usefull on embedded platform with ROM :-). + * + * Downsides- Currently linear addressed cramfs partitions + * don't co-exist with block cramfs partitions. + * + */ + #include #include #include @@ -68,6 +82,23 @@ return inode; } +#if defined(CONFIG_CRAMFS_CRAMFS_LINEAR_ADDRESSING) && defined (CONFIG_CRAMFS_LA_ADDRESS) + +/* + * Returns a pointer to the linearly addressed filesystem. + * Simple byte size pointer addition. + */ +static unsigned char* romdisk_top=(unsigned char*) CONFIG_CRAMFS_LA_ADDRESS; + +static void *cramfs_read(struct super_block *sb, unsigned int offset, unsigned int len) +{ + if (!len) + return NULL; + return romdisk_top + offset; +} + +#else /* !CONFIG_CRAMFS_LINEAR_ADDRESSING aka Regular block mode */ + /* * We have our own block cache: don't fill up the buffer cache * with the rom-image, because the way the filesystem is set @@ -149,6 +180,8 @@ } return read_buffers[buffer] + offset; } + +#endif static struct super_block * cramfs_read_super(struct super_block *sb, void *data, int silent) @@ -161,10 +194,11 @@ set_blocksize(sb->s_dev, PAGE_CACHE_SIZE); sb->s_blocksize = PAGE_CACHE_SIZE; sb->s_blocksize_bits = PAGE_CACHE_SHIFT; +#if !( defined(CONFIG_CRAMFS_CRAMFS_LINEAR_ADDRESSING) && defined (CONFIG_CRAMFS_LA_ADDRESS) ) /* Invalidate the read buffers on mount: think disk change.. */ for (i = 0; i < READ_BUFFERS; i++) buffer_blocknr[i] = -1; +#endif /* Read the first block and get the superblock from it */ memcpy(&super, cramfs_read(sb, 0, sizeof(super)), sizeof(super));