]> arthur.barton.de Git - netatalk.git/commitdiff
New volume option searchdb which enables fast CNID db dbd name search
authorFrank Lahm <franklahm@googlemail.com>
Tue, 7 Dec 2010 11:08:20 +0000 (12:08 +0100)
committerFrank Lahm <franklahm@googlemail.com>
Tue, 7 Dec 2010 11:08:20 +0000 (12:08 +0100)
NEWS
etc/afpd/catsearch.c
etc/afpd/volume.c
include/atalk/volume.h
man/man5/AppleVolumes.default.5.tmpl

diff --git a/NEWS b/NEWS
index b03244cc4e1c4ef854848657d7a5c713930de1d6..453f20e6f97c8aba9733495d27b7b26f1328654d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,9 @@
+Changes in 2.2alpha5
+====================
+
+* UPD: afpd: new option "searchdb" which enables fast catalog searches
+       using the CNID db.
+
 Changes in 2.2alpha4
 ====================
 
index aee1b8f1f510fbba190f33e2983d458d92f6756f..4ef8be4317fee15b6e57469e43cda62b23b9947a 100644 (file)
@@ -1013,7 +1013,9 @@ static int catsearch_afp(AFPObj *obj _U_, char *ibuf, size_t ibuflen,
     
     /* Call search */
     *rbuflen = 24;
-    if ((c1.rbitmap & (1 << FILPBIT_PDINFO)) && (strcmp(vol->v_cnidscheme, "dbd") == 0))
+    if ((c1.rbitmap & (1 << FILPBIT_PDINFO))
+        && (strcmp(vol->v_cnidscheme, "dbd") == 0)
+        && (vol->v_flags & AFPVOL_SEARCHDB))
         /* we've got a name and it's a dbd volume, so search CNID database */
         ret = catsearch_db(vol, vol->v_root, uname, rmatches, &catpos[0], rbuf+24, &nrecs, &rsize, ext);
     else
index 479923f246e46c70496878ed3c46c062772d9648..507a8eeb9782b45db4815c148cda7e163e378fec 100644 (file)
@@ -504,6 +504,8 @@ static void volset(struct vol_option *options, struct vol_option *save,
                 options[VOLOPT_FLAGS].i_value &= ~AFPVOL_CACHE;
             else if (strcasecmp(p, "tm") == 0)
                 options[VOLOPT_FLAGS].i_value |= AFPVOL_TM;
+            else if (strcasecmp(p, "searchdb") == 0)
+                options[VOLOPT_FLAGS].i_value |= AFPVOL_SEARCHDB;
 /* Found this in branch dir-rewrite, maybe we want to use it sometimes */
 #if 0
             else if (strcasecmp(p, "cdrom") == 0)
@@ -733,7 +735,8 @@ static int creatvol(AFPObj *obj, struct passwd *pwd,
     volume->v_vid = htons(volume->v_vid);
 #ifdef HAVE_ACLS
     if (check_vol_acl_support(volume))
-        volume->v_flags |= AFPVOL_ACLS;
+        volume->v_flags |= AFPVOL_ACLS
+;
 #endif
 
     /* handle options */
index 993b1a746ecd9b3295d4f33074ef5a063119e1d5..77966459b2618f69d3cff16faeae7680a00bb9e0 100644 (file)
@@ -133,9 +133,13 @@ struct vol {
 
 #define AFPVOL_CACHE     (1 << 21)   /* Use adouble v2 CNID caching. Default: yes */
 #define AFPVOL_INV_DOTS  (1 << 22)   /* dots files are invisible */
-#define AFPVOL_TM        (1 << 24)   /* Supports TimeMachine */
-#define AFPVOL_ACLS      (1 << 25)   /* Volume supports ACLS */
-#define AFPVOL_CDROM     (1 << 25)   /* Ejectable media eg CD -> in memory CNID db */
+#define AFPVOL_TM        (1 << 23)   /* Supports TimeMachine */
+#define AFPVOL_ACLS      (1 << 24)   /* Volume supports ACLS */
+#define AFPVOL_SEARCHDB  (1 << 25)   /* Use fast CNID db search instead of filesystem */
+/* Found this in branch dir-rewrite, maybe we want to use it sometimes */
+#if 0
+#define AFPVOL_CDROM     (1 << XX)   /* Ejectable media eg CD -> in memory CNID db */
+#endif
 
 /* Extended Attributes vfs indirection  */
 #define AFPVOL_EA_NONE           0   /* No EAs */
index afaec7866701b6049cdfe760d1c67c19d9d7fd27..c754aeea017bcca0ebdc4564e69f9d9b4b7cae8b 100644 (file)
@@ -2,12 +2,12 @@
 .\"     Title: AppleVolumes.default
 .\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
 .\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\"      Date: 22 Apr 2010
+.\"      Date: 07 Dec 2010
 .\"    Manual: Netatalk 2.2
 .\"    Source: Netatalk 2.2
 .\"  Language: English
 .\"
-.TH "APPLEVOLUMES\&.DEFAU" "5" "22 Apr 2010" "Netatalk 2.2" "Netatalk 2.2"
+.TH "APPLEVOLUMES\&.DEFAU" "5" "07 Dec 2010" "Netatalk 2.2" "Netatalk 2.2"
 .\" -----------------------------------------------------------------
 .\" * set default formatting
 .\" -----------------------------------------------------------------
@@ -234,6 +234,11 @@ options:\fI[option]\fR
 .RS 4
 This allows multiple options to be specified in a comma delimited format\&. The available options are:
 .PP
+searchdb
+.RS 4
+Use fast CNID database namesearch instead of slow recursive filesystem search\&. Relies on a consistent CNID database, ie Samba or local filesystem access lead to inaccurate or wrong results\&. Works only for "dbd" CNID db volumes\&.
+.RE
+.PP
 tm
 .RS 4
 Enable Time Machine suport for this volume\&.