]> arthur.barton.de Git - netatalk.git/commitdiff
Add some description of dir caching in afpd
authorfranklahm <franklahm>
Wed, 6 Jan 2010 15:37:01 +0000 (15:37 +0000)
committerfranklahm <franklahm>
Wed, 6 Jan 2010 15:37:01 +0000 (15:37 +0000)
etc/afpd/directory.c

index 9917dd43358173c6e0a0fed5e3757b495476d325..a2b746eef79a8767728d7527530ec24e68d86803 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: directory.c,v 1.125 2010-01-06 11:08:53 franklahm Exp $
+ * $Id: directory.c,v 1.126 2010-01-06 15:37:01 franklahm Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -62,6 +62,41 @@ char *strchr (), *strrchr ();
 extern void addir_inherit_acl(const struct vol *vol);
 #endif
 
+/* 
+ * Directory caches
+ * ================
+ *
+ * There are currently two cache structures where afpd caches directory information
+ * a) a DID/dirname cache in a hashtable 
+ * b) a (red-black) tree with CNIDs as key
+ *
+ * a) is for searching by DID/dirname
+ * b) is for searching by CNID
+ *
+ * Through additional parent, child, previous and next pointers, b) is also used to
+ * represent the on-disk layout of the filesystem. parent and child point to parent
+ * and child directory respectively, linking 2 or more subdirectories in one
+ * directory with previous and next pointers.
+ *
+ * Usage examples, highlighting the main functions:
+ * 
+ * a) is eg used in enumerate():
+ * if IS_DIR
+ *     dir = dirsearch_byname() // search in cache
+ *     if (dir == NULL)         // not found
+ *         dir = adddir()       // add to cache
+ *      getdirparams()
+ *
+ * b) is eg used in afp_getfildirparams()
+ * dirlookup()             // wrapper for cache and db search
+ *   => dir = dirsearch()  // search in cache
+ *      if (dir)           // found
+ *          return
+ *      else               // not found,
+ *          cnid_resolve() // resolve with CNID database
+ *      cname()            // add to cache
+ */
+
 struct dir  *curdir;
 int             afp_errno;