• Home
  • Raw
  • Download

Lines Matching +full:use +full:- +full:libc

1 //! Get filesystem statistics, non-portably
5 use std::ffi::CStr;
6 use std::fmt::{self, Debug};
7 use std::mem;
8 use std::os::unix::io::AsRawFd;
10 use cfg_if::cfg_if;
22 use crate::mount::MntFlags;
24 use crate::sys::statvfs::FsFlags;
25 use crate::{errno::Errno, NixPath, Result};
30 pub type fsid_t = libc::__fsid_t;
34 pub type fsid_t = libc::fsid_t;
38 type type_of_statfs = libc::statfs64;
40 (fd: libc::c_int, buf: *mut type_of_statfs) -> libc::c_int
41 = libc::fstatfs64;
43 (path: *const libc::c_char, buf: *mut type_of_statfs) -> libc::c_int
44 = libc::statfs64;
46 type type_of_statfs = libc::statfs;
48 (fd: libc::c_int, buf: *mut type_of_statfs) -> libc::c_int
49 = libc::fstatfs;
51 (path: *const libc::c_char, buf: *mut type_of_statfs) -> libc::c_int
52 = libc::statfs;
64 type fs_type_t = libc::c_ulong;
66 type fs_type_t = libc::c_uint;
68 type fs_type_t = libc::c_ulong;
70 type fs_type_t = libc::c_int;
80 type fs_type_t = libc::__fsword_t;
101 FsType(libc::ADFS_SUPER_MAGIC as fs_type_t);
105 FsType(libc::AFFS_SUPER_MAGIC as fs_type_t);
108 pub const AFS_SUPER_MAGIC: FsType = FsType(libc::AFS_SUPER_MAGIC as fs_type_t);
112 FsType(libc::AUTOFS_SUPER_MAGIC as fs_type_t);
115 pub const BPF_FS_MAGIC: FsType = FsType(libc::BPF_FS_MAGIC as fs_type_t);
119 FsType(libc::BTRFS_SUPER_MAGIC as fs_type_t);
123 FsType(libc::CGROUP2_SUPER_MAGIC as fs_type_t);
127 FsType(libc::CGROUP_SUPER_MAGIC as fs_type_t);
131 FsType(libc::CODA_SUPER_MAGIC as fs_type_t);
134 pub const CRAMFS_MAGIC: FsType = FsType(libc::CRAMFS_MAGIC as fs_type_t);
137 pub const DEBUGFS_MAGIC: FsType = FsType(libc::DEBUGFS_MAGIC as fs_type_t);
141 FsType(libc::DEVPTS_SUPER_MAGIC as fs_type_t);
145 FsType(libc::ECRYPTFS_SUPER_MAGIC as fs_type_t);
148 pub const EFS_SUPER_MAGIC: FsType = FsType(libc::EFS_SUPER_MAGIC as fs_type_t);
152 FsType(libc::EXT2_SUPER_MAGIC as fs_type_t);
156 FsType(libc::EXT3_SUPER_MAGIC as fs_type_t);
160 FsType(libc::EXT4_SUPER_MAGIC as fs_type_t);
164 FsType(libc::F2FS_SUPER_MAGIC as fs_type_t);
168 FsType(libc::FUSE_SUPER_MAGIC as fs_type_t);
172 FsType(libc::FUTEXFS_SUPER_MAGIC as fs_type_t);
176 FsType(libc::HOSTFS_SUPER_MAGIC as fs_type_t);
180 FsType(libc::HPFS_SUPER_MAGIC as fs_type_t);
183 pub const HUGETLBFS_MAGIC: FsType = FsType(libc::HUGETLBFS_MAGIC as fs_type_t);
187 FsType(libc::ISOFS_SUPER_MAGIC as fs_type_t);
191 FsType(libc::JFFS2_SUPER_MAGIC as fs_type_t);
195 FsType(libc::MINIX2_SUPER_MAGIC2 as fs_type_t);
199 FsType(libc::MINIX2_SUPER_MAGIC as fs_type_t);
203 FsType(libc::MINIX3_SUPER_MAGIC as fs_type_t);
207 FsType(libc::MINIX_SUPER_MAGIC2 as fs_type_t);
211 FsType(libc::MINIX_SUPER_MAGIC as fs_type_t);
215 FsType(libc::MSDOS_SUPER_MAGIC as fs_type_t);
218 pub const NCP_SUPER_MAGIC: FsType = FsType(libc::NCP_SUPER_MAGIC as fs_type_t);
221 pub const NFS_SUPER_MAGIC: FsType = FsType(libc::NFS_SUPER_MAGIC as fs_type_t);
225 FsType(libc::NILFS_SUPER_MAGIC as fs_type_t);
229 FsType(libc::OCFS2_SUPER_MAGIC as fs_type_t);
233 FsType(libc::OPENPROM_SUPER_MAGIC as fs_type_t);
237 FsType(libc::OVERLAYFS_SUPER_MAGIC as fs_type_t);
241 FsType(libc::PROC_SUPER_MAGIC as fs_type_t);
245 FsType(libc::QNX4_SUPER_MAGIC as fs_type_t);
249 FsType(libc::QNX6_SUPER_MAGIC as fs_type_t);
253 FsType(libc::RDTGROUP_SUPER_MAGIC as fs_type_t);
257 FsType(libc::REISERFS_SUPER_MAGIC as fs_type_t);
261 FsType(libc::SECURITYFS_MAGIC as fs_type_t);
264 pub const SELINUX_MAGIC: FsType = FsType(libc::SELINUX_MAGIC as fs_type_t);
267 pub const SMACK_MAGIC: FsType = FsType(libc::SMACK_MAGIC as fs_type_t);
270 pub const SMB_SUPER_MAGIC: FsType = FsType(libc::SMB_SUPER_MAGIC as fs_type_t);
273 pub const SYSFS_MAGIC: FsType = FsType(libc::SYSFS_MAGIC as fs_type_t);
276 pub const TMPFS_MAGIC: FsType = FsType(libc::TMPFS_MAGIC as fs_type_t);
279 pub const TRACEFS_MAGIC: FsType = FsType(libc::TRACEFS_MAGIC as fs_type_t);
282 pub const UDF_SUPER_MAGIC: FsType = FsType(libc::UDF_SUPER_MAGIC as fs_type_t);
286 FsType(libc::USBDEVICE_SUPER_MAGIC as fs_type_t);
290 FsType(libc::XENFS_SUPER_MAGIC as fs_type_t);
293 pub const NSFS_MAGIC: FsType = FsType(libc::NSFS_MAGIC as fs_type_t);
299 pub const XFS_SUPER_MAGIC: FsType = FsType(libc::XFS_SUPER_MAGIC as fs_type_t);
310 pub fn filesystem_type(&self) -> FsType { in filesystem_type()
317 pub fn filesystem_type_name(&self) -> &str { in filesystem_type_name()
325 pub fn optimal_transfer_size(&self) -> i32 { in optimal_transfer_size()
332 pub fn optimal_transfer_size(&self) -> u32 { in optimal_transfer_size()
339 pub fn optimal_transfer_size(&self) -> u32 { in optimal_transfer_size()
349 pub fn optimal_transfer_size(&self) -> libc::c_ulong { in optimal_transfer_size()
364 pub fn optimal_transfer_size(&self) -> libc::__fsword_t { in optimal_transfer_size()
371 pub fn optimal_transfer_size(&self) -> libc::c_int { in optimal_transfer_size()
378 pub fn optimal_transfer_size(&self) -> libc::c_long { in optimal_transfer_size()
385 pub fn optimal_transfer_size(&self) -> u64 { in optimal_transfer_size()
392 pub fn block_size(&self) -> u32 { in block_size()
400 pub fn block_size(&self) -> u32 { in block_size()
408 pub fn block_size(&self) -> libc::c_ulong { in block_size()
416 pub fn block_size(&self) -> libc::c_int { in block_size()
432 pub fn block_size(&self) -> libc::__fsword_t { in block_size()
439 pub fn block_size(&self) -> u64 { in block_size()
446 pub fn block_size(&self) -> libc::c_ulong { in block_size()
453 pub fn block_size(&self) -> libc::c_long { in block_size()
470 pub fn flags(&self) -> MntFlags { in flags()
479 pub fn flags(&self) -> FsFlags { in flags()
480 FsFlags::from_bits_truncate(self.0.f_flags as libc::c_ulong) in flags()
486 pub fn maximum_name_length(&self) -> u32 { in maximum_name_length()
493 pub fn maximum_name_length(&self) -> u32 { in maximum_name_length()
500 pub fn maximum_name_length(&self) -> libc::c_ulong { in maximum_name_length()
507 pub fn maximum_name_length(&self) -> libc::c_int { in maximum_name_length()
522 pub fn maximum_name_length(&self) -> libc::__fsword_t { in maximum_name_length()
529 pub fn maximum_name_length(&self) -> libc::c_ulong { in maximum_name_length()
544 pub fn blocks(&self) -> u64 { in blocks()
551 pub fn blocks(&self) -> libc::c_long { in blocks()
558 pub fn blocks(&self) -> u32 { in blocks()
573 pub fn blocks_free(&self) -> u64 { in blocks_free()
580 pub fn blocks_free(&self) -> libc::c_long { in blocks_free()
587 pub fn blocks_free(&self) -> u32 { in blocks_free()
600 pub fn blocks_available(&self) -> u64 { in blocks_available()
607 pub fn blocks_available(&self) -> libc::c_long { in blocks_available()
614 pub fn blocks_available(&self) -> i64 { in blocks_available()
621 pub fn blocks_available(&self) -> u32 { in blocks_available()
636 pub fn files(&self) -> u64 { in files()
643 pub fn files(&self) -> libc::c_long { in files()
650 pub fn files(&self) -> u32 { in files()
664 pub fn files_free(&self) -> u64 { in files_free()
671 pub fn files_free(&self) -> libc::c_long { in files_free()
678 pub fn files_free(&self) -> i64 { in files_free()
685 pub fn files_free(&self) -> u32 { in files_free()
690 pub fn filesystem_id(&self) -> fsid_t { in filesystem_id()
696 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { in fmt()
723 /// The result is OS-dependent. For a portable alternative, see
728 /// `path` - Path to any file within the file system to describe
729 pub fn statfs<P: ?Sized + NixPath>(path: &P) -> Result<Statfs> { in statfs()
741 /// The result is OS-dependent. For a portable alternative, see
746 /// `fd` - File descriptor of any open file within the file system to describe
747 pub fn fstatfs<T: AsRawFd>(fd: &T) -> Result<Statfs> { in fstatfs()
757 use std::fs::File;
759 use crate::sys::statfs::*;
760 use crate::sys::statvfs::*;
761 use std::path::Path;