]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/volume.c
Redesign ad_open API to only use one arg for all flags, fix locking for adouble:v2
[netatalk.git] / etc / afpd / volume.c
index 7437f58b6a6fad9a86b7d13bf4dd1cac89cb7446..0d2bf0614560ca78e2d5955adf1730fea9d3c68b 100644 (file)
@@ -1620,7 +1620,7 @@ static int getvolparams( uint16_t bitmap, struct vol *vol, struct stat *st, char
      * .Parent file here if it doesn't exist. */
 
     ad_init(&ad, vol->v_adouble, vol->v_ad_options);
-    if (ad_open(&ad, vol->v_path, ADFLAGS_HF | ADFLAGS_DIR, O_RDWR | O_CREAT, 0666) != 0 ) {
+    if (ad_open(&ad, vol->v_path, ADFLAGS_HF | ADFLAGS_DIR | ADFLAGS_RDWR | ADFLAGS_CREATE, 0666) != 0 ) {
         isad = 0;
         vol->v_ctime = AD_DATE_FROM_UNIX(st->st_mtime);
 
@@ -1797,7 +1797,7 @@ static int getvolparams( uint16_t bitmap, struct vol *vol, struct stat *st, char
         data += aint;
     }
     if ( isad ) {
-        ad_close_metadata( &ad);
+        ad_close(&ad, ADFLAGS_HF);
     }
     *buflen = data - buf;
     return( AFP_OK );
@@ -2605,7 +2605,7 @@ int afp_setvolparams(AFPObj *obj _U_, char *ibuf, size_t ibuflen _U_, char *rbuf
         return AFPERR_BITMAP;
 
     ad_init(&ad, vol->v_adouble, vol->v_ad_options);
-    if ( ad_open(&ad,  vol->v_path, ADFLAGS_HF|ADFLAGS_DIR, O_RDWR) < 0 ) {
+    if ( ad_open(&ad,  vol->v_path, ADFLAGS_HF | ADFLAGS_DIR | ADFLAGS_RDWR) < 0 ) {
         if (errno == EROFS)
             return AFPERR_VLOCK;
 
@@ -2700,7 +2700,7 @@ static int create_special_folder (const struct vol *vol, const struct _special_f
     if ( !ret && folder->hide) {
         /* Hide it */
         ad_init(&ad, vol->v_adouble, vol->v_ad_options);
-        if (ad_open(&ad, p, ADFLAGS_HF | ADFLAGS_DIR, O_RDWR | O_CREAT, 0666) != 0) {
+        if (ad_open(&ad, p, ADFLAGS_HF | ADFLAGS_DIR | ADFLAGS_RDWR | ADFLAGS_CREATE, 0666) != 0) {
             free(p);
             free(q);
             return (-1);
@@ -2719,8 +2719,8 @@ static int create_special_folder (const struct vol *vol, const struct _special_f
             memcpy(ad_entry(&ad, ADEID_FINDERI) + FINDERINFO_FRFLAGOFF,&attr, sizeof(attr));
         }
 
-        ad_flush( &ad );
-        ad_close_metadata( &ad);
+        ad_flush(&ad);
+        ad_close(&ad, ADFLAGS_HF);
     }
     free(p);
     free(q);