]>
Commit | Line | Data |
---|---|---|
508c1a57 ED |
1 | #ifndef FSM_PATH_UTILS_H |
2 | #define FSM_PATH_UTILS_H | |
3 | ||
12fd27df ED |
4 | #include "strbuf.h" |
5 | ||
6 | struct alias_info | |
7 | { | |
8 | struct strbuf alias; | |
9 | struct strbuf points_to; | |
10 | }; | |
11 | ||
508c1a57 ED |
12 | struct fs_info { |
13 | int is_remote; | |
14 | char *typename; | |
15 | }; | |
16 | ||
17 | /* | |
12fd27df | 18 | * Get some basic filesystem information for the given path |
508c1a57 ED |
19 | * |
20 | * The caller owns the storage that is occupied by fs_info and | |
21 | * is responsible for releasing it. | |
22 | * | |
23 | * Returns -1 on error, zero otherwise. | |
24 | */ | |
25 | int fsmonitor__get_fs_info(const char *path, struct fs_info *fs_info); | |
26 | ||
27 | /* | |
28 | * Determines if the filesystem that path resides on is remote. | |
29 | * | |
30 | * Returns -1 on error, 0 if not remote, 1 if remote. | |
31 | */ | |
32 | int fsmonitor__is_fs_remote(const char *path); | |
33 | ||
12fd27df ED |
34 | /* |
35 | * Get the alias in given path, if any. | |
36 | * | |
37 | * Sets alias to the first alias that matches any part of the path. | |
38 | * | |
39 | * If an alias is found, info.alias and info.points_to are set to the | |
40 | * found mapping. | |
41 | * | |
42 | * Returns -1 on error, 0 otherwise. | |
43 | * | |
44 | * The caller owns the storage that is occupied by info.alias and | |
45 | * info.points_to and is responsible for releasing it. | |
46 | */ | |
47 | int fsmonitor__get_alias(const char *path, struct alias_info *info); | |
48 | ||
49 | /* | |
50 | * Resolve the path against the given alias. | |
51 | * | |
52 | * Returns the resolved path if there is one, NULL otherwise. | |
53 | * | |
54 | * The caller owns the storage that the returned string occupies and | |
55 | * is responsible for releasing it. | |
56 | */ | |
57 | char *fsmonitor__resolve_alias(const char *path, | |
58 | const struct alias_info *info); | |
59 | ||
508c1a57 | 60 | #endif |