2 * $Id: volume.h,v 1.25 2008-08-31 13:26:00 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"
20 #define AFPVOL_NAMELEN 27
22 #include <atalk/cnid.h>
29 struct dir *v_dir, *v_root;
37 time_t v_ctime; /* volume creation date, not unix ctime */
51 dev_t v_dev; /* Unix volume device */
52 struct _cnid_db *v_cdb;
53 char v_stamp[ADEDLEN_PRIVSYN];
55 mode_t v_perm; /* default permission value OR with requested perm*/
63 charset_t v_volcharset;
64 struct charset_functions *v_vol;
66 charset_t v_maccharset;
67 struct charset_functions *v_mac;
69 int v_deleted; /* volume open but deleted in new config file */
70 int v_hide; /* new volume wait until old volume is closed */
71 int v_new; /* volume deleted but there's a new one with the same name */
72 int v_adouble; /* default adouble format */
73 int v_ad_options; /* adouble option NODEV, NOCACHE, etc.. */
78 char *v_root_postexec;
81 int v_root_preexec_close;
84 /* adouble indirection */
86 int (*validupath)(const struct vol *, const char *);
87 char *(*ad_path)(const char *, int);
90 #ifdef NO_LARGE_VOL_SUPPORT
91 typedef u_int32_t VolSpace;
92 #else /* NO_LARGE_VOL_SUPPORT */
93 typedef u_int64_t VolSpace;
94 #endif /* NO_LARGE_VOL_SUPPORT */
96 #define AFPVOL_OPEN (1<<0)
98 /* flags for AFS and quota 0xxx0 */
99 #define AFPVOL_GVSMASK (7<<2)
100 #define AFPVOL_NONE (0<<2)
101 #define AFPVOL_AFSGVS (1<<2)
102 #define AFPVOL_USTATFS (2<<2)
103 #define AFPVOL_UQUOTA (4<<2)
105 /* flags that alter volume behaviour. */
106 #define AFPVOL_A2VOL (1 << 5) /* prodos volume */
107 #define AFPVOL_CRLF (1 << 6) /* cr/lf translation */
108 #define AFPVOL_NOADOUBLE (1 << 7) /* don't create .AppleDouble by default */
109 #define AFPVOL_RO (1 << 8) /* read-only volume */
110 #define AFPVOL_MSWINDOWS (1 << 9) /* deal with ms-windows yuckiness.
111 this is going away. */
112 #define AFPVOL_NOHEX (1 << 10) /* don't do :hex translation */
113 #define AFPVOL_USEDOTS (1 << 11) /* use real dots */
114 #define AFPVOL_LIMITSIZE (1 << 12) /* limit size for older macs */
115 #define AFPVOL_MAPASCII (1 << 13) /* map the ascii range as well */
116 #define AFPVOL_DROPBOX (1 << 14) /* dropkludge dropbox support */
117 #define AFPVOL_NOFILEID (1 << 15) /* don't advertise createid resolveid and deleteid calls */
118 #define AFPVOL_NOSTAT (1 << 16) /* advertise the volume even if we can't stat() it
119 * maybe because it will be mounted later in preexec */
120 #define AFPVOL_UNIX_PRIV (1 << 17) /* support unix privileges */
121 #define AFPVOL_NODEV (1 << 18) /* always use 0 for device number in cnid calls
122 * help if device number is notconsistent across reboot
123 * NOTE symlink to a different device will return an ACCESS error
125 #define AFPVOL_RESERVED (1 << 19) /* was AFPVOL_CASEINSEN, volume is case insensitive */
126 #define AFPVOL_EILSEQ (1 << 20) /* encode illegal sequence 'asis' UCS2, ex "\217-", which is not
127 a valid SHIFT-JIS char, is encoded as U\217 -*/
129 #define AFPVOL_CACHE (1 << 21) /* Use adouble v2 CNID caching, default don't use it */
130 #define AFPVOL_INV_DOTS (1 << 22) /* dots files are invisible */
132 /* FPGetSrvrParms options */
133 #define AFPSRVR_CONFIGINFO (1 << 0)
134 #define AFPSRVR_PASSWD (1 << 7)
136 /* handle casefolding */
137 #define AFPVOL_MTOUUPPER (1 << 0)
138 #define AFPVOL_MTOULOWER (1 << 1)
139 #define AFPVOL_UTOMUPPER (1 << 2)
140 #define AFPVOL_UTOMLOWER (1 << 3)
141 #define AFPVOL_UMLOWER (AFPVOL_MTOULOWER | AFPVOL_UTOMLOWER)
142 #define AFPVOL_UMUPPER (AFPVOL_MTOUUPPER | AFPVOL_UTOMUPPER)
143 #define AFPVOL_UUPPERMLOWER (AFPVOL_MTOUUPPER | AFPVOL_UTOMLOWER)
144 #define AFPVOL_ULOWERMUPPER (AFPVOL_MTOULOWER | AFPVOL_UTOMUPPER)
146 #define MSWINDOWS_BADCHARS ":\t\\/<>*?|\""
148 int wincheck(const struct vol *vol, const char *path);
150 #define AFPVOLSIG_FLAT 0x0001 /* flat fs */
151 #define AFPVOLSIG_FIX 0x0002 /* fixed ids */
152 #define AFPVOLSIG_VAR 0x0003 /* variable ids */
153 #define AFPVOLSIG_DEFAULT AFPVOLSIG_FIX
155 /* volume attributes */
156 #define VOLPBIT_ATTR_RO (1 << 0)
157 #define VOLPBIT_ATTR_PASSWD (1 << 1)
158 #define VOLPBIT_ATTR_FILEID (1 << 2)
159 #define VOLPBIT_ATTR_CATSEARCH (1 << 3)
160 #define VOLPBIT_ATTR_BLANKACCESS (1 << 4)
161 #define VOLPBIT_ATTR_UNIXPRIV (1 << 5)
162 #define VOLPBIT_ATTR_UTF8 (1 << 6)
163 #define VOLPBIT_ATTR_NONETUID (1 << 7)
165 #define VOLPBIT_ATTR 0
166 #define VOLPBIT_SIG 1
167 #define VOLPBIT_CDATE 2
168 #define VOLPBIT_MDATE 3
169 #define VOLPBIT_BDATE 4
170 #define VOLPBIT_VID 5
171 #define VOLPBIT_BFREE 6
172 #define VOLPBIT_BTOTAL 7
173 #define VOLPBIT_NAME 8
174 /* handle > 4GB volumes */
175 #define VOLPBIT_XBFREE 9
176 #define VOLPBIT_XBTOTAL 10
177 #define VOLPBIT_BSIZE 11 /* block size */
180 #define vol_noadouble(vol) (((vol)->v_flags & AFPVOL_NOADOUBLE) ? \
181 ADFLAGS_NOADOUBLE : 0)
183 #define utf8_encoding() (afp_version >= 30)
185 #define utf8_encoding() (0)
188 #define vol_nodev(vol) (((vol)->v_flags & AFPVOL_NODEV) ? 1 : 0)
190 #define vol_unix_priv(vol) (afp_version >= 30 && ((vol)->v_flags & AFPVOL_UNIX_PRIV))
192 #define vol_inv_dots(vol) (((vol)->v_flags & AFPVOL_INV_DOTS) ? 1 : 0)
194 extern struct vol *getvolbyvid __P((const u_int16_t));
195 extern int ustatfs_getvolspace __P((const struct vol *,
196 VolSpace *, VolSpace *,
198 extern void setvoltime __P((AFPObj *, struct vol *));
199 extern int pollvoltime __P((AFPObj *));
200 extern void load_volumes __P((AFPObj *obj));
203 extern int afp_openvol __P((AFPObj *, char *, int, char *, int *));
204 extern int afp_getvolparams __P((AFPObj *, char *, int, char *, int *));
205 extern int afp_setvolparams __P((AFPObj *, char *, int, char *, int *));
206 extern int afp_getsrvrparms __P((AFPObj *, char *, int, char *, int *));
207 extern int afp_closevol __P((AFPObj *, char *, int, char *, int *));
209 /* netatalk functions */
210 extern void close_all_vol __P((void));