netatalk 4.4.3
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
21 * netatalk@itd.umich.edu
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
58#define DIRPBIT_UNIXPR 15
59
60#define FILDIRBIT_ISDIR (1 << 7)
61#define FILDIRBIT_ISFILE (0)
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
68 struct 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
80 extern q_t *invalid_dircache_entries;
81
82 typedef int (*dir_loop)(struct dirent *, char *, void *);
83
84 extern void dir_free_invalid_q(void);
85 extern 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 *);
88 extern void dir_free(struct dir *);
89 extern struct dir *dir_add(struct vol *, const struct dir *, struct path *,
90 int);
91 extern int dir_modify(const struct vol *vol, struct dir *dir,
92 cnid_t pdid, cnid_t did,
93 const char *new_mname, const char *new_uname, bstring pdir_fullpath);
94 extern int dir_remove(const struct vol *vol, struct dir *dir);
95 extern struct dir *dirlookup(const struct vol *, cnid_t);
96 extern struct dir *dirlookup_strict(const struct vol *, cnid_t);
97 extern struct dir *dirlookup_bypath(const struct vol *vol, const char *path);
98
99 extern int movecwd(const struct vol *, struct dir *);
100 extern struct path *cname(struct vol *, struct dir *, char **);
101
102 extern int deletecurdir(struct vol *);
103 extern mode_t mtoumode(struct maccess *);
104 extern int getdirparams(const AFPObj *obj, const struct vol *, uint16_t,
105 struct path *,
106 struct dir *, char *, size_t *);
107
108 extern int setdirparams(struct vol *, struct path *, uint16_t, char *);
109 extern int renamedir(struct vol *, int, char *, char *, struct dir *,
110 char *);
111 extern int path_error(struct path *, int error);
112 extern void setdiroffcnt(struct dir *dir, struct stat *st,
113 uint32_t count);
114 extern int dirreenumerate(struct dir *dir, struct stat *st);
115 extern int for_each_dirent(const struct vol *, char *, dir_loop,
116 void *);
117 extern int check_access(const AFPObj *obj, struct vol *, char *name,
118 int mode);
119 extern int file_access(const AFPObj *obj, struct vol *vol,
120 struct path *path, int mode);
121 extern int netatalk_unlink(const char *name);
122
123/* from enumerate.c */
124 extern char *check_dirent(const struct vol *, char *);
125
126/* FP functions */
127 int afp_createdir(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,
128 size_t *rbuflen);
129 int afp_opendir(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,
130 size_t *rbuflen);
131 int afp_setdirparams(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,
132 size_t *rbuflen);
133 int afp_closedir(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,
134 size_t *rbuflen);
135 int afp_mapid(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,
136 size_t *rbuflen);
137 int afp_mapname(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,
138 size_t *rbuflen);
139 int afp_syncdir(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,
140 size_t *rbuflen);
141
142/* from enumerate.c */
143 int afp_enumerate(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,
144 size_t *rbuflen);
145 int afp_enumerate_ext(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,
146 size_t *rbuflen);
147 int afp_enumerate_ext2(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,
148 size_t *rbuflen);
149
150/* from catsearch.c */
151 int afp_catsearch(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,
152 size_t *rbuflen);
153 int afp_catsearch_ext(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf,
154 size_t *rbuflen);
155
156#endif
cnid_t
uint32_t cnid_t
Definition adouble.h:156
rbuflen
static size_t rbuflen
Definition afpfunc_helpers.c:45
rbuf
static char rbuf[rbufsize]
Definition afpfunc_helpers.c:44
bstring
struct tagbstring * bstring
Definition bstrlib.h:82
invalid_dircache_entries
q_t * invalid_dircache_entries
Definition directory.c:89
renamedir
int renamedir(struct vol *, int, char *, char *, struct dir *, char *)
Rename a directory.
Definition directory.c:2704
afp_enumerate_ext
int afp_enumerate_ext(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
Definition enumerate.c:538
check_access
int check_access(const AFPObj *obj, struct vol *, char *name, int mode)
Definition directory.c:1671
setdirparams
int setdirparams(struct vol *, struct path *, uint16_t, char *)
Definition directory.c:2091
file_access
int file_access(const AFPObj *obj, struct vol *vol, struct path *path, int mode)
Definition directory.c:1695
dir_free_invalid_q
void dir_free_invalid_q(void)
Free the queue with invalid struct dirs.
Definition directory.c:1107
for_each_dirent
int for_each_dirent(const struct vol *, char *, dir_loop, void *)
Definition enumerate.c:134
afp_setdirparams
int afp_setdirparams(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
Definition directory.c:2028
dir_add
struct dir * dir_add(struct vol *, const struct dir *, struct path *, int)
Create struct dir from struct path.
Definition directory.c:983
afp_mapid
int afp_mapid(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
Definition directory.c:2844
afp_opendir
int afp_opendir(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
Definition directory.c:3111
check_dirent
char * check_dirent(const struct vol *, char *)
Definition enumerate.c:101
dir_new
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:890
dirreenumerate
int dirreenumerate(struct dir *dir, struct stat *st)
Definition directory.c:1729
getdirparams
int getdirparams(const AFPObj *obj, const struct vol *, uint16_t, struct path *, struct dir *, char *, size_t *)
Definition directory.c:1739
movecwd
int movecwd(const struct vol *, struct dir *)
chdir() to dir
Definition directory.c:1560
setdiroffcnt
void setdiroffcnt(struct dir *dir, struct stat *st, uint32_t count)
Definition directory.c:1718
mtoumode
mode_t mtoumode(struct maccess *)
Definition etc/afpd/unix.c:168
path_error
int path_error(struct path *, int error)
Definition directory.c:2010
dirlookup
struct dir * dirlookup(const struct vol *, cnid_t)
Public CNID (Directory ID) resolution (supports files and directories).
Definition directory.c:793
afp_catsearch_ext
int afp_catsearch_ext(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
Definition catsearch.c:1192
dirlookup_strict
struct dir * dirlookup_strict(const struct vol *, cnid_t)
Strict DID resolution with inode validation.
Definition directory.c:818
cname
struct path * cname(struct vol *, struct dir *, char **)
Resolve a catalog node name path.
Definition directory.c:1233
afp_syncdir
int afp_syncdir(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
Definition directory.c:2498
deletecurdir
int deletecurdir(struct vol *)
Definition directory.c:2766
afp_enumerate_ext2
int afp_enumerate_ext2(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
Definition enumerate.c:545
afp_enumerate
int afp_enumerate(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
Definition enumerate.c:531
dir_loop
int(* dir_loop)(struct dirent *, char *, void *)
Definition etc/afpd/directory.h:82
dir_remove
int dir_remove(const struct vol *vol, struct dir *dir)
Remove a file/directory from dircache with automatic curdir recovery.
Definition directory.c:1136
afp_catsearch
int afp_catsearch(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
Definition catsearch.c:1185
afp_closedir
int afp_closedir(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
Definition directory.c:3100
dirlookup_bypath
struct dir * dirlookup_bypath(const struct vol *vol, const char *path)
afp_createdir
int afp_createdir(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
Definition directory.c:2598
netatalk_unlink
int netatalk_unlink(const char *name)
system unlink with afp error code.
Definition libatalk/vfs/unix.c:124
afp_mapname
int afp_mapname(AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
Definition directory.c:2988
dir_free
void dir_free(struct dir *)
Free a struct dir and all its members.
Definition directory.c:949
dir_modify
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)
volume.h
globals.h
directory.h
did
cnid_t did
Definition nad_cp.c:93
pdid
cnid_t pdid
Definition nad_cp.c:93
obj
static AFPObj obj
Definition netatalk.c:62
q_t
qnode_t q_t
Definition queue.h:32
AFPObj
Definition globals.h:158
dir
Definition include/atalk/directory.h:55
maccess
Definition etc/afpd/directory.h:68
maccess::ma_owner
uint8_t ma_owner
Definition etc/afpd/directory.h:72
maccess::ma_world
uint8_t ma_world
Definition etc/afpd/directory.h:70
maccess::ma_user
uint8_t ma_user
Definition etc/afpd/directory.h:69
maccess::ma_group
uint8_t ma_group
Definition etc/afpd/directory.h:71
path
Definition include/atalk/directory.h:82
path::st
struct stat st
Definition include/atalk/directory.h:90
vol
Definition include/atalk/volume.h:30