Standardize License information
[openafs.git] / src / dir / dir.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #if     !defined(__AFS_DIR_H)
11
12 #define __AFS_DIR_H
13
14 #define AFS_PAGESIZE 2048       /* bytes per page */
15 #define NHASHENT 128    /* entries in the hash tbl */
16 #define MAXPAGES 128    /* max pages in a dir */
17 #define BIGMAXPAGES 1023   /* new big max pages */
18 #define EPP 64          /* dir entries per page */
19 #define LEPP 6          /* log above */
20 /* When this next field changs, it is crucial to modify MakeDir, since the latter is responsible for marking these entries as allocated.  Also change the salvager. */
21 #define DHE 12          /* entries in a dir header above a pages header alone. */
22
23 #define FFIRST 1
24 #define FNEXT 2
25
26 struct MKFid
27     {/* A file identifier. */
28     afs_int32 vnode;    /* file's vnode slot */
29     afs_int32 vunique;  /* the slot incarnation number */
30     };
31
32 struct PageHeader
33     {/* A page header entry. */
34     unsigned short pgcount;     /* number of pages, or 0 if old-style */
35     unsigned short tag;         /* 1234 in network byte order */
36     char freecount;     /* unused, info in dirHeader structure */
37     char freebitmap[EPP/8];
38     char padding[32-(5+EPP/8)];
39     };
40
41 struct DirHeader
42     {/* A directory header object.
43      */struct PageHeader header;
44     char alloMap[MAXPAGES];    /* one byte per 2K page */
45     unsigned short hashTable[NHASHENT];
46     };
47
48 struct DirEntry
49     {/* A directory entry */
50     char flag;
51     char length;        /* currently unused */
52     unsigned short next;
53     struct MKFid fid;
54     char name[16];
55     };
56
57 struct DirXEntry
58     {/* A directory extension entry. */
59     char name[32];
60     };
61
62 struct DirPage0
63     {/* A page in a directory. */
64     struct DirHeader header;
65     struct DirEntry entry[1];
66     };
67
68 struct DirPage1
69     {/* A page in a directory. */
70     struct PageHeader header;
71     struct DirEntry entry[1];
72     };
73
74 /*
75  * Note that this declaration is seen in both the kernel code and the
76  * user space code.  One implementation is in afs/afs_buffer.c; the
77  * other is in dir/buffer.c.
78  */
79 extern int DVOffset(void *ap);
80
81 #endif /*       !defined(__AFS_DIR_H) */