]> arthur.barton.de Git - netatalk.git/commitdiff
simplify fork mapping, always map ADFLAGS_SETSHRMD | ADFLAGS_CHECK_OF to ADFLAGS_DF
authorFrank Lahm <franklahm@googlemail.com>
Wed, 8 Feb 2012 10:01:57 +0000 (11:01 +0100)
committerFrank Lahm <franklahm@googlemail.com>
Wed, 8 Feb 2012 10:01:57 +0000 (11:01 +0100)
libatalk/adouble/ad_flush.c
libatalk/adouble/ad_open.c

index dbf1576d886d81861ac14b8a446d6d4add7e5bcc..89a37a7e9fcf55f9e9820f1d9cee8bc52e2c313e 100644 (file)
@@ -359,7 +359,7 @@ int ad_close(struct adouble *ad, int adflags)
         ad_meta_fileno(ad), ad->ad_mdp->adf_refcount,
         ad_reso_fileno(ad), ad->ad_rfp->adf_refcount);
 
-    if ((ad->ad_vers == AD_VERSION2) && (adflags & (ADFLAGS_SETSHRMD | ADFLAGS_CHECK_OF))) {
+    if (adflags & (ADFLAGS_SETSHRMD | ADFLAGS_CHECK_OF)) {
         /* sharemode locks are stored in the data fork, adouble:v2 needs this extra handling */
         adflags |= ADFLAGS_DF;
     }
index f7048aa054c1979c13ae352b2157977d124699d6..b83d384d4570213521e1e7e7a4f81ac498beb23a 100644 (file)
@@ -778,6 +778,25 @@ static int ad2openflags(const struct adouble *ad, int adfile, int adflags)
     return oflags;
 }
 
+static int ad_conv_v22ea(const char *path, int adflags, const struct adouble *adea)
+{
+    EC_INIT;
+    struct adouble adv2;
+    const char *adp;
+
+    LOG(log_note, logtype_default,"ad_conv_v22ea(\"%s\"): BEGIN", fullpathname(path));
+
+    ad_init_old(&adv2, AD_VERSION2, adea->ad_options);
+    EC_NULL( adp = adv2.ad_ops->ad_path(path, adflags) );
+
+    LOG(log_note, logtype_default,"ad_conv_v22ea(\"%s\"): adouble:v2 path: \"%s\"",
+        fullpathname(path), fullpathname(adp));
+
+EC_CLEANUP:
+    EC_EXIT;
+}
+
+
 static int ad_open_df(const char *path, int adflags, mode_t mode, struct adouble *ad)
 {
     EC_INIT;
@@ -1584,10 +1603,11 @@ int ad_open(struct adouble *ad, const char *path, int adflags, ...)
         /* Checking for open forks requires sharemode lock support (ie RDWR instead of RDONLY) */
         adflags |= ADFLAGS_SETSHRMD;
 
+    if (adflags & ADFLAGS_SETSHRMD)
+        /* sharemode locks are stored in the data fork */
+        adflags |= ADFLAGS_DF;
+
     if (ad->ad_vers == AD_VERSION2) {
-        if (adflags & ADFLAGS_SETSHRMD)
-            /* sharemode locks are stored in the data fork, adouble:v2 needs this extra handling here */
-            adflags |= ADFLAGS_DF;
         if (adflags & ADFLAGS_RF)
             adflags |= ADFLAGS_HF;
         if (adflags & ADFLAGS_NORF)