Commit e6adbbcd authored by Daniel Quinlan's avatar Daniel Quinlan Committed by Linus Torvalds

[PATCH] cramfs updates for 2.5.6-pre2

Documentation/filesystems/cramfs.txt
  - remove comment about ROM size limit
  - fix up magic
  - update location of tools

fs/cramfs/README
  - add note about sorted directory entries
  - mkcramfs compile-time DO_HOLES option replaced by run-time -z option
  - update tools section
  - add note about PAGE_CACHE_SIZE possibly changing on arm and ia64

fs/cramfs/inode.c
  - statfs->f_namelen = CRAMFS_MAXPATHLEN

include/linux/cramfs_fs.h
  - add CRAMFS_MAXPATHLEN (252)
  - clarify CRAMFS_SUPPORTED_FLAGS definition

scripts/cramfs
  - directory removed, the cramfs user-space tools are now located at
    <http://sourceforge.net/projects/cramfs/>.
parent 6282c8d3
......@@ -10,7 +10,7 @@ diskspace than traditional filesystems.
You can't write to a cramfs filesystem (making it compressible and
compact also makes it _very_ hard to update on-the-fly), so you have to
create the disk image with the "mkcramfs" utility in scripts/cramfs.
create the disk image with the "mkcramfs" utility.
Usage Notes
......@@ -19,9 +19,7 @@ Usage Notes
File sizes are limited to less than 16MB.
Maximum filesystem size is a little over 256MB. (The last file on the
filesystem is allowed to extend past 256MB.) (Comments in mkcramfs.c
suggest that ROM sizes may be limited to 64MB, though that's not a
limitation in cramfs code.)
filesystem is allowed to extend past 256MB.)
Only the low 8 bits of gid are stored. The current version of
mkcramfs simply truncates to 8 bits, which is a potential security
......@@ -48,18 +46,28 @@ mind the filesystem becoming unreadable to future kernels.
For /usr/share/magic
------------------
--------------------
0 long 0x28cd3d45 Linux cramfs
>4 long x size %d
>8 long x flags 0x%x
>12 long x future 0x%x
0 ulelong 0x28cd3d45 Linux cramfs offset 0
>4 ulelong x size %d
>8 ulelong x flags 0x%x
>12 ulelong x future 0x%x
>16 string >\0 signature "%.16s"
>32 long x fsid.crc 0x%x
>36 long x fsid.edition %d
>40 long x fsid.blocks %d
>44 long x fsid.files %d
>32 ulelong x fsid.crc 0x%x
>36 ulelong x fsid.edition %d
>40 ulelong x fsid.blocks %d
>44 ulelong x fsid.files %d
>48 string >\0 name "%.16s"
512 ulelong 0x28cd3d45 Linux cramfs offset 512
>516 ulelong x size %d
>520 ulelong x flags 0x%x
>524 ulelong x future 0x%x
>528 string >\0 signature "%.16s"
>544 ulelong x fsid.crc 0x%x
>548 ulelong x fsid.edition %d
>552 ulelong x fsid.blocks %d
>556 ulelong x fsid.files %d
>560 string >\0 name "%.16s"
Hacker Notes
......
......@@ -6,8 +6,8 @@ a bit looser, e.g. it doesn't care if the <file_data> items are
swapped around (though it does care that directory entries (inodes) in
a given directory are contiguous, as this is used by readdir).
All data is in host-endian format; neither mkcramfs nor the kernel
ever do swabbing. (See section `Block Size' below.)
All data is currently in host-endian format; neither mkcramfs nor the
kernel ever do swabbing. (See section `Block Size' below.)
<filesystem>:
<superblock>
......@@ -29,6 +29,10 @@ same order as `ls -AUR' (but without the /^\..*:$/ directory header
lines); put another way, the same order as `find -type d -exec
ls -AU1 {} \;'.
Beginning in 2.4.7, directory entries are sorted. This optimization
allows cramfs_lookup to return more quickly when a filename does not
exist, speeds up user-space directory sorts, etc.
<data>:
One <file_data> for each file that's either a symlink or a
regular file of non-zero st_size.
......@@ -63,17 +67,15 @@ Holes
This kernel supports cramfs holes (i.e. [efficient representation of]
blocks in uncompressed data consisting entirely of NUL bytes), but by
default mkcramfs doesn't test for & create holes, since cramfs in
kernels up to at least 2.3.39 didn't support holes. Compile mkcramfs
with -DDO_HOLES if you want it to create files that can have holes in
them.
kernels up to at least 2.3.39 didn't support holes. Run mkcramfs
with -z if you want it to create files that can have holes in them.
Tools
-----
If you're hacking on cramfs, you might find useful some tools for
testing cramfs at <http://cvs.bofh.asn.au/cramfs/>, including a
rudimentary fsck for cramfs.
The cramfs user-space tools, including mkcramfs and cramfsck, are
located at <http://sourceforge.net/projects/cramfs/>.
Future Development
......@@ -103,8 +105,8 @@ require the least amount of change: just change `#define
PAGE_CACHE_SIZE (4096)' to `#include <asm/page.h>'. The disadvantage
is that the generated cramfs cannot always be shared between different
kernels, not even necessarily kernels of the same architecture if
PAGE_CACHE_SIZE is subject to change between kernel versions.
PAGE_CACHE_SIZE is subject to change between kernel versions
(currently possible with arm and ia64).
The remaining options try to make cramfs more sharable.
......
......@@ -266,7 +266,7 @@ static int cramfs_statfs(struct super_block *sb, struct statfs *buf)
buf->f_bavail = 0;
buf->f_files = sb->CRAMFS_SB_FILES;
buf->f_ffree = 0;
buf->f_namelen = 255;
buf->f_namelen = CRAMFS_MAXPATHLEN;
return 0;
}
......@@ -476,4 +476,3 @@ static void __exit exit_cramfs_fs(void)
module_init(init_cramfs_fs)
module_exit(exit_cramfs_fs)
MODULE_LICENSE("GPL");
......@@ -23,6 +23,12 @@ typedef unsigned int u32;
#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.
*/
......@@ -54,12 +60,12 @@ struct cramfs_info {
struct cramfs_super {
u32 magic; /* 0x28cd3d45 - random number */
u32 size; /* length in bytes */
u32 flags; /* 0 */
u32 future; /* 0 */
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 */
struct cramfs_inode root; /* root inode data */
};
/*
......@@ -79,7 +85,10 @@ struct cramfs_super {
* if (flags & ~CRAMFS_SUPPORTED_FLAGS). Maybe that should be
* changed to test super.future instead.
*/
#define CRAMFS_SUPPORTED_FLAGS (0x7ff)
#define CRAMFS_SUPPORTED_FLAGS ( 0x000000ff \
| CRAMFS_FLAG_HOLES \
| CRAMFS_FLAG_WRONG_SIGNATURE \
| CRAMFS_FLAG_SHIFTED_ROOT_OFFSET )
/* Uncompression interfaces to the underlying zlib */
int cramfs_uncompress_block(void *dst, int dstlen, void *src, int srclen);
......
CC = gcc
CFLAGS = -W -Wall -O2 -g
CPPFLAGS = -I../../include
LDLIBS = -lz
PROGS = mkcramfs cramfsck
all: $(PROGS)
distclean clean:
rm -f $(PROGS)
.PHONY: all clean
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment