Commit | Line | Data |
---|---|---|
da7c5cc6 | 1 | /* |
1810611d | 2 | * Copyright (c) 1982, 1986 Regents of the University of California. |
da7c5cc6 KM |
3 | * All rights reserved. The Berkeley software License Agreement |
4 | * specifies the terms and conditions for redistribution. | |
5 | * | |
644ccedd | 6 | * @(#)fs.h 7.4 (Berkeley) %G% |
da7c5cc6 | 7 | */ |
1ef63481 KM |
8 | |
9 | /* | |
10 | * Each disk drive contains some number of file systems. | |
11 | * A file system consists of a number of cylinder groups. | |
12 | * Each cylinder group has inodes and data. | |
13 | * | |
14 | * A file system is described by its super-block, which in turn | |
15 | * describes the cylinder groups. The super-block is critical | |
16 | * data and is replicated in each cylinder group to protect against | |
17 | * catastrophic loss. This is done at mkfs time and the critical | |
18 | * super-block data does not change, so the copies need not be | |
19 | * referenced further unless disaster strikes. | |
20 | * | |
aca50d72 KM |
21 | * For file system fs, the offsets of the various blocks of interest |
22 | * are given in the super block as: | |
aca50d72 KM |
23 | * [fs->fs_sblkno] Super-block |
24 | * [fs->fs_cblkno] Cylinder group block | |
25 | * [fs->fs_iblkno] Inode blocks | |
26 | * [fs->fs_dblkno] Data blocks | |
27 | * The beginning of cylinder group cg in fs, is given by | |
6994bf5d | 28 | * the ``cgbase(fs, cg)'' macro. |
b6407c9d | 29 | * |
aca50d72 | 30 | * The first boot and super blocks are given in absolute disk addresses. |
cddafded | 31 | * The byte-offset forms are preferred, as they don't imply a sector size. |
f08630d9 | 32 | * The byte-offset forms are preferred, as they don't imply a sector size. |
b6407c9d | 33 | */ |
1df1dbcd | 34 | #define BBSIZE 8192 |
80cc8328 | 35 | #define SBSIZE 8192 |
cddafded MK |
36 | #define BBOFF ((off_t)(0)) |
37 | #define SBOFF ((off_t)(BBOFF + BBSIZE)) | |
f08630d9 MK |
38 | #define BBOFF ((off_t)(0)) |
39 | #define SBOFF ((off_t)(BBOFF + BBSIZE)) | |
cddafded | 40 | #ifndef SECSIZE |
80cc8328 KM |
41 | #define BBLOCK ((daddr_t)(0)) |
42 | #define SBLOCK ((daddr_t)(BBLOCK + BBSIZE / DEV_BSIZE)) | |
cddafded | 43 | #endif SECSIZE |
1ef63481 KM |
44 | |
45 | /* | |
b6407c9d KM |
46 | * Addresses stored in inodes are capable of addressing fragments |
47 | * of `blocks'. File system blocks of at most size MAXBSIZE can | |
48 | * be optionally broken into 2, 4, or 8 pieces, each of which is | |
49 | * addressible; these pieces may be DEV_BSIZE, or some multiple of | |
50 | * a DEV_BSIZE unit. | |
1ef63481 | 51 | * |
b6407c9d KM |
52 | * Large files consist of exclusively large data blocks. To avoid |
53 | * undue wasted disk space, the last data block of a small file may be | |
54 | * allocated as only as many fragments of a large block as are | |
55 | * necessary. The file system format retains only a single pointer | |
56 | * to such a fragment, which is a piece of a single large block that | |
57 | * has been divided. The size of such a fragment is determinable from | |
58 | * information in the inode, using the ``blksize(fs, ip, lbn)'' macro. | |
1ef63481 KM |
59 | * |
60 | * The file system records space availability at the fragment level; | |
61 | * to determine block availability, aligned fragments are examined. | |
743f1ef7 | 62 | * |
80cc8328 KM |
63 | * The root inode is the root of the file system. |
64 | * Inode 0 can't be used for normal purposes and | |
65 | * historically bad blocks were linked to inode 1, | |
66 | * thus the root inode is 2. (inode 1 is no longer used for | |
67 | * this purpose, however numerous dump tapes make this | |
68 | * assumption, so we are stuck with it) | |
69 | * The lost+found directory is given the next available | |
70 | * inode when it is created by ``mkfs''. | |
71 | */ | |
72 | #define ROOTINO ((ino_t)2) /* i number of all roots */ | |
73 | #define LOSTFOUNDINO (ROOTINO + 1) | |
74 | ||
80cc8328 KM |
75 | /* |
76 | * Cylinder group related limits. | |
77 | * | |
743f1ef7 KM |
78 | * For each cylinder we keep track of the availability of blocks at different |
79 | * rotational positions, so that we can lay out the data to be picked | |
80 | * up with minimum rotational latency. NRPOS is the number of rotational | |
81 | * positions which we distinguish. With NRPOS 8 the resolution of our | |
82 | * summary information is 2ms for a typical 3600 rpm drive. | |
83 | */ | |
80cc8328 | 84 | #define NRPOS 8 /* number distinct rotational positions */ |
1ef63481 KM |
85 | |
86 | /* | |
80cc8328 KM |
87 | * MAXIPG bounds the number of inodes per cylinder group, and |
88 | * is needed only to keep the structure simpler by having the | |
89 | * only a single variable size element (the free bit map). | |
90 | * | |
91 | * N.B.: MAXIPG must be a multiple of INOPB(fs). | |
1ef63481 | 92 | */ |
80cc8328 | 93 | #define MAXIPG 2048 /* max number inodes/cyl group */ |
1ef63481 | 94 | |
b6407c9d KM |
95 | /* |
96 | * MINBSIZE is the smallest allowable block size. | |
97 | * In order to insure that it is possible to create files of size | |
98 | * 2^32 with only two levels of indirection, MINBSIZE is set to 4096. | |
99 | * MINBSIZE must be big enough to hold a cylinder group block, | |
100 | * thus changes to (struct cg) must keep its size within MINBSIZE. | |
101 | * MAXCPG is limited only to dimension an array in (struct cg); | |
102 | * it can be made larger as long as that structures size remains | |
103 | * within the bounds dictated by MINBSIZE. | |
25621fac KM |
104 | * Note that super blocks are always of size SBSIZE, |
105 | * and that both SBSIZE and MAXBSIZE must be >= MINBSIZE. | |
b6407c9d KM |
106 | */ |
107 | #define MINBSIZE 4096 | |
b6407c9d | 108 | #define MAXCPG 32 /* maximum fs_cpg */ |
80cc8328 | 109 | |
2c9afb08 KM |
110 | /* |
111 | * The path name on which the file system is mounted is maintained | |
112 | * in fs_fsmnt. MAXMNTLEN defines the amount of space allocated in | |
113 | * the super block for this name. | |
1b807fc9 | 114 | * The limit on the amount of summary information per file system |
26169eda KM |
115 | * is defined by MAXCSBUFS. It is currently parameterized for a |
116 | * maximum of two million cylinders. | |
2c9afb08 | 117 | */ |
3699d961 | 118 | #define MAXMNTLEN 384 |
26169eda | 119 | #define MAXCSBUFS 32 |
2c9afb08 | 120 | |
1ef63481 | 121 | /* |
80cc8328 KM |
122 | * Per cylinder group information; summarized in blocks allocated |
123 | * from first cylinder group data blocks. These blocks have to be | |
124 | * read in from fs_csaddr (size fs_cssize) in addition to the | |
125 | * super block. | |
1ef63481 | 126 | * |
80cc8328 KM |
127 | * N.B. sizeof(struct csum) must be a power of two in order for |
128 | * the ``fs_cs'' macro to work (see below). | |
1ef63481 | 129 | */ |
80cc8328 KM |
130 | struct csum { |
131 | long cs_ndir; /* number of directories */ | |
132 | long cs_nbfree; /* number of free blocks */ | |
133 | long cs_nifree; /* number of free inodes */ | |
134 | long cs_nffree; /* number of free frags */ | |
135 | }; | |
1ef63481 | 136 | |
80cc8328 KM |
137 | /* |
138 | * Super block for a file system. | |
139 | */ | |
b9b166c6 | 140 | #define FS_MAGIC 0x011954 |
1ef63481 KM |
141 | struct fs |
142 | { | |
b9b166c6 KM |
143 | struct fs *fs_link; /* linked list of file systems */ |
144 | struct fs *fs_rlink; /* used for incore super blocks */ | |
26169eda | 145 | daddr_t fs_sblkno; /* addr of super-block in filesys */ |
aca50d72 KM |
146 | daddr_t fs_cblkno; /* offset of cyl-block in filesys */ |
147 | daddr_t fs_iblkno; /* offset of inode-blocks in filesys */ | |
26169eda KM |
148 | daddr_t fs_dblkno; /* offset of first data after cg */ |
149 | long fs_cgoffset; /* cylinder group offset in cylinder */ | |
150 | long fs_cgmask; /* used to calc mod fs_ntrak */ | |
1ef63481 | 151 | time_t fs_time; /* last time written */ |
003319d1 KM |
152 | long fs_size; /* number of blocks in fs */ |
153 | long fs_dsize; /* number of data blocks in fs */ | |
154 | long fs_ncg; /* number of cylinder groups */ | |
b6407c9d KM |
155 | long fs_bsize; /* size of basic blocks in fs */ |
156 | long fs_fsize; /* size of frag blocks in fs */ | |
26169eda | 157 | long fs_frag; /* number of frags in a block in fs */ |
7e2a7a5c | 158 | /* these are configuration parameters */ |
26169eda KM |
159 | long fs_minfree; /* minimum percentage of free blocks */ |
160 | long fs_rotdelay; /* num of ms for optimal next block */ | |
161 | long fs_rps; /* disk revolutions per second */ | |
7e2a7a5c | 162 | /* these fields can be computed from the others */ |
c1ab275c KM |
163 | long fs_bmask; /* ``blkoff'' calc of blk offsets */ |
164 | long fs_fmask; /* ``fragoff'' calc of frag offsets */ | |
26169eda KM |
165 | long fs_bshift; /* ``lblkno'' calc of logical blkno */ |
166 | long fs_fshift; /* ``numfrags'' calc number of frags */ | |
7e2a7a5c | 167 | /* these are configuration parameters */ |
af0b24db SL |
168 | long fs_maxcontig; /* max number of contiguous blks */ |
169 | long fs_maxbpg; /* max number of blks per cyl group */ | |
7e2a7a5c | 170 | /* these fields can be computed from the others */ |
decc359e KM |
171 | long fs_fragshift; /* block to frag shift */ |
172 | long fs_fsbtodb; /* fsbtodb and dbtofsb shift constant */ | |
173 | long fs_sbsize; /* actual size of super block */ | |
174 | long fs_csmask; /* csum block offset */ | |
175 | long fs_csshift; /* csum block number */ | |
176 | long fs_nindir; /* value of NINDIR */ | |
177 | long fs_inopb; /* value of INOPB */ | |
178 | long fs_nspf; /* value of NSPF */ | |
3699d961 | 179 | /* yet another configuration parameter */ |
b8f2ca7d | 180 | long fs_optim; /* optimization preference, see below */ |
3699d961 KM |
181 | /* these fields are derived from the hardware */ |
182 | long fs_npsect; /* # sectors/track including spares */ | |
183 | long fs_interleave; /* hardware sector interleave */ | |
184 | long fs_trackskew; /* sector 0 skew, per track */ | |
185 | long fs_headswitch; /* head switch time, usec */ | |
186 | long fs_trkseek; /* track-to-track seek, usec */ | |
1ef63481 | 187 | /* sizes determined by number of cylinder groups and their sizes */ |
b6407c9d | 188 | daddr_t fs_csaddr; /* blk addr of cyl grp summary area */ |
003319d1 KM |
189 | long fs_cssize; /* size of cyl grp summary area */ |
190 | long fs_cgsize; /* cylinder group size */ | |
3699d961 | 191 | /* these fields are derived from the hardware */ |
26169eda KM |
192 | long fs_ntrak; /* tracks per cylinder */ |
193 | long fs_nsect; /* sectors per track */ | |
003319d1 | 194 | long fs_spc; /* sectors per cylinder */ |
1ef63481 | 195 | /* this comes from the disk driver partitioning */ |
003319d1 | 196 | long fs_ncyl; /* cylinders in file system */ |
1ef63481 | 197 | /* these fields can be computed from the others */ |
26169eda KM |
198 | long fs_cpg; /* cylinders per group */ |
199 | long fs_ipg; /* inodes per group */ | |
b6407c9d | 200 | long fs_fpg; /* blocks per group * fs_frag */ |
003319d1 KM |
201 | /* this data must be re-computed after crashes */ |
202 | struct csum fs_cstotal; /* cylinder summary information */ | |
1ef63481 KM |
203 | /* these fields are cleared at mount time */ |
204 | char fs_fmod; /* super block modified flag */ | |
26169eda | 205 | char fs_clean; /* file system is clean flag */ |
1ef63481 | 206 | char fs_ronly; /* mounted read-only flag */ |
26169eda | 207 | char fs_flags; /* currently unused flag */ |
2c9afb08 | 208 | char fs_fsmnt[MAXMNTLEN]; /* name mounted on */ |
cddafded MK |
209 | long fs_dbsize; /* hardware sector size */ |
210 | long fs_sparecon[31]; /* reserved for future constants */ | |
743f1ef7 | 211 | /* these fields retain the current block allocation info */ |
003319d1 | 212 | long fs_cgrotor; /* last cg searched */ |
1b807fc9 | 213 | struct csum *fs_csp[MAXCSBUFS];/* list of fs_cs info buffers */ |
26169eda | 214 | long fs_cpc; /* cyl per cycle in postbl */ |
aca50d72 | 215 | short fs_postbl[MAXCPG][NRPOS];/* head of blocks for each rotation */ |
b9b166c6 | 216 | long fs_magic; /* magic number */ |
aca50d72 | 217 | u_char fs_rotbl[1]; /* list of blocks for each rotation */ |
743f1ef7 | 218 | /* actually longer */ |
1ef63481 | 219 | }; |
b8f2ca7d KM |
220 | /* |
221 | * Preference for optimization. | |
222 | */ | |
223 | #define FS_OPTTIME 0 /* minimize allocation time */ | |
224 | #define FS_OPTSPACE 1 /* minimize disk fragmentation */ | |
b6407c9d KM |
225 | |
226 | /* | |
2c9afb08 | 227 | * Convert cylinder group to base address of its global summary info. |
80cc8328 | 228 | * |
b6407c9d KM |
229 | * N.B. This macro assumes that sizeof(struct csum) is a power of two. |
230 | */ | |
231 | #define fs_cs(fs, indx) \ | |
7e2a7a5c | 232 | fs_csp[(indx) >> (fs)->fs_csshift][(indx) & ~(fs)->fs_csmask] |
1ef63481 KM |
233 | |
234 | /* | |
aca50d72 KM |
235 | * MAXBPC bounds the size of the rotational layout tables and |
236 | * is limited by the fact that the super block is of size SBSIZE. | |
237 | * The size of these tables is INVERSELY proportional to the block | |
238 | * size of the file system. It is aggravated by sector sizes that | |
239 | * are not powers of two, as this increases the number of cylinders | |
240 | * included before the rotational pattern repeats (fs_cpc). | |
241 | * Its size is derived from the number of bytes remaining in (struct fs) | |
1ef63481 | 242 | */ |
aca50d72 | 243 | #define MAXBPC (SBSIZE - sizeof (struct fs)) |
1ef63481 KM |
244 | |
245 | /* | |
80cc8328 | 246 | * Cylinder group block for a file system. |
1ef63481 | 247 | */ |
b9b166c6 | 248 | #define CG_MAGIC 0x090255 |
1ef63481 | 249 | struct cg { |
b9b166c6 KM |
250 | struct cg *cg_link; /* linked list of cyl groups */ |
251 | struct cg *cg_rlink; /* used for incore cyl groups */ | |
1ef63481 | 252 | time_t cg_time; /* time last written */ |
003319d1 | 253 | long cg_cgx; /* we are the cgx'th cylinder group */ |
1ef63481 KM |
254 | short cg_ncyl; /* number of cyl's this cg */ |
255 | short cg_niblk; /* number of inode blocks this cg */ | |
003319d1 KM |
256 | long cg_ndblk; /* number of data blocks this cg */ |
257 | struct csum cg_cs; /* cylinder summary information */ | |
258 | long cg_rotor; /* position of last used block */ | |
259 | long cg_frotor; /* position of last used frag */ | |
260 | long cg_irotor; /* position of last used inode */ | |
b6407c9d | 261 | long cg_frsum[MAXFRAG]; /* counts of available frags */ |
d37938c8 | 262 | long cg_btot[MAXCPG]; /* block totals per cylinder */ |
1ef63481 KM |
263 | short cg_b[MAXCPG][NRPOS]; /* positions of free blocks */ |
264 | char cg_iused[MAXIPG/NBBY]; /* used inode map */ | |
b9b166c6 | 265 | long cg_magic; /* magic number */ |
110d7a57 | 266 | u_char cg_free[1]; /* free block map */ |
1ef63481 KM |
267 | /* actually longer */ |
268 | }; | |
80cc8328 KM |
269 | |
270 | /* | |
271 | * MAXBPG bounds the number of blocks of data per cylinder group, | |
272 | * and is limited by the fact that cylinder groups are at most one block. | |
273 | * Its size is derived from the size of blocks and the (struct cg) size, | |
274 | * by the number of remaining bits. | |
275 | */ | |
276 | #define MAXBPG(fs) \ | |
c7cd2adb | 277 | (fragstoblks((fs), (NBBY * ((fs)->fs_bsize - (sizeof (struct cg)))))) |
80cc8328 KM |
278 | |
279 | /* | |
280 | * Turn file system block numbers into disk block addresses. | |
281 | * This maps file system blocks to device size blocks. | |
282 | */ | |
7e2a7a5c KM |
283 | #define fsbtodb(fs, b) ((b) << (fs)->fs_fsbtodb) |
284 | #define dbtofsb(fs, b) ((b) >> (fs)->fs_fsbtodb) | |
80cc8328 KM |
285 | |
286 | /* | |
287 | * Cylinder group macros to locate things in cylinder groups. | |
26169eda | 288 | * They calc file system addresses of cylinder group data structures. |
80cc8328 | 289 | */ |
26169eda KM |
290 | #define cgbase(fs, c) ((daddr_t)((fs)->fs_fpg * (c))) |
291 | #define cgstart(fs, c) \ | |
292 | (cgbase(fs, c) + (fs)->fs_cgoffset * ((c) & ~((fs)->fs_cgmask))) | |
293 | #define cgsblock(fs, c) (cgstart(fs, c) + (fs)->fs_sblkno) /* super blk */ | |
294 | #define cgtod(fs, c) (cgstart(fs, c) + (fs)->fs_cblkno) /* cg block */ | |
295 | #define cgimin(fs, c) (cgstart(fs, c) + (fs)->fs_iblkno) /* inode blk */ | |
296 | #define cgdmin(fs, c) (cgstart(fs, c) + (fs)->fs_dblkno) /* 1st data */ | |
80cc8328 KM |
297 | |
298 | /* | |
2c9afb08 KM |
299 | * Macros for handling inode numbers: |
300 | * inode number to file system block offset. | |
301 | * inode number to cylinder group number. | |
302 | * inode number to file system block address. | |
80cc8328 | 303 | */ |
6994bf5d KM |
304 | #define itoo(fs, x) ((x) % INOPB(fs)) |
305 | #define itog(fs, x) ((x) / (fs)->fs_ipg) | |
306 | #define itod(fs, x) \ | |
307 | ((daddr_t)(cgimin(fs, itog(fs, x)) + \ | |
c7cd2adb | 308 | (blkstofrags((fs), (((x) % (fs)->fs_ipg) / INOPB(fs)))))) |
80cc8328 | 309 | |
80cc8328 | 310 | /* |
2c9afb08 KM |
311 | * Give cylinder group number for a file system block. |
312 | * Give cylinder group block number for a file system block. | |
80cc8328 | 313 | */ |
6994bf5d KM |
314 | #define dtog(fs, d) ((d) / (fs)->fs_fpg) |
315 | #define dtogd(fs, d) ((d) % (fs)->fs_fpg) | |
80cc8328 | 316 | |
aca50d72 | 317 | /* |
2c9afb08 KM |
318 | * Extract the bits for a block from a map. |
319 | * Compute the cylinder and rotational position of a cyl block addr. | |
aca50d72 | 320 | */ |
2c9afb08 | 321 | #define blkmap(fs, map, loc) \ |
25621fac | 322 | (((map)[(loc) / NBBY] >> ((loc) % NBBY)) & (0xff >> (NBBY - (fs)->fs_frag))) |
aca50d72 | 323 | #define cbtocylno(fs, bno) \ |
5a367fe7 | 324 | ((bno) * NSPF(fs) / (fs)->fs_spc) |
aca50d72 | 325 | #define cbtorpos(fs, bno) \ |
3699d961 KM |
326 | (((bno) * NSPF(fs) % (fs)->fs_spc / (fs)->fs_nsect * (fs)->fs_trackskew + \ |
327 | (bno) * NSPF(fs) % (fs)->fs_spc % (fs)->fs_nsect * (fs)->fs_interleave) % \ | |
328 | (fs)->fs_nsect * NRPOS / (fs)->fs_npsect) | |
aca50d72 | 329 | |
c1ab275c KM |
330 | /* |
331 | * The following macros optimize certain frequently calculated | |
332 | * quantities by using shifts and masks in place of divisions | |
333 | * modulos and multiplications. | |
334 | */ | |
335 | #define blkoff(fs, loc) /* calculates (loc % fs->fs_bsize) */ \ | |
336 | ((loc) & ~(fs)->fs_bmask) | |
337 | #define fragoff(fs, loc) /* calculates (loc % fs->fs_fsize) */ \ | |
338 | ((loc) & ~(fs)->fs_fmask) | |
339 | #define lblkno(fs, loc) /* calculates (loc / fs->fs_bsize) */ \ | |
340 | ((loc) >> (fs)->fs_bshift) | |
341 | #define numfrags(fs, loc) /* calculates (loc / fs->fs_fsize) */ \ | |
342 | ((loc) >> (fs)->fs_fshift) | |
343 | #define blkroundup(fs, size) /* calculates roundup(size, fs->fs_bsize) */ \ | |
344 | (((size) + (fs)->fs_bsize - 1) & (fs)->fs_bmask) | |
345 | #define fragroundup(fs, size) /* calculates roundup(size, fs->fs_fsize) */ \ | |
346 | (((size) + (fs)->fs_fsize - 1) & (fs)->fs_fmask) | |
c7cd2adb SL |
347 | #define fragstoblks(fs, frags) /* calculates (frags / fs->fs_frag) */ \ |
348 | ((frags) >> (fs)->fs_fragshift) | |
349 | #define blkstofrags(fs, blks) /* calculates (blks * fs->fs_frag) */ \ | |
350 | ((blks) << (fs)->fs_fragshift) | |
6d55d657 KM |
351 | #define fragnum(fs, fsb) /* calculates (fsb % fs->fs_frag) */ \ |
352 | ((fsb) & ((fs)->fs_frag - 1)) | |
353 | #define blknum(fs, fsb) /* calculates rounddown(fsb, fs->fs_frag) */ \ | |
354 | ((fsb) &~ ((fs)->fs_frag - 1)) | |
c7cd2adb SL |
355 | |
356 | /* | |
357 | * Determine the number of available frags given a | |
358 | * percentage to hold in reserve | |
359 | */ | |
360 | #define freespace(fs, percentreserved) \ | |
361 | (blkstofrags((fs), (fs)->fs_cstotal.cs_nbfree) + \ | |
362 | (fs)->fs_cstotal.cs_nffree - ((fs)->fs_dsize * (percentreserved) / 100)) | |
c1ab275c | 363 | |
80cc8328 | 364 | /* |
2c9afb08 | 365 | * Determining the size of a file block in the file system. |
80cc8328 KM |
366 | */ |
367 | #define blksize(fs, ip, lbn) \ | |
7e2a7a5c | 368 | (((lbn) >= NDADDR || (ip)->i_size >= ((lbn) + 1) << (fs)->fs_bshift) \ |
c1ab275c KM |
369 | ? (fs)->fs_bsize \ |
370 | : (fragroundup(fs, blkoff(fs, (ip)->i_size)))) | |
80cc8328 | 371 | #define dblksize(fs, dip, lbn) \ |
7e2a7a5c | 372 | (((lbn) >= NDADDR || (dip)->di_size >= ((lbn) + 1) << (fs)->fs_bshift) \ |
c1ab275c KM |
373 | ? (fs)->fs_bsize \ |
374 | : (fragroundup(fs, blkoff(fs, (dip)->di_size)))) | |
80cc8328 KM |
375 | |
376 | /* | |
2c9afb08 | 377 | * Number of disk sectors per block; assumes DEV_BSIZE byte sector size. |
80cc8328 | 378 | */ |
7e2a7a5c KM |
379 | #define NSPB(fs) ((fs)->fs_nspf << (fs)->fs_fragshift) |
380 | #define NSPF(fs) ((fs)->fs_nspf) | |
80cc8328 KM |
381 | |
382 | /* | |
2c9afb08 | 383 | * INOPB is the number of inodes in a secondary storage block. |
80cc8328 | 384 | */ |
7e2a7a5c KM |
385 | #define INOPB(fs) ((fs)->fs_inopb) |
386 | #define INOPF(fs) ((fs)->fs_inopb >> (fs)->fs_fragshift) | |
80cc8328 KM |
387 | |
388 | /* | |
2c9afb08 | 389 | * NINDIR is the number of indirects in a file system block. |
80cc8328 | 390 | */ |
7e2a7a5c | 391 | #define NINDIR(fs) ((fs)->fs_nindir) |
1ef63481 KM |
392 | |
393 | #ifdef KERNEL | |
394 | struct fs *getfs(); | |
1bbbd864 | 395 | struct fs *mountfs(); |
1ef63481 | 396 | #endif |