2 * $Id: volume.h,v 1.19.2.1 2003-05-26 11:04:36 didg Exp $
4 * Copyright (c) 1990,1994 Regents of The University of Michigan.
5 * All Rights Reserved. See COPYRIGHT.
9 #define AFPD_VOLUME_H 1
11 #include <sys/cdefs.h>
12 #include <sys/types.h>
13 #include <netatalk/endian.h>
15 #ifdef HAVE_USABLE_ICONV
21 #define AFPVOL_NAMELEN 27
23 struct codepage_hash {
24 unsigned char *from, *to;
25 struct codepage_hash *next, *prev;
29 struct codepage_hash hash; /* hash for multibyte values */
30 unsigned char value; /* single byte value/rule */
34 union codepage_val *map;
38 #define CP_HASH(a) (*(a))
44 struct dir *v_dir, *v_root;
57 struct codepage *v_mtoupage, *v_utompage, *v_badumap;
74 #ifdef HAVE_USABLE_ICONV
75 iconv_t *v_utf8toucs2;
76 iconv_t *v_ucs2toutf8;
84 char *v_root_postexec;
87 int v_root_preexec_close;
91 #ifdef NO_LARGE_VOL_SUPPORT
92 typedef u_int32_t VolSpace;
93 #else /* NO_LARGE_VOL_SUPPORT */
94 typedef u_int64_t VolSpace;
95 #endif /* NO_LARGE_VOL_SUPPORT */
97 #define AFPVOL_OPEN (1<<0)
98 #define AFPVOL_DT (1<<1)
100 #define AFPVOL_GVSMASK (7<<2)
101 #define AFPVOL_NONE (0<<2)
102 #define AFPVOL_AFSGVS (1<<2)
103 #define AFPVOL_USTATFS (2<<2)
104 #define AFPVOL_UQUOTA (4<<2)
106 /* flags that alter volume behaviour. */
107 #define AFPVOL_A2VOL (1 << 5) /* prodos volume */
108 #define AFPVOL_CRLF (1 << 6) /* cr/lf translation */
109 #define AFPVOL_NOADOUBLE (1 << 7) /* don't create .AppleDouble by default */
110 #define AFPVOL_RO (1 << 8) /* read-only volume */
111 #define AFPVOL_MSWINDOWS (1 << 9) /* deal with ms-windows yuckiness.
112 this is going away. */
113 #define AFPVOL_NOHEX (1 << 10) /* don't do :hex translation */
114 #define AFPVOL_USEDOTS (1 << 11) /* use real dots */
115 #define AFPVOL_LIMITSIZE (1 << 12) /* limit size for older macs */
116 #define AFPVOL_MAPASCII (1 << 13) /* map the ascii range as well */
117 #define AFPVOL_DROPBOX (1 << 14) /* dropkludge dropbox support */
118 #define AFPVOL_NOFILEID (1 << 15) /* don't advertise createid resolveid and deleteid calls */
119 #define AFPVOL_UTF8 (1 << 16) /* unix name are in UTF8 */
121 /* FPGetSrvrParms options */
122 #define AFPSRVR_CONFIGINFO (1 << 0)
123 #define AFPSRVR_PASSWD (1 << 7)
125 /* handle casefolding */
126 #define AFPVOL_MTOUUPPER (1 << 0)
127 #define AFPVOL_MTOULOWER (1 << 1)
128 #define AFPVOL_UTOMUPPER (1 << 2)
129 #define AFPVOL_UTOMLOWER (1 << 3)
130 #define AFPVOL_UMLOWER (AFPVOL_MTOULOWER | AFPVOL_UTOMLOWER)
131 #define AFPVOL_UMUPPER (AFPVOL_MTOUUPPER | AFPVOL_UTOMUPPER)
132 #define AFPVOL_UUPPERMLOWER (AFPVOL_MTOUUPPER | AFPVOL_UTOMLOWER)
133 #define AFPVOL_ULOWERMUPPER (AFPVOL_MTOULOWER | AFPVOL_UTOMUPPER)
135 #define MSWINDOWS_BADCHARS ":\t\\/<>*?|\""
136 #define MSWINDOWS_CODEPAGE "maccode.iso8859-1"
138 int wincheck(const struct vol *vol, const char *path);
140 #define AFPVOLSIG_FLAT 0x0001 /* flat fs */
141 #define AFPVOLSIG_FIX 0x0002 /* fixed ids */
142 #define AFPVOLSIG_VAR 0x0003 /* variable ids */
143 #define AFPVOLSIG_DEFAULT AFPVOLSIG_FIX
145 /* volume attributes */
146 #define VOLPBIT_ATTR_RO (1 << 0)
147 #define VOLPBIT_ATTR_PASSWD (1 << 1)
148 #define VOLPBIT_ATTR_FILEID (1 << 2)
149 #define VOLPBIT_ATTR_CATSEARCH (1 << 3)
150 #define VOLPBIT_ATTR_BLANKACCESS (1 << 4)
151 #define VOLPBIT_ATTR_UNIXPRIV (1 << 5)
152 #define VOLPBIT_ATTR_UTF8 (1 << 6)
153 #define VOLPBIT_ATTR_NONETUID (1 << 7)
155 #define VOLPBIT_ATTR 0
156 #define VOLPBIT_SIG 1
157 #define VOLPBIT_CDATE 2
158 #define VOLPBIT_MDATE 3
159 #define VOLPBIT_BDATE 4
160 #define VOLPBIT_VID 5
161 #define VOLPBIT_BFREE 6
162 #define VOLPBIT_BTOTAL 7
163 #define VOLPBIT_NAME 8
164 /* handle > 4GB volumes */
165 #define VOLPBIT_XBFREE 9
166 #define VOLPBIT_XBTOTAL 10
167 #define VOLPBIT_BSIZE 11 /* block size */
170 #define vol_noadouble(vol) (((vol)->v_flags & AFPVOL_NOADOUBLE) ? \
171 ADFLAGS_NOADOUBLE : 0)
174 #define vol_utf8(vol) ((vol)->v_flags & AFPVOL_UTF8)
175 #define utf8_encoding() (afp_version >= 30)
177 #define vol_utf8(vol) (0)
178 #define utf8_encoding() (0)
181 extern struct vol *getvolbyvid __P((const u_int16_t));
182 extern int ustatfs_getvolspace __P((const struct vol *,
183 VolSpace *, VolSpace *,
185 extern int codepage_init __P((struct vol *, const int,
187 extern int codepage_read __P((struct vol *, const char *));
188 extern union codepage_val codepage_find __P(());
189 extern void setvoltime __P((AFPObj *, struct vol *));
190 extern int pollvoltime __P((AFPObj *));
193 extern int afp_openvol __P((AFPObj *, char *, int, char *, int *));
194 extern int afp_getvolparams __P((AFPObj *, char *, int, char *, int *));
195 extern int afp_setvolparams __P((AFPObj *, char *, int, char *, int *));
196 extern int afp_getsrvrparms __P((AFPObj *, char *, int, char *, int *));
197 extern int afp_closevol __P((AFPObj *, char *, int, char *, int *));
199 /* netatalk functions */
200 extern void close_all_vol __P((void));