X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=etc%2Fafpd%2Fdirectory.h;h=1504c649dbb9ba55ea083f8bc95b6d701cf6b05c;hb=6d60f95c388da5f8f901d67e0018cf4896e6c6dc;hp=ee8978d6cb6cb39c272e67ec82cd8bc9ee4b9a64;hpb=815d557e167e76015934397dffbfa869180dcdbc;p=netatalk.git diff --git a/etc/afpd/directory.h b/etc/afpd/directory.h index ee8978d6..1504c649 100644 --- a/etc/afpd/directory.h +++ b/etc/afpd/directory.h @@ -1,6 +1,4 @@ /* - * $Id: directory.h,v 1.29 2009-10-13 22:55:36 didg Exp $ - * * Copyright (c) 1990,1991 Regents of The University of Michigan. * All Rights Reserved. * @@ -26,10 +24,8 @@ #ifndef AFPD_DIRECTORY_H #define AFPD_DIRECTORY_H 1 -#include #include -/*#include */ /* including it here causes some confusion */ -#include +#include #include /* sys/types.h usually snarfs in major/minor macros. if they don't @@ -43,16 +39,13 @@ #include "globals.h" #include "volume.h" -#define DIRTREE_COLOR_RED 0 -#define DIRTREE_COLOR_BLACK 1 - #define DIRF_FSMASK (3<<0) #define DIRF_NOFS (0<<0) #define DIRF_AFS (1<<0) #define DIRF_UFS (2<<0) -#define DIRF_OFFCNT (1<<4) /* offsprings count is valid */ -#define DIRF_CNID (1<<5) /* renumerate id */ +#define DIRF_OFFCNT (1<<4) /* offsprings count is valid */ +#define DIRF_CNID (1<<5) /* renumerate id */ #define AFPDIR_READ (1<<0) @@ -76,10 +69,6 @@ #define FILDIRBIT_ISDIR (1 << 7) /* is a directory */ #define FILDIRBIT_ISFILE (0) /* is a file */ -/* reserved directory id's */ -#define DIRDID_ROOT_PARENT htonl(1) /* parent directory of root */ -#define DIRDID_ROOT htonl(2) /* root directory */ - /* file/directory ids. what a mess. we scramble things in a vain attempt * to get something meaningful */ #ifndef AFS @@ -100,7 +89,6 @@ #define CNID(a,b) (((a)->st_ino & 0x7fffffff) | CNID_FILE(b)) #endif /* AFS */ - struct maccess { u_char ma_user; u_char ma_world; @@ -113,63 +101,61 @@ struct maccess { #define AR_UWRITE (1<<2) #define AR_UOWN (1<<7) -extern struct dir *dirnew (const char *, const char *); -extern void dirfreename (struct dir *); -extern void dirfree (struct dir *); -extern struct dir *dirsearch (const struct vol *, u_int32_t); -extern struct dir *dirlookup (const struct vol *, u_int32_t); -extern struct dir *dirsearch_byname (const struct vol *, struct dir *,char *); - -extern struct dir *adddir (struct vol *, struct dir *, - struct path *); - -extern int movecwd (const struct vol *, struct dir *); -extern int deletecurdir (const struct vol *); -extern struct path *cname (const struct vol *, struct dir *, - char **); -extern mode_t mtoumode (struct maccess *); -extern void utommode (struct stat *, struct maccess *); -extern int getdirparams (const struct vol *, u_int16_t, struct path *, - struct dir *, char *, int *); -extern int setdirparams (const struct vol *, struct path *, u_int16_t, char *); -extern int renamedir (const struct vol *, char *, char *, struct dir *, - struct dir *, char *); -extern int path_error (struct path *, int error); - -extern void setdiroffcnt (struct dir *dir, struct stat *st, u_int32_t count); -extern int dirreenumerate (struct dir *dir, struct stat *st); +q_t *invalid_dircache_entries; typedef int (*dir_loop)(struct dirent *, char *, void *); -extern int for_each_dirent (const struct vol *, char *, dir_loop , void *); - -extern int check_access (char *name , int mode); -extern int file_access (struct path *path, int mode); - -extern int netatalk_unlink (const char *name); - -extern int caseenumerate (const struct vol *, struct path *, struct dir *); +extern void dir_free_invalid_q(void); +extern struct dir *dir_new(const char *mname, const char *uname, const struct vol *, + cnid_t pdid, cnid_t did, bstring fullpath, time_t ctime); +extern void dir_free (struct dir *); +extern struct dir *dir_add(struct vol *, const struct dir *, struct path *, int); +extern 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); +extern int dir_remove(const struct vol *vol, struct dir *dir); +extern struct dir *dirlookup (const struct vol *, cnid_t); +extern struct dir *dirlookup_bypath(const struct vol *vol, const char *path); + +extern int movecwd (const struct vol *, struct dir *); +extern struct path *cname (struct vol *, struct dir *, char **); + +extern int deletecurdir (struct vol *); +extern mode_t mtoumode (struct maccess *); +extern void utommode (struct stat *, struct maccess *); +extern int getdirparams (const struct vol *, u_int16_t, struct path *, + struct dir *, char *, size_t *); + +extern int setdirparams(struct vol *, struct path *, u_int16_t, char *); +extern int renamedir(const struct vol *, int, char *, char *, struct dir *, + struct dir *, char *); +extern int path_error(struct path *, int error); +extern void setdiroffcnt(struct dir *dir, struct stat *st, u_int32_t count); +extern int dirreenumerate(struct dir *dir, struct stat *st); +extern int for_each_dirent(const struct vol *, char *, dir_loop , void *); +extern int check_access(char *name , int mode); +extern int file_access(struct path *path, int mode); +extern int netatalk_unlink (const char *name); +extern int caseenumerate (const struct vol *, struct path *, struct dir *); -extern hash_t *dirhash (void); /* from enumerate.c */ -extern char *check_dirent (const struct vol *, char *); +extern char *check_dirent (const struct vol *, char *); /* FP functions */ -extern int afp_createdir (AFPObj *, char *, int, char *, int *); -extern int afp_opendir (AFPObj *, char *, int, char *, int *); -extern int afp_setdirparams (AFPObj *, char *, int, char *, int *); -extern int afp_closedir (AFPObj *, char *, int, char *, int *); -extern int afp_mapid (AFPObj *, char *, int, char *, int *); -extern int afp_mapname (AFPObj *, char *, int, char *, int *); -extern int afp_syncdir (AFPObj *, char *, int, char *, int *); +int afp_createdir (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); +int afp_opendir (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); +int afp_setdirparams (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); +int afp_closedir (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); +int afp_mapid (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); +int afp_mapname (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); +int afp_syncdir (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); /* from enumerate.c */ -extern int afp_enumerate (AFPObj *, char *, unsigned int, char *, unsigned int *); -extern int afp_enumerate_ext (AFPObj *, char *, unsigned int, char *, unsigned int *); -extern int afp_enumerate_ext2 (AFPObj *, char *, unsigned int, char *, unsigned int *); +int afp_enumerate (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); +int afp_enumerate_ext (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); +int afp_enumerate_ext2 (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); /* from catsearch.c */ -extern int afp_catsearch (AFPObj *, char *, int, char *, int *); -extern int afp_catsearch_ext (AFPObj *, char *, int, char *, int *); +int afp_catsearch (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); +int afp_catsearch_ext (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen); #endif