LLFIO
v2.00
|
Metadata about a directory entry. More...
#include "stat.hpp"
Public Types | |
enum | bitfield__want : unsigned { dev = 1 << 0 , ino = 1 << 1 , type = 1 << 2 , perms = 1 << 3 , nlink = 1 << 4 , uid = 1 << 5 , gid = 1 << 6 , rdev = 1 << 7 , atim = 1 << 8 , mtim = 1 << 9 , ctim = 1 << 10 , size = 1 << 11 , allocated = 1 << 12 , blocks = 1 << 13 , blksize = 1 << 14 , flags = 1 << 15 , gen = 1 << 16 , birthtim = 1 << 17 , sparse = 1 << 24 , compressed = 1 << 25 , reparse_point = 1 << 26 , all = static_cast<unsigned>(-1) , none = 0 } |
Used to indicate what metadata should be filled in. | |
Public Member Functions | |
stat_t () | |
Constructs a UNINITIALIZED instance i.e. full of random garbage. | |
constexpr | stat_t (std::nullptr_t) noexcept |
Constructs a zeroed instance. | |
bool | operator== (const stat_t &o) const noexcept |
Equality comparison. | |
bool | operator!= (const stat_t &o) const noexcept |
Inequality comparison. | |
bool | operator< (const stat_t &o) const noexcept |
Ordering. | |
result< size_t > | fill (const handle &h, want wanted=want::all) noexcept |
result< want > | stamp (handle &h, want wanted=want::all) noexcept |
Public Attributes | |
uint64_t | st_dev |
uint64_t | st_ino |
filesystem::file_type | st_type |
stil1z::filesystem::perms | st_perms |
int16_t | st_nlink |
int16_t | st_uid |
int16_t | st_gid |
dev_t | st_rdev |
union { | |
std::chrono::system_clock::time_point st_atim | |
}; | |
union { | |
std::chrono::system_clock::time_point st_mtim | |
}; | |
union { | |
std::chrono::system_clock::time_point st_ctim | |
}; | |
handle::extent_type | st_size |
handle::extent_type | st_allocated |
handle::extent_type | st_blocks |
uint16_t | st_blksize |
uint32_t | st_flags |
uint32_t | st_gen |
union { | |
std::chrono::system_clock::time_point st_birthtim | |
}; | |
unsigned | st_sparse: 1 |
unsigned | st_compressed: 1 |
unsigned | st_reparse_point: 1 |
Metadata about a directory entry.
This structure looks somewhat like a struct stat
, and indeed it was derived from BSD's struct stat
. However there are a number of changes to better interoperate with modern practice, specifically:
std::chrono::system_clock::time_point
or Boost equivalent. The resolution of these may or may not equal what a struct timespec
can do depending on your STL.st_type
which is one of the values from filesystem::file_type
.st_mode
, instead being a st_perms
which is solely the permissions bits. If you want to test permission bits in st_perms
but don't want to include platform specific headers, note that filesystem::perms
contains definitions of the POSIX permissions flags.
|
inlinenoexcept |
Fills the structure with metadata.
|
inlinenoexcept |
Stamps the handle with the metadata in the structure, returning the metadata written.
The following want bits are always ignored, and are cleared in the want bits returned:
dev
ino
type
nlink
rdev
ctim
size
(use truncate()
on the file instead)allocated
blocks
blksize
flags
gen
sparse
compressed
reparse_point
The following want bits are supported by these platforms:
perms
, uid
, gid
(POSIX only)atim
(Windows, POSIX)mtim
(Windows, POSIX)birthtim
(Windows, POSIX)Note that on POSIX, setting birth time involves two syscalls, the first of which temporarily sets the modified date to the birth time, which is racy. This is unavoidable given the syscall's design.
Note also that on POSIX one can never make a birth time newer than the current birth time, nor a modified time older than a birth time. You can do these on Windows, however.
handle::extent_type llfio_v2_xxx::stat_t::st_allocated |
bytes allocated for file (Windows, POSIX)
std::chrono::system_clock::time_point llfio_v2_xxx::stat_t::st_atim |
time of last access (Windows, POSIX)
std::chrono::system_clock::time_point llfio_v2_xxx::stat_t::st_birthtim |
time of file creation (Windows, POSIX)
uint16_t llfio_v2_xxx::stat_t::st_blksize |
block size used by this device (Windows, POSIX)
handle::extent_type llfio_v2_xxx::stat_t::st_blocks |
number of blocks allocated (Windows, POSIX)
unsigned llfio_v2_xxx::stat_t::st_compressed |
if this file is compressed, or this directory capable of compressed files (Windows, Linux)
std::chrono::system_clock::time_point llfio_v2_xxx::stat_t::st_ctim |
time of last status change (Windows, POSIX)
uint64_t llfio_v2_xxx::stat_t::st_dev |
inode of device containing file (POSIX only)
uint32_t llfio_v2_xxx::stat_t::st_flags |
user defined flags for file (FreeBSD, OS X, zero otherwise)
uint32_t llfio_v2_xxx::stat_t::st_gen |
file generation number (FreeBSD, OS X, zero otherwise)
int16_t llfio_v2_xxx::stat_t::st_gid |
group ID of the file (POSIX only)
uint64_t llfio_v2_xxx::stat_t::st_ino |
inode of file (Windows, POSIX)
std::chrono::system_clock::time_point llfio_v2_xxx::stat_t::st_mtim |
time of last data modification (Windows, POSIX)
int16_t llfio_v2_xxx::stat_t::st_nlink |
number of hard links (Windows, POSIX)
stil1z::filesystem::perms llfio_v2_xxx::stat_t::st_perms |
uint16_t bitfield perms of file (POSIX only)
dev_t llfio_v2_xxx::stat_t::st_rdev |
id of file if special (POSIX only)
unsigned llfio_v2_xxx::stat_t::st_reparse_point |
if this file or directory is a reparse point (Windows)
handle::extent_type llfio_v2_xxx::stat_t::st_size |
file size, in bytes (Windows, POSIX)
unsigned llfio_v2_xxx::stat_t::st_sparse |
if this file is sparse, or this directory capable of sparse files (Windows, POSIX)
filesystem::file_type llfio_v2_xxx::stat_t::st_type |
type of file (Windows, POSIX)
int16_t llfio_v2_xxx::stat_t::st_uid |
user ID of the file (POSIX only)