Committer: Michael Beasley <mike@snafu.setup>
[mikesnafu-overlay.git] / fs / jfs / jfs_types.h
blob649f9817accd05f5899e54dca2ecb0dcb406c6d6
1 /*
2 * Copyright (C) International Business Machines Corp., 2000-2004
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
12 * the GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 #ifndef _H_JFS_TYPES
19 #define _H_JFS_TYPES
22 * jfs_types.h:
24 * basic type/utility definitions
26 * note: this header file must be the 1st include file
27 * of JFS include list in all JFS .c file.
30 #include <linux/types.h>
31 #include <linux/nls.h>
33 #include "endian24.h"
36 * transaction and lock id's
38 * Don't change these without carefully considering the impact on the
39 * size and alignment of all of the linelock variants
41 typedef u16 tid_t;
42 typedef u16 lid_t;
45 * Almost identical to Linux's timespec, but not quite
47 struct timestruc_t {
48 __le32 tv_sec;
49 __le32 tv_nsec;
53 * handy
56 #define LEFTMOSTONE 0x80000000
57 #define HIGHORDER 0x80000000u /* high order bit on */
58 #define ONES 0xffffffffu /* all bit on */
61 * logical xd (lxd)
63 typedef struct {
64 unsigned len:24;
65 unsigned off1:8;
66 u32 off2;
67 } lxd_t;
69 /* lxd_t field construction */
70 #define LXDlength(lxd, length32) ( (lxd)->len = length32 )
71 #define LXDoffset(lxd, offset64)\
73 (lxd)->off1 = ((s64)offset64) >> 32;\
74 (lxd)->off2 = (offset64) & 0xffffffff;\
77 /* lxd_t field extraction */
78 #define lengthLXD(lxd) ( (lxd)->len )
79 #define offsetLXD(lxd)\
80 ( ((s64)((lxd)->off1)) << 32 | (lxd)->off2 )
82 /* lxd list */
83 struct lxdlist {
84 s16 maxnlxd;
85 s16 nlxd;
86 lxd_t *lxd;
90 * physical xd (pxd)
92 typedef struct {
93 unsigned len:24;
94 unsigned addr1:8;
95 __le32 addr2;
96 } pxd_t;
98 /* xd_t field construction */
100 #define PXDlength(pxd, length32) ((pxd)->len = __cpu_to_le24(length32))
101 #define PXDaddress(pxd, address64)\
103 (pxd)->addr1 = ((s64)address64) >> 32;\
104 (pxd)->addr2 = __cpu_to_le32((address64) & 0xffffffff);\
107 /* xd_t field extraction */
108 #define lengthPXD(pxd) __le24_to_cpu((pxd)->len)
109 #define addressPXD(pxd)\
110 ( ((s64)((pxd)->addr1)) << 32 | __le32_to_cpu((pxd)->addr2))
112 #define MAXTREEHEIGHT 8
113 /* pxd list */
114 struct pxdlist {
115 s16 maxnpxd;
116 s16 npxd;
117 pxd_t pxd[MAXTREEHEIGHT];
122 * data extent descriptor (dxd)
124 typedef struct {
125 unsigned flag:8; /* 1: flags */
126 unsigned rsrvd:24;
127 __le32 size; /* 4: size in byte */
128 unsigned len:24; /* 3: length in unit of fsblksize */
129 unsigned addr1:8; /* 1: address in unit of fsblksize */
130 __le32 addr2; /* 4: address in unit of fsblksize */
131 } dxd_t; /* - 16 - */
133 /* dxd_t flags */
134 #define DXD_INDEX 0x80 /* B+-tree index */
135 #define DXD_INLINE 0x40 /* in-line data extent */
136 #define DXD_EXTENT 0x20 /* out-of-line single extent */
137 #define DXD_FILE 0x10 /* out-of-line file (inode) */
138 #define DXD_CORRUPT 0x08 /* Inconsistency detected */
140 /* dxd_t field construction
141 * Conveniently, the PXD macros work for DXD
143 #define DXDlength PXDlength
144 #define DXDaddress PXDaddress
145 #define lengthDXD lengthPXD
146 #define addressDXD addressPXD
147 #define DXDsize(dxd, size32) ((dxd)->size = cpu_to_le32(size32))
148 #define sizeDXD(dxd) le32_to_cpu((dxd)->size)
151 * directory entry argument
153 struct component_name {
154 int namlen;
155 wchar_t *name;
160 * DASD limit information - stored in directory inode
162 struct dasd {
163 u8 thresh; /* Alert Threshold (in percent) */
164 u8 delta; /* Alert Threshold delta (in percent) */
165 u8 rsrvd1;
166 u8 limit_hi; /* DASD limit (in logical blocks) */
167 __le32 limit_lo; /* DASD limit (in logical blocks) */
168 u8 rsrvd2[3];
169 u8 used_hi; /* DASD usage (in logical blocks) */
170 __le32 used_lo; /* DASD usage (in logical blocks) */
173 #define DASDLIMIT(dasdp) \
174 (((u64)((dasdp)->limit_hi) << 32) + __le32_to_cpu((dasdp)->limit_lo))
175 #define setDASDLIMIT(dasdp, limit)\
177 (dasdp)->limit_hi = ((u64)limit) >> 32;\
178 (dasdp)->limit_lo = __cpu_to_le32(limit);\
180 #define DASDUSED(dasdp) \
181 (((u64)((dasdp)->used_hi) << 32) + __le32_to_cpu((dasdp)->used_lo))
182 #define setDASDUSED(dasdp, used)\
184 (dasdp)->used_hi = ((u64)used) >> 32;\
185 (dasdp)->used_lo = __cpu_to_le32(used);\
188 #endif /* !_H_JFS_TYPES */