]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/file.c
Fix build
[netatalk.git] / etc / afpd / file.c
index 14906d294f124d800a43493450901299f606d0dc..c8101048e038ecbc52c1acd6db978047435c2234 100644 (file)
@@ -76,22 +76,16 @@ static int default_type(void *finder)
 /* FIXME path : unix or mac name ? (for now it's unix name ) */
 void *get_finderinfo(const struct vol *vol, const char *upath, struct adouble *adp, void *data, int islink)
 {
-    struct extmap      *em;
     void                *ad_finder = NULL;
     int                 chk_ext = 0;
-    
-    if (adp)
+
         ad_finder = ad_entry(adp, ADEID_FINDERI);
 
     if (ad_finder) {
         memcpy(data, ad_finder, ADEDLEN_FINDERI);
-        /* default type ? */
-        if (default_type(ad_finder)) 
-            chk_ext = 1;
     }
     else {
         memcpy(data, ufinderi, ADEDLEN_FINDERI);
-        chk_ext = 1;
         if (vol_inv_dots(vol) && *upath == '.') { /* make it invisible */
             uint16_t ashort;
             
@@ -107,14 +101,8 @@ void *get_finderinfo(const struct vol *vol, const char *upath, struct adouble *a
         memcpy((char *)data + FINDERINFO_FRFLAGOFF, &linkflag, 2);
         memcpy((char *)data + FINDERINFO_FRTYPEOFF,"slnk",4); 
         memcpy((char *)data + FINDERINFO_FRCREATOFF,"rhap",4); 
-        chk_ext = 0;
     }
 
-    /** Only enter if no appledouble information and no finder information found. */
-    if (chk_ext && (em = getextmap( upath ))) {
-        memcpy(data, em->em_type, sizeof( em->em_type ));
-        memcpy((char *)data + 4, em->em_creator, sizeof(em->em_creator));
-    }
     return data;
 }
 
@@ -249,8 +237,7 @@ restart:
                         vol->v_path);
                     vol->v_cdb = cnid_open(vol->v_path, vol->v_umask, "tdb", flags, NULL, NULL);
                     if (vol->v_cdb) {
-                        /* deactivate cnid caching/storing in AppleDouble files and set ro mode*/
-                        vol->v_flags &= ~AFPVOL_CACHE;
+                        /* set ro mode*/
                         vol->v_flags |= AFPVOL_RO;
 #ifdef SERVERTEXT
                         /* kill ourself with SIGUSR2 aka msg pending */
@@ -1005,17 +992,6 @@ int setfilparams(struct vol *vol,
             ad_setdate(adp, AD_DATE_BACKUP, bdate);
             break;
         case FILPBIT_FINFO :
-            if (default_type( ad_entry( adp, ADEID_FINDERI ))
-                    && ( 
-                     ((em = getextmap( path->m_name )) &&
-                      !memcmp(finder_buf, em->em_type, sizeof( em->em_type )) &&
-                      !memcmp(finder_buf + 4, em->em_creator,sizeof( em->em_creator)))
-                     || ((em = getdefextmap()) &&
-                      !memcmp(finder_buf, em->em_type, sizeof( em->em_type )) &&
-                      !memcmp(finder_buf + 4, em->em_creator,sizeof( em->em_creator)))
-            )) {
-                memcpy(finder_buf, ufinderi, 8 );
-            }
             memcpy(ad_entry( adp, ADEID_FINDERI ), finder_buf, 32 );
             break;
         case FILPBIT_UNIXPR :
@@ -1337,104 +1313,6 @@ copy_exit:
     return( retvalue );
 }
 
-/* ----------------------- */
-static int copy_all(const int dfd, const void *buf,
-                               size_t buflen)
-{
-    ssize_t cc;
-
-#ifdef DEBUG
-    LOG(log_debug9, logtype_afpd, "begin copy_all:");
-#endif /* DEBUG */
-
-    while (buflen > 0) {
-        if ((cc = write(dfd, buf, buflen)) < 0) {
-            switch (errno) {
-            case EINTR:
-                continue;
-            default:
-                return -1;
-            }
-        }
-        buflen -= cc;
-    }
-
-#ifdef DEBUG
-    LOG(log_debug9, logtype_afpd, "end copy_all:");
-#endif /* DEBUG */
-
-    return 0;
-}
-
-/* -------------------------- 
- * copy only the fork data stream
-*/
-static int copy_fork(int eid, struct adouble *add, struct adouble *ads)
-{
-    ssize_t cc;
-    int     err = 0;
-    char    filebuf[8192];
-    int     sfd, dfd;
-
-    if (eid == ADEID_DFORK) {
-        sfd = ad_data_fileno(ads);
-        dfd = ad_data_fileno(add);
-    }
-    else {
-        sfd = ad_reso_fileno(ads);
-        dfd = ad_reso_fileno(add);
-    }        
-
-    if ((off_t)-1 == lseek(sfd, ad_getentryoff(ads, eid), SEEK_SET))
-       return -1;
-
-    if ((off_t)-1 == lseek(dfd, ad_getentryoff(add, eid), SEEK_SET))
-       return -1;
-       
-#if 0 /* ifdef SENDFILE_FLAVOR_LINUX */
-    /* doesn't work With 2.6 FIXME, only check for EBADFD ? */
-    off_t   offset = 0;
-    size_t  size;
-    struct stat         st;
-    #define BUF 128*1024*1024
-
-    if (fstat(sfd, &st) == 0) {
-        
-        while (1) {
-            if ( offset >= st.st_size) {
-               return 0;
-            }
-            size = (st.st_size -offset > BUF)?BUF:st.st_size -offset;
-            if ((cc = sys_sendfile(dfd, sfd, &offset, size)) < 0) {
-                switch (errno) {
-                case ENOSYS:
-                case EINVAL:  /* there's no guarantee that all fs support sendfile */
-                    goto no_sendfile;
-                default:
-                    return -1;
-                }
-            }
-        }
-    }
-    no_sendfile:
-    lseek(sfd, offset, SEEK_SET);
-#endif 
-
-    while (1) {
-        if ((cc = read(sfd, filebuf, sizeof(filebuf))) < 0) {
-            if (errno == EINTR)
-                continue;
-            err = -1;
-            break;
-        }
-
-        if (!cc || ((err = copy_all(dfd, filebuf, cc)) < 0)) {
-            break;
-        }
-    }
-    return err;
-}
-
 /* ----------------------------------
  * if newname is NULL (from directory.c) we don't want to copy the resource fork.
  * because we are doing it elsewhere.