netatalk  4.4.0dev
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
etc/afpd/directory.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
22 */
23
24#ifndef AFPD_DIRECTORY_H
25#define AFPD_DIRECTORY_H 1
26
27#include <arpa/inet.h>
28#include <dirent.h>
29
30/* sys/types.h usually snarfs in major/minor macros. if they don't
31 * try this file. */
32#ifndef major
33#include <sys/sysmacros.h>
34#endif
35
36#include <sys/types.h>
37
38#include <atalk/directory.h>
39#include <atalk/globals.h>
40
41#include "volume.h"
42
43/* directory bits */
44#define DIRPBIT_ATTR 0
45#define DIRPBIT_PDID 1
46#define DIRPBIT_CDATE 2
47#define DIRPBIT_MDATE 3
48#define DIRPBIT_BDATE 4
49#define DIRPBIT_FINFO 5
50#define DIRPBIT_LNAME 6
51#define DIRPBIT_SNAME 7
52#define DIRPBIT_DID 8
53#define DIRPBIT_OFFCNT 9
54#define DIRPBIT_UID 10
55#define DIRPBIT_GID 11
56#define DIRPBIT_ACCESS 12
57#define DIRPBIT_PDINFO 13 /* ProDOS Info */
58#define DIRPBIT_UNIXPR 15
59
60#define FILDIRBIT_ISDIR (1 << 7) /* is a directory */
61#define FILDIRBIT_ISFILE (0) /* is a file */
62
63/* file/directory ids. what a mess. we scramble things in a vain attempt
64 * to get something meaningful */
65
66#define CNID(a,b) ((a)->st_ino & 0xffffffff)
67
68struct maccess {
69 uint8_t ma_user;
70 uint8_t ma_world;
71 uint8_t ma_group;
72 uint8_t ma_owner;
73};
74
75#define AR_USEARCH (1<<0)
76#define AR_UREAD (1<<1)
77#define AR_UWRITE (1<<2)
78#define AR_UOWN (1<<7)
79
81
82typedef int (*dir_loop)(struct dirent *, char *, void *);
83
84extern void dir_free_invalid_q(void);
85extern struct dir *dir_new(const char *mname, const char *uname,
86 const struct vol *,
87 cnid_t pdid, cnid_t did, bstring fullpath, struct stat *);
88extern void dir_free(struct dir *);
89extern struct dir *dir_add(struct vol *, const struct dir *, struct path *,
90 int);
91extern int dir_modify(const struct vol *vol, struct dir *dir,
93 const char *new_mname, const char *new_uname, bstring pdir_fullpath);
94extern int dir_remove(const struct vol *vol, struct dir *dir);
95extern struct dir *dirlookup(const struct vol *, cnid_t);
96extern struct dir *dirlookup_bypath(const struct vol *vol, const char *path);
97
98extern int movecwd(const struct vol *, struct dir *);
99extern struct path *cname(struct vol *, struct dir *, char **);
100
101extern int deletecurdir(struct vol *);
102extern mode_t mtoumode(struct maccess *);
103extern int getdirparams(const AFPObj *obj, const struct vol *, uint16_t,
104 struct path *,
105 struct dir *, char *, size_t *);
106
107extern int setdirparams(struct vol *, struct path *, uint16_t, char *);
108extern int renamedir(struct vol *, int, char *, char *, struct dir *,
109 char *);
110extern int path_error(struct path *, int error);
111extern void setdiroffcnt(struct dir *dir, struct stat *st,
112 uint32_t count);
113extern int dirreenumerate(struct dir *dir, struct stat *st);
114extern int for_each_dirent(const struct vol *, char *, dir_loop,
115 void *);
116extern int check_access(const AFPObj *obj, struct vol *, char *name,
117 int mode);
118extern int file_access(const AFPObj *obj, struct vol *vol,
119 struct path *path, int mode);
120extern int netatalk_unlink(const char *name);
121
122/* from enumerate.c */
123extern char *check_dirent(const struct vol *, char *);
124
125/* FP functions */
126int afp_createdir(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,
127 size_t *rbuflen);
128int afp_opendir(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,
129 size_t *rbuflen);
130int afp_setdirparams(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,
131 size_t *rbuflen);
132int afp_closedir(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,
133 size_t *rbuflen);
134int afp_mapid(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,
135 size_t *rbuflen);
136int afp_mapname(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,
137 size_t *rbuflen);
138int afp_syncdir(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,
139 size_t *rbuflen);
140
141/* from enumerate.c */
142int afp_enumerate(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,
143 size_t *rbuflen);
144int afp_enumerate_ext(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,
145 size_t *rbuflen);
146int afp_enumerate_ext2(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,
147 size_t *rbuflen);
148
149/* from catsearch.c */
150int afp_catsearch(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,
151 size_t *rbuflen);
152int afp_catsearch_ext(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,
153 size_t *rbuflen);
154
155#endif
uint32_t cnid_t
Definition adouble.h:156
static size_t rbuflen
Definition afpfunc_helpers.c:45
static char rbuf[rbufsize]
Definition afpfunc_helpers.c:44
struct tagbstring * bstring
Definition bstrlib.h:82
q_t * invalid_dircache_entries
Definition directory.c:99
int renamedir(struct vol *, int, char *, char *, struct dir *, char *)
Definition directory.c:2313
int afp_enumerate_ext(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
Definition enumerate.c:539
int check_access(const AFPObj *obj, struct vol *, char *name, int mode)
Definition directory.c:1325
int setdirparams(struct vol *, struct path *, uint16_t, char *)
Definition directory.c:1745
int file_access(const AFPObj *obj, struct vol *vol, struct path *path, int mode)
Definition directory.c:1349
void dir_free_invalid_q(void)
Definition directory.c:906
int for_each_dirent(const struct vol *, char *, dir_loop, void *)
Definition enumerate.c:135
int afp_setdirparams(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
struct dir * dir_add(struct vol *, const struct dir *, struct path *, int)
Create struct dir from struct path.
Definition directory.c:787
int afp_mapid(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
Definition directory.c:2450
int afp_opendir(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
char * check_dirent(const struct vol *, char *)
Definition enumerate.c:102
struct dir * dir_new(const char *mname, const char *uname, const struct vol *, cnid_t pdid, cnid_t did, bstring fullpath, struct stat *)
Construct struct dir.
Definition directory.c:694
int dirreenumerate(struct dir *dir, struct stat *st)
Definition directory.c:1383
int getdirparams(const AFPObj *obj, const struct vol *, uint16_t, struct path *, struct dir *, char *, size_t *)
Definition directory.c:1393
int movecwd(const struct vol *, struct dir *)
Definition directory.c:1269
void setdiroffcnt(struct dir *dir, struct stat *st, uint32_t count)
Definition directory.c:1372
mode_t mtoumode(struct maccess *)
Definition etc/afpd/unix.c:168
int path_error(struct path *, int error)
Definition directory.c:1664
struct dir * dirlookup(const struct vol *, cnid_t)
Resolve a DID.
Definition directory.c:510
int afp_catsearch_ext(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
Definition catsearch.c:1194
struct path * cname(struct vol *, struct dir *, char **)
Resolve a catalog node name path.
Definition directory.c:984
int afp_syncdir(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
int deletecurdir(struct vol *)
Definition directory.c:2372
int afp_enumerate_ext2(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
Definition enumerate.c:546
int afp_enumerate(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
Definition enumerate.c:532
int(* dir_loop)(struct dirent *, char *, void *)
Definition etc/afpd/directory.h:82
int dir_remove(const struct vol *vol, struct dir *dir)
Remove a file/directory from dircache.
Definition directory.c:928
int afp_catsearch(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
Definition catsearch.c:1187
int afp_closedir(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
struct dir * dirlookup_bypath(const struct vol *vol, const char *path)
int afp_createdir(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
Definition directory.c:2223
int netatalk_unlink(const char *name)
Definition libatalk/vfs/unix.c:124
int afp_mapname(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
Definition directory.c:2594
void dir_free(struct dir *)
Free a struct dir and all its members.
Definition directory.c:753
int dir_modify(const struct vol *vol, struct dir *dir, cnid_t pdid, cnid_t did, const char *new_mname, const char *new_uname, bstring pdir_fullpath)
cnid_t did
Definition nad_cp.c:92
cnid_t pdid
Definition nad_cp.c:92
static AFPObj obj
Definition netatalk.c:62
qnode_t q_t
Definition queue.h:32
Definition globals.h:154
Definition include/atalk/directory.h:62
Definition etc/afpd/directory.h:68
uint8_t ma_owner
Definition etc/afpd/directory.h:72
uint8_t ma_world
Definition etc/afpd/directory.h:70
uint8_t ma_user
Definition etc/afpd/directory.h:69
uint8_t ma_group
Definition etc/afpd/directory.h:71
Definition include/atalk/directory.h:97
struct stat st
Definition include/atalk/directory.h:110
Definition include/atalk/volume.h:32