11//! inotify support for working with inotifies
22
3+ #![ allow( unused_qualifications) ]
4+
5+ use super :: inotify;
36pub use crate :: backend:: fs:: inotify:: { CreateFlags , ReadFlags , WatchFlags } ;
47use crate :: backend:: fs:: syscalls;
58use crate :: fd:: { AsFd , OwnedFd } ;
@@ -9,13 +12,23 @@ use crate::io::{read_uninit, Errno};
912use core:: mem:: { align_of, size_of, MaybeUninit } ;
1013use linux_raw_sys:: general:: inotify_event;
1114
15+ #[ deprecated( note = "Use add_watch." ) ]
16+ #[ doc( hidden) ]
17+ pub use add_watch as inotify_add_watch;
18+ #[ deprecated( note = "Use init." ) ]
19+ #[ doc( hidden) ]
20+ pub use init as inotify_init;
21+ #[ deprecated( note = "Use remove_watch." ) ]
22+ #[ doc( hidden) ]
23+ pub use remove_watch as inotify_remove_watch;
24+
1225/// `inotify_init1(flags)`—Creates a new inotify object.
1326///
1427/// Use the [`CreateFlags::CLOEXEC`] flag to prevent the resulting file
1528/// descriptor from being implicitly passed across `exec` boundaries.
1629#[ doc( alias = "inotify_init1" ) ]
1730#[ inline]
18- pub fn inotify_init ( flags : CreateFlags ) -> io:: Result < OwnedFd > {
31+ pub fn init ( flags : inotify :: CreateFlags ) -> io:: Result < OwnedFd > {
1932 syscalls:: inotify_init1 ( flags)
2033}
2134
@@ -27,22 +40,23 @@ pub fn inotify_init(flags: CreateFlags) -> io::Result<OwnedFd> {
2740/// Note: Due to the existence of hardlinks, providing two different paths to
2841/// this method may result in it returning the same watch descriptor. An
2942/// application should keep track of this externally to avoid logic errors.
43+ #[ doc( alias = "inotify_add_watch" ) ]
3044#[ inline]
31- pub fn inotify_add_watch < P : crate :: path:: Arg > (
45+ pub fn add_watch < P : crate :: path:: Arg > (
3246 inot : impl AsFd ,
3347 path : P ,
34- flags : WatchFlags ,
48+ flags : inotify :: WatchFlags ,
3549) -> io:: Result < i32 > {
3650 path. into_with_c_str ( |path| syscalls:: inotify_add_watch ( inot. as_fd ( ) , path, flags) )
3751}
3852
3953/// `inotify_rm_watch(self, wd)`—Removes a watch from this inotify.
4054///
4155/// The watch descriptor provided should have previously been returned by
42- /// [`inotify_add_watch `] and not previously have been removed.
56+ /// [`inotify::add_watch `] and not previously have been removed.
4357#[ doc( alias = "inotify_rm_watch" ) ]
4458#[ inline]
45- pub fn inotify_remove_watch ( inot : impl AsFd , wd : i32 ) -> io:: Result < ( ) > {
59+ pub fn remove_watch ( inot : impl AsFd , wd : i32 ) -> io:: Result < ( ) > {
4660 syscalls:: inotify_rm_watch ( inot. as_fd ( ) , wd)
4761}
4862
@@ -52,14 +66,14 @@ pub fn inotify_remove_watch(inot: impl AsFd, wd: i32) -> io::Result<()> {
5266/// based on it.
5367///
5468/// [`RawDir`]: crate::fs::raw_dir::RawDir
55- pub struct InotifyReader < ' buf , Fd : AsFd > {
69+ pub struct Reader < ' buf , Fd : AsFd > {
5670 fd : Fd ,
5771 buf : & ' buf mut [ MaybeUninit < u8 > ] ,
5872 initialized : usize ,
5973 offset : usize ,
6074}
6175
62- impl < ' buf , Fd : AsFd > InotifyReader < ' buf , Fd > {
76+ impl < ' buf , Fd : AsFd > Reader < ' buf , Fd > {
6377 /// Create a new iterator from the given file descriptor and buffer.
6478 pub fn new ( fd : Fd , buf : & ' buf mut [ MaybeUninit < u8 > ] ) -> Self {
6579 Self {
@@ -114,7 +128,7 @@ impl<'a> InotifyEvent<'a> {
114128 }
115129}
116130
117- impl < ' buf , Fd : AsFd > InotifyReader < ' buf , Fd > {
131+ impl < ' buf , Fd : AsFd > Reader < ' buf , Fd > {
118132 /// Read the next inotify event.
119133 #[ allow( unsafe_code) ]
120134 pub fn next ( & mut self ) -> io:: Result < InotifyEvent > {
0 commit comments