diff options
author | Mike Shaver <shaver@ingenia.com> | 1999-03-25 17:14:33 +0000 |
---|---|---|
committer | Mike Shaver <shaver@ingenia.com> | 1999-03-25 17:14:33 +0000 |
commit | ae9d38e9ea2cb7f28e757975537dabe5fb2f145d (patch) | |
tree | 19d200885708b6a2449f7465f19f3828a1e243f7 /include | |
parent | c01138a72c1ed121902fc3c1dda854239d506368 (diff) |
new EFS headers (Al Smith rocks my world)
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/efs.h | 65 | ||||
-rw-r--r-- | include/linux/efs_dir.h | 41 | ||||
-rw-r--r-- | include/linux/efs_fs.h | 221 | ||||
-rw-r--r-- | include/linux/efs_fs_i.h | 27 | ||||
-rw-r--r-- | include/linux/efs_fs_sb.h | 29 | ||||
-rw-r--r-- | include/linux/efs_inode.h | 88 | ||||
-rw-r--r-- | include/linux/efs_super.h | 61 | ||||
-rw-r--r-- | include/linux/efs_vh.h | 43 |
8 files changed, 298 insertions, 277 deletions
diff --git a/include/linux/efs.h b/include/linux/efs.h new file mode 100644 index 000000000..340a0b2f1 --- /dev/null +++ b/include/linux/efs.h @@ -0,0 +1,65 @@ +/* + * efs.h + * + * Copyright (c) 1999 Al Smith + * + * Portions derived from work (c) 1995,1996 Christian Vogelgsang. + */ + +#ifndef __EFS_H__ +#define __EFS_H__ + +#include <linux/stat.h> +#include <linux/sched.h> +#include <linux/kernel.h> +#include <linux/major.h> +#include <linux/mm.h> +#include <linux/string.h> +#include <linux/locks.h> +#include <linux/malloc.h> +#include <linux/errno.h> +#include <linux/cdrom.h> + +#include <asm/system.h> +#include <asm/segment.h> +#include <asm/uaccess.h> +#include <asm/byteorder.h> + +#include "efs_vh.h" +#include "efs_super.h" +#include "efs_inode.h" +#include "efs_dir.h" + +#ifndef MIN +#define MIN(a,b) ((a)<(b)?(a):(b)) +#endif +#ifndef MAX +#define MAX(a,b) ((a)>(b)?(a):(b)) +#endif + +/* private inode storage */ +struct efs_in_info { + int numextents; + int lastextent; + + efs_extent extents[EFS_DIRECTEXTENTS]; +}; + +extern struct inode_operations efs_dir_inode_operations; +extern struct inode_operations efs_file_inode_operations; +extern struct inode_operations efs_symlink_inode_operations; + +extern int init_module(void); +extern void cleanup_module(void); +extern struct super_block *efs_read_super(struct super_block *, void *, int); +extern void efs_put_super(struct super_block *); +extern int efs_statfs(struct super_block *, struct statfs *, int); + +extern void efs_read_inode(struct inode *); +extern efs_block_t efs_read_block(struct inode *, efs_block_t); + +extern int efs_lookup(struct inode *, struct dentry *); +extern int efs_bmap(struct inode *, int); + +#endif /* __EFS_H__ */ + diff --git a/include/linux/efs_dir.h b/include/linux/efs_dir.h new file mode 100644 index 000000000..3459bd4bf --- /dev/null +++ b/include/linux/efs_dir.h @@ -0,0 +1,41 @@ +/* + * efs_dir.h + * + * Copyright (c) 1999 Al Smith + */ + +#ifndef __EFS_DIR_H__ +#define __EFS_DIR_H__ + +#define EFS_DIRBSIZE EFS_BLOCKSIZE + +struct efs_dentry { + unsigned int inode; + unsigned char namelen; + char name[3]; +}; + +#define EFS_DENTSIZE (sizeof(struct efs_dentry) - 3 + 1) +#define EFS_MAXNAMELEN ((1 << (sizeof(char) * 8)) - 1) + +#define EFS_DIRBLK_HEADERSIZE 4 +#define EFS_DIRBLK_MAGIC 0xbeef /* moo */ + +struct efs_dir { + unsigned short magic; + unsigned char firstused; + unsigned char slots; + + unsigned char space[EFS_DIRBSIZE - EFS_DIRBLK_HEADERSIZE]; +}; + +#define EFS_MAXENTS \ + ((EFS_DIRBSIZE - EFS_DIRBLK_HEADERSIZE) / \ + (EFS_DENTSIZE + sizeof(char))) + +#define EFS_SLOTAT(dir, slot) EFS_REALOFF((dir)->space[slot]) + +#define EFS_REALOFF(offset) ((offset << 1)) + +#endif /* __EFS_DIR_H__ */ + diff --git a/include/linux/efs_fs.h b/include/linux/efs_fs.h deleted file mode 100644 index 80a41fa2d..000000000 --- a/include/linux/efs_fs.h +++ /dev/null @@ -1,221 +0,0 @@ -/* - * linux/include/linux/efs_fs.h - * - * Copyright (C) 1997, 1998 Mike Shaver (shaver@netscape.com) - * - * Based on work Copyright (C) 1995, 1996 Christian Vogelgsang. - * - * $Id: efs_fs.h,v 1.4 1998/08/25 09:22:46 ralf Exp $ - */ - -#ifndef __LINUX_EFS_FS_H -#define __LINUX_EFS_FS_H - -#include <linux/types.h> -#include <linux/kernel.h> -#include <linux/time.h> -#include <linux/stat.h> - -/* SuperMagic: need a unique Identifier for EFS */ -#define EFS_SUPER_MAGIC 0x280273 -#define EFS_ROOT_INODE 2 -#define EFS_BLK_VOLDESC 0 -#define EFS_BLK_SUPER 1 - -#define EFS_BLOCK_SIZE 512 -#define EFS_BLOCK_SIZE_BITS 9 - -/* EFS Magic IDs */ -#define EFS_MAGIC1 0x72959 -#define EFS_MAGIC2 0x7295a - -/* Offsets in VolumeDescriptor */ -#define EFS_VD_FS_START 0x190 /* First FS block */ -#define EFS_VD_ENTRYFIRST 0x48 /* Begin of Entry list */ -#define EFS_VD_ENTRYPOS 8 /* offset for the entry position */ -#define EFS_VD_ENTRYLEN 12 /* offset for the entry length */ -#define EFS_VD_ENTRYSIZE 16 /* length of an entry */ - -/* Offsets in Superblock */ -#define EFS_SB_TOTAL 0 /* Number of Blocks used for filesystem */ -#define EFS_SB_FIRST 4 /* BB of Begin First Cylinder Group */ -#define EFS_SB_GROUP 8 /* BBs per Group */ -#define EFS_SB_INODE 12 /* BBs used for Inodes at begin of group */ -#define EFS_SB_TOGRP 18 /* Number of Groups in Filesystem */ -#define EFS_SB_MAGIC 28 - -struct efs_disk_sb { - __u32 s_size; - __u32 s_firstcg; - __u32 s_cgfsize; - __u16 s_cgisize; - __u16 s_sectors; - __u16 s_heads; - __u16 s_ncg; - __u16 s_dirty; - __u32 s_time; - __u32 s_magic; - char s_fname[6]; - char s_fpack[6]; - __u32 s_bmsize; - __u32 s_tfree; - __u32 s_tinode; - __u32 s_bmblock; - __u32 s_replsb; - __u32 s_lastialloc; - char s_spare[20]; /* Must be zero */ - __u32 s_checksum; -}; - -#define EFS_CLEAN 0x0000 /* clean, not mounted */ -#define EFS_ACTIVE 0x7777 /* clean, mounted */ -#define EFS_ACTIVEDIRT 0x0BAD /* dirty when mounted */ -#define EFS_DIRTY 0x1234 /* mounted, then made dirty */ - -#ifdef DEBUG -void efs_dump_super(struct efs_super_block *); -#endif - -#define EFS_MAX_EXTENTS 12 - -/* odev is used by "pre-extended-dev_t" IRIX EFS implementations, and - later ones use odev and ndev together */ - -struct efs_devs { - __u16 odev; - __u32 ndev; -}; - -union efs_extent { - struct { - __u32 ex_magic:4, /* must be zero */ - ex_bn:24; - __u32 ex_length:8, - ex_offset; - } ex_ex; - __u32 ex_bytes[2]; -}; - -#define EFS_INODES_PER_BLOCK 4 - -struct efs_disk_inode { - __u16 di_mode; - __u16 di_nlink; - __u16 di_uid; - __u16 di_gid; - __u32 di_size; - __u32 di_atime; - __u32 di_mtime; - __u32 di_ctime; - __u32 di_gen; - __u16 di_numextents; - __u8 di_version; - __u8 di_spare; - union di_addr { - union efs_extent di_extents[EFS_MAX_EXTENTS]; - struct efs_devs di_dev; - } di_u; -}; - -/* Offsets in DirBlock */ -#define EFS_DB_ENTRIES 3 -#define EFS_DB_FIRST 4 -#define EFS_DIRBLK_MAGIC 0xBEEF -#define EFS_DIRBLK_HEADERSIZE 4 -#define EFS_DIRBLK_SIZE EFS_BLOCK_SIZE - -struct efs_dirblk { - __u16 db_magic; /* 0xBEEF */ - __u8 db_firstused; - __u8 db_slots; - __u8 db_space[EFS_DIRBLK_SIZE - EFS_DIRBLK_HEADERSIZE]; -}; - -/* Offsets in DirItem */ -#define EFS_DI_NAMELEN 4 -#define EFS_DI_NAME 5 - -struct efs_dir_entry { - union { - __u32 l; - __u16 s[2]; - } ud_inum; - __u8 d_namelen; - __u8 d_name[3]; -}; - -#define EFS_EXT_PER_BLK_BITS 5 -#define EFS_EXT_PER_BLK_MASK 63 -#define EFS_EXT_SIZE_BITS 3 - -#define EFS_SLOT2OFF(dirblk, slot) \ - (((dirblk)->db_space[(slot)]) << 1) - -#define EFS_DENT4OFF(dirblk, offset) \ - ((struct efs_dir_entry *)((char *)(dirblk) + (offset))) - -/* define a few convenient types */ -#ifdef __KERNEL__ - -#include <linux/fs.h> - -#ifdef DEBUG_EFS -#define DB(x) printk##x -#else -#define DB(x) do { } while(0); -#endif - -extern int -efs_lookup(struct inode *dir, struct dentry *dentry); - -extern int -efs_bmap(struct inode *inode, int block); - -extern struct buffer_head * -efs_bread(struct inode * inode, int block, int create); - -extern void -efs_put_super(struct super_block *sb); - -extern struct super_block * -efs_read_super(struct super_block *sb, void *data, int silent); - -extern void -efs_read_inode(struct inode *inode); - -extern int -efs_remount(struct super_block *sb, int *flags, char *data); - -extern int -efs_statfs(struct super_block *sb, struct statfs *buf, int bufsiz); - - -/* Byte swapping 32/16-bit quantities into little endian format. */ -#define efs_need_swab 0 -/* extern int efs_need_swab; */ - -extern __inline__ __u32 efs_swab32(__u32 value) -{ - return (efs_need_swab ? ((value >> 24) | - ((value >> 8) & 0xff00) | - ((value << 8) & 0xff0000) | - (value << 24)) : value); -} - -extern __inline__ __u16 efs_swab16(__u16 value) -{ - return (efs_need_swab ? ((value >> 8) | - (value << 8)) : value); -} - -int init_efs_fs(void); - -/* Inode Method structures for Dirs, Files and Symlinks */ -extern struct inode_operations efs_dir_inode_operations; -extern struct inode_operations efs_file_inode_operations; -extern struct inode_operations efs_symlink_inode_operations; -extern struct dentry_operations efs_dentry_operations; - -#endif /* __KERNEL__ */ - -#endif /* __LINUX_EFS_FS_H */ diff --git a/include/linux/efs_fs_i.h b/include/linux/efs_fs_i.h deleted file mode 100644 index 701bce8e7..000000000 --- a/include/linux/efs_fs_i.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * linux/include/linux/efs_fs_i.h - * - * Copyright (C) 1997 - * Mike Shaver (shaver@neon.ingenia.ca) - * - * Based on work Copyright (C) 1995, 1996 Christian Vogelgsang. - * - * $Id: efs_fs_i.h,v 1.1 1997/12/02 02:28:29 ralf Exp $ - */ - -#ifndef __LINUX_EFS_FS_I_H -#define __LINUX_EFS_FS_I_H - -#include <linux/efs_fs.h> - -/* private Inode part */ -struct efs_inode_info { - __u32 extblk; - - __u16 tot; - __u16 cur; - - union efs_extent extents[EFS_MAX_EXTENTS]; -}; - -#endif /* __LINUX_EFS_FS_I_H */ diff --git a/include/linux/efs_fs_sb.h b/include/linux/efs_fs_sb.h deleted file mode 100644 index 4c6d17f14..000000000 --- a/include/linux/efs_fs_sb.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * linux/include/linux/efs_fs_sb.h - * - * Copyright (C) 1997 - * Mike Shaver (shaver@neon.ingenia.ca) - * - * Based on work Copyright (C) 1995, 1996 Christian Vogelgsang. - * - * $Id: efs_fs_sb.h,v 1.1 1997/12/02 02:28:29 ralf Exp $ - */ - -#ifndef __LINUX_EFS_FS_SB_H -#define __LINUX_EFS_FS_SB_H - -#include <linux/efs_fs.h> - -/* EFS Superblock Information */ -struct efs_sb_info { - __u32 fs_start; /* first block of filesystem */ - __u32 total_blocks; /* total number of blocks in filesystem */ - __u32 first_block; /* first data block in filesystem */ - __u32 group_size; /* number of blocks a group consists of */ - __u16 inode_blocks; /* number of blocks used for inodes in - * every group */ - __u16 total_groups; /* number of groups */ -}; - - -#endif /* __LINUX_UFS_FS_SB_H */ diff --git a/include/linux/efs_inode.h b/include/linux/efs_inode.h new file mode 100644 index 000000000..eb61c941e --- /dev/null +++ b/include/linux/efs_inode.h @@ -0,0 +1,88 @@ +/* + * efs_ino.h + * + * Copyright (c) 1999 Al Smith + * + * Portions derived from IRIX header files (c) 1988 Silicon Graphics + */ + +#ifndef __EFS_INO_ +#define __EFS_INO_ + +typedef int32_t efs_block_t; +typedef uint32_t efs_ino_t; + +/* this is very icky */ +union extent1 { +#ifdef __LITTLE_ENDIAN + struct s1 { + unsigned int ex_bn:24; /* basic block # */ + unsigned int ex_magic:8; /* magic # (zero) */ + } s; +#else +#ifdef __BIG_ENDIAN + struct s1 { + unsigned int ex_magic:8; /* magic # (zero) */ + unsigned int ex_bn:24; /* basic block # */ + } s; +#else +#error system endianness is undefined +#endif +#endif + unsigned long l; +} extent1; + +union extent2 { +#ifdef __LITTLE_ENDIAN + struct s2 { + unsigned int ex_offset:24; /* logical bb offset into file */ + unsigned int ex_length:8; /* numblocks in this extent */ + } s; +#else +#ifdef __BIG_ENDIAN + struct s2 { + unsigned int ex_length:8; /* numblocks in this extent */ + unsigned int ex_offset:24; /* logical bb offset into file */ + } s; +#else +#error system endianness is undefined +#endif +#endif + unsigned long l; +} extent2; + +/* + * layout of an extent, in memory and on disk. 8 bytes exactly + */ +typedef struct extent { + union extent1 u1; + union extent2 u2; +} efs_extent; + +#define EFS_DIRECTEXTENTS 12 + +/* + * extent based filesystem inode as it appears on disk. The efs inode + * is exactly 128 bytes long. + */ +struct efs_dinode { + u_short di_mode; /* mode and type of file */ + short di_nlink; /* number of links to file */ + u_short di_uid; /* owner's user id */ + u_short di_gid; /* owner's group id */ + int32_t di_size; /* number of bytes in file */ + int32_t di_atime; /* time last accessed */ + int32_t di_mtime; /* time last modified */ + int32_t di_ctime; /* time created */ + uint32_t di_gen; /* generation number */ + short di_numextents; /* # of extents */ + u_char di_version; /* version of inode */ + u_char di_spare; /* spare - used by AFS */ + union di_addr { + efs_extent di_extents[EFS_DIRECTEXTENTS]; + dev_t di_dev; /* device for IFCHR/IFBLK */ + } di_u; +}; + +#endif /* __EFS_INO_ */ + diff --git a/include/linux/efs_super.h b/include/linux/efs_super.h new file mode 100644 index 000000000..b840abcc4 --- /dev/null +++ b/include/linux/efs_super.h @@ -0,0 +1,61 @@ +/* + * efs_super.h + * + * Copyright (c) 1999 Al Smith + * + * Portions derived from IRIX header files (c) 1988 Silicon Graphics + */ + +#ifndef __EFS_SUPER_H__ +#define __EFS_SUPER_H__ + +/* statfs() magic number for EFS */ +#define EFS_SUPER_MAGIC 0x414A83 + +/* EFS superblock magic numbers */ +#define EFS_MAGIC 0x072959 +#define EFS_NEWMAGIC 0x07295a + +#define IS_EFS_MAGIC(x) ((x == EFS_MAGIC) || (x == EFS_NEWMAGIC)) + +#define EFS_SUPER 1 +#define EFS_ROOTINODE 2 +#define EFS_BLOCKSIZE 512 +#define EFS_BLOCKSIZE_BITS 9 + +struct efs { + int32_t fs_size; /* size of filesystem, in sectors */ + int32_t fs_firstcg; /* bb offset to first cg */ + int32_t fs_cgfsize; /* size of cylinder group in bb's */ + short fs_cgisize; /* bb's of inodes per cylinder group */ + short fs_sectors; /* sectors per track */ + short fs_heads; /* heads per cylinder */ + short fs_ncg; /* # of cylinder groups in filesystem */ + short fs_dirty; /* fs needs to be fsck'd */ + int32_t fs_time; /* last super-block update */ + int32_t fs_magic; /* magic number */ + char fs_fname[6]; /* file system name */ + char fs_fpack[6]; /* file system pack name */ + int32_t fs_bmsize; /* size of bitmap in bytes */ + int32_t fs_tfree; /* total free data blocks */ + int32_t fs_tinode; /* total free inodes */ + int32_t fs_bmblock; /* bitmap location. */ + int32_t fs_replsb; /* Location of replicated superblock. */ + int32_t fs_lastialloc; /* last allocated inode */ + char fs_spare[20]; /* space for expansion - MUST BE ZERO */ + int32_t fs_checksum; /* checksum of volume portion of fs */ +}; + +/* efs superblock information */ +struct efs_spb { + int32_t fs_magic; /* first block of filesystem */ + int32_t fs_start; /* first block of filesystem */ + int32_t total_blocks; /* total number of blocks in filesystem */ + int32_t first_block; /* first data block in filesystem */ + int32_t group_size; /* number of blocks a group consists of */ + short inode_blocks; /* number of blocks used for inodes in every grp */ + short total_groups; /* number of groups */ +}; + +#endif /* __EFS_SUPER_H__ */ + diff --git a/include/linux/efs_vh.h b/include/linux/efs_vh.h new file mode 100644 index 000000000..013c7aaf6 --- /dev/null +++ b/include/linux/efs_vh.h @@ -0,0 +1,43 @@ +/* + * efs_vh.h + * + * Copyright (c) 1999 Al Smith + * + * Portions derived from IRIX header files (c) 1985 MIPS Computer Systems, Inc. + */ + +#ifndef __EFS_VH_H__ +#define __EFS_VH_H__ + +#define VHMAGIC 0xbe5a941 /* volume header magic number */ +#define NPARTAB 16 /* 16 unix partitions */ +#define NVDIR 15 /* max of 15 directory entries */ +#define BFNAMESIZE 16 /* max 16 chars in boot file name */ +#define VDNAMESIZE 8 + +struct volume_directory { + char vd_name[VDNAMESIZE]; /* name */ + int vd_lbn; /* logical block number */ + int vd_nbytes; /* file length in bytes */ +}; + +struct partition_table { /* one per logical partition */ + int pt_nblks; /* # of logical blks in partition */ + int pt_firstlbn; /* first lbn of partition */ + int pt_type; /* use of partition */ +}; + +struct volume_header { + int vh_magic; /* identifies volume header */ + short vh_rootpt; /* root partition number */ + short vh_swappt; /* swap partition number */ + char vh_bootfile[BFNAMESIZE]; /* name of file to boot */ + char pad[48]; /* space for device params */ + struct volume_directory vh_vd[NVDIR]; /* other vol hdr contents */ + struct partition_table vh_pt[NPARTAB]; /* device partition layout */ + int vh_csum; /* volume header checksum */ + int vh_fill; /* fill out to 512 bytes */ +}; + +#endif /* __EFS_VH_H__ */ + |