/* Tables sizes */
-#define V1_NR_DZONES 7 /* # direct zone numbers in a V1 inode */
-#define V1_NR_TZONES 9 /* total # zone numbers in a V1 inode */
-#define V2_NR_DZONES 7 /* # direct zone numbers in a V2 inode */
-#define V2_NR_TZONES 10 /* total # zone numbers in a V2 inode */
-
#define NR_FILPS 512 /* # slots in filp table */
-#define NR_INODES 256 /* # slots in "in core" inode table */
-#define NR_SUPERS 12 /* # slots in super block table */
#define NR_LOCKS 8 /* # slots in the file locking table */
-
-
-#define NR_MNTS 8
-#define NR_VNODES 512
-
-
-/* The type of sizeof may be (unsigned) long. Use the following macro for
- * taking the sizes of small objects so that there are no surprises like
- * (small) long constants being passed to routines expecting an int.
- */
-#define usizeof(t) ((unsigned) sizeof(t))
-
-/* File system types. */
-#define SUPER_MAGIC 0x137F /* magic number contained in super-block */
-#define SUPER_REV 0x7F13 /* magic # when 68000 disk read on PC or vv */
-#define SUPER_V2 0x2468 /* magic # for V2 file systems */
-#define SUPER_V2_REV 0x6824 /* V2 magic written on PC, read on 68K or vv */
-#define SUPER_V3 0x4d5a /* magic # for V3 file systems */
-
-#define V1 1 /* version number of V1 file systems */
-#define V2 2 /* version number of V2 file systems */
-#define V3 3 /* version number of V3 file systems */
+#define NR_MNTS 8 /* # slots in mount table */
+#define NR_VNODES 512 /* # slots in vnode table */
/* Miscellaneous constants */
#define SU_UID ((uid_t) 0) /* super_user's uid_t */
#define SERVERS_UID ((uid_t) 11) /* who may do FSSIGNON */
#define SYS_UID ((uid_t) 0) /* uid_t for processes MM and INIT */
#define SYS_GID ((gid_t) 0) /* gid_t for processes MM and INIT */
-#define NORMAL 0 /* forces get_block to do disk read */
-#define NO_READ 1 /* prevents get_block from doing disk read */
-#define PREFETCH 2 /* tells get_block not to read or mark dev */
#define XPIPE (-NR_TASKS-1) /* used in fp_task when susp'd on pipe */
#define XLOCK (-NR_TASKS-2) /* used in fp_task when susp'd on lock */
#define XSELECT (-NR_TASKS-4) /* used in fp_task when susp'd on select */
#define XDOPEN (-NR_TASKS-5) /* used in fp_task when susp'd on device open */
-#define NO_BIT ((bit_t) 0) /* returned by alloc_bit() to signal failure */
-
#define DUP_MASK 0100 /* mask to distinguish dup2 from dup */
#define LOOK_UP 0 /* tells search_dir to lookup string */
#define DELETE 2 /* tells search_dir to delete entry */
#define IS_EMPTY 3 /* tells search_dir to ret. OK or ENOTEMPTY */
-/* write_map() args */
-#define WMAP_FREE (1 << 0)
-
-#define PATH_TRANSPARENT 000 /* parse_path stops at final object */
-#define PATH_PENULTIMATE 001 /* parse_path stops at last but one name */
-#define PATH_OPAQUE 002 /* parse_path stops at final name */
-#define PATH_NONSYMBOLIC 004 /* parse_path scans final name if symbolic */
-#define PATH_STRIPDOT 010 /* parse_path strips /. from path */
-#define EAT_PATH PATH_TRANSPARENT
-#define EAT_PATH_OPAQUE PATH_OPAQUE
-#define LAST_DIR PATH_PENULTIMATE
-#define LAST_DIR_NOTDOT PATH_PENULTIMATE | PATH_STRIPDOT
-#define LAST_DIR_EATSYM PATH_NONSYMBOLIC
#define SYMLOOP 16
-#define CLEAN 0 /* disk and memory copies identical */
-#define DIRTY 1 /* disk and memory copies differ */
-#define ATIME 002 /* set if atime field needs updating */
-#define CTIME 004 /* set if ctime field needs updating */
-#define MTIME 010 /* set if mtime field needs updating */
-
-#define BYTE_SWAP 0 /* tells conv2/conv4 to swap bytes */
-
-#define END_OF_FILE (-104) /* eof detected */
-
#define ROOT_INODE 1 /* inode number for root directory */
-#define BOOT_BLOCK ((block_t) 0) /* block number of boot block */
-#define SUPER_BLOCK_BYTES (1024) /* bytes offset */
-#define START_BLOCK 2 /* first block of FS (not counting SB) */
-
-#define DIR_ENTRY_SIZE usizeof (struct direct) /* # bytes/dir entry */
-#define NR_DIR_ENTRIES(b) ((b)/DIR_ENTRY_SIZE) /* # dir entries/blk */
-#define SUPER_SIZE usizeof (struct super_block) /* super_block size */
-
-#define FS_BITMAP_CHUNKS(b) ((b)/usizeof (bitchunk_t))/* # map chunks/blk */
-#define FS_BITCHUNK_BITS (usizeof(bitchunk_t) * CHAR_BIT)
-#define FS_BITS_PER_BLOCK(b) (FS_BITMAP_CHUNKS(b) * FS_BITCHUNK_BITS)
-
-/* Derived sizes pertaining to the V1 file system. */
-#define V1_ZONE_NUM_SIZE usizeof (zone1_t) /* # bytes in V1 zone */
-#define V1_INODE_SIZE usizeof (d1_inode) /* bytes in V1 dsk ino */
-
-/* # zones/indir block */
-#define V1_INDIRECTS (_STATIC_BLOCK_SIZE/V1_ZONE_NUM_SIZE)
-
-/* # V1 dsk inodes/blk */
-#define V1_INODES_PER_BLOCK (_STATIC_BLOCK_SIZE/V1_INODE_SIZE)
-
-/* Derived sizes pertaining to the V2 file system. */
-#define V2_ZONE_NUM_SIZE usizeof (zone_t) /* # bytes in V2 zone */
-#define V2_INODE_SIZE usizeof (d2_inode) /* bytes in V2 dsk ino */
-#define V2_INDIRECTS(b) ((b)/V2_ZONE_NUM_SIZE) /* # zones/indir block */
-#define V2_INODES_PER_BLOCK(b) ((b)/V2_INODE_SIZE)/* # V2 dsk inodes/blk */
/* Args to dev_io */
#define VFS_DEV_READ 2001
+++ /dev/null
-/* Inode table. This table holds inodes that are currently in use. In some
- * cases they have been opened by an open() or creat() system call, in other
- * cases the file system itself needs the inode for one reason or another,
- * such as to search a directory for a path name.
- * The first part of the struct holds fields that are present on the
- * disk; the second part holds fields not present on the disk.
- * The disk inode part is also declared in "type.h" as 'd1_inode' for V1
- * file systems and 'd2_inode' for V2 file systems.
- */
-
-EXTERN struct inode {
- mode_t i_mode; /* file type, protection, etc. */
- nlink_t i_nlinks; /* how many links to this file */
- uid_t i_uid; /* user id of the file's owner */
- gid_t i_gid; /* group number */
- off_t i_size; /* current file size in bytes */
- time_t i_atime; /* time of last access (V2 only) */
- time_t i_mtime; /* when was file data last changed */
- time_t i_ctime; /* when was inode itself changed (V2 only)*/
- zone_t i_zone[V2_NR_TZONES]; /* zone numbers for direct, ind, and dbl ind */
-
- /* The following items are not present on the disk. */
- dev_t i_dev; /* which device is the inode on */
- ino_t i_num; /* inode number on its (minor) device */
- int i_count; /* # times inode used; 0 means slot is free */
- int i_ndzones; /* # direct zones (Vx_NR_DZONES) */
- int i_nindirs; /* # indirect zones per indirect block */
- struct super_block *i_sp; /* pointer to super block for inode's device */
- char i_dirt; /* CLEAN or DIRTY */
- char i_pipe; /* set to I_PIPE if pipe */
- char i_mount; /* this bit is set if file mounted on */
- char i_seek; /* set on LSEEK, cleared on READ/WRITE */
- char i_update; /* the ATIME, CTIME, and MTIME bits are here */
-} inode[NR_INODES];
-
-#define NIL_INODE (struct inode *) 0 /* indicates absence of inode slot */
-
-/* Field values. Note that CLEAN and DIRTY are defined in "const.h" */
-#define NO_PIPE 0 /* i_pipe is NO_PIPE if inode is not a pipe */
-#define I_PIPE 1 /* i_pipe is I_PIPE if inode is a pipe */
-#define NO_MOUNT 0 /* i_mount is NO_MOUNT if file not mounted on*/
-#define I_MOUNT 1 /* i_mount is I_MOUNT if file mounted on */
-#define NO_SEEK 0 /* i_seek = NO_SEEK if last op was not SEEK */
-#define ISEEK 1 /* i_seek = ISEEK if last op was SEEK */
/* Unmount all filesystems. File systems are mounted on other file systems,
* so you have to pull off the loose bits repeatedly to get it all undone.
*/
- for (i= 0; i < NR_SUPERS; i++) {
+ for (i= 0; i < NR_MNTS; i++) {
struct vmnt *vmp;
/* Unmount at least one. */
worked = remain = 0;
+++ /dev/null
-/* Super block table. The root file system and every mounted file system
- * has an entry here. The entry holds information about the sizes of the bit
- * maps and inodes. The s_ninodes field gives the number of inodes available
- * for files and directories, including the root directory. Inode 0 is
- * on the disk, but not used. Thus s_ninodes = 4 means that 5 bits will be
- * used in the bit map, bit 0, which is always 1 and not used, and bits 1-4
- * for files and directories. The disk layout is:
- *
- * Item # blocks
- * boot block 1
- * super block 1 (offset 1kB)
- * inode map s_imap_blocks
- * zone map s_zmap_blocks
- * inodes (s_ninodes + 'inodes per block' - 1)/'inodes per block'
- * unused whatever is needed to fill out the current zone
- * data zones (s_zones - s_firstdatazone) << s_log_zone_size
- *
- * A super_block slot is free if s_dev == NO_DEV.
- */
-
-#if 0
-EXTERN struct super_block {
- ino_t s_ninodes; /* # usable inodes on the minor device */
- zone1_t s_nzones; /* total device size, including bit maps etc */
- short s_imap_blocks; /* # of blocks used by inode bit map */
- short s_zmap_blocks; /* # of blocks used by zone bit map */
- zone1_t s_firstdatazone; /* number of first data zone */
- short s_log_zone_size; /* log2 of blocks/zone */
- short s_pad; /* try to avoid compiler-dependent padding */
- off_t s_max_size; /* maximum file size on this device */
- zone_t s_zones; /* number of zones (replaces s_nzones in V2) */
- short s_magic; /* magic number to recognize super-blocks */
-
- /* The following items are valid on disk only for V3 and above */
-
- /* The block size in bytes. Minimum MIN_BLOCK SIZE. SECTOR_SIZE
- * multiple. If V1 or V2 filesystem, this should be
- * initialised to STATIC_BLOCK_SIZE. Maximum MAX_BLOCK_SIZE.
- */
- short s_pad2; /* try to avoid compiler-dependent padding */
- unsigned short s_block_size; /* block size in bytes. */
- char s_disk_version; /* filesystem format sub-version */
-
- /* The following items are only used when the super_block is in memory. */
- struct inode *s_isup; /* inode for root dir of mounted file sys */
- struct inode *s_imount; /* inode mounted on */
- unsigned s_inodes_per_block; /* precalculated from magic number */
- dev_t s_dev; /* whose super block is this? */
- int s_rd_only; /* set to 1 iff file sys mounted read only */
- int s_native; /* set to 1 iff not byte swapped file system */
- int s_version; /* file system version, zero means bad magic */
- int s_ndzones; /* # direct zones in an inode */
- int s_nindirs; /* # indirect zones per indirect block */
- bit_t s_isearch; /* inodes below this bit number are in use */
- bit_t s_zsearch; /* all zones below this bit number are in use*/
-} super_block[NR_SUPERS];
-#endif
-
-#define NIL_SUPER (struct super_block *) 0
-#define IMAP 0 /* operating on the inode bit map */
-#define ZMAP 1 /* operating on the zone bit map */
-/* Declaration of the V1 inode as it is on the disk (not in core). */
-typedef struct { /* V1.x disk inode */
- mode_t d1_mode; /* file type, protection, etc. */
- uid_t d1_uid; /* user id of the file's owner */
- off_t d1_size; /* current file size in bytes */
- time_t d1_mtime; /* when was file data last changed */
- u8_t d1_gid; /* group number */
- u8_t d1_nlinks; /* how many links to this file */
- u16_t d1_zone[V1_NR_TZONES]; /* block nums for direct, ind, and dbl ind */
-} d1_inode;
-
-/* Declaration of the V2 inode as it is on the disk (not in core). */
-typedef struct { /* V2.x disk inode */
- mode_t d2_mode; /* file type, protection, etc. */
- u16_t d2_nlinks; /* how many links to this file. HACK! */
- uid_t d2_uid; /* user id of the file's owner. */
- u16_t d2_gid; /* group number HACK! */
- off_t d2_size; /* current file size in bytes */
- time_t d2_atime; /* when was file data last accessed */
- time_t d2_mtime; /* when was file data last changed */
- time_t d2_ctime; /* when was inode data last changed */
- zone_t d2_zone[V2_NR_TZONES]; /* block nums for direct, ind, and dbl ind */
-} d2_inode;
-
#if 1
extern struct dmap {
int _PROTOTYPE ((*dmap_opcl), (int, Dev_t, int, int) );
#define NIL_VNODE (struct vnode *) 0 /* indicates absence of vnode slot */
-/* Field values. Note that CLEAN and DIRTY are defined in "const.h" */
+/* Field values. */
#define NO_PIPE 0 /* i_pipe is NO_PIPE if inode is not a pipe */
#define I_PIPE 1 /* i_pipe is I_PIPE if inode is a pipe */
-#define NO_MOUNT 0 /* i_mount is NO_MOUNT if file not mounted on*/
-#define I_MOUNT 1 /* i_mount is I_MOUNT if file mounted on */
-#define NO_SEEK 0 /* i_seek = NO_SEEK if last op was not SEEK */
-#define ISEEK 1 /* i_seek = ISEEK if last op was SEEK */