• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/router/netatalk-3.0.5/etc/afpd/
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
16struct file_key {
17    dev_t       dev;
18    ino_t       inode;
19};
20
21struct 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};
30
31#define OPENFORK_DATA   (0)
32#define OPENFORK_RSCS   (1<<7)
33
34#define OPENACC_RD  (1<<0)
35#define OPENACC_WR  (1<<1)
36#define OPENACC_DRD (1<<4)
37#define OPENACC_DWR (1<<5)
38
39/* ofork.of_flags bits */
40#define AFPFORK_DATA    (1<<0)  /* open datafork */
41#define AFPFORK_RSRC    (1<<1)  /* open rsrcfork */
42#define AFPFORK_META    (1<<2)  /* open metadata */
43#define AFPFORK_DIRTY   (1<<3)
44#define AFPFORK_ACCRD   (1<<4)
45#define AFPFORK_ACCWR   (1<<5)
46#define AFPFORK_ACCMASK (AFPFORK_ACCRD | AFPFORK_ACCWR)
47#define AFPFORK_MODIFIED (1<<6) /* used in FCE for modified files */
48#define AFPFORK_ERROR   (1<<7)  /* used to indicate an error in opening the fork */
49
50#ifdef AFS
51extern struct ofork *writtenfork;
52#endif
53
54#define of_name(a) (a)->of_ad->ad_name
55/* in ofork.c */
56extern struct ofork *of_alloc    (struct vol *, struct dir *,
57                                                      char *, uint16_t *, const int,
58                                                      struct adouble *,
59                                                      struct stat *);
60extern void         of_dealloc   (struct ofork *);
61extern struct ofork *of_find     (const uint16_t);
62extern struct ofork *of_findname (const struct vol *vol, struct path *);
63extern int          of_rename    (const struct vol *,
64                                          struct ofork *,
65                                          struct dir *, const char *,
66                                          struct dir *, const char *);
67extern int          of_flush     (const struct vol *);
68extern int          of_stat      (const struct vol *vol, struct path *);
69extern int          of_statdir   (struct vol *vol, struct path *);
70extern int          of_closefork (const AFPObj *obj, struct ofork *ofork);
71extern void         of_closevol  (const AFPObj *obj, const struct vol *vol);
72extern void         of_close_all_forks(const AFPObj *obj);
73extern struct adouble *of_ad     (const struct vol *, struct path *, struct adouble *);
74
75#ifdef HAVE_ATFUNCS
76extern struct ofork *of_findnameat(int dirfd, struct path *path);
77extern int of_fstatat(int dirfd, struct path *path);
78#endif  /* HAVE_ATFUNCS */
79
80
81/* in fork.c */
82extern int          flushfork    (struct ofork *);
83
84/* FP functions */
85int afp_openfork (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
86int afp_bytelock (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
87int afp_getforkparams (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
88int afp_setforkparams (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
89int afp_read (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
90int afp_write (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
91int afp_flushfork (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
92int afp_flush (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
93int afp_closefork (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
94
95int afp_bytelock_ext (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
96int afp_read_ext (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
97int afp_write_ext (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
98int afp_syncfork (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,  size_t *rbuflen);
99#endif
100