blob: ab02e3995ee8f4eb3739359ea4b31f2a9bf697c9 [file] [log] [blame]
Jeff Hostetler1e0ea5c2022-03-25 18:02:46 +00001#ifndef FSMONITOR_SETTINGS_H
2#define FSMONITOR_SETTINGS_H
3
4struct repository;
5
6enum fsmonitor_mode {
Jeff Hostetler62a62a22022-05-26 21:46:58 +00007 FSMONITOR_MODE_INCOMPATIBLE = -1, /* see _reason */
Jeff Hostetler1e0ea5c2022-03-25 18:02:46 +00008 FSMONITOR_MODE_DISABLED = 0,
9 FSMONITOR_MODE_HOOK = 1, /* core.fsmonitor=<hook_path> */
10 FSMONITOR_MODE_IPC = 2, /* core.fsmonitor=<true> */
11};
12
Jeff Hostetler62a62a22022-05-26 21:46:58 +000013/*
14 * Incompatibility reasons.
15 */
16enum fsmonitor_reason {
17 FSMONITOR_REASON_UNTESTED = 0,
18 FSMONITOR_REASON_OK, /* no incompatibility or when disabled */
19 FSMONITOR_REASON_BARE,
Jeff Hostetler1e7be102022-05-26 21:47:02 +000020 FSMONITOR_REASON_ERROR, /* FS error probing for compatibility */
21 FSMONITOR_REASON_REMOTE,
Jeff Hostetler5c58fbd2022-05-26 21:47:00 +000022 FSMONITOR_REASON_VFS4GIT, /* VFS for Git virtualization */
Jeff Hostetlerddc5dac2022-05-26 21:47:04 +000023 FSMONITOR_REASON_NOSOCKETS, /* NTFS,FAT32 do not support Unix sockets */
Jeff Hostetler62a62a22022-05-26 21:46:58 +000024};
25
Jeff Hostetler1e0ea5c2022-03-25 18:02:46 +000026void fsm_settings__set_ipc(struct repository *r);
27void fsm_settings__set_hook(struct repository *r, const char *path);
28void fsm_settings__set_disabled(struct repository *r);
Jeff Hostetler62a62a22022-05-26 21:46:58 +000029void fsm_settings__set_incompatible(struct repository *r,
30 enum fsmonitor_reason reason);
Jeff Hostetler1e0ea5c2022-03-25 18:02:46 +000031
32enum fsmonitor_mode fsm_settings__get_mode(struct repository *r);
33const char *fsm_settings__get_hook_path(struct repository *r);
34
Jeff Hostetler62a62a22022-05-26 21:46:58 +000035enum fsmonitor_reason fsm_settings__get_reason(struct repository *r);
Eric DeCosta25c2cab2022-10-04 17:32:30 +000036char *fsm_settings__get_incompatible_msg(struct repository *r,
Jeff Hostetler62a62a22022-05-26 21:46:58 +000037 enum fsmonitor_reason reason);
38
Jeff Hostetler1e0ea5c2022-03-25 18:02:46 +000039struct fsmonitor_settings;
40
Jeff Hostetlerd33c8042022-05-26 21:46:59 +000041#ifdef HAVE_FSMONITOR_OS_SETTINGS
42/*
43 * Ask platform-specific code whether the repository is incompatible
44 * with fsmonitor (both hook and ipc modes). For example, if the working
45 * directory is on a remote volume and mounted via a technology that does
46 * not support notification events, then we should not pretend to watch it.
47 *
48 * fsm_os__* routines should considered private to fsm_settings__
49 * routines.
50 */
Eric DeCosta8f449762022-10-04 17:32:28 +000051enum fsmonitor_reason fsm_os__incompatible(struct repository *r, int ipc);
Jeff Hostetlerd33c8042022-05-26 21:46:59 +000052#endif /* HAVE_FSMONITOR_OS_SETTINGS */
53
Jeff Hostetler1e0ea5c2022-03-25 18:02:46 +000054#endif /* FSMONITOR_SETTINGS_H */