netatalk  4.4.0dev
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
include/atalk/volume.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 1990,1994 Regents of The University of Michigan.
3 * All Rights Reserved. See COPYRIGHT.
4 */
5
6#ifndef ATALK_VOLUME_H
7#define ATALK_VOLUME_H 1
8
9#include <stdint.h>
10#include <sys/types.h>
11
12#include <atalk/cnid.h>
13#include <atalk/globals.h>
14#include <atalk/hash.h>
15#include <atalk/unicode.h>
16#include <atalk/vfs.h>
17
18/* AFP3 spec */
19#define AFPVOL_U8MNAMELEN 255
20/* AFP2 spec */
21#define AFPVOL_MACNAMELEN 27
22
23typedef uint64_t VolSpace;
24
25/* This should belong in a file.h */
26struct extmap {
27 char *em_ext;
28 char em_creator[4];
29 char em_type[4];
30};
31
32struct vol {
33 struct vol *v_next;
35 uint16_t v_vid;
37 char *v_path;
38 struct dir *v_root;
39 time_t v_mtime;
40
43 /* flags for convert_charset in mtoupath */
44 uint16_t v_mtou_flags;
45 uint16_t v_utom_flags;
46 /* mac charset encoding in network order */
49 char *v_veto;
50 /* adouble format: v1, v2, sfm ... */
52 /* adouble option NODEV, NOCACHE, etc.. */
54 const char *(*ad_path)(const char *, int);
55 struct _cnid_db *v_cdb;
57 /* Size limit, if any, in MiB */
59 mode_t v_umask;
60 /* default directories permission value OR with requested perm*/
61 mode_t v_dperm;
62 /* default files permission value OR with requested perm*/
63 mode_t v_fperm;
64 /* converted to utf8-mac in ucs2 */
66 /* mangled to legacy longname in ucs2 */
68 /* either v_u8mname or v_macname */
70
71 /* get/set volparams */
72 /* volume creation date, not unix ctime */
73 time_t v_ctime;
74 /* Unix volume device, Set but not used */
75 dev_t v_dev;
76
77 /* adouble VFS indirection */
78 /* pointer to vfs_master_funcs for chaining */
79 struct vfs_ops *vfs;
80 const struct vfs_ops *vfs_modules[4];
81 /* The AFPVOL_EA_xx flag */
83
84 /* misc */
85 char *v_gvs;
87 int v_nfs;
88 /* used bytes on a TM volume */
90 /* time at which v_tm_used was calculated last */
92 /* amount of data appended to files */
94
95 /* only when opening/closing volumes or in error */
97 /* as defined in afpc.conf */
99 /* as defined in afp.conf but with vars expanded */
105 char *v_dbpath;
108#if 0
109 /* new volume wait until old volume is closed */
110 int v_hide;
111 /* volume deleted but there's a new one with the same name */
112 int v_new;
113#endif
114 /* volume open but deleted in new config file */
116#if 0
117 char *v_root_preexec;
118#endif
120#if 0
121 char *v_root_postexec;
122#endif
124#if 0
125 int v_root_preexec_close;
126#endif
128 /* For TimeMachine zeroconf record */
129 char *v_uuid;
130 int v_qfd;
131 /* AFP attributes that shall be ignored */
132 uint32_t v_ignattr;
133};
134
135/* load_volumes() flags */
136typedef enum {
138 /* Skip access checks */
140 /* Reload even if unchanged */
142} lv_flags_t;
143
144/* volume flags */
145#define AFPVOL_OPEN (1<<0)
146
147/* flags for quota 0xxx0 */
148#define AFPVOL_GVSMASK (7<<2)
149#define AFPVOL_NONE (0<<2)
150#if 0
151/* Previously used for Andrew File System */
152#define AFPVOL_AFSGVS (1<<2)
153#endif
154#define AFPVOL_USTATFS (1<<3)
155#define AFPVOL_UQUOTA (1<<4)
156
157/* no adouble:v2 to adouble:ea conversion */
158#define AFPVOL_NOV2TOEACONV (1 << 5)
159/* Index volume for Spotlight searches */
160#define AFPVOL_SPOTLIGHT (1 << 6)
161/* Store Samba compatible xattrs (append 0 byte) */
162#define AFPVOL_EA_SAMBA (1 << 7)
163/* read-only volume */
164#define AFPVOL_RO (1 << 8)
165/* try to preserve ACLs */
166#define AFPVOL_CHMOD_PRESERVE_ACL (1 << 9)
167/* try to preserve ACLs */
168#define AFPVOL_CHMOD_IGNORE (1 << 10)
169/* write metadata xattr as root on sticky dirs */
170#define AFPVOL_FORCE_STICKY_XATTR (1 << 11)
171/* limit size for older macs */
172#define AFPVOL_LIMITSIZE (1 << 12)
173/* prodos volume */
174#define AFPVOL_A2VOL (1 << 13)
175/* advertise the volume even if we can't stat() it
176 * maybe because it will be mounted later in preexec */
177#define AFPVOL_NOSTAT (1 << 16)
178/* support unix privileges */
179#define AFPVOL_UNIX_PRIV (1 << 17)
180/* always use 0 for device number in cnid calls
181 * help if device number is notconsistent across reboot
182 * NOTE symlink to a different device will return an ACCESS error
183 */
184#define AFPVOL_NODEV (1 << 18)
185/* encode illegal sequence 'asis' UCS2, ex "\217-", which is not
186 * a valid SHIFT-JIS char, is encoded as U\217 -*/
187#define AFPVOL_EILSEQ (1 << 20)
188/* dots files are invisible */
189#define AFPVOL_INV_DOTS (1 << 22)
190/* Supports TimeMachine */
191#define AFPVOL_TM (1 << 23)
192/* Volume supports ACLS */
193#define AFPVOL_ACLS (1 << 24)
194/* Use fast CNID db search instead of filesystem */
195#define AFPVOL_SEARCHDB (1 << 25)
196/* signal the client it shall do privelege mapping */
197#define AFPVOL_NONETIDS (1 << 26)
198/* follow symlinks on the server, default is not to */
199#define AFPVOL_FOLLOWSYM (1 << 27)
200/* delete veto files and dirs */
201#define AFPVOL_DELVETO (1 << 28)
202
203/* Extended Attributes vfs indirection */
204/* No EAs */
205#define AFPVOL_EA_NONE 0
206/* try sys, fallback to ad (default) */
207#define AFPVOL_EA_AUTO 1
208/* Store them in native EAs */
209#define AFPVOL_EA_SYS 2
210/* Store them in adouble files */
211#define AFPVOL_EA_AD 3
212
213/* FPGetSrvrParms options */
214#define AFPSRVR_CONFIGINFO (1 << 0)
215#define AFPSRVR_PASSWD (1 << 7)
216
217/* handle casefolding */
218#define AFPVOL_MTOUUPPER (1 << 0)
219#define AFPVOL_MTOULOWER (1 << 1)
220#define AFPVOL_UTOMUPPER (1 << 2)
221#define AFPVOL_UTOMLOWER (1 << 3)
222#define AFPVOL_UMLOWER (AFPVOL_MTOULOWER | AFPVOL_UTOMLOWER)
223#define AFPVOL_UMUPPER (AFPVOL_MTOUUPPER | AFPVOL_UTOMUPPER)
224#define AFPVOL_UUPPERMLOWER (AFPVOL_MTOUUPPER | AFPVOL_UTOMLOWER)
225#define AFPVOL_ULOWERMUPPER (AFPVOL_MTOULOWER | AFPVOL_UTOMUPPER)
226#define AFPVOL_CASESENS (1 << 4)
227
228/* flat fs */
229#define AFPVOLSIG_FLAT 0x0001
230/* fixed ids */
231#define AFPVOLSIG_FIX 0x0002
232/* variable ids */
233#define AFPVOLSIG_VAR 0x0003
234#define AFPVOLSIG_DEFAULT AFPVOLSIG_FIX
235
236/* volume attributes */
237#define VOLPBIT_ATTR_RO (1 << 0)
238#define VOLPBIT_ATTR_PASSWD (1 << 1)
239#define VOLPBIT_ATTR_FILEID (1 << 2)
240#define VOLPBIT_ATTR_CATSEARCH (1 << 3)
241#define VOLPBIT_ATTR_BLANKACCESS (1 << 4)
242#define VOLPBIT_ATTR_UNIXPRIV (1 << 5)
243#define VOLPBIT_ATTR_UTF8 (1 << 6)
244#define VOLPBIT_ATTR_NONETIDS (1 << 7)
245#define VOLPBIT_ATTR_PRIVPARENT (1 << 8)
246#define VOLPBIT_ATTR_NOTFILEXCHG (1 << 9)
247#define VOLPBIT_ATTR_EXT_ATTRS (1 << 10)
248#define VOLPBIT_ATTR_ACLS (1 << 11)
249#define VOLPBIT_ATTR_CASESENS (1 << 12)
250#define VOLPBIT_ATTR_TM (1 << 13)
251
252#define VOLPBIT_ATTR 0
253#define VOLPBIT_SIG 1
254#define VOLPBIT_CDATE 2
255#define VOLPBIT_MDATE 3
256#define VOLPBIT_BDATE 4
257#define VOLPBIT_VID 5
258#define VOLPBIT_BFREE 6
259#define VOLPBIT_BTOTAL 7
260#define VOLPBIT_NAME 8
261/* handle > 4GB volumes */
262#define VOLPBIT_XBFREE 9
263#define VOLPBIT_XBTOTAL 10
264/* block size */
265#define VOLPBIT_BSIZE 11
266
267#define utf8_encoding(obj) ((obj)->afp_version >= 30)
268
269#define vol_nodev(vol) (((vol)->v_flags & AFPVOL_NODEV) ? 1 : 0)
270#define vol_unix_priv(vol) ((vol)->v_obj->afp_version >= 30 && ((vol)->v_flags & AFPVOL_UNIX_PRIV))
271#define vol_inv_dots(vol) (((vol)->v_flags & AFPVOL_INV_DOTS) ? 1 : 0)
272#define vol_syml_opt(vol) (((vol)->v_flags & AFPVOL_FOLLOWSYM) ? 0 : O_NOFOLLOW)
273#define vol_chmod_opt(vol) (((vol)->v_flags & AFPVOL_CHMOD_PRESERVE_ACL) ? O_NETATALK_ACL : \
274 ((vol)->v_flags & AFPVOL_CHMOD_IGNORE) ? O_IGNORE : 0)
275
276#endif
#define ADEDLEN_PRIVSYN
Definition adouble.h:112
lv_flags_t
Definition include/atalk/volume.h:136
@ LV_DEFAULT
Definition include/atalk/volume.h:137
@ LV_ALL
Definition include/atalk/volume.h:139
@ LV_FORCE
Definition include/atalk/volume.h:141
uint64_t VolSpace
Definition include/atalk/volume.h:23
Definition cnid.h:55
Definition globals.h:154
Definition include/atalk/directory.h:62
Definition include/atalk/volume.h:26
char * em_ext
Definition include/atalk/volume.h:27
char em_type[4]
Definition include/atalk/volume.h:29
char em_creator[4]
Definition include/atalk/volume.h:28
Definition vfs.h:98
Definition include/atalk/volume.h:32
char * v_postexec
Definition include/atalk/volume.h:123
void * v_nfsclient
Definition include/atalk/volume.h:86
char * v_volcodepage
Definition include/atalk/volume.h:101
uint32_t v_kTextEncoding
Definition include/atalk/volume.h:47
ucs2_t * v_name
Definition include/atalk/volume.h:69
char * v_password
Definition include/atalk/volume.h:103
dev_t v_dev
Definition include/atalk/volume.h:75
uint16_t v_utom_flags
Definition include/atalk/volume.h:45
struct dir * v_root
Definition include/atalk/volume.h:38
ucs2_t * v_u8mname
Definition include/atalk/volume.h:65
uint16_t v_vid
Definition include/atalk/volume.h:35
time_t v_tm_cachetime
Definition include/atalk/volume.h:91
int v_flags
Definition include/atalk/volume.h:36
int v_ad_options
Definition include/atalk/volume.h:53
int v_adouble
Definition include/atalk/volume.h:51
AFPObj * v_obj
Definition include/atalk/volume.h:34
char * v_path
Definition include/atalk/volume.h:37
char * v_veto
Definition include/atalk/volume.h:49
charset_t v_volcharset
Definition include/atalk/volume.h:41
char * v_cnidport
Definition include/atalk/volume.h:107
VolSpace v_appended
Definition include/atalk/volume.h:93
VolSpace v_limitsize
Definition include/atalk/volume.h:58
int v_preexec_close
Definition include/atalk/volume.h:127
char * v_cnidserver
Definition include/atalk/volume.h:106
mode_t v_dperm
Definition include/atalk/volume.h:61
struct vfs_ops * vfs
Definition include/atalk/volume.h:79
char * v_maccodepage
Definition include/atalk/volume.h:102
int v_nfs
Definition include/atalk/volume.h:87
const struct vfs_ops * vfs_modules[4]
Definition include/atalk/volume.h:80
char * v_localname
Definition include/atalk/volume.h:100
char * v_configname
Definition include/atalk/volume.h:98
ucs2_t * v_macname
Definition include/atalk/volume.h:67
mode_t v_fperm
Definition include/atalk/volume.h:63
charset_t v_maccharset
Definition include/atalk/volume.h:42
uint16_t v_mtou_flags
Definition include/atalk/volume.h:44
size_t max_filename
Definition include/atalk/volume.h:48
mode_t v_umask
Definition include/atalk/volume.h:59
VolSpace v_tm_used
Definition include/atalk/volume.h:89
char * v_preexec
Definition include/atalk/volume.h:119
char * v_gvs
Definition include/atalk/volume.h:85
char * v_cnidscheme
Definition include/atalk/volume.h:104
time_t v_mtime
Definition include/atalk/volume.h:39
time_t v_ctime
Definition include/atalk/volume.h:73
struct vol * v_next
Definition include/atalk/volume.h:33
int v_deleted
Definition include/atalk/volume.h:115
int v_vfs_ea
Definition include/atalk/volume.h:82
char * v_dbpath
Definition include/atalk/volume.h:105
char * v_uuid
Definition include/atalk/volume.h:129
struct _cnid_db * v_cdb
Definition include/atalk/volume.h:55
uint32_t v_ignattr
Definition include/atalk/volume.h:132
int v_qfd
Definition include/atalk/volume.h:130
int v_casefold
Definition include/atalk/volume.h:96
char v_stamp[ADEDLEN_PRIVSYN]
Definition include/atalk/volume.h:56
#define ucs2_t
Definition unicode.h:8
charset_t
Definition unicode.h:68