Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fsnotify #13077

Merged
merged 13 commits into from
Aug 21, 2024
Merged

Fsnotify #13077

merged 13 commits into from
Aug 21, 2024

Conversation

guohao15
Copy link
Contributor

Summary

Support inotify API

int inotify_init(void);
int inotify_init1(int flags);
int inotify_add_watch(int fd, FAR const char *pathname, uint32_t mask);
int inotify_rm_watch(int fd, uint32_t wd);

The usage of the API is the same as that of the Linux version.

Usage
We can select CONFIG_FS_NOTIFY to enable this feature

Impact

The functionality is achieved based on monitoring various behaviors of the file system, which may have a slight impact on performance.

Testing

We can use libuv test cases for testing.

uv_run_tests fs_event_watch_dir
uv_run_tests fs_event_close_in_callback
uv_run_tests fs_event_watch_file
uv_run_tests fs_event_watch_file_current_dir
uv_run_tests fs_event_ref
uv_run_tests fs_event_immediate_close
uv_run_tests fs_event_watch_file_exact_path
uv_run_tests fs_event_no_callback_on_close
uv_run_tests fs_event_no_callback_after_close
uv_run_tests fs_event_close_with_pending_event
uv_run_tests fs_event_close_with_pending_delete_event
uv_run_tests fs_event_error_reporting
uv_run_tests fs_event_start_and_close
uv_run_tests fs_event_watch_file_twice
uv_run_tests fs_event_getpath
uv_run_tests fs_event_watch_invalid_path
uv_run_tests fs_event_stop_in_cb

All these test cases have passed.

support API: open close read write unlink mkdir rename fchstat rmdir symlink

Signed-off-by: guohao15 <[email protected]>
fix crash when queue event to root dir's parent

Signed-off-by: guohao15 <[email protected]>
only mountpt/driver/pseudodir need inotify

Signed-off-by: guohao15 <[email protected]>
Some signal handler may opreate files, that will cause deadlock
when the thread holding file system lock

Signed-off-by: guohao15 <[email protected]>
In rpmsgfs case the old tempbuffer will case deadlock

Signed-off-by: guohao15 <[email protected]>
@acassis
Copy link
Contributor

acassis commented Aug 21, 2024

Nice work @guohao15 !!! Please include Documentation/

@xiaoxiang781216 xiaoxiang781216 merged commit a69d3d7 into apache:master Aug 21, 2024
28 checks passed
@xiaoxiang781216
Copy link
Contributor

Nice work @guohao15 !!! Please include Documentation/

@guohao15 please create a new pr for document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants