2 * $Id: volume.h,v 1.19.2.5 2003-07-21 05:50:54 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 #include "atalk/unicode.h"
16 #ifdef HAVE_USABLE_ICONV
22 #define AFPVOL_NAMELEN 27
24 struct codepage_hash {
25 unsigned char *from, *to;
26 struct codepage_hash *next, *prev;
30 struct codepage_hash hash; /* hash for multibyte values */
31 unsigned char value; /* single byte value/rule */
35 union codepage_val *map;
39 #define CP_HASH(a) (*(a))
45 struct dir *v_dir, *v_root;
58 struct codepage *v_mtoupage, *v_utompage, *v_badumap;
76 charset_t v_maccharset;
78 int v_deleted; /* volume open but deleted in new config file */
79 int v_hide; /* new volume wait open volume */
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 */
120 #define AFPVOL_NOSTAT (1 << 17) /* unix name are in UTF8 */
121 #define AFPVOL_UNIX_PRIV (1 << 18) /* support unix privileges */
123 /* FPGetSrvrParms options */
124 #define AFPSRVR_CONFIGINFO (1 << 0)
125 #define AFPSRVR_PASSWD (1 << 7)
127 /* handle casefolding */
128 #define AFPVOL_MTOUUPPER (1 << 0)
129 #define AFPVOL_MTOULOWER (1 << 1)
130 #define AFPVOL_UTOMUPPER (1 << 2)
131 #define AFPVOL_UTOMLOWER (1 << 3)
132 #define AFPVOL_UMLOWER (AFPVOL_MTOULOWER | AFPVOL_UTOMLOWER)
133 #define AFPVOL_UMUPPER (AFPVOL_MTOUUPPER | AFPVOL_UTOMUPPER)
134 #define AFPVOL_UUPPERMLOWER (AFPVOL_MTOUUPPER | AFPVOL_UTOMLOWER)
135 #define AFPVOL_ULOWERMUPPER (AFPVOL_MTOULOWER | AFPVOL_UTOMUPPER)
137 #define MSWINDOWS_BADCHARS ":\t\\/<>*?|\""
138 #define MSWINDOWS_CODEPAGE "maccode.iso8859-1"
140 int wincheck(const struct vol *vol, const char *path);
142 #define AFPVOLSIG_FLAT 0x0001 /* flat fs */
143 #define AFPVOLSIG_FIX 0x0002 /* fixed ids */
144 #define AFPVOLSIG_VAR 0x0003 /* variable ids */
145 #define AFPVOLSIG_DEFAULT AFPVOLSIG_FIX
147 /* volume attributes */
148 #define VOLPBIT_ATTR_RO (1 << 0)
149 #define VOLPBIT_ATTR_PASSWD (1 << 1)
150 #define VOLPBIT_ATTR_FILEID (1 << 2)
151 #define VOLPBIT_ATTR_CATSEARCH (1 << 3)
152 #define VOLPBIT_ATTR_BLANKACCESS (1 << 4)
153 #define VOLPBIT_ATTR_UNIXPRIV (1 << 5)
154 #define VOLPBIT_ATTR_UTF8 (1 << 6)
155 #define VOLPBIT_ATTR_NONETUID (1 << 7)
157 #define VOLPBIT_ATTR 0
158 #define VOLPBIT_SIG 1
159 #define VOLPBIT_CDATE 2
160 #define VOLPBIT_MDATE 3
161 #define VOLPBIT_BDATE 4
162 #define VOLPBIT_VID 5
163 #define VOLPBIT_BFREE 6
164 #define VOLPBIT_BTOTAL 7
165 #define VOLPBIT_NAME 8
166 /* handle > 4GB volumes */
167 #define VOLPBIT_XBFREE 9
168 #define VOLPBIT_XBTOTAL 10
169 #define VOLPBIT_BSIZE 11 /* block size */
172 #define vol_noadouble(vol) (((vol)->v_flags & AFPVOL_NOADOUBLE) ? \
173 ADFLAGS_NOADOUBLE : 0)
176 #define vol_utf8(vol) ((vol)->v_flags & AFPVOL_UTF8)
177 #define utf8_encoding() (afp_version >= 30)
179 #define vol_utf8(vol) (0)
180 #define utf8_encoding() (0)
182 #define vol_unix_priv(vol) (afp_version >= 30 && ((vol)->v_flags & AFPVOL_UNIX_PRIV))
184 extern struct vol *getvolbyvid __P((const u_int16_t));
185 extern int ustatfs_getvolspace __P((const struct vol *,
186 VolSpace *, VolSpace *,
188 extern int codepage_init __P((struct vol *, const int,
190 extern void codepage_free __P((struct vol *vol));
192 extern int codepage_read __P((struct vol *, const char *));
193 extern union codepage_val codepage_find __P(());
194 extern void setvoltime __P((AFPObj *, struct vol *));
195 extern int pollvoltime __P((AFPObj *));
196 extern void load_volumes __P((AFPObj *obj));
199 extern int afp_openvol __P((AFPObj *, char *, int, char *, int *));
200 extern int afp_getvolparams __P((AFPObj *, char *, int, char *, int *));
201 extern int afp_setvolparams __P((AFPObj *, char *, int, char *, int *));
202 extern int afp_getsrvrparms __P((AFPObj *, char *, int, char *, int *));
203 extern int afp_closevol __P((AFPObj *, char *, int, char *, int *));
205 /* netatalk functions */
206 extern void close_all_vol __P((void));