2010-06-01 14:35:33 +02:00
|
|
|
#ifndef __MFS_CONST_H__
|
|
|
|
#define __MFS_CONST_H__
|
|
|
|
|
2005-04-21 16:53:53 +02:00
|
|
|
/* Tables sizes */
|
|
|
|
#define V2_NR_DZONES 7 /* # direct zone numbers in a V2 inode */
|
|
|
|
#define V2_NR_TZONES 10 /* total # zone numbers in a V2 inode */
|
|
|
|
|
2010-08-05 13:37:37 +02:00
|
|
|
#define NR_INODES 512 /* # slots in "in core" inode table,
|
|
|
|
* should be more or less the same as
|
|
|
|
* NR_VNODES in vfs
|
|
|
|
*/
|
2006-10-25 15:40:36 +02:00
|
|
|
|
|
|
|
#define INODE_HASH_LOG2 7 /* 2 based logarithm of the inode hash size */
|
|
|
|
#define INODE_HASH_SIZE ((unsigned long)1<<INODE_HASH_LOG2)
|
|
|
|
#define INODE_HASH_MASK (((unsigned long)1<<INODE_HASH_LOG2)-1)
|
|
|
|
|
2011-08-05 01:15:16 +02:00
|
|
|
/* Max. filename length */
|
|
|
|
#define MFS_NAME_MAX MFS_DIRSIZ
|
|
|
|
|
2005-04-21 16:53:53 +02:00
|
|
|
|
|
|
|
/* 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 V2 2 /* version number of V2 file systems */
|
|
|
|
#define V3 3 /* version number of V3 file systems */
|
|
|
|
|
|
|
|
/* Miscellaneous constants */
|
|
|
|
#define SU_UID ((uid_t) 0) /* super_user's uid_t */
|
|
|
|
|
|
|
|
#define NO_BIT ((bit_t) 0) /* returned by alloc_bit() to signal failure */
|
|
|
|
|
2005-08-29 18:47:18 +02:00
|
|
|
#define LOOK_UP 0 /* tells search_dir to lookup string */
|
|
|
|
#define ENTER 1 /* tells search_dir to make dir entry */
|
|
|
|
#define DELETE 2 /* tells search_dir to delete entry */
|
|
|
|
#define IS_EMPTY 3 /* tells search_dir to ret. OK or ENOTEMPTY */
|
2005-04-21 16:53:53 +02:00
|
|
|
|
2006-01-11 18:14:51 +01:00
|
|
|
/* write_map() args */
|
|
|
|
#define WMAP_FREE (1 << 0)
|
|
|
|
|
- Introduce support for sticky bit.
- Revise VFS-FS protocol and update VFS/MFS/ISOFS accordingly.
- Clean up MFS by removing old, dead code (backwards compatibility is broken by
the new VFS-FS protocol, anyway) and rewrite other parts. Also, make sure all
functions have proper banners and prototypes.
- VFS should always provide a (syntactically) valid path to the FS; no need for
the FS to do sanity checks when leaving/entering mount points.
- Fix several bugs in MFS:
- Several path lookup bugs in MFS.
- A link can be too big for the path buffer.
- A mountpoint can become inaccessible when the creation of a new inode
fails, because the inode already exists and is a mountpoint.
- Introduce support for supplemental groups.
- Add test 46 to test supplemental group functionality (and removed obsolete
suppl. tests from test 2).
- Clean up VFS (not everything is done yet).
- ISOFS now opens device read-only. This makes the -r flag in the mount command
unnecessary (but will still report to be mounted read-write).
- Introduce PipeFS. PipeFS is a new FS that handles all anonymous and
named pipes. However, named pipes still reside on the (M)FS, as they are part
of the file system on disk. To make this work VFS now has a concept of
'mapped' inodes, which causes read, write, truncate and stat requests to be
redirected to the mapped FS, and all other requests to the original FS.
2009-12-20 21:27:14 +01:00
|
|
|
#define IGN_PERM 0
|
|
|
|
#define CHK_PERM 1
|
|
|
|
|
2011-12-22 01:29:27 +01:00
|
|
|
#define IN_CLEAN 0 /* in-block inode and memory copies identical */
|
|
|
|
#define IN_DIRTY 1 /* in-block inode and memory copies differ */
|
2005-04-21 16:53:53 +02:00
|
|
|
#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 */
|
|
|
|
|
2014-05-01 16:19:28 +02:00
|
|
|
#define ROOT_INODE ((ino_t) 1) /* inode number for root directory */
|
2005-04-21 16:53:53 +02:00
|
|
|
#define BOOT_BLOCK ((block_t) 0) /* block number of boot block */
|
2010-06-01 14:35:33 +02:00
|
|
|
#define SUPER_BLOCK_BYTES (1024) /* bytes offset */
|
|
|
|
#define START_BLOCK ((block_t) 2) /* first block of FS (not counting SB) */
|
2005-04-21 16:53:53 +02:00
|
|
|
|
|
|
|
#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 */
|
2005-06-06 15:51:50 +02:00
|
|
|
|
|
|
|
#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)
|
2005-04-21 16:53:53 +02:00
|
|
|
|
|
|
|
/* 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 */
|
2007-01-16 15:50:10 +01:00
|
|
|
|
2010-06-01 14:35:33 +02:00
|
|
|
#define NUL(str,l,m) mfs_nul_f(__FILE__,__LINE__,(str), (l), (m))
|
2007-02-07 17:22:19 +01:00
|
|
|
|
2010-06-01 14:35:33 +02:00
|
|
|
#endif
|
|
|
|
|