From 80d0eca29401ba9d1e291e7d03402cda1e1731b7 Mon Sep 17 00:00:00 2001 From: franklahm Date: Fri, 4 Sep 2009 07:59:50 +0000 Subject: [PATCH] Enable CNID caching/backup in AppleDouble files by default. New voloption nocnidcache disables it. --- NEWS | 6 ++++++ config/AppleVolumes.default.tmpl | 3 +++ etc/afpd/volume.c | 12 ++++++++---- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 809ce8fa..cda4e302 100644 --- a/NEWS +++ b/NEWS @@ -14,8 +14,14 @@ Changes in 2.1 will be able to upgrade the CNID databases. * NEW: AppleDouble compatible UNIX files utility suite `ad ...`. With 2.1 only `ad ls`. +* NEW: afpd: AFP 3.2 support * NEW: afpd: ACL support with ZFS * NEW: afpd: ExtendedAttributes support with ZFS +* NEW: afpd: store and read CNIDs to/from AppleDouble files by default. + This is used as a cache and as a backup in case the database + is deleted or corrupted. It can be disabled with a new volume + option "nocnidcache". + Changes in 2.0.x ================ diff --git a/config/AppleVolumes.default.tmpl b/config/AppleVolumes.default.tmpl index 95a3b732..74a5c350 100644 --- a/config/AppleVolumes.default.tmpl +++ b/config/AppleVolumes.default.tmpl @@ -111,6 +111,9 @@ # compatible filesystem (e.g. ZFS) and an ACL API # compatible to *Solaris. In other words: this requires # Solaris, Opensolaris or a derived distribution. +# nocnidcache -> Don't store and read CNID to/from AppleDouble file. +# This should not be used as it also prevents a CNID +# database rebuild with `dbd`! # dbpath:path -> store the database stuff in the following path. # password:password -> set a volume password (8 characters max) diff --git a/etc/afpd/volume.c b/etc/afpd/volume.c index 346c9a98..04f53f75 100644 --- a/etc/afpd/volume.c +++ b/etc/afpd/volume.c @@ -1,5 +1,5 @@ /* - * $Id: volume.c,v 1.88 2009-07-20 23:23:02 didg Exp $ + * $Id: volume.c,v 1.89 2009-09-04 07:59:50 franklahm Exp $ * * Copyright (c) 1990,1993 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -180,7 +180,7 @@ static const _vol_opt_name vol_opt_names[] = { {AFPVOL_NODEV, "NODEV"}, /* always use 0 for device number in cnid calls */ {AFPVOL_CASEINSEN, "CASEINSENSITIVE"}, /* volume is case insensitive */ {AFPVOL_EILSEQ, "ILLEGALSEQ"}, /* encode illegal sequence */ - {AFPVOL_CACHE, "CACHEID"}, /* Use adouble v2 CNID caching, default don't use it */ + {AFPVOL_CACHE, "CACHEID"}, /* Use adouble v2 CNID caching. Default: yes */ {AFPVOL_EXT_ATTRS, "EXT_ATTRS"}, /* Vol supports Extened Attributes */ {AFPVOL_ACLS, "ACLS"}, /* Vol supports ACLs */ {0, NULL} @@ -500,8 +500,8 @@ static void volset(struct vol_option *options, struct vol_option *save, options[VOLOPT_FLAGS].i_value |= AFPVOL_CASEINSEN; else if (strcasecmp(p, "illegalseq") == 0) options[VOLOPT_FLAGS].i_value |= AFPVOL_EILSEQ; - else if (strcasecmp(p, "cachecnid") == 0) - options[VOLOPT_FLAGS].i_value |= AFPVOL_CACHE; + else if (strcasecmp(p, "nocnidcache") == 0) + options[VOLOPT_FLAGS].i_value &= ~AFPVOL_CACHE; p = strtok(NULL, ","); } @@ -1094,6 +1094,10 @@ struct passwd *pwent; } memset(save_options, 0, sizeof(save_options)); + + /* Enable some default options for all volumes */ + save_options[VOLOPT_FLAGS].i_value |= AFPVOL_CACHE; + while ( myfgets( buf, sizeof( buf ), fp ) != NULL ) { initline( strlen( buf ), buf ); parseline( sizeof( path ) - 1, path ); -- 2.39.2