remove extra mkfs.1
[minix.git] / include / minix / const.h
blob0afebcf6cfe603d4908b258e068ee51cecd7c1f1
1 #ifndef _MINIX_CONST_H
2 #define _MINIX_CONST_H
4 #include <machine/archconst.h>
6 /* The UNUSED annotation tells the compiler or lint not to complain
7 * about an unused variable or function parameter.
9 * A number of different annotations are used, depending on the
10 * compiler or checker that is looking at the code.
12 * Note that some variants rename the parameter, so if you use
13 * the parameter after all, you'll get a complaint about a missing
14 * variable.
16 * You use it like this:
18 * void foo(int UNUSED(x)){}
21 #ifndef UNUSED
22 #if defined _lint
23 # define UNUSED(v) /*lint -e(715,818)*/ v
24 #elif defined(__GNUC__)
25 # define UNUSED(v) UNUSED_ ## v __attribute((unused))
26 #elif defined __LCLINT__
27 # define UNUSED(v) /*@unused@*/ v
28 #else
29 # define UNUSED(v) _UNUSED_ ## v
30 #endif
31 #endif
33 #define EXTERN extern /* used in *.h files */
35 #define TRUE 1 /* used for turning integers into Booleans */
36 #define FALSE 0 /* used for turning integers into Booleans */
38 #define SUPER_USER ((uid_t) 0) /* uid_t of superuser */
40 #include <sys/null.h> /* NULL Pointer */
42 #define SCPVEC_NR 64 /* max # of entries in a SYS_VSAFECOPY request */
43 #define MAPVEC_NR 64 /* max # of entries in a SYS_VUMAP request */
44 #define NR_IOREQS 64 /* maximum number of entries in an iorequest */
46 #define VUA_READ 0x01 /* for SYS_VUMAP: read access */
47 #define VUA_WRITE 0x02 /* for SYS_VUMAP: write access */
49 /* Message passing constants. */
50 #define MESS_SIZE (sizeof(message)) /* might need usizeof from FS here */
52 /* Memory related constants. */
53 #define SEGMENT_TYPE 0xFF00 /* bit mask to get segment type */
54 #define SEGMENT_INDEX 0x00FF /* bit mask to get segment index */
56 #define D_OBSOLETE 1 /* proc[i].mem_map[D] is for data */
58 #define PHYS_SEG 0x0400 /* flag indicating entire physical memory */
60 #define LOCAL_VM_SEG 0x1000 /* same as LOCAL_SEG, but with vm lookup */
61 #define MEM_GRANT 3
62 #define VIR_ADDR 1
63 #define VM_D (LOCAL_VM_SEG | VIR_ADDR)
64 #define VM_GRANT (LOCAL_VM_SEG | MEM_GRANT)
66 /* Labels used to disable code sections for different reasons. */
67 #define DEAD_CODE 0 /* unused code in normal configuration */
68 #define FUTURE_CODE 0 /* new code to be activated + tested later */
69 #define TEMP_CODE 1 /* active code to be removed later */
71 /* Miscellaneous */
72 #define BYTE 0377 /* mask for 8 bits */
73 #define READING 0 /* copy data to user */
74 #define WRITING 1 /* copy data from user */
75 #define HAVE_SCATTERED_IO 1 /* scattered I/O is now standard */
77 /* Memory is allocated in clicks. */
78 #if defined(__i386__) || defined(__arm__)
79 #define CLICK_SIZE 4096 /* unit in which memory is allocated */
80 #define CLICK_SHIFT 12 /* log2 of CLICK_SIZE */
81 #else
82 #error Unsupported arch
83 #endif
85 /* Click alignment macros. */
86 #define CLICK_FLOOR(n) (((vir_bytes)(n) / CLICK_SIZE) * CLICK_SIZE)
87 #define CLICK_CEIL(n) CLICK_FLOOR((vir_bytes)(n) + CLICK_SIZE-1)
89 /* Sizes of memory tables. The boot monitor distinguishes three memory areas,
90 * namely low mem below 1M, 1M-16M, and mem after 16M. More chunks are needed
91 * for DOS MINIX.
93 #define NR_MEMS 16
96 /* Click to byte conversions (and vice versa). */
97 #define HCLICK_SHIFT 4 /* log2 of HCLICK_SIZE */
98 #define HCLICK_SIZE 16 /* hardware segment conversion magic */
99 #if CLICK_SIZE >= HCLICK_SIZE
100 #define click_to_hclick(n) ((n) << (CLICK_SHIFT - HCLICK_SHIFT))
101 #else
102 #define click_to_hclick(n) ((n) >> (HCLICK_SHIFT - CLICK_SHIFT))
103 #endif
104 #define hclick_to_physb(n) ((phys_bytes) (n) << HCLICK_SHIFT)
105 #define physb_to_hclick(n) ((n) >> HCLICK_SHIFT)
107 #define CLICK2ABS(v) ((v) << CLICK_SHIFT)
108 #define ABS2CLICK(a) ((a) >> CLICK_SHIFT)
110 #define ABS -999 /* this process means absolute memory */
112 /* Flag bits for i_mode in the inode. */
113 #define I_TYPE 0170000 /* this field gives inode type */
114 #define I_UNIX_SOCKET 0140000 /* unix domain socket */
115 #define I_SYMBOLIC_LINK 0120000 /* file is a symbolic link */
116 #define I_REGULAR 0100000 /* regular file, not dir or special */
117 #define I_BLOCK_SPECIAL 0060000 /* block special file */
118 #define I_DIRECTORY 0040000 /* file is a directory */
119 #define I_CHAR_SPECIAL 0020000 /* character special file */
120 #define I_NAMED_PIPE 0010000 /* named pipe (FIFO) */
121 #define I_SET_UID_BIT 0004000 /* set effective uid_t on exec */
122 #define I_SET_GID_BIT 0002000 /* set effective gid_t on exec */
123 #define I_SET_STCKY_BIT 0001000 /* sticky bit */
124 #define ALL_MODES 0007777 /* all bits for user, group and others */
125 #define RWX_MODES 0000777 /* mode bits for RWX only */
126 #define R_BIT 0000004 /* Rwx protection bit */
127 #define W_BIT 0000002 /* rWx protection bit */
128 #define X_BIT 0000001 /* rwX protection bit */
129 #define I_NOT_ALLOC 0000000 /* this inode is free */
131 /* Some limits. */
132 #define MAX_INODE_NR ((ino_t) 037777777777) /* largest inode number */
133 #define MAX_FILE_POS ((off_t) 0x7FFFFFFF) /* largest legal file offset */
134 #define UMAX_FILE_POS ((unsigned) 0x7FFFFFFF) /* largest legal file offset */
136 #define MAX_SYM_LOOPS 8 /* how many symbolic links are recursed */
138 #define NO_BLOCK ((block_t) 0) /* absence of a block number */
139 #define NO_ENTRY ((ino_t) 0) /* absence of a dir entry */
140 #define NO_ZONE ((zone_t) 0) /* absence of a zone number */
141 #define NO_DEV ((dev_t) 0) /* absence of a device numb */
142 #define NO_LINK ((nlink_t) 0) /* absence of incoming links */
143 #define INVAL_UID ((uid_t) -1) /* invalid uid value */
144 #define INVAL_GID ((gid_t) -1) /* invalid gid value */
146 #define SERVARNAME "cttyline"
147 #define SERBAUDVARNAME "cttybaud"
149 /* Bits for s_flags in the privilege structure. */
150 #define PREEMPTIBLE 0x002 /* kernel tasks are not preemptible */
151 #define BILLABLE 0x004 /* some processes are not billable */
152 #define DYN_PRIV_ID 0x008 /* privilege id assigned dynamically */
154 #define SYS_PROC 0x010 /* system processes have own priv structure */
155 #define CHECK_IO_PORT 0x020 /* check if I/O request is allowed */
156 #define CHECK_IRQ 0x040 /* check if IRQ can be used */
157 #define CHECK_MEM 0x080 /* check if (VM) mem map request is allowed */
158 #define ROOT_SYS_PROC 0x100 /* this is a root system process instance */
159 #define VM_SYS_PROC 0x200 /* this is a vm system process instance */
160 #define LU_SYS_PROC 0x400 /* this is a live updated sys proc instance */
161 #define RST_SYS_PROC 0x800 /* this is a restarted sys proc instance */
163 /* Bits for device driver flags managed by RS and VFS. */
164 #define DRV_FORCED 0x01 /* driver is mapped even if not alive yet */
166 /* Values for the "verbose" boot monitor variable */
167 #define VERBOSEBOOT_QUIET 0
168 #define VERBOSEBOOT_BASIC 1
169 #define VERBOSEBOOT_EXTRA 2
170 #define VERBOSEBOOT_MAX 3
171 #define VERBOSEBOOTVARNAME "verbose"
173 /* magic value to put in struct proc entries for sanity checks. */
174 #define PMAGIC 0xC0FFEE1
176 /* MINIX_KERNFLAGS flags */
177 #define MKF_I386_INTEL_SYSENTER (1L << 0) /* SYSENTER available and supported */
178 #define MKF_I386_AMD_SYSCALL (1L << 1) /* SYSCALL available and supported */
180 #endif /* _MINIX_CONST_H */