Skip to main content

Module fs

Module fs 

Source
Expand description

Filesystem operations.

Structs§

Access
*_OK constants for use with accessat.
AtFlags
AT_* constants for use with openat, statat, and other *at functions.
Dir
DIR*
DirEntry
struct dirent
FallocateFlags
FALLOC_FL_* constants for use with fallocate.
Gid
gid_t—A Unix group ID.
Mode
S_I* constants for use with openat, chmodat, and fchmod.
OFlags
O_* constants for use with openat.
SealFlags
F_SEAL_* constants for use with fcntl_add_seals and fcntl_get_seals.
StatVfs
struct statvfs for use with statvfs and fstatvfs.
StatVfsMountFlags
ST_* constants for use with StatVfs.
Timespec
struct timespec—A quantity of time in seconds plus nanoseconds.
Timestamps
Timestamps used by utimensat and futimens.
Uid
uid_t—A Unix user ID.

Enums§

Advice
POSIX_FADV_* constants for use with fadvise.
FileType
S_IF* constants for use with mknodat and Stat’s st_mode field.
FlockOperation
LOCK_* constants for use with flock and fcntl_lock.
SeekFrom
Enumeration of possible methods to seek within an I/O object.

Constants§

ABS
-EBADF—A handle that requires paths to be absolute.
CWD
AT_FDCWD—A handle representing the current working directory.
UTIME_NOW
UTIME_NOW for use with utimensat.
UTIME_OMIT
UTIME_OMIT for use with utimensat.

Traits§

DirEntryExt
Re-export types common to POSIX-ish platforms. Unix-specific extension methods for fs::DirEntry.
FileExt
Re-export types common to POSIX-ish platforms. Unix-specific extensions to fs::File.
FileTypeExt
Re-export types common to POSIX-ish platforms. Unix-specific extensions for fs::FileType.
MetadataExt
Re-export types common to POSIX-ish platforms. Unix-specific extensions to fs::Metadata.
OpenOptionsExt
Re-export types common to POSIX-ish platforms. Unix-specific extensions to fs::OpenOptions.

Functions§

access
access(path, access)—Tests permissions for a file or directory.
accessat
faccessat(dirfd, path, access, flags)—Tests permissions for a file or directory.
chmod
chmod(path, mode)—Sets file or directory permissions.
chmodat
fchmodat(dirfd, path, mode, flags)—Sets file or directory permissions.
chown
chown(path, owner, group)—Sets open file or directory ownership.
chownat
fchownat(dirfd, path, owner, group, flags)—Sets file or directory ownership.
fadvise
posix_fadvise(fd, offset, len, advice)—Declares an expected access pattern for a file.
fallocate
fallocate(fd, mode, offset, len)—Adjusts file allocation.
fchmod
fchmod(fd, mode)—Sets open file or directory permissions.
fchown
fchown(fd, owner, group)—Sets open file or directory ownership.
fcntl_add_seals
fcntl(fd, F_ADD_SEALS)—Add seals to fd’s inode.
fcntl_get_seals
fcntl(fd, F_GET_SEALS)—Return the seals for fd’s inode.
fcntl_getfl
fcntl(fd, F_GETFL)—Returns a file descriptor’s access mode and status.
fcntl_setfl
fcntl(fd, F_SETFL, flags)—Sets a file descriptor’s status.
fdatasync
fdatasync(fd)—Ensures that file data is written to the underlying storage device.
flock
flock(fd, operation)—Acquire or release an advisory lock on an open file.
fstat
fstat(fd)—Queries metadata for an open file or directory.
fstatfs
fstatfs(fd)—Queries filesystem statistics for an open file or directory.
fstatvfs
fstatvfs(fd)—Queries filesystem statistics for an open file or directory, POSIX version.
fsync
fsync(fd)—Ensures that file data and metadata is written to the underlying storage device.
ftruncate
ftruncate(fd, length)—Sets the length of a file.
futimens
futimens(fd, times)—Sets timestamps for an open file or directory.
link
link(old_path, new_path)—Creates a hard link.
linkat
linkat(old_dirfd, old_path, new_dirfd, new_path, flags)—Creates a hard link.
lstat
lstat(path)—Queries metadata for a file or directory, without following symlinks.
major
major(dev)—Compute the major ID of a given device ID.
makedev
makedev(maj, min)—Compute a device ID from a given major and minor ID.
minor
minor(dev)—Compute the minor ID of a given device ID.
mkdir
mkdir(path, mode)—Creates a directory.
mkdirat
mkdirat(fd, path, mode)—Creates a directory.
mkfifoat
mkfifoat(dirfd, path, mode)—Make a FIFO special file.
mknodat
mknodat(dirfd, path, mode, dev)—Creates special or normal files.
open
open(path, oflags, mode)—Opens a file.
openat
openat(dirfd, path, oflags, mode)—Opens a file.
readlink
readlink(path)—Reads the contents of a symlink.
readlinkat
readlinkat(fd, path)—Reads the contents of a symlink.
readlinkat_raw
readlinkat(fd, path)—Reads the contents of a symlink, without allocating.
rename
rename(old_path, new_path)—Renames a file or directory.
renameat
renameat(old_dirfd, old_path, new_dirfd, new_path)—Renames a file or directory.
rmdir
rmdir(path)—Removes a directory.
seek
lseek(fd, offset, whence)—Repositions a file descriptor within a file.
stat
stat(path)—Queries metadata for a file or directory.
statat
fstatat(dirfd, path, flags)—Queries metadata for a file or directory.
statfs
statfs—Queries filesystem metadata.
statvfs
statvfs—Queries filesystem metadata, POSIX version.
symlink
symlink(old_path, new_path)—Creates a symlink.
symlinkat
symlinkat(old_path, new_dirfd, new_path)—Creates a symlink.
sync
sync—Flush cached filesystem data for all filesystems.
tell
lseek(fd, 0, SEEK_CUR)—Returns the current position within a file.
unlink
unlink(path)—Unlinks a file.
unlinkat
unlinkat(fd, path, flags)—Unlinks a file or remove a directory.
utimensat
utimensat(dirfd, path, times, flags)—Sets file or directory timestamps.

Type Aliases§

Dev
dev_t
Fsid
fsid_t for use with StatFs.
Nsecs
A type for the tv_nsec field of Timespec.
RawMode
mode_t
Secs
A type for the tv_sec field of Timespec.
Stat
struct stat for use with statat and fstat.
StatFs
struct statfs for use with statfs and fstatfs.