1 #ifndef _PROCFS_CONST_H 2 #define _PROCFS_CONST_H 3 4 /* 5 * The minimum number of inodes depends on a number of factors: 6 * - Each statically created inode (e.g., /proc/hz) needs an inode. As of 7 * writing, this requires about a dozen inodes. 8 * - Deleted inodes that are still in use by VFS must be retained. For deleted 9 * directories, all their containing directories up to the root must be 10 * retained as well (to allow the user to "cd .." out). VTreeFS already 11 * takes care of this. In the case of ProcFS, only PID-based directories can 12 * be deleted; no other directories are dynamically created. These 13 * directories currently do not contain subdirectories, either. Hence, for 14 * deleted open inodes, we need to reserve at most NR_VNODES inodes in the 15 * worst case. 16 * - In order for getdents to be able to return all PID-based directories, 17 * inodes must not be recycled while generating the list of these PID-based 18 * directories. In the worst case, this means (NR_TASKS + NR_PROCS) extra 19 * inodes. 20 * The sum of these is the bare minimum for correct operation in all possible 21 * circumstances. In practice, not all open files will be deleted files in 22 * ProcFS, and not all process slots will be in use either, so the average use 23 * will be a lot less. However, setting the value too low allows for a 24 * potential denial-of-service attack by a non-root user. 25 * 26 * For the moment, we simply set this value to something reasonable. 27 */ 28 #define NR_INODES ((NR_TASKS + NR_PROCS) * 4) 29 30 /* Various file modes. */ 31 #define REG_ALL_MODE (S_IFREG | 0444) /* world-readable regular */ 32 #define DIR_ALL_MODE (S_IFDIR | 0555) /* world-accessible directory */ 33 #define LNK_ALL_MODE (S_IFLNK | 0777) /* symbolic link */ 34 35 /* Size of the I/O buffer. */ 36 #define BUF_SIZE 4097 /* 4KB+1 (see buf.c) */ 37 38 #endif /* _PROCFS_CONST_H */ 39