2 * $Id: cnid_cdb_private.h,v 1.1.4.7.2.2 2008-11-25 15:16:34 didg Exp $
5 #ifndef LIBATALK_CDB_PRIVATE_H
6 #define LIBATALK_CDB_PRIVATE_H 1
10 #endif /* HAVE_CONFIG_H */
12 #include <netatalk/endian.h>
16 #endif /* HAVE_UNISTD_H */
22 #endif /* HAVE_FCNTL_H */
23 #include <sys/param.h>
25 #ifdef HAVE_SYS_TIME_H
27 #endif /* HAVE_SYS_TIME_H */
31 #include <sys/cdefs.h>
34 #include <atalk/logger.h>
35 #include <atalk/adouble.h>
36 #include <atalk/cnid.h>
37 #include <atalk/util.h>
40 #define CNID_DB_MAGIC 0x434E4944U /* CNID */
41 #define CNID_DATA_MAGIC 0x434E4945U /* CNIE */
47 type/last cnid 4 Not used
59 typedef struct cnid_record { /* helper for debug don't use */
71 #define CNID_DEV_OFS CNID_LEN
72 #define CNID_DEV_LEN 8
74 #define CNID_INO_OFS (CNID_DEV_OFS + CNID_DEV_LEN)
75 #define CNID_INO_LEN 8
77 #define CNID_DEVINO_OFS CNID_LEN
78 #define CNID_DEVINO_LEN (CNID_DEV_LEN +CNID_INO_LEN)
80 #define CNID_TYPE_OFS (CNID_DEVINO_OFS +CNID_DEVINO_LEN)
81 #define CNID_TYPE_LEN 4
83 #define CNID_DID_OFS (CNID_TYPE_OFS +CNID_TYPE_LEN)
84 #define CNID_DID_LEN CNID_LEN
86 #define CNID_NAME_OFS (CNID_DID_OFS + CNID_DID_LEN)
87 #define CNID_HEADER_LEN (CNID_NAME_OFS)
91 #define CNIDFLAG_ROOTINFO_RO (1 << 0)
92 #define CNIDFLAG_DB_RO (1 << 1)
95 * we use 0/RootInfo. */
96 #define ROOTINFO_KEY "\0\0\0\0"
97 #define ROOTINFO_KEYLEN 4
99 /* cnid - dev - inode - type - did - name */
100 #define ROOTINFO_DATA "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0RootInfo"
101 #define ROOTINFO_DATALEN (3*4 +2*8 +9)
104 typedef struct CNID_private {
111 char lock_file[MAXPATHLEN + 1];
114 /* on-disk data format (in network byte order where appropriate) --
115 * db_cnid: (key: cnid)
116 * name size (in bytes)
120 * unix name strlen(name) + 1
122 * db_didname: (key: did/unix name)
123 * -- this also caches the bits of .AppleDouble used by FPGetFilDirParam
124 * so that we don't have to open the header file.
125 * NOTE: FPCatSearch has to search through all of the directories as
126 * this stuff doesn't get entered until needed.
127 * if the entire volume is in the database, though, we can use
128 * cursor operations to make this faster.
130 * version number is stored with did/name key of 0/0
133 * modfiller 4 (dates only use 4 bytes right now, but we leave space
134 * moddate 4 for 8. moddate is also used to keep this info
135 * createfiller 4 up-to-date.)
139 * accfiller 4 (unused)
141 * AFP info 4 (stores a couple permission bits as well)
146 * macname 32 (nul-terminated)
147 * shortname 12 (nul-terminated)
148 * longname longnamelen (nul-terminated)
150 * 132 bytes + longnamelen
152 * db_devino: (key: dev/ino)
153 * -- this is only used for consistency checks and isn't 1-1
156 * these correspond to the different path types. longname is for the
157 * 255 unicode character names (path type == ?), macname is for the
158 * 32-character names (path type == 2), and shortname is for the
159 * 8+3-character names (path type == 1).
161 * db_longname: (key: did/longname)
162 * name namelen = strlen(name) + 1
164 * db_macname: (key: did/macname)
165 * name namelen = strlen(name) + 1
167 * db_shortname: (key: did/shortname)
168 * name namelen = strlen(name) + 1
171 /* construct db_cnid data. NOTE: this is not re-entrant. */
172 extern unsigned char *make_cnid_data __P((const struct stat *,const cnid_t ,
173 const char *, const size_t ));
175 #endif /* atalk/cnid/cnid_private.h */