Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2434 → Rev 2435

/branches/fs/uspace/fs/const.h
32,67 → 32,66
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/** @addtogroup FileSystemImpl
* @{
*/
 
 
/* Constants of all file system. Some of them are not used here in
* current version, but will be used in later versions probably.
/**
* @file const.h
* @brief Constants of all file system. Some of them are not used here in
* current version, but will be used in later versions probably.
*/
 
#ifndef _CONST_H
#define _CONST_H
 
/* Defined in ../share/base_const.h */
/*
#define FALSE 0
#define TRUE 1
#define OK 0
*/
#define BLOCK_SIZE 1024 /**< # bytes in a disk block */
#define MAJOR 8 /**< major device = (dev>>MAJOR) & 0377 */
#define MINOR 0 /**< minor device = (dev>>MINOR) & 0377 */
#define BYTE 0377 /**< mask for 8 bits */
#define NO_NUM 0x8000 /**< used as numerical argument to panic() */
 
#define BLOCK_SIZE 1024 /* # bytes in a disk block */
#define MAJOR 8 /* major device = (dev>>MAJOR) & 0377 */
#define MINOR 0 /* minor device = (dev>>MINOR) & 0377 */
#define BYTE 0377 /* mask for 8 bits */
#define NO_NUM 0x8000 /* used as numerical argument to panic() */
 
/* Not used here. */
#define NR_SEGS 3 /* # segments per process */
#define T 0 /* proc[i].mem_map[T] is for text */
#define D 1 /* proc[i].mem_map[D] is for data */
#define S 2 /* proc[i].mem_map[S] is for stack */
#define NR_SEGS 3 /**< # segments per process */
#define T 0 /**< proc[i].mem_map[T] is for text */
#define D 1 /**< proc[i].mem_map[D] is for data */
#define S 2 /**< proc[i].mem_map[S] is for stack */
 
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
 
#define I_NOT_ALLOC 0000000 /* this inode is free */
#define I_NOT_ALLOC 0000000 /**< this inode is free */
 
#define I_TYPE 0170000 /* this field gives inode type */
#define I_REGULAR 0100000 /* regular file, not dir or special */
#define I_DIRECTORY 0040000 /* file is a directory */
#define I_BLOCK_SPECIAL 0060000 /* block special file */
#define I_CHAR_SPECIAL 0020000 /* character special file */
#define I_TYPE 0170000 /**< this field gives inode type */
#define I_REGULAR 0100000 /**< regular file, not dir or special */
#define I_DIRECTORY 0040000 /**< file is a directory */
#define I_BLOCK_SPECIAL 0060000 /**< block special file */
#define I_CHAR_SPECIAL 0020000 /**< character special file */
 
#define MAX_FILE_POS ((off_t) 037777777777) /* largest legal file offset */
#define MAX_FILE_POS ((off_t) 037777777777) /**< largest legal file offset */
 
#define R_BIT 0000004 /* Rwx protection bit */
#define W_BIT 0000002 /* rWx protection bit */
#define X_BIT 0000001 /* rwX protection bit */
#define R_BIT 0000004 /**< Rwx protection bit */
#define W_BIT 0000002 /**< rWx protection bit */
#define X_BIT 0000001 /**< rwX protection bit */
 
#define NO_BLOCK ((block_num_t) 0) /* absence of a block number */
#define NO_ZONE ((zone_t) 0) /* absence of a zone number */
#define NO_DEV ((dev_t) 0) /* absence of a device numb */
#define NO_BLOCK ((block_num_t) 0) /**< absence of a block number */
#define NO_ZONE ((zone_t) 0) /**< absence of a zone number */
#define NO_DEV ((dev_t) 0) /**< absence of a device numb */
 
 
/* 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 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 128 /* # slots in filp table */
#define NR_INODES 64 /* # slots in "in core" inode table */
#define NR_FILPS 128 /**< # slots in filp table */
#define NR_INODES 64 /**< # slots in "in core" inode table */
 
/* The type of sizeof may be (unsigned) long. Use the following macro for
/**
* 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.
*/
100,69 → 99,69
 
 
/* File system macros corresponding with given versions. */
#define SUPER_MAGIC 0x137F /* magic number for V1 file systems */
#define SUPER_MAGIC2 0x138F /* magic number for V1 file systems - 30 char names */
#define SUPER_V2 0x2468 /* magic number for V2 file systems */
#define SUPER_V2E 0x2478 /* magic number for V2 file systems - 30 char names */
#define SUPER_MAGIC 0x137F /**< magic number for V1 file systems */
#define SUPER_MAGIC2 0x138F /**< magic number for V1 file systems - 30 char names */
#define SUPER_V2 0x2468 /**< magic number for V2 file systems */
#define SUPER_V2E 0x2478 /**< magic number for V2 file systems - 30 char names */
 
#define TOTAL_VERSIONS 2 /* number of versions of file system */
#define TOTAL_VERSIONS 2 /**< number of versions of file system */
 
#define V1 1 /* version number of V2 file systems */
#define V2 2 /* version number of V2 file systems */
#define V1 1 /**< version number of V2 file systems */
#define V2 2 /**< version number of V2 file systems */
 
#define LOOK_UP 0 /* tells search_dir to lookup string */
#define IS_EMPTY 3 /* tells search_dir to ret. OK or ENOTEMPTY */
#define LOOK_UP 0 /**< tells search_dir to lookup string */
#define IS_EMPTY 3 /**< tells search_dir to ret. OK or ENOTEMPTY */
 
#define BYTE_SWAP 0 /* tells conv2/conv4 to swap bytes */
#define DONT_SWAP 1 /* tells conv2/conv4 not to swap bytes */
#define BYTE_SWAP 0 /**< tells conv2/conv4 to swap bytes */
#define DONT_SWAP 1 /**< tells conv2/conv4 not to swap bytes */
 
#define END_OF_FILE (-104) /* eof detected */
#define END_OF_FILE (-104) /**< eof detected */
#define ROOT_INODE 1 /* inode number for root directory */
#define BOOT_BLOCK ((block_num_t) 0) /* block number of boot block */
#define SUPER_BLOCK ((block_num_t) 1) /* block number of super block */
#define ROOT_INODE 1 /**< inode number for root directory */
#define BOOT_BLOCK ((block_num_t) 0) /**< block number of boot block */
#define SUPER_BLOCK ((block_num_t) 1) /**< block number of super block */
/* For normal version. */
#define DIR_ENTRY_SIZE usizeof (direct_t) /* # bytes/dir entry */
#define NR_DIR_ENTRIES (BLOCK_SIZE/DIR_ENTRY_SIZE) /* # dir entries/blk */
#define DIR_ENTRY_SIZE usizeof (direct_t) /**< # bytes/dir entry */
#define NR_DIR_ENTRIES (BLOCK_SIZE/DIR_ENTRY_SIZE) /**< # dir entries/blk */
 
/* For extended version. */
#define DIR_ENTRY_SIZE_EX usizeof (directex_t) /* # bytes/dir entry */
#define NR_DIR_ENTRIES_EX (BLOCK_SIZE/DIR_ENTRY_SIZE_EX) /* # dir entries/blk */
#define DIR_ENTRY_SIZE_EX usizeof (directex_t) /**< # bytes/dir entry */
#define NR_DIR_ENTRIES_EX (BLOCK_SIZE/DIR_ENTRY_SIZE_EX) /**< # dir entries/blk */
 
#define SUPER_SIZE usizeof (super_block_t) /* super_block size */
#define SUPER_SIZE usizeof (super_block_t) /**< super_block size */
 
 
/* 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_t) /* bytes in V1 dsk ino */
#define V1_INDIRECTS (BLOCK_SIZE/V1_ZONE_NUM_SIZE) /* # zones/indir block */
#define V1_INODES_PER_BLOCK (BLOCK_SIZE/V1_INODE_SIZE)/* # V1 dsk inodes/blk */
#define V1_ZONE_NUM_SIZE usizeof (zone1_t) /**< # bytes in V1 zone */
#define V1_INODE_SIZE usizeof (d1_inode_t) /**< bytes in V1 dsk ino */
#define V1_INDIRECTS (BLOCK_SIZE/V1_ZONE_NUM_SIZE) /**< # zones/indir block */
#define V1_INODES_PER_BLOCK (BLOCK_SIZE/V1_INODE_SIZE)/**< # V1 dsk inodes/blk */
/* 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_t) /* bytes in V2 dsk ino */
#define V2_INDIRECTS (BLOCK_SIZE/V2_ZONE_NUM_SIZE) /* # zones/indir block */
#define V2_INODES_PER_BLOCK (BLOCK_SIZE/V2_INODE_SIZE)/* # V2 dsk inodes/blk */
#define V2_ZONE_NUM_SIZE usizeof (zone_t) /**< # bytes in V2 zone */
#define V2_INODE_SIZE usizeof (d2_inode_t) /**< bytes in V2 dsk ino */
#define V2_INDIRECTS (BLOCK_SIZE/V2_ZONE_NUM_SIZE) /**< # zones/indir block */
#define V2_INODES_PER_BLOCK (BLOCK_SIZE/V2_INODE_SIZE)/**< # V2 dsk inodes/blk */
 
 
/* Filesystem supported operations. */
#define FS_NEW_CONSUMER (FIRST_USER_METHOD + 50) /* this is not file system system call */
#define FS_DROP_CONSUMER (FS_NEW_CONSUMER + 1) /* drops connected consument */
#define FS_NEW_CONSUMER (FIRST_USER_METHOD + 50) /**< this is not file system system call */
#define FS_DROP_CONSUMER (FS_NEW_CONSUMER + 1) /**< drops connected consument */
 
#define FS_BASE FIRST_USER_METHOD
#define FS_NOSYS (0 + FS_BASE)
#define FS_OPEN (1 + FS_BASE)
#define FS_SEEK (2 + FS_BASE)
#define FS_READ (3 + FS_BASE)
#define FS_CLOSE (4 + FS_BASE)
#define FS_CHDIR (5 + FS_BASE)
#define FS_STAT (6 + FS_BASE)
#define FS_FSTAT (7 + FS_BASE)
#define FS_DSUM (8 + FS_BASE)
#define FS_READENTRY (9 + FS_BASE)
#define FS_BASE FIRST_USER_METHOD /**> Index of the first FS method */
#define FS_NOSYS (0 + FS_BASE) /**> */
#define FS_OPEN (1 + FS_BASE) /**> Open file method */
#define FS_SEEK (2 + FS_BASE) /**> Seek in file method */
#define FS_READ (3 + FS_BASE) /**> File read method */
#define FS_CLOSE (4 + FS_BASE) /**> File close method */
#define FS_CHDIR (5 + FS_BASE) /**> Change current directory method */
#define FS_STAT (6 + FS_BASE) /**> Stat method */
#define FS_FSTAT (7 + FS_BASE) /**> File stat method */
#define FS_DSUM (8 + FS_BASE) /**> Directory entry count method */
#define FS_READENTRY (9 + FS_BASE) /**> Read directory entry method */
 
#define FS_CALLS 10
#define FS_CALLS 10 /**> The number of File system calls */
 
#define FS_MIN (FS_BASE)
#define FS_MAX (FS_BASE + FS_CALLS)
169,8 → 168,12
 
#define FS_IN_RANGE(VAL) ((FS_MIN <= VAL && VAL < FS_MAX)? TRUE:FALSE)
 
/* Number of attempts the FS will try to connect to each defined services. */
#define CON_CONN_ATTEMPTS 1000
#define RD_CONN_ATTEMPTS 1000
#define CON_CONN_ATTEMPTS 1000 /**< Number of attempts the FS will try to connect to the console services. */
#define RD_CONN_ATTEMPTS 1000 /**< Number of attempts the FS will try to connect to the RAM disk services. */
 
#endif /* _CONST_H */
 
/**
* }
*/