Skip to content

Commit

Permalink
Merge pull request torvalds#603 from danobi/file_flags
Browse files Browse the repository at this point in the history
rust: file: Add flags() method to `File`
  • Loading branch information
ojeda authored Jan 3, 2022
2 parents 8ca7a7f + 53df040 commit 4f082c4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions rust/kernel/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ impl File {
// change over the lifetime of a file).
unsafe { CredentialRef::from_ptr(ptr) }
}

/// Returns the flags associated with the file.
pub fn flags(&self) -> u32 {
// SAFETY: `File::ptr` is guaranteed to be valid by the type invariants.
unsafe { (*self.ptr).f_flags }
}
}

impl Drop for File {
Expand Down

0 comments on commit 4f082c4

Please sign in to comment.