2 * Copyright 2000, International Business Machines Corporation and others.
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
10 #ifndef __CM_DIR_ENV__
11 #define __CM_DIR_ENV__ 1
13 /* These data structures are derived from src/dir/dir.h and should not
14 * be changed as they describe AFS3 wire protocol.
18 #define CM_DIR_PAGESIZE 2048 /* bytes per page */
19 #define CM_DIR_NHASHENT 128 /* entries in the dir hash tbl */
20 #define CM_DIR_MAXPAGES 128 /* max pages in a dir */
21 #define CM_DIR_BIGMAXPAGES 1023 /* new big max pages */
22 #define CM_DIR_EPP 64 /* dir entries per page */
23 #define CM_DIR_LEPP 6 /* log above */
24 #define CM_DIR_CHUNKSIZE 32 /* bytes per dir entry chunk */
26 /* When this next field changs, it is crucial to modify MakeDir, since the latter is
27 * responsible for marking these entries as allocated. Also change
30 #define CM_DIR_DHE 12 /* entries in a dir header above a pages
34 typedef struct cm_dirFid {
35 /* A file identifier. */
36 afs_int32 vnode; /* file's vnode slot */
37 afs_int32 unique; /* the slot incarnation number */
40 typedef struct cm_pageHeader {
41 /* A page header entry. */
42 unsigned short pgcount; /* number of pages, or 0 if old-style */
43 unsigned short tag; /* '1234' in network byte order */
44 char freeCount; /* unused, info in dirHeader structure */
45 char freeBitmap[CM_DIR_EPP/8];
46 char padding[CM_DIR_CHUNKSIZE-(5+CM_DIR_EPP/8)];/* pad to one 32-byte entry */
49 /* a total of 13 32-byte entries, 1 for the header that in all pages, and
50 * 12 more special ones for the entries in a the first page.
52 typedef struct cm_dirHeader {
53 /* A directory header object. */
54 cm_pageHeader_t header;
55 char alloMap[CM_DIR_MAXPAGES]; /* one byte per 2K page */
56 unsigned short hashTable[CM_DIR_NHASHENT];
59 /* this represents a directory entry. We use strlen to find out how many bytes are
60 * really in the dir entry; it is always a multiple of 32.
62 typedef struct cm_dirEntry {
63 /* A directory entry */
64 char flag; /* this must be FFIRST (1) */
65 char length; /* currently unused */
68 char name[1]; /* the real length is determined with strlen() */
72 typedef struct cm_dirXEntry {
73 /* A directory extension entry. */
77 typedef struct cm_dirPage0 {
78 /* A page in a directory. */
79 cm_dirHeader_t header;
80 cm_dirEntry_t entry[1];
83 typedef struct cm_dirPage1 {
84 /* A page in a directory. */
85 cm_pageHeader_t header;
86 cm_dirEntry_t entry[1];
90 extern long cm_NameEntries(char *namep, long *lenp);
92 #endif /* __CM_DIR_ENV__ */