]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/directory.h
First working IPC reconnect
[netatalk.git] / etc / afpd / directory.h
index 94db14d26652b8f76ad341826afce40cbf021693..e9c6a457f4344cb2865f0295d0d78885c4f096c7 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * $Id: directory.h,v 1.21 2008-08-31 13:25:58 didg Exp $
- *
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
  * All Rights Reserved.
  *
 #include <sys/sysmacros.h>
 #endif
 
-#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;
-
-    time_t      ctime;                /* inode ctime */
-    u_int32_t   offcnt;               /* offspring count */
-
-    char       *d_m_name;            /* mac name */
-    char        *d_u_name;            /* unix name */
-    ucs2_t     *d_m_name_ucs2;       /* mac name as UCS2 */
-};
-
-struct path {
-    int         m_type;             /* mac name type (long name, unicode */
-    char       *m_name;            /* mac name */
-    char        *u_name;            /* unix name */
-    cnid_t     id;                 /* file id (only for getmetadata) */
-    struct dir  *d_dir;             /* */
-    int         st_valid;           /* does st_errno and st set */
-    int         st_errno;
-    struct stat st;
-};
-
-#ifndef ATACC
-static __inline__ int path_isadir(struct path *o_path)
-{
-    return o_path->d_dir != NULL;
-#if 0
-    return o_path->m_name == '\0' || /* we are in a it */
-           !o_path->st_valid ||      /* in cache but we can't chdir in it */ 
-           (!o_path->st_errno && S_ISDIR(o_path->st.st_mode)); /* not in cache an can't chdir */
-#endif
-}
-#else
-extern int path_isadir(struct path *o_path);
-#endif
-
-#define DIRTREE_COLOR_RED    0
-#define DIRTREE_COLOR_BLACK  1
+#include <atalk/directory.h>
+#include <atalk/globals.h>
 
-/* 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)
+#include "volume.h"
 
 /* directory bits */
 #define DIRPBIT_ATTR   0
@@ -125,18 +58,9 @@ extern int path_isadir(struct path *o_path);
 #define DIRPBIT_PDINFO  13         /* ProDOS Info */
 #define DIRPBIT_UNIXPR  15
 
-/* 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 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
@@ -157,7 +81,6 @@ extern int path_isadir(struct path *o_path);
 #define CNID(a,b)     (((a)->st_ino & 0x7fffffff) | CNID_FILE(b))
 #endif /* AFS */
 
-
 struct maccess {
     u_char     ma_user;
     u_char     ma_world;
@@ -170,62 +93,61 @@ struct maccess {
 #define        AR_UWRITE       (1<<2)
 #define        AR_UOWN         (1<<7)
 
-extern struct dir       *dirnew __P((const char *, const char *));
-extern void             dirfreename __P((struct dir *));
-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       *dirsearch_byname __P((const struct vol *, struct dir *,char *));
-
-extern struct dir      *adddir __P((struct vol *, struct dir *, 
-                                               struct path *));
-
-extern int              movecwd __P((const struct vol *, struct dir *));
-extern int              deletecurdir __P((const struct vol *));
-extern struct path      *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, struct path *,
-                                 struct dir *, char *, int *));
-extern int setdirparams __P((const struct vol *, struct path *, u_int16_t, char *));
-extern int renamedir __P((const struct vol *, char *, char *, struct dir *,
-                              struct dir *, char *));
-extern int path_error __P((struct path *, int error));
-
-extern void setdiroffcnt __P((struct dir *dir, struct stat *st,  u_int32_t count));
-extern int dirreenumerate __P((struct dir *dir, struct stat *st));
+q_t *invalid_dircache_entries;
 
 typedef int (*dir_loop)(struct dirent *, char *, void *);
 
-extern int  for_each_dirent __P((const struct vol *, char *, dir_loop , void *));
-
-extern int  check_access __P((char *name , int mode));
-extern int file_access   __P((struct path *path, int mode));
-
-extern int netatalk_rmdir __P((const char *name));
-extern int netatalk_unlink __P((const char *name));
+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, struct stat *);
+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 __P((void));
 /* from enumerate.c */
-extern char *check_dirent __P((const struct vol *, char *));
+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 *));
-extern int      afp_syncdir __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 *, unsigned int, char *, unsigned int *));
-extern int     afp_enumerate_ext __P((AFPObj *, char *, unsigned int, char *, unsigned int *));
-extern int     afp_enumerate_ext2 __P((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 __P((AFPObj *, char *, int, char *, int *));
-extern int     afp_catsearch_ext __P((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