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