OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [fs/] [freevxfs/] [vxfs.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/*
2
 * Copyright (c) 2000-2001 Christoph Hellwig.
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 * 1. Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions, and the following disclaimer,
10
 *    without modification.
11
 * 2. The name of the author may not be used to endorse or promote products
12
 *    derived from this software without specific prior written permission.
13
 *
14
 * Alternatively, this software may be distributed under the terms of the
15
 * GNU General Public License ("GPL").
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
21
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27
 * SUCH DAMAGE.
28
 *
29
 */
30
#ifndef _VXFS_SUPER_H_
31
#define _VXFS_SUPER_H_
32
 
33
#ident "$Id: vxfs.h,v 1.1.1.1 2004-04-15 01:11:46 phoenix Exp $"
34
 
35
/*
36
 * Veritas filesystem driver - superblock structure.
37
 *
38
 * This file contains the definition of the disk and core
39
 * superblocks of the Veritas Filesystem.
40
 */
41
#include <linux/types.h>
42
#include "vxfs_kcompat.h"
43
 
44
 
45
/*
46
 * Data types for use with the VxFS ondisk format.
47
 */
48
typedef int32_t         vx_daddr_t;
49
typedef int32_t         vx_ino_t;
50
 
51
/*
52
 * Superblock magic number (vxfs_super->vs_magic).
53
 */
54
#define VXFS_SUPER_MAGIC        0xa501FCF5
55
 
56
/*
57
 * The root inode.
58
 */
59
#define VXFS_ROOT_INO           2
60
 
61
/*
62
 * Num of entries in free extent array
63
 */
64
#define VXFS_NEFREE             32
65
 
66
 
67
/*
68
 * VxFS superblock (disk).
69
 */
70
struct vxfs_sb {
71
        /*
72
         * Readonly fields for the version 1 superblock.
73
         *
74
         * Lots of this fields are no more used by version 2
75
         * and never filesystems.
76
         */
77
        u_int32_t       vs_magic;               /* Magic number */
78
        int32_t         vs_version;             /* VxFS version */
79
        u_int32_t       vs_ctime;               /* create time - secs */
80
        u_int32_t       vs_cutime;              /* create time - usecs */
81
        int32_t         __unused1;              /* unused */
82
        int32_t         __unused2;              /* unused */
83
        vx_daddr_t      vs_old_logstart;        /* obsolete */
84
        vx_daddr_t      vs_old_logend;          /* obsolete */
85
        int32_t         vs_bsize;               /* block size */
86
        int32_t         vs_size;                /* number of blocks */
87
        int32_t         vs_dsize;               /* number of data blocks */
88
        u_int32_t       vs_old_ninode;          /* obsolete */
89
        int32_t         vs_old_nau;             /* obsolete */
90
        int32_t         __unused3;              /* unused */
91
        int32_t         vs_old_defiextsize;     /* obsolete */
92
        int32_t         vs_old_ilbsize;         /* obsolete */
93
        int32_t         vs_immedlen;            /* size of immediate data area */
94
        int32_t         vs_ndaddr;              /* number of direct extentes */
95
        vx_daddr_t      vs_firstau;             /* address of first AU */
96
        vx_daddr_t      vs_emap;                /* offset of extent map in AU */
97
        vx_daddr_t      vs_imap;                /* offset of inode map in AU */
98
        vx_daddr_t      vs_iextop;              /* offset of ExtOp. map in AU */
99
        vx_daddr_t      vs_istart;              /* offset of inode list in AU */
100
        vx_daddr_t      vs_bstart;              /* offset of fdblock in AU */
101
        vx_daddr_t      vs_femap;               /* aufirst + emap */
102
        vx_daddr_t      vs_fimap;               /* aufirst + imap */
103
        vx_daddr_t      vs_fiextop;             /* aufirst + iextop */
104
        vx_daddr_t      vs_fistart;             /* aufirst + istart */
105
        vx_daddr_t      vs_fbstart;             /* aufirst + bstart */
106
        int32_t         vs_nindir;              /* number of entries in indir */
107
        int32_t         vs_aulen;               /* length of AU in blocks */
108
        int32_t         vs_auimlen;             /* length of imap in blocks */
109
        int32_t         vs_auemlen;             /* length of emap in blocks */
110
        int32_t         vs_auilen;              /* length of ilist in blocks */
111
        int32_t         vs_aupad;               /* length of pad in blocks */
112
        int32_t         vs_aublocks;            /* data blocks in AU */
113
        int32_t         vs_maxtier;             /* log base 2 of aublocks */
114
        int32_t         vs_inopb;               /* number of inodes per blk */
115
        int32_t         vs_old_inopau;          /* obsolete */
116
        int32_t         vs_old_inopilb;         /* obsolete */
117
        int32_t         vs_old_ndiripau;        /* obsolete */
118
        int32_t         vs_iaddrlen;            /* size of indirect addr ext. */
119
        int32_t         vs_bshift;              /* log base 2 of bsize */
120
        int32_t         vs_inoshift;            /* log base 2 of inobp */
121
        int32_t         vs_bmask;               /* ~( bsize - 1 ) */
122
        int32_t         vs_boffmask;            /* bsize - 1 */
123
        int32_t         vs_old_inomask;         /* old_inopilb - 1 */
124
        int32_t         vs_checksum;            /* checksum of V1 data */
125
 
126
        /*
127
         * Version 1, writable
128
         */
129
        int32_t         vs_free;                /* number of free blocks */
130
        int32_t         vs_ifree;               /* number of free inodes */
131
        int32_t         vs_efree[VXFS_NEFREE];  /* number of free extents by size */
132
        int32_t         vs_flags;               /* flags ?!? */
133
        u_int8_t        vs_mod;                 /* filesystem has been changed */
134
        u_int8_t        vs_clean;               /* clean FS */
135
        u_int16_t       __unused4;              /* unused */
136
        u_int32_t       vs_firstlogid;          /* mount time log ID */
137
        u_int32_t       vs_wtime;               /* last time written - sec */
138
        u_int32_t       vs_wutime;              /* last time written - usec */
139
        u_int8_t        vs_fname[6];            /* FS name */
140
        u_int8_t        vs_fpack[6];            /* FS pack name */
141
        int32_t         vs_logversion;          /* log format version */
142
        int32_t         __unused5;              /* unused */
143
 
144
        /*
145
         * Version 2, Read-only
146
         */
147
        vx_daddr_t      vs_oltext[2];           /* OLT extent and replica */
148
        int32_t         vs_oltsize;             /* OLT extent size */
149
        int32_t         vs_iauimlen;            /* size of inode map */
150
        int32_t         vs_iausize;             /* size of IAU in blocks */
151
        int32_t         vs_dinosize;            /* size of inode in bytes */
152
        int32_t         vs_old_dniaddr;         /* indir levels per inode */
153
        int32_t         vs_checksum2;           /* checksum of V2 RO */
154
 
155
        /*
156
         * Actually much more...
157
         */
158
};
159
 
160
 
161
/*
162
 * In core superblock filesystem private data for VxFS.
163
 */
164
struct vxfs_sb_info {
165
        struct vxfs_sb          *vsi_raw;       /* raw (on disk) supeblock */
166
        struct buffer_head      *vsi_bp;        /* buffer for raw superblock*/
167
        struct inode            *vsi_fship;     /* fileset header inode */
168
        struct inode            *vsi_ilist;     /* inode list inode */
169
        struct inode            *vsi_stilist;   /* structual inode list inode */
170
        u_long                  vsi_iext;       /* initial inode list */
171
        ino_t                   vsi_fshino;     /* fileset header inode */
172
        daddr_t                 vsi_oltext;     /* OLT extent */
173
        daddr_t                 vsi_oltsize;    /* OLT size */
174
};
175
 
176
 
177
/*
178
 * File modes.  File types above 0xf000 are vxfs internal only, they should
179
 * not be passed back to higher levels of the system.  vxfs file types must
180
 * never have one of the regular file type bits set.
181
 */
182
enum vxfs_mode {
183
        VXFS_ISUID = 0x00000800,        /* setuid */
184
        VXFS_ISGID = 0x00000400,        /* setgid */
185
        VXFS_ISVTX = 0x00000200,        /* sticky bit */
186
        VXFS_IREAD = 0x00000100,        /* read */
187
        VXFS_IWRITE = 0x00000080,       /* write */
188
        VXFS_IEXEC = 0x00000040,        /* exec */
189
 
190
        VXFS_IFIFO = 0x00001000,        /* Named pipe */
191
        VXFS_IFCHR = 0x00002000,        /* Character device */
192
        VXFS_IFDIR = 0x00004000,        /* Directory */
193
        VXFS_IFNAM = 0x00005000,        /* Xenix device ?? */
194
        VXFS_IFBLK = 0x00006000,        /* Block device */
195
        VXFS_IFREG = 0x00008000,        /* Regular file */
196
        VXFS_IFCMP = 0x00009000,        /* Compressed file ?!? */
197
        VXFS_IFLNK = 0x0000a000,        /* Symlink */
198
        VXFS_IFSOC = 0x0000c000,        /* Socket */
199
 
200
        /* VxFS internal */
201
        VXFS_IFFSH = 0x10000000,        /* Fileset header */
202
        VXFS_IFILT = 0x20000000,        /* Inode list */
203
        VXFS_IFIAU = 0x30000000,        /* Inode allocation unit */
204
        VXFS_IFCUT = 0x40000000,        /* Current usage table */
205
        VXFS_IFATT = 0x50000000,        /* Attr. inode */
206
        VXFS_IFLCT = 0x60000000,        /* Link count table */
207
        VXFS_IFIAT = 0x70000000,        /* Indirect attribute file */
208
        VXFS_IFEMR = 0x80000000,        /* Extent map reorg file */
209
        VXFS_IFQUO = 0x90000000,        /* BSD quota file */
210
        VXFS_IFPTI = 0xa0000000,        /* "Pass through" inode */
211
        VXFS_IFLAB = 0x11000000,        /* Device label file */
212
        VXFS_IFOLT = 0x12000000,        /* OLT file */
213
        VXFS_IFLOG = 0x13000000,        /* Log file */
214
        VXFS_IFEMP = 0x14000000,        /* Extent map file */
215
        VXFS_IFEAU = 0x15000000,        /* Extent AU file */
216
        VXFS_IFAUS = 0x16000000,        /* Extent AU summary file */
217
        VXFS_IFDEV = 0x17000000,        /* Device config file */
218
 
219
};
220
 
221
#define VXFS_TYPE_MASK          0xfffff000
222
 
223
#define VXFS_IS_TYPE(ip,type)   (((ip)->vii_mode & VXFS_TYPE_MASK) == (type))
224
#define VXFS_ISFIFO(x)          VXFS_IS_TYPE((x),VXFS_IFIFO)
225
#define VXFS_ISCHR(x)           VXFS_IS_TYPE((x),VXFS_IFCHR)
226
#define VXFS_ISDIR(x)           VXFS_IS_TYPE((x),VXFS_IFDIR)
227
#define VXFS_ISNAM(x)           VXFS_IS_TYPE((x),VXFS_IFNAM)
228
#define VXFS_ISBLK(x)           VXFS_IS_TYPE((x),VXFS_IFBLK)
229
#define VXFS_ISLNK(x)           VXFS_IS_TYPE((x),VXFS_IFLNK)
230
#define VXFS_ISREG(x)           VXFS_IS_TYPE((x),VXFS_IFREG)
231
#define VXFS_ISCMP(x)           VXFS_IS_TYPE((x),VXFS_IFCMP)
232
#define VXFS_ISSOC(x)           VXFS_IS_TYPE((x),VXFS_IFSOC)
233
 
234
#define VXFS_ISFSH(x)           VXFS_IS_TYPE((x),VXFS_IFFSH)
235
#define VXFS_ISILT(x)           VXFS_IS_TYPE((x),VXFS_IFILT)
236
 
237
/*
238
 * Inmode organisation types.
239
 */
240
enum {
241
        VXFS_ORG_NONE   = 0,     /* Inode has *no* format ?!? */
242
        VXFS_ORG_EXT4   = 1,    /* Ext4 */
243
        VXFS_ORG_IMMED  = 2,    /* All data stored in inode */
244
        VXFS_ORG_TYPED  = 3,    /* Typed extents */
245
};
246
 
247
#define VXFS_IS_ORG(ip,org)     ((ip)->vii_orgtype == (org))
248
#define VXFS_ISNONE(ip)         VXFS_IS_ORG((ip), VXFS_ORG_NONE)
249
#define VXFS_ISEXT4(ip)         VXFS_IS_ORG((ip), VXFS_ORG_EXT4)
250
#define VXFS_ISIMMED(ip)        VXFS_IS_ORG((ip), VXFS_ORG_IMMED)
251
#define VXFS_ISTYPED(ip)        VXFS_IS_ORG((ip), VXFS_ORG_TYPED)
252
 
253
 
254
/*
255
 * Get filesystem private data from VFS inode.
256
 */
257
#define VXFS_INO(ip) \
258
        ((struct vxfs_inode_info *)(ip)->u.generic_ip)
259
 
260
/*
261
 * Get filesystem private data from VFS superblock.
262
 */
263
#define VXFS_SBI(sbp) \
264
        ((struct vxfs_sb_info *)(sbp)->u.generic_sbp)
265
 
266
#endif /* _VXFS_SUPER_H_ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.