]> arthur.barton.de Git - netatalk.git/commitdiff
long name an utf8 name in the same query (copy the same name for now). More
authordidg <didg>
Fri, 25 Oct 2002 11:10:46 +0000 (11:10 +0000)
committerdidg <didg>
Fri, 25 Oct 2002 11:10:46 +0000 (11:10 +0000)
offspring book keeping.

etc/afpd/directory.c
etc/afpd/file.c
etc/afpd/filedir.c

index 91e9b558cd1a4f3be3e869f124dc1503d4571b9f..c03c47ba5113ee95f4fc63b736f38d41613bee7e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: directory.c,v 1.48 2002-10-14 06:30:49 didg Exp $
+ * $Id: directory.c,v 1.49 2002-10-25 11:10:46 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -1047,7 +1047,7 @@ int getdirparams(const struct vol *vol,
 {
     struct maccess     ma;
     struct adouble     ad;
-    char               *data, *nameoff = NULL;
+    char               *data, *l_nameoff = NULL, *utf_nameoff = NULL;
     int                        bit = 0, isad = 0;
     u_int32_t           aint;
     u_int16_t          ashort;
@@ -1143,7 +1143,7 @@ int getdirparams(const struct vol *vol,
 
         case DIRPBIT_LNAME :
             if (dir->d_m_name) /* root of parent can have a null name */
-                nameoff = data;
+                l_nameoff = data;
             else
                 memset(data, 0, sizeof(u_int16_t));
             data += sizeof( u_int16_t );
@@ -1203,7 +1203,7 @@ int getdirparams(const struct vol *vol,
             if (afp_version >= 30) { /* UTF8 name */
                 utf8 = kTextEncodingUTF8;
                 if (dir->d_m_name) /* root of parent can have a null name */
-                    nameoff = data;
+                    utf_nameoff = data;
                 else
                     memset(data, 0, sizeof(u_int16_t));
                 data += sizeof( u_int16_t );
@@ -1231,9 +1231,14 @@ int getdirparams(const struct vol *vol,
         bitmap = bitmap>>1;
         bit++;
     }
-    if ( nameoff ) {
+    if ( l_nameoff ) {
         ashort = htons( data - buf );
-        memcpy( nameoff, &ashort, sizeof( ashort ));
+        memcpy( l_nameoff, &ashort, sizeof( ashort ));
+        data = set_name(data, dir->d_m_name, 0);
+    }
+    if ( utf_nameoff ) {
+        ashort = htons( data - buf );
+        memcpy( utf_nameoff, &ashort, sizeof( ashort ));
         data = set_name(data, dir->d_m_name, utf8);
     }
     if ( isad ) {
@@ -1688,6 +1693,7 @@ int               ibuflen, *rbuflen;
     if (of_stat(s_path) < 0) {
         return AFPERR_MISC;
     }
+    curdir->offcnt++;
     if ((dir = adddir( vol, curdir, s_path)) == NULL) {
         return AFPERR_MISC;
     }
index 7168a1a8572a96417213e9dae2fcae701ec5f133..c3e0780c2131bb3425823219760760b5f166a6fa 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: file.c,v 1.67 2002-10-13 21:30:55 didg Exp $
+ * $Id: file.c,v 1.68 2002-10-25 11:10:48 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -160,7 +160,8 @@ int getmetadata(struct vol *vol,
 #ifndef USE_LASTDID
     struct stat                lst, *lstp;
 #endif /* USE_LASTDID */
-    char               *data, *nameoff = NULL, *upath;
+    char               *data, *l_nameoff = NULL, *upath;
+    char                *utf_nameoff = NULL;
     int                        bit = 0;
     u_int32_t          aint;
     u_int16_t          ashort;
@@ -250,7 +251,7 @@ int getmetadata(struct vol *vol,
             break;
 
         case FILPBIT_LNAME :
-            nameoff = data;
+            l_nameoff = data;
             data += sizeof( u_int16_t );
             break;
 
@@ -355,7 +356,7 @@ int getmetadata(struct vol *vol,
         case FILPBIT_PDINFO :
             if (afp_version >= 30) { /* UTF8 name */
                 utf8 = kTextEncodingUTF8;
-                nameoff = data;
+                utf_nameoff = data;
                 data += sizeof( u_int16_t );
                 aint = 0;
                 memcpy(data, &aint, sizeof( aint ));
@@ -428,9 +429,14 @@ int getmetadata(struct vol *vol,
         bitmap = bitmap>>1;
         bit++;
     }
-    if ( nameoff ) {
+    if ( l_nameoff ) {
         ashort = htons( data - buf );
-        memcpy(nameoff, &ashort, sizeof( ashort ));
+        memcpy(l_nameoff, &ashort, sizeof( ashort ));
+        data = set_name(data, path, 0);
+    }
+    if ( utf_nameoff ) {
+        ashort = htons( data - buf );
+        memcpy(utf_nameoff, &ashort, sizeof( ashort ));
         data = set_name(data, path, utf8);
     }
     *buflen = data - buf;
@@ -597,6 +603,7 @@ int         ibuflen, *rbuflen;
     ad_close( adp, ADFLAGS_DF|ADFLAGS_HF );
 
 createfile_done:
+    curdir->offcnt++;
 
 #ifdef DROPKLUDGE
     if (vol->v_flags & AFPVOL_DROPBOX) {
@@ -1105,6 +1112,7 @@ int               ibuflen, *rbuflen;
     if ( (err = copyfile(p, upath , newname, vol_noadouble(vol))) < 0 ) {
         return err;
     }
+    curdir->offcnt++;
 
 #ifdef DROPKLUDGE
     if (vol->v_flags & AFPVOL_DROPBOX) {
index 22c38870103ed08d57a08abc9db90767956bf4fa..0eb383e59ea4dfdce05a1c1cd756b0a62fad1eb5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: filedir.c,v 1.34 2002-10-13 06:18:13 didg Exp $
+ * $Id: filedir.c,v 1.35 2002-10-25 11:10:48 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -566,6 +566,7 @@ int         ibuflen, *rbuflen;
 #endif /* CNID_DB */
     }
     if ( rc == AFP_OK ) {
+       curdir->offcnt--;
         setvoltime(obj, vol );
     }
 
@@ -697,6 +698,9 @@ int         ibuflen, *rbuflen;
     rc = moveandrename(vol, sdir, oldname, newname, isdir);
 
     if ( rc == AFP_OK ) {
+        curdir->offcnt++;
+        sdir->offcnt--;
+
         char *upath = mtoupath(vol, newname);
 #ifdef DROPKLUDGE
         if (vol->v_flags & AFPVOL_DROPBOX) {