@@ -22,12 +22,7 @@ use core::{cell::UnsafeCell, marker, mem, ptr};
2222use macros:: vtable;
2323
2424/// Flags associated with a [`File`].
25- ///
26- /// It is tagged with `non_exhaustive` to prevent users from instantiating it.
27- #[ non_exhaustive]
28- pub struct FileFlags ;
29-
30- impl FileFlags {
25+ pub mod flags {
3126 /// File is opened in append mode.
3227 pub const O_APPEND : u32 = bindings:: O_APPEND ;
3328
@@ -46,7 +41,7 @@ impl FileFlags {
4641 /// File must be a directory.
4742 pub const O_DIRECTORY : u32 = bindings:: O_DIRECTORY ;
4843
49- /// Like `Self:: O_SYNC` except metadata is not synced.
44+ /// Like [` O_SYNC`] except metadata is not synced.
5045 pub const O_DSYNC : u32 = bindings:: O_DSYNC ;
5146
5247 /// Ensure that this file is created with the `open(2)` call.
@@ -69,7 +64,7 @@ impl FileFlags {
6964
7065 /// Also known as `O_NDELAY`.
7166 ///
72- /// This is effectively the same flag as [`Self:: O_NONBLOCK`] on all architectures
67+ /// This is effectively the same flag as [`O_NONBLOCK`] on all architectures
7368 /// except SPARC64.
7469 pub const O_NDELAY : u32 = bindings:: O_NDELAY ;
7570
@@ -90,10 +85,10 @@ impl FileFlags {
9085 /// # Examples
9186 ///
9287 /// ```
93- /// use kernel::file::FileFlags ;
88+ /// use kernel::file;
9489 /// # fn do_something() {}
9590 /// # let flags = 0;
96- /// if (flags & FileFlags:: O_ACCMODE) == FileFlags ::O_RDONLY {
91+ /// if (flags & file::flags:: O_ACCMODE) == file::flags ::O_RDONLY {
9792 /// do_something();
9893 /// }
9994 /// ```
@@ -163,7 +158,7 @@ impl File {
163158
164159 /// Returns the flags associated with the file.
165160 ///
166- /// The flags are a combination of the constants in [`FileFlags `].
161+ /// The flags are a combination of the constants in [`flags `].
167162 pub fn flags ( & self ) -> u32 {
168163 // SAFETY: The file is valid because the shared reference guarantees a nonzero refcount.
169164 unsafe { core:: ptr:: addr_of!( ( * self . 0 . get( ) ) . f_flags) . read ( ) }
0 commit comments