]> arthur.barton.de Git - netatalk.git/commitdiff
use the cnid in adouble header as a hint for dbd add/update
authordidg <didg>
Mon, 30 Nov 2009 15:27:48 +0000 (15:27 +0000)
committerdidg <didg>
Mon, 30 Nov 2009 15:27:48 +0000 (15:27 +0000)
etc/afpd/file.c
etc/cnid_dbd/dbd_lookup.c
libatalk/adouble/ad_attr.c
libatalk/cnid/dbd/cnid_dbd.c

index 198b155e78899bc6b076189e2655ada4f4bf399f..a5a2c1cce76da4b0c0aae24086be55e4c5a2c5aa 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: file.c,v 1.125 2009-11-27 15:45:40 franklahm Exp $
+ * $Id: file.c,v 1.126 2009-11-30 15:27:48 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -187,6 +187,7 @@ char *set_name(const struct vol *vol, char *data, cnid_t pid, char *name, cnid_t
                                  (1 << FILPBIT_RFLEN) |\
                                  (1 << FILPBIT_EXTRFLEN) |\
                                  (1 << FILPBIT_PDINFO) |\
+                                 (1 << FILPBIT_FNUM) |\
                                  (1 << FILPBIT_UNIXPR)))
 
 /* -------------------------- */
@@ -196,6 +197,10 @@ u_int32_t get_id(struct vol *vol, struct adouble *adp,  const struct stat *st,
     u_int32_t aint = 0;
 
     if (vol->v_cdb != NULL) {
+        /* prime aint with what we think is the cnid, set did to zero for
+           catching moved files */
+        aint = ad_getid(adp, st->st_dev, st->st_ino, 0, vol->v_stamp);
+
            aint = cnid_add(vol->v_cdb, st, did, upath, len, aint);
            /* Throw errors if cnid_add fails. */
            if (aint == CNID_INVALID) {
index f680d2f0c5ae7a46fae3d169dcd0e77791774b67..df24cc4c5c5270bddc40688e623e72a88ea8fc79 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: dbd_lookup.c,v 1.13 2009-11-28 15:42:05 didg Exp $
+ * $Id: dbd_lookup.c,v 1.14 2009-11-30 15:27:48 didg Exp $
  *
  * Copyright (C) Joerg Lenneis 2003
  * Copyright (C) Frank Lahm 2009
@@ -241,9 +241,8 @@ int dbd_lookup(DBD *dbd, struct cnid_dbd_rqst *rqst, struct cnid_dbd_rply *rply,
         LOG(log_debug, logtype_cnid, "dbd_lookup(DID:%u/'%s',0x%llx/0x%llx): CNID resolve problem: server side rename oder reused inode",
             ntohl(rqst->did), rqst->name, (unsigned long long)rqst->dev, (unsigned long long)rqst->ino);
         /* Case 2) ? */
-        if (strcmp(rqst->name, (char *)devdata.data + CNID_NAME_OFS) == 0) {
-            rqst->cnid = id_devino;
-            LOG(log_debug, logtype_cnid, "dbd_lookup: server side mv from one dir to another");
+        if (rqst->cnid == id_devino) {
+            LOG(log_debug, logtype_cnid, "dbd_lookup: server side mv (with resource fork)");
             update = 1;
         } else {
             if ( ! roflag) {
index a5727d52d40a31a2d48939057e95ceed983b0cfc..3ce43f2d4be5c2b2533c1d01eed05c24f96856a6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ad_attr.c,v 1.10 2009-07-21 13:41:16 didg Exp $
+ * $Id: ad_attr.c,v 1.11 2009-11-30 15:27:48 didg Exp $
  */
 
 #ifdef HAVE_CONFIG_H
@@ -168,7 +168,7 @@ u_int32_t ad_getid (struct adouble *adp, const dev_t st_dev, const ino_t st_ino
         memcpy(&a_did, ad_entry(adp, ADEID_DID), sizeof(cnid_t));
 
         if (  ((adp->ad_options & ADVOL_NODEV) || dev == st_dev)
-              && ino == st_ino && a_did == did
+              && ino == st_ino && (!did || a_did == did)
               && !memcmp(stamp, temp, sizeof(temp))) {
             memcpy(&aint, ad_entry(adp, ADEID_PRIVID), sizeof(aint));
             return aint;
index 2a34c8d3eda546927b2b6180d4532eb811f1a87e..20512de4cdfc300607258d9af019fcc91dc70a18 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: cnid_dbd.c,v 1.14 2009-11-24 12:18:19 didg Exp $
+ * $Id: cnid_dbd.c,v 1.15 2009-11-30 15:27:48 didg Exp $
  *
  * Copyright (C) Joerg Lenneis 2003
  * All Rights Reserved.  See COPYING.
@@ -513,7 +513,7 @@ void cnid_dbd_close(struct _cnid_db *cdb)
 /* ---------------------- */
 cnid_t cnid_dbd_add(struct _cnid_db *cdb, const struct stat *st,
                     const cnid_t did, char *name, const size_t len,
-                    cnid_t hint _U_)
+                    cnid_t hint)
 {
     CNID_private *db;
     struct cnid_dbd_rqst rqst;
@@ -541,6 +541,7 @@ cnid_t cnid_dbd_add(struct _cnid_db *cdb, const struct stat *st,
 
     rqst.ino = st->st_ino;
     rqst.type = S_ISDIR(st->st_mode)?1:0;
+    rqst.cnid = hint;
     rqst.did = did;
     rqst.name = name;
     rqst.namelen = len;