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