From 1b1048c40ff0200c5d37b52a62dd6f4554fdb258 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Tue, 11 Apr 1995 16:37:40 +0000 Subject: Formerly ext2fs.h.~4~ --- ext2fs/ext2fs.h | 109 ++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 75 insertions(+), 34 deletions(-) (limited to 'ext2fs/ext2fs.h') diff --git a/ext2fs/ext2fs.h b/ext2fs/ext2fs.h index 8e2e2595..17b656fc 100644 --- a/ext2fs/ext2fs.h +++ b/ext2fs/ext2fs.h @@ -33,6 +33,24 @@ /* #undef DONT_CACHE_MEMORY_OBJECTS */ +struct disknode +{ + ino_t number; + + /* For a directory, this array holds the number of directory entries in + each DIRBLKSIZE piece of the directory. */ + int *dirents; + + /* Links on hash list. */ + struct node *hnext, **hprevp; + + struct rwlock allocptrlock; + + struct dirty_indir *dirty; + + struct user_pager_info *fileinfo; +}; + /* Identifies a particular block and where it's found when interpreting indirect block structure. */ struct iblock_spec @@ -63,20 +81,66 @@ struct user_pager_info struct pager *p; struct user_pager_info *next, **prevp; }; - -struct user_pager_info *diskpager; -mach_port_t diskpagerport; -off_t diskpagersize; - /* ---------------------------------------------------------------- */ -vm_address_t zeroblock; -void *disk_image; - -struct super_block *sblock; -int sblock_dirty; -int csum_dirty; +#define BLOCK_SIZE 1024 +#define BLOCK_SIZE_BITS 10 + +extern unsigned long inode_init(unsigned long start, unsigned long end); +extern unsigned long file_table_init(unsigned long start, unsigned long end); +extern unsigned long name_cache_init(unsigned long start, unsigned long end); + +#ifndef NULL +#define NULL ((void *) 0) +#endif + +/* + * These are the fs-independent mount-flags: up to 16 flags are supported + */ +#define MS_RDONLY 1 /* mount read-only */ +#define MS_NOSUID 2 /* ignore suid and sgid bits */ +#define MS_NODEV 4 /* disallow access to device special files */ +#define MS_NOEXEC 8 /* disallow program execution */ +#define MS_SYNCHRONOUS 16 /* writes are synced at once */ +#define MS_REMOUNT 32 /* alter flags of a mounted FS */ + +#define S_APPEND 256 /* append-only file */ +#define S_IMMUTABLE 512 /* immutable file */ + +/* + * Note that read-only etc flags are inode-specific: setting some file-system + * flags just means all the inodes inherit those flags by default. It might be + * possible to override it selectively if you really wanted to with some + * ioctl() that is not currently implemented. + * + * Exception: MS_RDONLY is always applied to the entire file system. + */ +#define IS_RDONLY(inode) (((inode)->i_sb) && ((inode)->i_sb->s_flags & MS_RDONLY)) +#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND) +#define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE) + +struct super_block +{ + void *s_dev; /* actually a point to the disk image */ + char *s_devname; + mach_port_t s_device_port; + + struct user_pager_info *s_pager; + mach_port_t s_pager_port; + off_t s_pager_size; + + spin_lock_t file_pagers_lock; + + unsigned long s_blocksize; + struct mutex s_lock; + unsigned char s_dirt; + unsigned long s_flags; + unsigned long s_magic; + union { + struct ext2_sb_info ext2_sb; + } u; +}; /* ---------------------------------------------------------------- */ @@ -86,11 +150,6 @@ spin_lock_t alloclock; spin_lock_t gennumberlock; u_long nextgennumber; - - -/* ---------------------------------------------------------------- */ - -mach_port_t ext2fs_device; /* ---------------------------------------------------------------- */ @@ -115,25 +174,7 @@ enum compat_mode #define isset(a, i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<(i)%NBBY)) -#define fsaddr(fs,n) (fsbtodb(fs,n)*DEV_BSIZE) #define bread(void *dev, long block, long amount) \ ((char *)(vm_addres_t)dev + block * DEV_BSIZE) #define brelse(char *bh) ((void)0) - - -/* Functions for looking inside disk_image */ - -/* Sync part of the disk */ -extern inline void -sync_disk_blocks (daddr_t blkno, size_t nbytes, int wait) -{ - pager_sync_some (diskpager->p, fsaddr (sblock, blkno), nbytes, wait); -} - -/* Sync an disk inode */ -extern inline void -sync_dinode (int inum, int wait) -{ - sync_disk_blocks (ino_to_fsba (sblock, inum), sblock->fs_fsize, wait); -} -- cgit v1.2.3