X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=netatalk.git;a=blobdiff_plain;f=etc%2Fafpd%2Fdirectory.h;h=5334be5d5610817c7e117f2efd3390c4420f2aff;hp=28dff40d3d6b18f99797e5bc178d3a278dadb02b;hb=a3e43549642d11f4bc86324f9a09c294f6a3f74b;hpb=2e93d6eaabf562849a4feed6a4d18de100726ce2 diff --git a/etc/afpd/directory.h b/etc/afpd/directory.h index 28dff40d..5334be5d 100644 --- a/etc/afpd/directory.h +++ b/etc/afpd/directory.h @@ -1,5 +1,5 @@ /* - * $Id: directory.h,v 1.5 2002-07-15 14:19:09 srittau Exp $ + * $Id: directory.h,v 1.34 2010-03-12 15:16:49 franklahm Exp $ * * Copyright (c) 1990,1991 Regents of The University of Michigan. * All Rights Reserved. @@ -30,6 +30,7 @@ #include /*#include */ /* including it here causes some confusion */ #include +#include /* sys/types.h usually snarfs in major/minor macros. if they don't * try this file. */ @@ -37,59 +38,22 @@ #include #endif +#include + #include "globals.h" #include "volume.h" -/* the did tree is now a red-black tree while the parent/child - * tree is a circular doubly-linked list. how exciting. */ -struct dir { - struct dir *d_left, *d_right, *d_back; /* for red-black tree */ - int d_color; - struct dir *d_parent, *d_child; /* parent-child */ - struct dir *d_prev, *d_next; /* siblings */ - void *d_ofork; /* oforks using this directory. */ - u_int32_t d_did; - int d_flags; - char *d_name; -}; - -/* child addition/removal macros */ -#define dirchildadd(a, b) do { \ - if (!(a)->d_child) \ - (a)->d_child = (b); \ - else { \ - (b)->d_next = (a)->d_child; \ - (b)->d_prev = (b)->d_next->d_prev; \ - (b)->d_next->d_prev = (b); \ - (b)->d_prev->d_next = (b); \ - } \ -} while (0) - -#define dirchildremove(a,b) do { \ - if ((a)->d_child == (b)) \ - (a)->d_child = ((b) == (b)->d_next) ? NULL : (b)->d_next; \ - (b)->d_next->d_prev = (b)->d_prev; \ - (b)->d_prev->d_next = (b)->d_next; \ - (b)->d_next = (b)->d_prev = (b); \ -} while (0) - #define DIRTREE_COLOR_RED 0 #define DIRTREE_COLOR_BLACK 1 -/* setgid directories */ -#ifndef DIRBITS -# ifdef AFS -# define DIRBITS 0 -# else /* AFS */ -# define DIRBITS S_ISGID -# endif /* AFS */ -#endif /* DIRBITS */ - #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 AFPDIR_READ (1<<0) /* directory bits */ @@ -107,11 +71,7 @@ struct dir { #define DIRPBIT_GID 11 #define DIRPBIT_ACCESS 12 #define DIRPBIT_PDINFO 13 /* ProDOS Info */ - -/* directory attribute bits (see file.h for other bits) */ -#define ATTRBIT_EXPFOLDER (1 << 1) /* shared point */ -#define ATTRBIT_MOUNTED (1 << 3) /* mounted share point by non-admin */ -#define ATTRBIT_INEXPFOLDER (1 << 4) /* folder in a shared area */ +#define DIRPBIT_UNIXPR 15 #define FILDIRBIT_ISDIR (1 << 7) /* is a directory */ #define FILDIRBIT_ISFILE (0) /* is a file */ @@ -123,6 +83,8 @@ struct dir { /* file/directory ids. what a mess. we scramble things in a vain attempt * to get something meaningful */ #ifndef AFS + +#if 0 #define CNID_XOR(a) (((a) >> 16) ^ (a)) #define CNID_DEV(a) ((((CNID_XOR(major((a)->st_dev)) & 0xf) << 3) | \ (CNID_XOR(minor((a)->st_dev)) & 0x7)) << 24) @@ -130,6 +92,10 @@ struct dir { & 0x00ffffff) #define CNID_FILE(a) (((a) & 0x1) << 31) #define CNID(a,b) (CNID_DEV(a) | CNID_INODE(a) | CNID_FILE(b)) +#endif + +#define CNID(a,b) ((a)->st_ino & 0xffffffff) + #else /* AFS */ #define CNID(a,b) (((a)->st_ino & 0x7fffffff) | CNID_FILE(b)) #endif /* AFS */ @@ -147,36 +113,63 @@ struct maccess { #define AR_UWRITE (1<<2) #define AR_UOWN (1<<7) -extern struct dir *dirnew __P((const int)); -extern void dirfree __P((struct dir *)); -extern struct dir *dirsearch __P((const struct vol *, u_int32_t)); -extern struct dir *dirlookup __P((const struct vol *, u_int32_t)); -extern struct dir *adddir __P((struct vol *, struct dir *, char *, - int, char *, int, struct stat *)); -extern struct dir *dirinsert __P((struct vol *, struct dir *)); -extern int movecwd __P((const struct vol *, struct dir *)); -extern int deletecurdir __P((const struct vol *, char *, int)); -extern char *cname __P((const struct vol *, struct dir *, - char **)); -extern mode_t mtoumode __P((struct maccess *)); -extern void utommode __P((struct stat *, struct maccess *)); -extern int getdirparams __P((const struct vol *, u_int16_t, char *, - struct dir *, struct stat *, char *, int *)); -extern int setdirparams __P((const struct vol *, char *, u_int16_t, char *)); -extern int renamedir __P((char *, char *, struct dir *, - struct dir *, char *, const int)); +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 (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 (struct vol *, struct dir *); +extern int deletecurdir (struct vol *); +extern struct path *cname (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 *, 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); + +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 hash_t *dirhash (void); +/* from enumerate.c */ +extern char *check_dirent (const struct vol *, char *); /* FP functions */ -extern int afp_createdir __P((AFPObj *, char *, int, char *, int *)); -extern int afp_opendir __P((AFPObj *, char *, int, char *, int *)); -extern int afp_setdirparams __P((AFPObj *, char *, int, char *, int *)); -extern int afp_closedir __P((AFPObj *, char *, int, char *, int *)); -extern int afp_mapid __P((AFPObj *, char *, int, char *, int *)); -extern int afp_mapname __P((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 __P((AFPObj *, char *, int, char *, int *)); -extern int afp_catsearch __P((AFPObj *, char *, int, char *, 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 */ +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