2010-03-09 10:41:14 +01:00
|
|
|
#ifndef _MINIX_CONST_H
|
|
|
|
#define _MINIX_CONST_H
|
2005-04-21 16:53:53 +02:00
|
|
|
|
|
|
|
#ifndef CHIP
|
|
|
|
#error CHIP is not defined
|
|
|
|
#endif
|
|
|
|
|
2010-03-11 15:23:33 +01:00
|
|
|
/* The UNUSED annotation tells the compiler or lint not to complain
|
|
|
|
* about an unused variable or function parameter.
|
|
|
|
*
|
|
|
|
* A number of different annotations are used, depending on the
|
|
|
|
* compiler or checker that is looking at the code.
|
|
|
|
*
|
|
|
|
* Note that some variants rename the parameter, so if you use
|
|
|
|
* the parameter after all, you'll get a complaint about a missing
|
|
|
|
* variable.
|
|
|
|
*
|
|
|
|
* You use it like this:
|
|
|
|
*
|
|
|
|
* void foo(int UNUSED(x)){}
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef UNUSED
|
2010-04-13 17:22:38 +02:00
|
|
|
#if defined _lint
|
|
|
|
# define UNUSED(v) /*lint -e(715,818)*/ v
|
|
|
|
#elif defined(__GNUC__)
|
2010-03-11 15:23:33 +01:00
|
|
|
# define UNUSED(v) UNUSED_ ## v __attribute((unused))
|
|
|
|
#elif defined __LCLINT__
|
|
|
|
# define UNUSED(v) /*@unused@*/ v
|
|
|
|
#else
|
|
|
|
# define UNUSED(v) _UNUSED_ ## v
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2005-04-21 16:53:53 +02:00
|
|
|
#define EXTERN extern /* used in *.h files */
|
|
|
|
#define PRIVATE static /* PRIVATE x limits the scope of x */
|
|
|
|
#define PUBLIC /* PUBLIC is the opposite of PRIVATE */
|
|
|
|
#define FORWARD static /* some compilers require this to be 'static'*/
|
|
|
|
|
|
|
|
#define TRUE 1 /* used for turning integers into Booleans */
|
|
|
|
#define FALSE 0 /* used for turning integers into Booleans */
|
|
|
|
|
2008-12-11 15:08:53 +01:00
|
|
|
#define DEFAULT_HZ 60 /* clock freq (software settable on IBM-PC) */
|
2005-04-21 16:53:53 +02:00
|
|
|
|
2010-03-11 15:23:33 +01:00
|
|
|
#define SUPER_USER ((uid_t) 0) /* uid_t of superuser */
|
2005-04-21 16:53:53 +02:00
|
|
|
|
|
|
|
#define NULL ((void *)0) /* null pointer */
|
2006-06-23 13:54:03 +02:00
|
|
|
#define SCPVEC_NR 64 /* max # of entries in a SYS_VSAFECOPY* request */
|
2008-11-19 13:26:10 +01:00
|
|
|
#define NR_IOREQS 64
|
2005-04-21 16:53:53 +02:00
|
|
|
/* maximum number of entries in an iorequest */
|
|
|
|
|
2005-07-14 17:14:44 +02:00
|
|
|
/* Message passing constants. */
|
|
|
|
#define MESS_SIZE (sizeof(message)) /* might need usizeof from FS here */
|
|
|
|
|
|
|
|
/* Memory related constants. */
|
2005-04-21 16:53:53 +02:00
|
|
|
#define SEGMENT_TYPE 0xFF00 /* bit mask to get segment type */
|
|
|
|
#define SEGMENT_INDEX 0x00FF /* bit mask to get segment index */
|
|
|
|
|
|
|
|
#define LOCAL_SEG 0x0000 /* flags indicating local memory segment */
|
|
|
|
#define NR_LOCAL_SEGS 3 /* # local segments per process (fixed) */
|
|
|
|
#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 REMOTE_SEG 0x0100 /* flags indicating remote memory segment */
|
|
|
|
#define NR_REMOTE_SEGS 3 /* # remote memory regions (variable) */
|
|
|
|
|
|
|
|
#define BIOS_SEG 0x0200 /* flags indicating BIOS memory segment */
|
|
|
|
#define NR_BIOS_SEGS 3 /* # BIOS memory regions (variable) */
|
|
|
|
|
2005-05-10 13:06:24 +02:00
|
|
|
#define PHYS_SEG 0x0400 /* flag indicating entire physical memory */
|
2005-04-29 17:36:43 +02:00
|
|
|
|
2008-11-19 13:26:10 +01:00
|
|
|
#define LOCAL_VM_SEG 0x1000 /* same as LOCAL_SEG, but with vm lookup */
|
|
|
|
#define VM_D (LOCAL_VM_SEG | D)
|
|
|
|
#define VM_T (LOCAL_VM_SEG | T)
|
|
|
|
#define MEM_GRANT 3
|
|
|
|
#define VM_GRANT (LOCAL_VM_SEG | MEM_GRANT)
|
|
|
|
|
2005-04-21 16:53:53 +02:00
|
|
|
/* Labels used to disable code sections for different reasons. */
|
|
|
|
#define DEAD_CODE 0 /* unused code in normal configuration */
|
|
|
|
#define FUTURE_CODE 0 /* new code to be activated + tested later */
|
|
|
|
#define TEMP_CODE 1 /* active code to be removed later */
|
|
|
|
|
2005-05-31 11:50:51 +02:00
|
|
|
/* Process name length in the PM process table, including '\0'. */
|
2005-04-21 16:53:53 +02:00
|
|
|
#define PROC_NAME_LEN 16
|
|
|
|
|
|
|
|
/* Miscellaneous */
|
|
|
|
#define BYTE 0377 /* mask for 8 bits */
|
|
|
|
#define READING 0 /* copy data to user */
|
|
|
|
#define WRITING 1 /* copy data from user */
|
|
|
|
#define HAVE_SCATTERED_IO 1 /* scattered I/O is now standard */
|
|
|
|
|
|
|
|
/* Macros. */
|
|
|
|
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
|
|
|
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
|
|
|
|
|
|
|
/* Memory is allocated in clicks. */
|
|
|
|
#if (CHIP == INTEL)
|
2005-09-30 14:47:03 +02:00
|
|
|
#define CLICK_SIZE 4096 /* unit in which memory is allocated */
|
|
|
|
#define CLICK_SHIFT 12 /* log2 of CLICK_SIZE */
|
2005-04-21 16:53:53 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if (CHIP == SPARC) || (CHIP == M68000)
|
|
|
|
#define CLICK_SIZE 4096 /* unit in which memory is allocated */
|
|
|
|
#define CLICK_SHIFT 12 /* log2 of CLICK_SIZE */
|
|
|
|
#endif
|
|
|
|
|
2010-01-14 16:24:16 +01:00
|
|
|
/* Click alignment macros. */
|
|
|
|
#define CLICK_FLOOR(n) (((vir_bytes)(n) / CLICK_SIZE) * CLICK_SIZE)
|
|
|
|
#define CLICK_CEIL(n) CLICK_FLOOR((vir_bytes)(n) + CLICK_SIZE-1)
|
|
|
|
|
2008-11-19 13:26:10 +01:00
|
|
|
/* Sizes of memory tables. The boot monitor distinguishes three memory areas,
|
|
|
|
* namely low mem below 1M, 1M-16M, and mem after 16M. More chunks are needed
|
|
|
|
* for DOS MINIX.
|
|
|
|
*/
|
|
|
|
#define NR_MEMS 8
|
|
|
|
|
|
|
|
|
2005-04-21 16:53:53 +02:00
|
|
|
/* Click to byte conversions (and vice versa). */
|
|
|
|
#define HCLICK_SHIFT 4 /* log2 of HCLICK_SIZE */
|
|
|
|
#define HCLICK_SIZE 16 /* hardware segment conversion magic */
|
|
|
|
#if CLICK_SIZE >= HCLICK_SIZE
|
|
|
|
#define click_to_hclick(n) ((n) << (CLICK_SHIFT - HCLICK_SHIFT))
|
|
|
|
#else
|
|
|
|
#define click_to_hclick(n) ((n) >> (HCLICK_SHIFT - CLICK_SHIFT))
|
|
|
|
#endif
|
|
|
|
#define hclick_to_physb(n) ((phys_bytes) (n) << HCLICK_SHIFT)
|
|
|
|
#define physb_to_hclick(n) ((n) >> HCLICK_SHIFT)
|
|
|
|
|
|
|
|
#define ABS -999 /* this process means absolute memory */
|
|
|
|
|
|
|
|
/* Flag bits for i_mode in the inode. */
|
|
|
|
#define I_TYPE 0170000 /* this field gives inode type */
|
2005-10-31 15:14:54 +01:00
|
|
|
#define I_SYMBOLIC_LINK 0120000 /* file is a symbolic link */
|
2005-04-21 16:53:53 +02:00
|
|
|
#define I_REGULAR 0100000 /* regular file, not dir or special */
|
|
|
|
#define I_BLOCK_SPECIAL 0060000 /* block special file */
|
|
|
|
#define I_DIRECTORY 0040000 /* file is a directory */
|
|
|
|
#define I_CHAR_SPECIAL 0020000 /* character special file */
|
- 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 I_NAMED_PIPE 0010000 /* named pipe (FIFO) */
|
2005-04-21 16:53:53 +02:00
|
|
|
#define I_SET_UID_BIT 0004000 /* set effective uid_t on exec */
|
|
|
|
#define I_SET_GID_BIT 0002000 /* set effective gid_t on exec */
|
- 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 I_SET_STCKY_BIT 0001000 /* sticky bit */
|
|
|
|
#define ALL_MODES 0007777 /* all bits for user, group and others */
|
2005-04-21 16:53:53 +02:00
|
|
|
#define RWX_MODES 0000777 /* mode bits for RWX only */
|
|
|
|
#define R_BIT 0000004 /* Rwx protection bit */
|
|
|
|
#define W_BIT 0000002 /* rWx protection bit */
|
|
|
|
#define X_BIT 0000001 /* rwX protection bit */
|
|
|
|
#define I_NOT_ALLOC 0000000 /* this inode is free */
|
|
|
|
|
|
|
|
/* Some limits. */
|
|
|
|
#define MAX_INODE_NR ((ino_t) 037777777777) /* largest inode number */
|
2006-11-27 15:21:43 +01:00
|
|
|
#define MAX_FILE_POS ((off_t) 0x7FFFFFFF) /* largest legal file offset */
|
2005-04-21 16:53:53 +02:00
|
|
|
|
2005-10-31 15:14:54 +01:00
|
|
|
#define MAX_SYM_LOOPS 8 /* how many symbolic links are recursed */
|
|
|
|
|
2005-04-21 16:53:53 +02:00
|
|
|
#define NO_BLOCK ((block_t) 0) /* absence of a block number */
|
|
|
|
#define NO_ENTRY ((ino_t) 0) /* absence of a dir entry */
|
|
|
|
#define NO_ZONE ((zone_t) 0) /* absence of a zone number */
|
|
|
|
#define NO_DEV ((dev_t) 0) /* absence of a device numb */
|
2008-12-11 15:08:53 +01:00
|
|
|
|
2008-12-19 14:21:42 +01:00
|
|
|
#define SERVARNAME "cttyline"
|
|
|
|
|
2008-12-11 15:08:53 +01:00
|
|
|
/* Bits for the system property flags in boot image processes. */
|
2009-12-11 01:08:19 +01:00
|
|
|
#define PROC_FULLVM 0x100 /* VM sets and manages full pagetable */
|
|
|
|
|
|
|
|
/* Bits for s_flags in the privilege structure. */
|
2008-12-11 15:08:53 +01:00
|
|
|
#define PREEMPTIBLE 0x02 /* kernel tasks are not preemptible */
|
|
|
|
#define BILLABLE 0x04 /* some processes are not billable */
|
2009-12-11 01:08:19 +01:00
|
|
|
#define DYN_PRIV_ID 0x08 /* privilege id assigned dynamically */
|
2008-12-11 15:08:53 +01:00
|
|
|
|
|
|
|
#define SYS_PROC 0x10 /* system processes have own priv structure */
|
|
|
|
#define CHECK_IO_PORT 0x20 /* check if I/O request is allowed */
|
|
|
|
#define CHECK_IRQ 0x40 /* check if IRQ can be used */
|
|
|
|
#define CHECK_MEM 0x80 /* check if (VM) mem map request is allowed */
|
2010-02-13 23:11:16 +01:00
|
|
|
|
2010-04-09 23:56:44 +02:00
|
|
|
/* Bits for device driver flags managed by RS and VFS. */
|
|
|
|
#define DRV_FORCED 0x01 /* driver is mapped even if not alive yet */
|
|
|
|
|
2010-02-13 23:11:16 +01:00
|
|
|
/* Values for the "verbose" boot monitor variable */
|
|
|
|
#define VERBOSEBOOT_QUIET 0
|
|
|
|
#define VERBOSEBOOT_BASIC 1
|
|
|
|
#define VERBOSEBOOT_MAX 2
|
|
|
|
#define VERBOSEBOOTVARNAME "verbose"
|
2010-03-09 10:41:14 +01:00
|
|
|
|
|
|
|
#endif /* _MINIX_CONST_H */
|