]> arthur.barton.de Git - netatalk.git/blob - etc/afpd/fork.h
Convert afp_moveandrename and all called funcs to XXXat semantics if available
[netatalk.git] / etc / afpd / fork.h
1 /*
2  * $Id: fork.h,v 1.18 2010-03-12 15:16:49 franklahm Exp $
3  *
4  * Copyright (c) 1990,1993 Regents of The University of Michigan.
5  * All Rights Reserved.  See COPYRIGHT.
6  */
7
8 #ifndef AFPD_FORK_H
9 #define AFPD_FORK_H 1
10
11 #include <stdio.h>
12 #include <sys/cdefs.h>
13
14 #include <netatalk/endian.h>
15 #include <atalk/adouble.h>
16 #include "volume.h"
17 #include "directory.h"
18
19 struct file_key {
20     dev_t               dev;
21     ino_t               inode;
22 };
23
24 struct ofork {
25     struct file_key     key;
26     struct adouble      *of_ad;
27     struct vol          *of_vol;
28     struct dir          *of_dir;
29
30     u_int16_t           of_refnum;
31     int                 of_flags;
32
33     struct ofork        **prevp, *next;
34     struct ofork        *of_d_prev, *of_d_next;
35 };
36
37 #define OPENFORK_DATA   (0)
38 #define OPENFORK_RSCS   (1<<7)
39
40 #define OPENACC_RD      (1<<0)
41 #define OPENACC_WR      (1<<1)
42 #define OPENACC_DRD     (1<<4)
43 #define OPENACC_DWR     (1<<5)
44
45 /* ofork.of_flags bits */
46 #define AFPFORK_OPEN    (1<<0)
47 #define AFPFORK_RSRC    (1<<1)
48 #define AFPFORK_DATA    (1<<2)
49 #define AFPFORK_DIRTY   (1<<3)
50 #define AFPFORK_ACCRD   (1<<4)
51 #define AFPFORK_ACCWR   (1<<5)
52 #define AFPFORK_ACCMASK (AFPFORK_ACCRD | AFPFORK_ACCWR)
53
54 #ifdef AFS
55 extern struct ofork *writtenfork;
56 #endif
57
58 #define of_name(a) (a)->of_ad->ad_m_name
59 /* in ofork.c */
60 extern struct ofork *of_alloc    (struct vol *, struct dir *,
61                                                       char *, u_int16_t *, const int,
62                                                       struct adouble *,
63                                                       struct stat *);
64 extern void         of_dealloc   (struct ofork *);
65 extern struct ofork *of_find     (const u_int16_t);
66 extern struct ofork *of_findname (struct path *);
67 extern int          of_rename    (const struct vol *,
68                                           struct ofork *,
69                                           struct dir *, const char *,
70                                           struct dir *, const char *);
71 extern int          of_flush     (const struct vol *);
72 extern void         of_pforkdesc (FILE *);
73 extern int          of_stat      (struct path *);
74 extern int          of_statdir   (struct vol *vol, struct path *);
75 extern int          of_closefork (struct ofork *ofork);
76 extern void         of_closevol  (const struct vol *vol);
77 extern struct adouble *of_ad     (const struct vol *, struct path *, struct adouble *);
78
79 #ifdef HAVE_RENAMEAT
80 extern struct ofork *of_findnameat(int dirfd, struct path *path);
81 extern int of_fstatat(int dirfd, struct path *path);
82 #endif  /* HAVE_RENAMEAT */
83
84
85 /* in fork.c */
86 extern int          flushfork    (struct ofork *);
87 extern int          getforkmode  (struct adouble *, int , int );
88
89 /* FP functions */
90 int afp_openfork (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
91 int afp_bytelock (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
92 int afp_getforkparams (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
93 int afp_setforkparams (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
94 int afp_read (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
95 int afp_write (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
96 int afp_flushfork (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
97 int afp_flush (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
98 int afp_closefork (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
99
100 int afp_bytelock_ext (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
101 int afp_read_ext (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
102 int afp_write_ext (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen); 
103 int afp_syncfork (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
104 #endif