Jeff Hostetler | 1e0ea5c | 2022-03-25 18:02:46 +0000 | [diff] [blame] | 1 | #ifndef FSMONITOR_SETTINGS_H |
| 2 | #define FSMONITOR_SETTINGS_H |
| 3 | |
| 4 | struct repository; |
| 5 | |
| 6 | enum fsmonitor_mode { |
Jeff Hostetler | 62a62a2 | 2022-05-26 21:46:58 +0000 | [diff] [blame] | 7 | FSMONITOR_MODE_INCOMPATIBLE = -1, /* see _reason */ |
Jeff Hostetler | 1e0ea5c | 2022-03-25 18:02:46 +0000 | [diff] [blame] | 8 | FSMONITOR_MODE_DISABLED = 0, |
| 9 | FSMONITOR_MODE_HOOK = 1, /* core.fsmonitor=<hook_path> */ |
| 10 | FSMONITOR_MODE_IPC = 2, /* core.fsmonitor=<true> */ |
| 11 | }; |
| 12 | |
Jeff Hostetler | 62a62a2 | 2022-05-26 21:46:58 +0000 | [diff] [blame] | 13 | /* |
| 14 | * Incompatibility reasons. |
| 15 | */ |
| 16 | enum fsmonitor_reason { |
| 17 | FSMONITOR_REASON_UNTESTED = 0, |
| 18 | FSMONITOR_REASON_OK, /* no incompatibility or when disabled */ |
| 19 | FSMONITOR_REASON_BARE, |
Jeff Hostetler | 1e7be10 | 2022-05-26 21:47:02 +0000 | [diff] [blame] | 20 | FSMONITOR_REASON_ERROR, /* FS error probing for compatibility */ |
| 21 | FSMONITOR_REASON_REMOTE, |
Jeff Hostetler | 5c58fbd | 2022-05-26 21:47:00 +0000 | [diff] [blame] | 22 | FSMONITOR_REASON_VFS4GIT, /* VFS for Git virtualization */ |
Jeff Hostetler | ddc5dac | 2022-05-26 21:47:04 +0000 | [diff] [blame] | 23 | FSMONITOR_REASON_NOSOCKETS, /* NTFS,FAT32 do not support Unix sockets */ |
Jeff Hostetler | 62a62a2 | 2022-05-26 21:46:58 +0000 | [diff] [blame] | 24 | }; |
| 25 | |
Jeff Hostetler | 1e0ea5c | 2022-03-25 18:02:46 +0000 | [diff] [blame] | 26 | void fsm_settings__set_ipc(struct repository *r); |
| 27 | void fsm_settings__set_hook(struct repository *r, const char *path); |
| 28 | void fsm_settings__set_disabled(struct repository *r); |
Jeff Hostetler | 62a62a2 | 2022-05-26 21:46:58 +0000 | [diff] [blame] | 29 | void fsm_settings__set_incompatible(struct repository *r, |
| 30 | enum fsmonitor_reason reason); |
Jeff Hostetler | 1e0ea5c | 2022-03-25 18:02:46 +0000 | [diff] [blame] | 31 | |
| 32 | enum fsmonitor_mode fsm_settings__get_mode(struct repository *r); |
| 33 | const char *fsm_settings__get_hook_path(struct repository *r); |
| 34 | |
Jeff Hostetler | 62a62a2 | 2022-05-26 21:46:58 +0000 | [diff] [blame] | 35 | enum fsmonitor_reason fsm_settings__get_reason(struct repository *r); |
Eric DeCosta | 25c2cab | 2022-10-04 17:32:30 +0000 | [diff] [blame] | 36 | char *fsm_settings__get_incompatible_msg(struct repository *r, |
Jeff Hostetler | 62a62a2 | 2022-05-26 21:46:58 +0000 | [diff] [blame] | 37 | enum fsmonitor_reason reason); |
| 38 | |
Jeff Hostetler | 1e0ea5c | 2022-03-25 18:02:46 +0000 | [diff] [blame] | 39 | struct fsmonitor_settings; |
| 40 | |
Jeff Hostetler | d33c804 | 2022-05-26 21:46:59 +0000 | [diff] [blame] | 41 | #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 DeCosta | 8f44976 | 2022-10-04 17:32:28 +0000 | [diff] [blame] | 51 | enum fsmonitor_reason fsm_os__incompatible(struct repository *r, int ipc); |
Jeff Hostetler | d33c804 | 2022-05-26 21:46:59 +0000 | [diff] [blame] | 52 | #endif /* HAVE_FSMONITOR_OS_SETTINGS */ |
| 53 | |
Jeff Hostetler | 1e0ea5c | 2022-03-25 18:02:46 +0000 | [diff] [blame] | 54 | #endif /* FSMONITOR_SETTINGS_H */ |