source: project/release/4/hfs+/trunk/copyfile.h @ 15278

Last change on this file since 15278 was 15278, checked in by Jim Ursetto, 12 years ago

hfs+: update to version 0.3 (copyfile)

File size: 3.2 KB
Line 
1/*
2 * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24/* This file was obtained from:
25 * http://www.opensource.apple.com/source/Libc/Libc-391.5.18/darwin/copyfile.h
26 */
27
28#ifndef _COPYFILE_H_ /* version 0.1 */
29#define _COPYFILE_H_
30
31/*
32 * this is a proposed API to add to libSystem to faciliatate copying
33 * of files and their associated metadata.  There are several open
34 * source projects that need modifications to support preserving
35 * extended attributes and acls and this API collapses several hundred
36 * lines of modifications into one or two calls.
37 *
38 * This implementation is incomplete and the interface may change in a
39 * future release.
40 */
41
42/* private */
43#include <stdint.h>
44struct _copyfile_state;
45typedef struct _copyfile_state * copyfile_state_t;
46typedef uint32_t copyfile_flags_t;
47
48/* public */
49
50/* receives:
51 *   from       path to source file system object
52 *   to         path to destination file system object
53 *   state      opaque blob for future extensibility
54 *              Must be NULL in current implementation
55 *   flags      (described below)
56 * returns:
57 *   int        negative for error
58 */
59
60int copyfile(const char *from, const char *to, copyfile_state_t state, copyfile_flags_t flags);
61int copyfile_free(copyfile_state_t);
62copyfile_state_t copyfile_init(void);
63
64/* Flag for clients to disable their use of copyfile() */
65#define COPYFILE_DISABLE_VAR    "COPY_EXTENDED_ATTRIBUTES_DISABLE"
66
67/* flags for copyfile */
68
69#define COPYFILE_ACL        (1<<0)
70#define COPYFILE_STAT       (1<<1)
71#define COPYFILE_XATTR      (1<<2)
72#define COPYFILE_DATA       (1<<3)
73
74#define COPYFILE_SECURITY   (COPYFILE_STAT | COPYFILE_ACL)
75#define COPYFILE_METADATA   (COPYFILE_SECURITY | COPYFILE_XATTR)
76#define COPYFILE_ALL        (COPYFILE_METADATA | COPYFILE_DATA)
77
78#define COPYFILE_CHECK          (1<<16) /* return flags for xattr or acls if set */
79#define COPYFILE_EXCL           (1<<17) /* fail if destination exists */
80#define COPYFILE_NOFOLLOW_SRC   (1<<18) /* don't follow if source is a symlink */
81#define COPYFILE_NOFOLLOW_DST   (1<<19) /* don't follow if dst is a symlink */
82#define COPYFILE_MOVE           (1<<20) /* unlink src after copy */
83#define COPYFILE_UNLINK         (1<<21) /* unlink dst before copy */
84#define COPYFILE_NOFOLLOW       (COPYFILE_NOFOLLOW_SRC | COPYFILE_NOFOLLOW_DST)
85
86#define COPYFILE_PACK           (1<<22)
87#define COPYFILE_UNPACK         (1<<23)
88
89#define COPYFILE_VERBOSE        (1<<30)
90
91#endif /* _COPYFILE_H_ */
Note: See TracBrowser for help on using the repository browser.