Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
n01e0 committed Nov 6, 2020
1 parent bf1c947 commit 477a923
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions src/high_level.rs
Expand Up @@ -46,28 +46,45 @@ impl Fanotify {
match mode {
FanotifyMode::PRECONTENT => {
return Fanotify {
fd: fanotify_init(FAN_CLOEXEC | FAN_CLASS_PRE_CONTENT | FAN_NONBLOCK, O_CLOEXEC | O_RDONLY)
.unwrap(),
fd: fanotify_init(
FAN_CLOEXEC | FAN_CLASS_PRE_CONTENT | FAN_NONBLOCK,
O_CLOEXEC | O_RDONLY,
)
.unwrap(),
};
}
FanotifyMode::CONTENT => {
return Fanotify {
fd: fanotify_init(FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK, O_CLOEXEC | O_RDONLY)
.unwrap(),
fd: fanotify_init(
FAN_CLOEXEC | FAN_CLASS_CONTENT | FAN_NONBLOCK,
O_CLOEXEC | O_RDONLY,
)
.unwrap(),
};
}
FanotifyMode::NOTIF => {
return Fanotify {
fd: fanotify_init(FAN_CLOEXEC | FAN_CLASS_NOTIF | FAN_NONBLOCK, O_CLOEXEC | O_RDONLY).unwrap(),
fd: fanotify_init(
FAN_CLOEXEC | FAN_CLASS_NOTIF | FAN_NONBLOCK,
O_CLOEXEC | O_RDONLY,
)
.unwrap(),
};
}
}
}
pub fn from_raw(fd: i32) -> Fanotify {
Fanotify { fd: fd }
}
pub fn add_path<P: ?Sized + FanotifyPath>(&self, mode: u64, path: &P) -> Result<(), Error> {
fanotify_mark(self.fd, FAN_MARK_ADD, mode, AT_FDCWD, path)?;
Ok(())
}
pub fn add_mountpoint<P: ?Sized + FanotifyPath>(&self, mode: u64, path: &P) -> Result<(), Error> {
pub fn add_mountpoint<P: ?Sized + FanotifyPath>(
&self,
mode: u64,
path: &P,
) -> Result<(), Error> {
fanotify_mark(self.fd, FAN_MARK_ADD | FAN_MARK_MOUNT, mode, AT_FDCWD, path)?;
Ok(())
}
Expand Down Expand Up @@ -110,9 +127,4 @@ impl Fanotify {
}
result
}
pub fn from_raw(fd: i32) -> Fanotify {
Fanotify {
fd: fd
}
}
}

0 comments on commit 477a923

Please sign in to comment.