copyfile-146.250.1.tar.gz
[apple/copyfile.git] / copyfile.h
index 8a0c6adb7e678fa41371edc77f2ed1585ee0686a..efea9dd5445ea19f607ac038067d2b7cc1815627 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2004-2010 Apple, Inc. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #define _COPYFILE_H_
 
 /*
- * this is an API to faciliatate copying of files and their
- * associated metadata.  There are several open source projects that
- * need modifications to support preserving extended attributes and
- * acls and this API collapses several hundred lines of modifications
- * into one or two calls.
- *
- * This implementation is incomplete and the interface may change in a 
- * future release.
+ * This API facilitates the copying of files and their associated
+ * metadata.  There are several open source projects that need
+ * modifications to support preserving extended attributes and ACLs
+ * and this API collapses several hundred lines of modifications into
+ * one or two calls.
  */
 
 /* private */
@@ -65,11 +62,19 @@ copyfile_state_t copyfile_state_alloc(void);
 int copyfile_state_get(copyfile_state_t s, uint32_t flag, void * dst);
 int copyfile_state_set(copyfile_state_t s, uint32_t flag, const void * src);
 
+typedef int (*copyfile_callback_t)(int, int, copyfile_state_t, const char *, const char *, void *);
+
 #define COPYFILE_STATE_SRC_FD          1
 #define COPYFILE_STATE_SRC_FILENAME    2
 #define COPYFILE_STATE_DST_FD          3
 #define COPYFILE_STATE_DST_FILENAME    4
 #define COPYFILE_STATE_QUARANTINE      5
+#define        COPYFILE_STATE_STATUS_CB        6
+#define        COPYFILE_STATE_STATUS_CTX       7
+#define        COPYFILE_STATE_COPIED           8
+#define        COPYFILE_STATE_XATTRNAME        9
+#define        COPYFILE_STATE_WAS_CLONED       10
+
 
 #define        COPYFILE_DISABLE_VAR    "COPYFILE_DISABLE"
 
@@ -84,6 +89,7 @@ int copyfile_state_set(copyfile_state_t s, uint32_t flag, const void * src);
 #define COPYFILE_METADATA   (COPYFILE_SECURITY | COPYFILE_XATTR)
 #define COPYFILE_ALL       (COPYFILE_METADATA | COPYFILE_DATA)
 
+#define        COPYFILE_RECURSIVE      (1<<15) /* Descend into hierarchies */
 #define COPYFILE_CHECK         (1<<16) /* return flags for xattr or acls if set */
 #define COPYFILE_EXCL          (1<<17) /* fail if destination exists */
 #define COPYFILE_NOFOLLOW_SRC  (1<<18) /* don't follow if source is a symlink */
@@ -95,8 +101,31 @@ int copyfile_state_set(copyfile_state_t s, uint32_t flag, const void * src);
 #define COPYFILE_PACK          (1<<22)
 #define COPYFILE_UNPACK                (1<<23)
 
+#define COPYFILE_CLONE         (1<<24)
+#define COPYFILE_CLONE_FORCE   (1<<25)
+
+#define COPYFILE_RUN_IN_PLACE  (1<<26)
+
+#define COPYFILE_DATA_SPARSE   (1<<27)
+
 #define COPYFILE_VERBOSE       (1<<30)
 
+#define        COPYFILE_RECURSE_ERROR  0
+#define        COPYFILE_RECURSE_FILE   1
+#define        COPYFILE_RECURSE_DIR    2
+#define        COPYFILE_RECURSE_DIR_CLEANUP    3
+#define        COPYFILE_COPY_DATA      4
+#define        COPYFILE_COPY_XATTR     5
+
+#define        COPYFILE_START          1
+#define        COPYFILE_FINISH         2
+#define        COPYFILE_ERR            3
+#define        COPYFILE_PROGRESS       4
+
+#define        COPYFILE_CONTINUE       0
+#define        COPYFILE_SKIP   1
+#define        COPYFILE_QUIT   2
+
 __END_DECLS
 
 #endif /* _COPYFILE_H_ */