]>
Commit | Line | Data |
---|---|---|
b061a43b A |
1 | /* |
2 | * Copyright (c) 2017 Apple Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_APACHE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
7 | * you may not use this file except in compliance with the License. | |
8 | * You may obtain a copy of the License at | |
9 | * | |
10 | * http://www.apache.org/licenses/LICENSE-2.0 | |
11 | * | |
12 | * Unless required by applicable law or agreed to in writing, software | |
13 | * distributed under the License is distributed on an "AS IS" BASIS, | |
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
15 | * See the License for the specific language governing permissions and | |
16 | * limitations under the License. | |
17 | * | |
18 | * @APPLE_APACHE_LICENSE_HEADER_END@ | |
19 | */ | |
20 | ||
21 | #ifndef __DIRSTAT_H__ | |
22 | #define __DIRSTAT_H__ | |
23 | ||
70ad1dc8 | 24 | #include <Availability.h> |
b061a43b A |
25 | #include <sys/types.h> |
26 | #include <stdint.h> | |
27 | ||
28 | __BEGIN_DECLS | |
29 | ||
30 | /* Fail if the file system does not support fast directory sizing on the provided directory */ | |
31 | #define DIRSTAT_FAST_ONLY 0x1 | |
32 | ||
33 | /* Do not use filesystem support for directory sizing. */ | |
34 | #define DIRSTAT_FORCE_FALLBACK 0x2 | |
35 | ||
36 | /* | |
37 | * NOT ABI: the size of this structure may grow. You must pass the current | |
38 | * size of this structure in as the dirstat_size argument to the functions | |
39 | * below. | |
40 | */ | |
41 | struct dirstat { | |
42 | off_t total_size; | |
43 | uint64_t descendants; | |
44 | }; | |
45 | ||
46 | /* Returns -1 on error and sets errno. Does not cross file-system boundaries. */ | |
47 | __API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)) | |
48 | int dirstat_np(const char *path, int flags, struct dirstat *ds, size_t dirstat_size); | |
49 | ||
50 | __API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0)) | |
51 | int dirstatat_np(int dfd, const char *path, int flags, struct dirstat *ds, size_t dirstat_size); | |
52 | ||
53 | __END_DECLS | |
54 | ||
55 | #endif // __DIRSTAT_H__ |