]> git.saurik.com Git - apple/file_cmds.git/commitdiff
file_cmds-116.10.tar.gz mac-os-x-10410ppc mac-os-x-10410x86 mac-os-x-1047ppc mac-os-x-1047x86 mac-os-x-1048ppc mac-os-x-1048x86 mac-os-x-1049ppc mac-os-x-1049x86 v116.10
authorApple <opensource@apple.com>
Mon, 1 May 2006 23:10:24 +0000 (23:10 +0000)
committerApple <opensource@apple.com>
Mon, 1 May 2006 23:10:24 +0000 (23:10 +0000)
cp/utils.c
mv/mv.c

index 707266e56e501d8ae579694d99e1f37786f31862..70dc376d6c371ae70bed52b47e4da023289c9d75 100644 (file)
@@ -58,6 +58,8 @@ __RCSID("$FreeBSD: src/bin/cp/utils.c,v 1.38 2002/07/31 16:52:16 markm Exp $");
 
 #ifdef __APPLE__
 #include <copyfile.h>
+#include <string.h>
+#include <sys/mount.h>
 #endif
 
 #include "extern.h"
@@ -131,6 +133,28 @@ copy_file(FTSENT *entp, int dne)
 
        rval = 0;
 
+#ifdef __APPLE__
+       if (S_ISREG(fs->st_mode)) {
+               struct statfs sfs;
+
+               /*
+                * Pre-allocate blocks for the destination file if it
+                * resides on Xsan.
+                */
+               if (fstatfs(to_fd, &sfs) == 0 &&
+                   strcmp(sfs.f_fstypename, "acfs") == 0) {
+                       fstore_t fst;
+
+                       fst.fst_flags = 0;
+                       fst.fst_posmode = F_PEOFPOSMODE;
+                       fst.fst_offset = 0;
+                       fst.fst_length = fs->st_size;
+
+                       (void) fcntl(to_fd, F_PREALLOCATE, &fst);
+               }
+       }
+#endif /* __APPLE__ */
+
        /*
         * Mmap and write if less than 8M (the limit is so we don't totally
         * trash memory on big files.  This is really a minor hack, but it
diff --git a/mv/mv.c b/mv/mv.c
index f79cc0ef6efa88556e9d809ab29b73b6200a05c0..b8f275f09c4d920d71dd387b96717a1dbdb14f4a 100644 (file)
--- a/mv/mv.c
+++ b/mv/mv.c
@@ -69,6 +69,7 @@ __RCSID("$FreeBSD: src/bin/mv/mv.c,v 1.39 2002/07/09 17:45:13 johan Exp $");
 
 #ifdef __APPLE__
 #include <copyfile.h>
+#include <sys/mount.h>
 #endif
 
 #include "pathnames.h"
@@ -322,6 +323,27 @@ fastcopy(char *from, char *to, struct stat *sbp)
                (void)close(from_fd);
                return (1);
        }
+#ifdef __APPLE__
+       {
+               struct statfs sfs;
+
+               /*
+                * Pre-allocate blocks for the destination file if it
+                * resides on Xsan.
+                */
+               if (fstatfs(to_fd, &sfs) == 0 &&
+                   strcmp(sfs.f_fstypename, "acfs") == 0) {
+                       fstore_t fst;
+
+                       fst.fst_flags = 0;
+                       fst.fst_posmode = F_PEOFPOSMODE;
+                       fst.fst_offset = 0;
+                       fst.fst_length = sbp->st_size;
+
+                       (void) fcntl(to_fd, F_PREALLOCATE, &fst);
+               }
+       }
+#endif /* __APPLE__ */
        while ((nread = read(from_fd, bp, (size_t)blen)) > 0)
                if (write(to_fd, bp, (size_t)nread) != nread) {
                        warn("%s", to);