No empty .Rs/.Re
[netbsd-mini2440.git] / sys / fs / efs / efs_extent.h
blobfdce59e5ae53addc75a949d276f98da48aeb00d3
1 /* $NetBSD: efs_extent.h,v 1.2 2007/06/30 15:56:16 rumble Exp $ */
3 /*
4 * Copyright (c) 2006 Stephen M. Rumble <rumble@ephemeral.org>
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 * EFS extent descriptor format and sundry.
22 * See IRIX inode(4)
25 #ifndef _FS_EFS_EFS_EXTENT_H_
26 #define _FS_EFS_EFS_EXTENT_H_
29 * EFS on-disk extent descriptor (8 bytes)
31 * SGI smushed this structure's members into bit fields, but we have to
32 * be a little more portable. Therefore we use the efs_extent (see below)
33 * type for in-core manipulation and convert immediately to and from disk.
35 struct efs_dextent {
36 union {
37 uint64_t ex_magic:8, /* magic number (always 0) */
38 ex_bn:24, /* bb number in filesystem */
39 ex_length:8, /* length of extent (in bb) */
40 ex_offset:24; /* logical file offset (in bb) */
41 uint8_t bytes[8];
42 uint32_t words[2];
43 } ex_muddle;
44 } __packed;
45 #define ex_bytes ex_muddle.bytes
46 #define ex_words ex_muddle.words
49 * In-core, unsquished representation of an extent.
51 struct efs_extent {
52 uint8_t ex_magic;
53 uint32_t ex_bn; /* NB: only 24 bits on disk */
54 uint8_t ex_length;
55 uint32_t ex_offset; /* NB: only 24 bits on disk */
58 #define EFS_EXTENT_MAGIC 0
59 #define EFS_EXTENT_BN_MASK 0x00ffffff
60 #define EFS_EXTENT_OFFSET_MASK 0x00ffffff
62 #define EFS_EXTENTS_PER_BB (EFS_BB_SIZE / sizeof(struct efs_dextent))
64 #endif /* !_FS_EFS_EFS_EXTENT_H_ */