netatalk: adouble.h Source File

netatalk 4.5.1
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
adouble.h
Go to the documentation of this file.
1/*
2* Copyright (c) 1990,1991 Regents of The University of Michigan.
3* All Rights Reserved.
4*
5* Permission to use, copy, modify, and distribute this software and
6* its documentation for any purpose and without fee is hereby granted,
7* provided that the above copyright notice appears in all copies and
8* that both that copyright notice and this permission notice appear
9* in supporting documentation, and that the name of The University
10* of Michigan not be used in advertising or publicity pertaining to
11* distribution of the software without specific, written prior
12* permission. This software is supplied as is without expressed or
13* implied warranties of any kind.
14*
15* Research Systems Unix Group
16* The University of Michigan
17* c/o Mike Clark
18* 535 W. William Street
19* Ann Arbor, Michigan
20* +1-313-763-0525
21* netatalk@itd.umich.edu
22*/
23
28
29#ifndef _ATALK_ADOUBLE_H
30#define _ATALK_ADOUBLE_H
31
32#ifdef HAVE_CONFIG_H
33#include "config.h"
34#endif
35
36#include <fcntl.h>
37#include <inttypes.h>
38#include <sys/mman.h>
39#include <sys/stat.h>
40#include <sys/time.h>
41#include <sys/types.h>
42#include <unistd.h>
43
44/* version info */
45#define AD_VERSION2 0x00020000
46#define AD_VERSION_EA 0x00020002
47
48/* default */
49#define AD_VERSION AD_VERSION_EA
50
51/*
52 * AppleDouble entry IDs.
53 */
54#define ADEID_DFORK 1
55#define ADEID_RFORK 2
56#define ADEID_NAME 3
57#define ADEID_COMMENT 4
58#define ADEID_ICONBW 5
59#define ADEID_ICONCOL 6
60#define ADEID_FILEI 7
61#define ADEID_FILEDATESI 8
62#define ADEID_FINDERI 9
63#define ADEID_MACFILEI 10
64#define ADEID_PRODOSFILEI 11
65#define ADEID_MSDOSFILEI 12
66#define ADEID_SHORTNAME 13
67#define ADEID_AFPFILEI 14
68#define ADEID_DID 15
69
70/* netatalk private note fileid reused DID */
71#define ADEID_PRIVDEV 16
72#define ADEID_PRIVINO 17
73#define ADEID_PRIVSYN 18
74#define ADEID_PRIVID 19
75#define ADEID_MAX (ADEID_PRIVID + 1)
76
77/* These are the real ids for these entries, as stored in the adouble file */
78#define AD_DEV 0x80444556
79#define AD_INO 0x80494E4F
80#define AD_SYN 0x8053594E
81#define AD_ID 0x8053567E
82
83/* magic */
84#define AD_APPLESINGLE_MAGIC 0x00051600
85#define AD_APPLEDOUBLE_MAGIC 0x00051607
86#define AD_MAGIC AD_APPLEDOUBLE_MAGIC
87
88/* sizes of relevant entry bits */
89#define ADEDLEN_MAGIC 4
90#define ADEDLEN_VERSION 4
91#define ADEDLEN_FILLER 16
92#define ADEDLEN_NENTRIES 2
93#define AD_HEADER_LEN (ADEDLEN_MAGIC + ADEDLEN_VERSION + ADEDLEN_FILLER + ADEDLEN_NENTRIES)
94#define AD_ENTRY_LEN 12
95
96/* field widths */
97#define ADEDLEN_NAME 255
98#define ADEDLEN_COMMENT 200
99#define ADEDLEN_FILEI 16
100#define ADEDLEN_FINDERI 32
101#define ADEDLEN_FILEDATESI 16
102#define ADEDLEN_SHORTNAME 12
103#define ADEDLEN_AFPFILEI 4
104#define ADEDLEN_MACFILEI 4
105#define ADEDLEN_PRODOSFILEI 8
106#define ADEDLEN_MSDOSFILEI 2
107#define ADEDLEN_ICONBW 128
108#define ADEDLEN_ICONCOL 1024
109#define ADEDLEN_DID 4
110#define ADEDLEN_PRIVDEV 8
111#define ADEDLEN_PRIVINO 8
112#define ADEDLEN_PRIVSYN 8
113#define ADEDLEN_PRIVID 4
114
115#define ADEID_NUM_V2 13
116#define ADEID_NUM_EA 8
117#define ADEID_NUM_OSX 2
118
119#define AD_DATASZ2 (AD_HEADER_LEN + ADEDLEN_NAME + ADEDLEN_COMMENT + ADEDLEN_FILEI + \
120 ADEDLEN_FINDERI + ADEDLEN_DID + ADEDLEN_AFPFILEI + ADEDLEN_SHORTNAME + \
121 ADEDLEN_PRODOSFILEI + ADEDLEN_PRIVDEV + ADEDLEN_PRIVINO + \
122 ADEDLEN_PRIVSYN + ADEDLEN_PRIVID + (ADEID_NUM_V2 * AD_ENTRY_LEN))
123#if AD_DATASZ2 != 741
124#error bad size for AD_DATASZ2
125#endif
126
127#define AD_DATASZ_EA (AD_HEADER_LEN + (ADEID_NUM_EA * AD_ENTRY_LEN) + \
128 ADEDLEN_FINDERI + ADEDLEN_COMMENT + ADEDLEN_FILEDATESI + ADEDLEN_AFPFILEI + \
129 ADEDLEN_PRIVDEV + ADEDLEN_PRIVINO + ADEDLEN_PRIVSYN + ADEDLEN_PRIVID)
130
131#if AD_DATASZ_EA != 402
132#error bad size for AD_DATASZ_EA
133#endif
134
135#define AD_DATASZ_OSX (AD_HEADER_LEN + (ADEID_NUM_OSX * AD_ENTRY_LEN) + ADEDLEN_FINDERI)
136
137#if AD_DATASZ_OSX != 82
138#error bad size for AD_DATASZ_OSX
139#endif
140
141#define AD_DATASZ_MAX 1024
142
143#if AD_VERSION == AD_VERSION2
144#define AD_DATASZ AD_DATASZ2
145#elif AD_VERSION == AD_VERSION_EA
146#define AD_DATASZ AD_DATASZ_EA
147#endif
148
149/* fallback for ad:ea on filesystems without fds for EAs, like old adouble:osx */
150#define ADEDOFF_FINDERI_OSX (AD_HEADER_LEN + ADEID_NUM_OSX*AD_ENTRY_LEN)
151#define ADEDOFF_RFORK_OSX (ADEDOFF_FINDERI_OSX + ADEDLEN_FINDERI)
152
154#define AD_SYMLINK -2
155
156 typedef uint32_t cnid_t;
157
158 struct ad_entry {
159 off_t ade_off;
160 ssize_t ade_len;
161};
162
163 typedef struct adf_lock_t {
164 struct flock lock;
165 int user;
166 int *refcount;
167} adf_lock_t;
168
169 struct ad_fd {
170 int adf_fd;
171 char *adf_syml;
172 int adf_flags;
173 adf_lock_t *adf_lock;
174 int adf_refcount, adf_lockcount, adf_lockmax;
175};
176
177/* some header protection */
178#define AD_INITED 0xad494e54
179#define AD_CLOSED 0xadc10ced
180
181struct adouble;
182
183 struct adouble_fops {
184 const char *(*ad_path)(const char *, int);
185 int (*ad_mkrf)(const char *);
186 int (*ad_rebuild_header)(struct adouble *);
187 int (*ad_header_read)(const char *, struct adouble *, const struct stat *);
188 int (*ad_header_upgrade)(struct adouble *, const char *);
189};
190
191 struct adouble {
192 uint32_t ad_magic;
193 uint32_t ad_version;
194 char ad_filler[16];
195 struct ad_entry ad_eid[ADEID_MAX];
196
197 struct ad_fd ad_data_fork;
198
199 struct ad_fd ad_resource_fork;
201
202 struct ad_fd *ad_rfp;
204
205 struct ad_fd *ad_mdp;
207
208 int ad_vers;
209 int ad_adflags;
210 uint32_t ad_inited;
211 int ad_options;
212 int ad_refcount;
213 int ad_data_refcount;
214 int ad_meta_refcount;
215 int ad_reso_refcount;
216 off_t ad_rlen;
218 char *ad_name;
219 struct adouble_fops *ad_ops;
220 uint16_t ad_open_forks;
221 size_t valid_data_len;
222 char ad_data[AD_DATASZ_MAX];
223};
224
225#define ADFLAGS_DF (1<<0)
226#define ADFLAGS_RF (1<<1)
227#define ADFLAGS_HF (1<<2)
228#define ADFLAGS_DIR (1<<3)
229#define ADFLAGS_NOHF (1<<4)
230#define ADFLAGS_NORF (1<<5)
231#define ADFLAGS_CHECK_OF (1<<6)
232#define ADFLAGS_SETSHRMD (1<<7)
238#define ADFLAGS_RDWR (1<<8)
239#define ADFLAGS_RDONLY (1<<9)
240#define ADFLAGS_CREATE (1<<10)
241#define ADFLAGS_EXCL (1<<11)
242#define ADFLAGS_TRUNC (1<<12)
243
244#define ADVOL_NODEV (1 << 0)
245#define ADVOL_RO (1 << 1)
246#define ADVOL_UNIXPRIV (1 << 2)
247#define ADVOL_INVDOTS (1 << 3)
248#define ADVOL_FOLLO_SYML (1 << 4)
249#define ADVOL_FORCE_STICKY_XATTR (1 << 5)
250
251/* lock flags */
252#define ADLOCK_CLR (0)
253#define ADLOCK_RD (1<<0)
254#define ADLOCK_WR (1<<1)
255#define ADLOCK_MASK (ADLOCK_RD | ADLOCK_WR)
256#define ADLOCK_UPGRADE (1<<2)
257#define ADLOCK_FILELOCK (1<<3)
258
259/* we use this so that we can use the same mechanism for both byte
260 * locks and file synchronization locks. */
261#if _FILE_OFFSET_BITS == 64
262#define AD_FILELOCK_BASE (UINT64_C(0x7FFFFFFFFFFFFFFF) - 9)
263#else
264#define AD_FILELOCK_BASE (UINT32_C(0x7FFFFFFF) - 9)
265#endif
266
267#define BYTELOCK_MAX (AD_FILELOCK_BASE - 1)
268
269/* datafork and rsrcfork sharemode locks */
270#define AD_FILELOCK_OPEN_WR (AD_FILELOCK_BASE + 0)
271#define AD_FILELOCK_OPEN_RD (AD_FILELOCK_BASE + 1)
272#define AD_FILELOCK_RSRC_OPEN_WR (AD_FILELOCK_BASE + 2)
273#define AD_FILELOCK_RSRC_OPEN_RD (AD_FILELOCK_BASE + 3)
274
275#define AD_FILELOCK_DENY_WR (AD_FILELOCK_BASE + 4)
276#define AD_FILELOCK_DENY_RD (AD_FILELOCK_BASE + 5)
277#define AD_FILELOCK_RSRC_DENY_WR (AD_FILELOCK_BASE + 6)
278#define AD_FILELOCK_RSRC_DENY_RD (AD_FILELOCK_BASE + 7)
279
280#define AD_FILELOCK_OPEN_NONE (AD_FILELOCK_BASE + 8)
281#define AD_FILELOCK_RSRC_OPEN_NONE (AD_FILELOCK_BASE + 9)
282
283/* time stuff. we overload the bits a little. */
284#define AD_DATE_CREATE 0
285#define AD_DATE_MODIFY 4
286#define AD_DATE_BACKUP 8
287#define AD_DATE_ACCESS 12
288#define AD_DATE_MASK (AD_DATE_CREATE | AD_DATE_MODIFY | \
289 AD_DATE_BACKUP | AD_DATE_ACCESS)
290#define AD_DATE_UNIX (1 << 10)
291#define AD_DATE_START htonl(0x80000000)
292#define AD_DATE_DELTA 946684800
293#define AD_DATE_FROM_UNIX(x) htonl((x) - AD_DATE_DELTA)
294#define AD_DATE_TO_UNIX(x) (ntohl(x) + AD_DATE_DELTA)
295
296/* various finder offset and info bits */
297#define FINDERINFO_FRTYPEOFF 0
298#define FINDERINFO_FRCREATOFF 4
299#define FINDERINFO_FRFLAGOFF 8
300
301/* FinderInfo Flags, char in `ad ls`, valid for files|dirs */
302#define FINDERINFO_ISONDESK (1)
303#define FINDERINFO_COLOR (0x0e)
304#define FINDERINFO_HIDEEXT (1<<4)
305#define FINDERINFO_ISHARED (1<<6)
306#define FINDERINFO_HASNOINITS (1<<7)
307#define FINDERINFO_HASBEENINITED (1<<8)
308#define FINDERINFO_HASCUSTOMICON (1<<10)
309#define FINDERINFO_ISSTATIONNERY (1<<11)
310#define FINDERINFO_NAMELOCKED (1<<12)
311#define FINDERINFO_HASBUNDLE (1<<13)
312#define FINDERINFO_INVISIBLE (1<<14)
313#define FINDERINFO_ISALIAS (1<<15)
314
315#define FINDERINFO_FRVIEWOFF 14
316#define FINDERINFO_CUSTOMICON 0x4
317#define FINDERINFO_CLOSEDVIEW 0x100
318
319/*
320 The "shared" and "invisible" attributes are opaque and stored and
321 retrieved from the FinderFlags. This fixes Bug #2802236:
322 <https://sourceforge.net/tracker/?func=detail&aid=2802236&group_id=8642&atid=108642>
323*/
324
325/* AFP attributes, char in `ad ls`, valid for files|dirs */
326#define ATTRBIT_INVISIBLE (1<<0)
327#define ATTRBIT_MULTIUSER (1<<1)
328#define ATTRBIT_SYSTEM (1<<2)
329#define ATTRBIT_DOPEN (1<<3)
330#define ATTRBIT_ROPEN (1<<4)
331#define ATTRBIT_NOWRITE (1<<5)
332#define ATTRBIT_BACKUP (1<<6)
333#define ATTRBIT_NORENAME (1<<7)
334#define ATTRBIT_NODELETE (1<<8)
335#define ATTRBIT_NOCOPY (1<<10)
336#define ATTRBIT_SETCLR (1<<15)
337
338/* AFP attributes for dirs. These should probably be computed on the fly.
339 * We don't do that, nor does e.g. OS S X 10.5 Server */
340#define ATTRBIT_EXPFLDR (1<<1)
341#define ATTRBIT_MOUNTED (1<<3)
342#define ATTRBIT_SHARED (1<<4)
343
344/* private AFPFileInfo bits */
345#define AD_AFPFILEI_OWNER (1 << 0)
346#define AD_AFPFILEI_GROUP (1 << 1)
347#define AD_AFPFILEI_BLANKACCESS (1 << 2)
348
349/*
350 * String identifiers for the 16 AppleDouble filler bytes
351 */
352#define AD_FILLER_NETATALK "Netatalk "
353#define AD_FILLER_OSX "Mac OS X"
354
355#define ad_data_fileno(ad) ((ad)->ad_data_fork.adf_fd)
356#define ad_reso_fileno(ad) ((ad)->ad_rfp->adf_fd)
357#define ad_meta_fileno(ad) ((ad)->ad_mdp->adf_fd)
358
359/* -1: not open, AD_SYMLINK (-2): it's a symlink */
360#define AD_DATA_OPEN(ad) (((ad)->ad_data_refcount) && (ad_data_fileno(ad) >= 0))
361#define AD_META_OPEN(ad) (((ad)->ad_meta_refcount) && (ad_meta_fileno(ad) >= 0))
362#define AD_RSRC_OPEN(ad) (((ad)->ad_reso_refcount) && (ad_reso_fileno(ad) >= 0))
363
364#define ad_getversion(ad) ((ad)->ad_version)
365
366#define ad_getentrylen(ad,eid) ((ad)->ad_eid[(eid)].ade_len)
367#define ad_setentrylen(ad,eid,len) ((ad)->ad_eid[(eid)].ade_len = (len))
368#define ad_setentryoff(ad,eid,off) ((ad)->ad_eid[(eid)].ade_off = (off))
369
370#define ad_get_RF_flags(ad) ((ad)->ad_rfp->adf_flags)
371#define ad_get_MD_flags(ad) ((ad)->ad_mdp->adf_flags)
372
373/* Refcounting open forks using one struct adouble */
374#define ad_ref(ad) (ad)->ad_refcount++
375#define ad_unref(ad) --((ad)->ad_refcount)
376
377#define ad_get_syml_opt(ad) (((ad)->ad_options & ADVOL_FOLLO_SYML) ? 0 : O_NOFOLLOW)
378
379/* ad_flush.c */
380extern int ad_rebuild_adouble_header_v2(struct adouble *);
381extern int ad_rebuild_adouble_header_ea(struct adouble *);
382extern int ad_rebuild_adouble_header_osx(struct adouble *ad, char *adbuf);
383extern int ad_copy_header(struct adouble *, struct adouble *);
384extern int ad_flush(struct adouble *);
385extern int ad_close(struct adouble *, int);
386 extern int fsetrsrcea(struct adouble *ad, int fd, const char *eaname,
387 const void *value, size_t size, int flags);
388
389/* ad_lock.c */
390extern int ad_testlock(struct adouble *adp, int eid, off_t off);
391extern uint16_t ad_openforks(struct adouble *adp, uint16_t);
392extern int ad_lock(struct adouble *, uint32_t eid, int type, off_t off,
393 off_t len, int fork);
394extern void ad_unlock(struct adouble *, int fork, int unlckbrl);
395extern void adf_lock_init(struct ad_fd *adf);
396extern void adf_lock_free(struct ad_fd *adf);
397extern int ad_tmplock(struct adouble *, uint32_t eid, int type, off_t off,
398 off_t len, int fork);
399
400/* ad_open.c */
401extern void *ad_entry(const struct adouble *ad, int eid);
402extern off_t ad_getentryoff(const struct adouble *ad, int eid);
403extern const char *adflags2logstr(int adflags);
404extern int ad_setfuid(const uid_t);
405extern uid_t ad_getfuid(void);
406extern char *ad_dir(const char *);
407extern const char *ad_path(const char *, int);
408extern const char *ad_path_ea(const char *, int);
409extern const char *ad_path_osx(const char *path, int adflags);
410extern int ad_mode(const char *, mode_t);
411extern int ad_mkdir(const char *, mode_t);
412struct vol;
413extern void ad_init(struct adouble *, const struct vol *);
414extern void ad_init_old(struct adouble *ad, int flags, int options);
415extern int ad_init_offsets(struct adouble *ad);
416extern int ad_open(struct adouble *ad, const char *path, int adflags, ...);
417#ifdef __APPLE__
418extern int ad_open_native_finderinfo(const char *path, char *ret);
419#endif
420extern int ad_openat(struct adouble *, int dirfd, const char *path,
421 int adflags, ...);
422extern int ad_refresh(const char *path, struct adouble *);
423extern int ad_stat(const char *, struct stat *);
424extern int ad_metadata(const char *, int, struct adouble *);
425extern int ad_metadataat(int, const char *, int, struct adouble *);
426extern mode_t ad_hf_mode(mode_t mode);
427extern int ad_valid_header_osx(const char *path);
428extern off_t ad_reso_size(const char *path, int adflags, struct adouble *ad);
429
430/* ad_conv.c */
431extern int ad_convert(const char *path, const struct stat *sp,
432 const struct vol *vol, const char **newpath);
433
434/* ad_read.c/ad_write.c */
435extern int sys_ftruncate(int fd, off_t length);
436extern ssize_t ad_read(struct adouble *, uint32_t, off_t, char *, size_t);
437 extern ssize_t ad_pread(struct ad_fd *, void *, size_t, off_t);
438extern ssize_t ad_write(struct adouble *, uint32_t, off_t, int, const char *,
439 size_t);
440extern ssize_t adf_pread(struct ad_fd *, void *, size_t, off_t);
441extern ssize_t adf_pwrite(struct ad_fd *, const void *, size_t, off_t);
442extern int ad_dtruncate(struct adouble *, off_t);
443extern int ad_rtruncate(struct adouble *, const char *, off_t);
444extern int copy_fork(int eid, struct adouble *add, struct adouble *ads,
445 uint8_t *buf, size_t buflen);
446
447/* ad_size.c */
448extern off_t ad_size(const struct adouble *, uint32_t);
449
450/* ad_date.c */
451extern int ad_setdate(struct adouble *, unsigned int, uint32_t);
452extern int ad_getdate(const struct adouble *, unsigned int, uint32_t *);
453
454/* ad_attr.c */
455extern int ad_setattr(const struct adouble *, const uint16_t);
456extern int ad_getattr(const struct adouble *, uint16_t *);
457extern int ad_setname(struct adouble *, const char *);
458extern int ad_setid(struct adouble *, dev_t dev, ino_t ino, uint32_t,
459 uint32_t, const void *);
460extern uint32_t ad_getid(struct adouble *, dev_t, ino_t, cnid_t, const void *);
461extern uint32_t ad_forcegetid(struct adouble *adp);
462
463#ifdef WITH_SENDFILE
464extern int ad_readfile_init(const struct adouble *ad, int eid, off_t *off,
465 int end);
466#endif
467#ifdef WITH_RECVFILE
468extern ssize_t ad_recvfile(struct adouble *ad, int eid, int sock, off_t off,
469 size_t len, int);
470#endif
471
472#endif /* _ATALK_ADOUBLE_H */
ad_path_ea
const char * ad_path_ea(const char *, int)
Definition ad_open.c:1978
ad_lock
int ad_lock(struct adouble *, uint32_t eid, int type, off_t off, off_t len, int fork)
Definition ad_lock.c:453
ad_rebuild_adouble_header_osx
int ad_rebuild_adouble_header_osx(struct adouble *ad, char *adbuf)
Definition ad_flush.c:136
ad_dtruncate
int ad_dtruncate(struct adouble *, off_t)
Definition ad_write.c:199
ad_testlock
int ad_testlock(struct adouble *adp, int eid, off_t off)
Test for a share mode lock.
Definition ad_lock.c:705
ad_forcegetid
uint32_t ad_forcegetid(struct adouble *adp)
Definition ad_attr.c:289
ad_setfuid
int ad_setfuid(const uid_t)
Definition ad_open.c:2149
ad_setattr
int ad_setattr(const struct adouble *, const uint16_t)
Definition ad_attr.c:67
ad_convert
int ad_convert(const char *path, const struct stat *sp, const struct vol *vol, const char **newpath)
AppleDouble and encoding conversion on the fly.
Definition ad_conv.c:319
ad_reso_size
off_t ad_reso_size(const char *path, int adflags, struct adouble *ad)
Definition ad_open.c:1549
ad_getfuid
uid_t ad_getfuid(void)
Definition ad_open.c:2156
fsetrsrcea
int fsetrsrcea(struct adouble *ad, int fd, const char *eaname, const void *value, size_t size, int flags)
ad_openat
int ad_openat(struct adouble *, int dirfd, const char *path, int adflags,...)
Definition ad_open.c:2528
ad_rebuild_adouble_header_v2
int ad_rebuild_adouble_header_v2(struct adouble *)
Definition ad_flush.c:53
ad_tmplock
int ad_tmplock(struct adouble *, uint32_t eid, int type, off_t off, off_t len, int fork)
Definition ad_lock.c:607
ad_path
const char * ad_path(const char *, int)
Put the .AppleDouble where it needs to be:
Definition ad_open.c:2034
ad_valid_header_osx
int ad_valid_header_osx(const char *path)
Definition ad_open.c:595
ad_init
void ad_init(struct adouble *, const struct vol *)
Definition ad_open.c:2242
ad_rtruncate
int ad_rtruncate(struct adouble *, const char *, off_t)
Definition ad_write.c:175
ad_init_old
void ad_init_old(struct adouble *ad, int flags, int options)
Definition ad_open.c:2234
ad_unlock
void ad_unlock(struct adouble *, int fork, int unlckbrl)
Definition ad_lock.c:680
ad_rebuild_adouble_header_ea
int ad_rebuild_adouble_header_ea(struct adouble *)
Definition ad_flush.c:93
ad_getdate
int ad_getdate(const struct adouble *, unsigned int, uint32_t *)
Definition ad_date.c:39
ad_recvfile
ssize_t ad_recvfile(struct adouble *ad, int eid, int sock, off_t off, size_t len, int)
Definition ad_recvfile.c:269
adf_pread
ssize_t adf_pread(struct ad_fd *, void *, size_t, off_t)
Definition ad_read.c:38
ad_open
int ad_open(struct adouble *ad, const char *path, int adflags,...)
Open data-, metadata(header)- or resource fork.
Definition ad_open.c:2308
ad_size
off_t ad_size(const struct adouble *, uint32_t)
Definition ad_size.c:18
ad_getattr
int ad_getattr(const struct adouble *, uint16_t *)
Definition ad_attr.c:24
ad_mode
int ad_mode(const char *, mode_t)
Definition ad_open.c:2179
ad_path_osx
const char * ad_path_osx(const char *path, int adflags)
Definition ad_open.c:1983
ad_refresh
int ad_refresh(const char *path, struct adouble *)
Definition ad_open.c:2466
ad_copy_header
int ad_copy_header(struct adouble *, struct adouble *)
Definition ad_flush.c:192
adf_lock_init
void adf_lock_init(struct ad_fd *adf)
Initialize lock tracking for an ad_fd structure.
Definition ad_lock.c:197
ad_metadataat
int ad_metadataat(int, const char *, int, struct adouble *)
Definition ad_open.c:2433
ad_openforks
uint16_t ad_openforks(struct adouble *adp, uint16_t)
Return if a file is open by another process.
Definition ad_lock.c:737
ad_metadata
int ad_metadata(const char *, int, struct adouble *)
open metadata, possibly as root
Definition ad_open.c:2412
ad_pread
ssize_t ad_pread(struct ad_fd *, void *, size_t, off_t)
ad_entry
void * ad_entry(const struct adouble *ad, int eid)
Definition ad_open.c:1929
AD_DATASZ_MAX
#define AD_DATASZ_MAX
Definition adouble.h:141
ad_flush
int ad_flush(struct adouble *)
Definition ad_flush.c:448
ad_close
int ad_close(struct adouble *, int)
Definition ad_flush.c:485
ad_mkdir
int ad_mkdir(const char *, mode_t)
Definition ad_open.c:2189
ad_getid
uint32_t ad_getid(struct adouble *, dev_t, ino_t, cnid_t, const void *)
Retrieve stored file / folder.
Definition ad_attr.c:224
ad_readfile_init
int ad_readfile_init(const struct adouble *ad, int eid, off_t *off, int end)
Definition ad_sendfile.c:87
ad_getentryoff
off_t ad_getentryoff(const struct adouble *ad, int eid)
Definition ad_open.c:1953
adflags2logstr
const char * adflags2logstr(int adflags)
Definition ad_open.c:170
ADEID_MAX
#define ADEID_MAX
Definition adouble.h:75
ad_dir
char * ad_dir(const char *)
Support inherited protection modes for AppleDouble files. The supplied mode is ANDed with the parent ...
Definition ad_open.c:2091
ad_setdate
int ad_setdate(struct adouble *, unsigned int, uint32_t)
Definition ad_date.c:10
ad_setname
int ad_setname(struct adouble *, const char *)
Definition ad_attr.c:316
adf_pwrite
ssize_t adf_pwrite(struct ad_fd *, const void *, size_t, off_t)
Definition ad_write.c:25
ad_hf_mode
mode_t ad_hf_mode(mode_t mode)
Definition ad_open.c:2573
ad_setid
int ad_setid(struct adouble *, dev_t dev, ino_t ino, uint32_t, uint32_t, const void *)
save file/folder ID in AppleDoubleV2 netatalk private parameters
Definition ad_attr.c:114
cnid_t
uint32_t cnid_t
Definition adouble.h:156
ad_write
ssize_t ad_write(struct adouble *, uint32_t, off_t, int, const char *, size_t)
Definition ad_write.c:53
adf_lock_free
void adf_lock_free(struct ad_fd *adf)
Free all locks in an ad_fd structure.
Definition ad_lock.c:221
ad_init_offsets
int ad_init_offsets(struct adouble *ad)
Definition ad_open.c:372
sys_ftruncate
int sys_ftruncate(int fd, off_t length)
Definition ad_write.c:118
ad_stat
int ad_stat(const char *, struct stat *)
Definition ad_open.c:2164
ad_read
ssize_t ad_read(struct adouble *, uint32_t, off_t, char *, size_t)
Definition ad_read.c:65
copy_fork
int copy_fork(int eid, struct adouble *add, struct adouble *ads, uint8_t *buf, size_t buflen)
Definition ad_write.c:236
sock
static int sock
Definition aecho.c:59
buf
static char buf[MAXPATHLEN+1]
Definition afppasswd.c:113
flags
static dbd_flags_t flags
Definition cmd_dbd.c:43
config.h
type
static enum op type
Definition nad_cp.c:96
ad_entry
Definition adouble.h:158
ad_entry::ade_off
off_t ade_off
Definition adouble.h:159
ad_entry::ade_len
ssize_t ade_len
Definition adouble.h:160
ad_fd
Definition adouble.h:169
ad_fd::adf_syml
char * adf_syml
Definition adouble.h:171
ad_fd::adf_lockcount
int adf_lockcount
Definition adouble.h:174
ad_fd::adf_lock
adf_lock_t * adf_lock
Definition adouble.h:173
ad_fd::adf_flags
int adf_flags
Definition adouble.h:172
ad_fd::adf_refcount
int adf_refcount
Definition adouble.h:174
ad_fd::adf_lockmax
int adf_lockmax
Definition adouble.h:174
ad_fd::adf_fd
int adf_fd
Definition adouble.h:170
adf_lock_t
Definition adouble.h:163
adf_lock_t::lock
struct flock lock
Definition adouble.h:164
adf_lock_t::refcount
int * refcount
Definition adouble.h:166
adf_lock_t::user
int user
Definition adouble.h:165
adouble_fops
Definition adouble.h:183
adouble_fops::ad_rebuild_header
int(* ad_rebuild_header)(struct adouble *)
Definition adouble.h:186
adouble_fops::ad_header_read
int(* ad_header_read)(const char *, struct adouble *, const struct stat *)
Definition adouble.h:187
adouble_fops::ad_mkrf
int(* ad_mkrf)(const char *)
Definition adouble.h:185
adouble_fops::ad_header_upgrade
int(* ad_header_upgrade)(struct adouble *, const char *)
Definition adouble.h:188
adouble
Definition adouble.h:191
adouble::ad_version
uint32_t ad_version
Definition adouble.h:193
adouble::ad_mdp
struct ad_fd * ad_mdp
Definition adouble.h:205
adouble::ad_meta_refcount
int ad_meta_refcount
Definition adouble.h:214
adouble::ad_inited
uint32_t ad_inited
Definition adouble.h:210
adouble::ad_vers
int ad_vers
Definition adouble.h:208
adouble::valid_data_len
size_t valid_data_len
Definition adouble.h:221
adouble::ad_ops
struct adouble_fops * ad_ops
Definition adouble.h:219
adouble::ad_data
char ad_data[AD_DATASZ_MAX]
Definition adouble.h:222
adouble::ad_adflags
int ad_adflags
Definition adouble.h:209
adouble::ad_magic
uint32_t ad_magic
Definition adouble.h:192
adouble::ad_rlen
off_t ad_rlen
Definition adouble.h:216
adouble::ad_reso_refcount
int ad_reso_refcount
Definition adouble.h:215
adouble::ad_resource_fork
struct ad_fd ad_resource_fork
Definition adouble.h:199
adouble::ad_name
char * ad_name
Definition adouble.h:218
adouble::ad_eid
struct ad_entry ad_eid[ADEID_MAX]
Definition adouble.h:195
adouble::ad_open_forks
uint16_t ad_open_forks
Definition adouble.h:220
adouble::ad_rfp
struct ad_fd * ad_rfp
Definition adouble.h:202
adouble::ad_filler
char ad_filler[16]
Definition adouble.h:194
adouble::ad_options
int ad_options
Definition adouble.h:211
adouble::ad_refcount
int ad_refcount
Definition adouble.h:212
adouble::ad_data_refcount
int ad_data_refcount
Definition adouble.h:213
adouble::ad_data_fork
struct ad_fd ad_data_fork
Definition adouble.h:197
path
Definition include/atalk/directory.h:123
vol
Definition include/atalk/volume.h:33