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