authorgravatar for leroycepearson@geemili.xyzLeRoyce Pearson <leroycepearson@geemili.xyz> 2020-03-08 15:47:50-06:00
committergravatar for leroycepearson@geemili.xyzLeRoyce Pearson <leroycepearson@geemili.xyz> 2020-03-08 15:47:50-06:00
loge1c1ca99031a76b44ba1bdce0d10acb4513af8d6
treee4d8382356eddcfd9c7724de97ba6182af6b10f2
parent55077435bf53bb8273e1b23c1690798312d6abc6

Add documentation about Stat.inode


1 files changed, 14 insertions(+), 0 deletions(-)

lib/std/fs/file.zig+14
...@@ -28,8 +28,13 @@ pub const File = struct {...@@ -28,8 +28,13 @@ pub const File = struct {
28 pub const async_block_allowed_no = if (io.is_async) false else {};28 pub const async_block_allowed_no = if (io.is_async) false else {};
2929
30 pub const Mode = os.mode_t;30 pub const Mode = os.mode_t;
31
32 /// The type that is used to represent the inode/file index number. On windows this is a
33 /// LARGE_INTEGER (i64), and on linux this is a u64.
31 pub const INode = switch (builtin.os.tag) {34 pub const INode = switch (builtin.os.tag) {
32 .windows => os.windows.LARGE_INTEGER,35 .windows => os.windows.LARGE_INTEGER,
36 // TODO: Handle possibility of 128 bit numbers? ReFS on windows server 2012 uses a 128 bit file
37 // index. See https://docs.microsoft.com/en-us/windows/win32/api/fileapi/ns-fileapi-by_handle_file_information
33 else => u64,38 else => u64,
34 };39 };
3540
...@@ -149,7 +154,16 @@ pub const File = struct {...@@ -149,7 +154,16 @@ pub const File = struct {
149 }154 }
150155
151 pub const Stat = struct {156 pub const Stat = struct {
157 /// A number that the system uses to point to the file metadata. This number is not guaranteed to be
158 /// unique across time, as some file systems may reuse an inode after it's file has been deleted.
159 /// Some systems may change the inode of a file over time.
160 ///
161 /// On Linux, the inode _is_ structure that stores the metadata, and the inode _number_ is what
162 /// you see here: the index number of the inode.
163 ///
164 /// The FileIndex on Windows is similar. It is a number for a file that is unique to each filesystem.
152 inode: INode,165 inode: INode,
166
153 size: u64,167 size: u64,
154 mode: Mode,168 mode: Mode,
155169