mirror of
https://github.com/aaru-dps/fstester.git
synced 2025-12-16 19:24:39 +00:00
Decode DragonFly BSD flags from statfs(2).
This commit is contained in:
@@ -34,6 +34,8 @@ void NetBsdPrintStatvfsFlags(unsigned long flags);
|
||||
#include <stdint.h>
|
||||
|
||||
void FreeBsdPrintStatfsFlags(uint64_t flags);
|
||||
#elif defined(__DragonFly__)
|
||||
void DragonFlyPrintStatfsFlags(int flags);
|
||||
#endif
|
||||
|
||||
#endif // SETTER_SRC_BSD_H_
|
||||
|
||||
@@ -412,3 +412,162 @@ void FreeBsdPrintStatfsFlags(uint64_t flags)
|
||||
if(flags) { log_write("\t\tRemaining flags: 0x%08lX\n", flags); }
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__DragonFly__)
|
||||
void DragonFlyPrintStatfsFlags(int flags)
|
||||
{
|
||||
log_write("\tFlags:\n");
|
||||
|
||||
if(flags & MNT_RDONLY)
|
||||
{
|
||||
log_write("\t\tVolume is read-only.\n");
|
||||
flags -= MNT_RDONLY;
|
||||
}
|
||||
|
||||
if(flags & MNT_SYNCHRONOUS)
|
||||
{
|
||||
log_write("\t\tVolume writes are synced at once.\n");
|
||||
flags -= MNT_SYNCHRONOUS;
|
||||
}
|
||||
|
||||
if(flags & MNT_NOEXEC)
|
||||
{
|
||||
log_write("\t\tVolume disallows program execution.\n");
|
||||
flags -= MNT_NOEXEC;
|
||||
}
|
||||
|
||||
if(flags & MNT_NOSUID)
|
||||
{
|
||||
log_write("\t\tVolume ignores suid and sgid bits.\n");
|
||||
flags -= MNT_NOSUID;
|
||||
}
|
||||
|
||||
if(flags & MNT_NODEV)
|
||||
{
|
||||
log_write("\t\tVolume disallows access to device special files.\n");
|
||||
flags -= MNT_NODEV;
|
||||
}
|
||||
|
||||
if(flags & MNT_AUTOMOUNTED)
|
||||
{
|
||||
log_write("\t\tVolume is automounted.\n");
|
||||
flags -= MNT_AUTOMOUNTED;
|
||||
}
|
||||
|
||||
if(flags & MNT_ASYNC)
|
||||
{
|
||||
log_write("\t\tVolume is written asynchronously.\n");
|
||||
flags -= MNT_ASYNC;
|
||||
}
|
||||
|
||||
if(flags & MNT_SUIDDIR)
|
||||
{
|
||||
log_write("\t\tVolume handles SUID in directories in a special way.\n");
|
||||
flags -= MNT_SUIDDIR;
|
||||
}
|
||||
|
||||
if(flags & MNT_SOFTDEP)
|
||||
{
|
||||
log_write("\t\tVolume uses soft dependencies.\n");
|
||||
flags -= MNT_SOFTDEP;
|
||||
}
|
||||
|
||||
if(flags & MNT_NOSYMFOLLOW)
|
||||
{
|
||||
log_write("\t\tVolume does not follow symbolic links.\n");
|
||||
flags -= MNT_NOSYMFOLLOW;
|
||||
}
|
||||
|
||||
if(flags & MNT_TRIM)
|
||||
{
|
||||
log_write("\t\tVolume is TRIMmed/DISCARDed.\n");
|
||||
flags -= MNT_TRIM;
|
||||
}
|
||||
|
||||
if(flags & MNT_NOATIME)
|
||||
{
|
||||
log_write("\t\tVolume does not update access times.\n");
|
||||
flags -= MNT_NOATIME;
|
||||
}
|
||||
|
||||
if(flags & MNT_NOCLUSTERR)
|
||||
{
|
||||
log_write("\t\tVolume has read clustering disabled.\n");
|
||||
flags -= MNT_NOCLUSTERR;
|
||||
}
|
||||
|
||||
if(flags & MNT_NOCLUSTERW)
|
||||
{
|
||||
log_write("\t\tVolume has write clustering disabled.\n");
|
||||
flags -= MNT_NOCLUSTERW;
|
||||
}
|
||||
|
||||
if(flags & MNT_EXRDONLY)
|
||||
{
|
||||
log_write("\t\tVolume is exported read-only.\n");
|
||||
flags -= MNT_EXRDONLY;
|
||||
}
|
||||
|
||||
if(flags & MNT_EXPORTED)
|
||||
{
|
||||
log_write("\t\tVolume is exported.\n");
|
||||
flags -= MNT_EXPORTED;
|
||||
}
|
||||
|
||||
if(flags & MNT_DEFEXPORTED)
|
||||
{
|
||||
log_write("\t\tVolume is exported to the world.\n");
|
||||
flags -= MNT_DEFEXPORTED;
|
||||
}
|
||||
|
||||
if(flags & MNT_EXPORTANON)
|
||||
{
|
||||
log_write("\t\tVolume uses anon id.\n");
|
||||
flags -= MNT_EXPORTANON;
|
||||
}
|
||||
|
||||
if(flags & MNT_EXKERB)
|
||||
{
|
||||
log_write("\t\tVolume is exported with Kerberos ID.\n");
|
||||
flags -= MNT_EXKERB;
|
||||
}
|
||||
|
||||
if(flags & MNT_EXPUBLIC)
|
||||
{
|
||||
log_write("\t\tVolume is exported publicly.\n");
|
||||
flags -= MNT_EXPUBLIC;
|
||||
}
|
||||
|
||||
if(flags & MNT_LOCAL)
|
||||
{
|
||||
log_write("\t\tVolume is local.\n");
|
||||
flags -= MNT_LOCAL;
|
||||
}
|
||||
|
||||
if(flags & MNT_QUOTA)
|
||||
{
|
||||
log_write("\t\tVolume has quotas enabled.\n");
|
||||
flags -= MNT_QUOTA;
|
||||
}
|
||||
|
||||
if(flags & MNT_ROOTFS)
|
||||
{
|
||||
log_write("\t\tVolume is the root filesystem.\n");
|
||||
flags -= MNT_ROOTFS;
|
||||
}
|
||||
|
||||
if(flags & MNT_USER)
|
||||
{
|
||||
log_write("\t\tVolume has been mounted by a user.\n");
|
||||
flags -= MNT_USER;
|
||||
}
|
||||
|
||||
if(flags & MNT_IGNORE)
|
||||
{
|
||||
log_write("\t\tVolume does not appear in df.\n");
|
||||
flags -= MNT_IGNORE;
|
||||
}
|
||||
|
||||
if(flags) { log_write("\t\tRemaining flags: 0x%08lX\n", flags); }
|
||||
}
|
||||
#endif
|
||||
@@ -273,4 +273,106 @@ Copyright (C) 2011-2021 Natalia Portillo
|
||||
#endif
|
||||
#endif // FreeBSD
|
||||
|
||||
#if defined(__DragonFly__)
|
||||
#ifndef MNT_RDONLY
|
||||
#define MNT_RDONLY 0x00000001 /* read only filesystem */
|
||||
#endif
|
||||
|
||||
#ifndef MNT_SYNCHRONOUS
|
||||
#define MNT_SYNCHRONOUS 0x00000002 /* file system written synchronously */
|
||||
#endif
|
||||
|
||||
#ifndef MNT_NOEXEC
|
||||
#define MNT_NOEXEC 0x00000004 /* can't exec from filesystem */
|
||||
#endif
|
||||
|
||||
#ifndef MNT_NOSUID
|
||||
#define MNT_NOSUID 0x00000008 /* don't honor setuid bits on fs */
|
||||
#endif
|
||||
|
||||
#ifndef MNT_NODEV
|
||||
#define MNT_NODEV 0x00000010 /* don't interpret special files */
|
||||
#endif
|
||||
|
||||
#ifndef MNT_AUTOMOUNTED
|
||||
#define MNT_AUTOMOUNTED 0x00000020 /* mounted by automountd(8) */
|
||||
#endif
|
||||
|
||||
#ifndef MNT_ASYNC
|
||||
#define MNT_ASYNC 0x00000040 /* file system written asynchronously */
|
||||
#endif
|
||||
|
||||
#ifndef MNT_SUIDDIR
|
||||
#define MNT_SUIDDIR 0x00100000 /* special handling of SUID on dirs */
|
||||
#endif
|
||||
|
||||
#ifndef MNT_SOFTDEP
|
||||
#define MNT_SOFTDEP 0x00200000 /* soft updates being done */
|
||||
#endif
|
||||
|
||||
#ifndef MNT_NOSYMFOLLOW
|
||||
#define MNT_NOSYMFOLLOW 0x00400000 /* do not follow symlinks */
|
||||
#endif
|
||||
|
||||
#ifndef MNT_TRIM
|
||||
#define MNT_TRIM 0x01000000 /* Enable online FS trimming */
|
||||
#endif
|
||||
|
||||
#ifndef MNT_NOATIME
|
||||
#define MNT_NOATIME 0x10000000 /* disable update of file access time */
|
||||
#endif
|
||||
|
||||
#ifndef MNT_NOCLUSTERR
|
||||
#define MNT_NOCLUSTERR 0x40000000 /* disable cluster read */
|
||||
#endif
|
||||
|
||||
#ifndef MNT_NOCLUSTERW
|
||||
#define MNT_NOCLUSTERW 0x80000000 /* disable cluster write */
|
||||
#endif
|
||||
|
||||
#ifndef MNT_EXRDONLY
|
||||
#define MNT_EXRDONLY 0x00000080 /* exported read only */
|
||||
#endif
|
||||
|
||||
#ifndef MNT_EXPORTED
|
||||
#define MNT_EXPORTED 0x00000100 /* file system is exported */
|
||||
#endif
|
||||
|
||||
#ifndef MNT_DEFEXPORTED
|
||||
#define MNT_DEFEXPORTED 0x00000200 /* exported to the world */
|
||||
#endif
|
||||
|
||||
#ifndef MNT_EXPORTANON
|
||||
#define MNT_EXPORTANON 0x00000400 /* use anon uid mapping for everyone */
|
||||
#endif
|
||||
|
||||
#ifndef MNT_EXKERB
|
||||
#define MNT_EXKERB 0x00000800 /* exported with Kerberos uid mapping */
|
||||
#endif
|
||||
|
||||
#ifndef MNT_EXPUBLIC
|
||||
#define MNT_EXPUBLIC 0x20000000 /* public export (WebNFS) */
|
||||
#endif
|
||||
|
||||
#ifndef MNT_LOCAL
|
||||
#define MNT_LOCAL 0x00001000 /* filesystem is stored locally */
|
||||
#endif
|
||||
|
||||
#ifndef MNT_QUOTA
|
||||
#define MNT_QUOTA 0x00002000 /* quotas are enabled on filesystem */
|
||||
#endif
|
||||
|
||||
#ifndef MNT_ROOTFS
|
||||
#define MNT_ROOTFS 0x00004000 /* identifies the root filesystem */
|
||||
#endif
|
||||
|
||||
#ifndef MNT_USER
|
||||
#define MNT_USER 0x00008000 /* mounted by a user */
|
||||
#endif
|
||||
|
||||
#ifndef MNT_IGNORE
|
||||
#define MNT_IGNORE 0x00800000 /* do not show entry in df */
|
||||
#endif
|
||||
#endif // DragonFly BSD
|
||||
|
||||
#endif // AARU_FSTESTER_SETTER_SRC_BSD_VOLUME_H_
|
||||
|
||||
@@ -199,6 +199,8 @@ void GetVolumeInfo(const char* path, size_t* clusterSize)
|
||||
DarwinPrintStatfsFlags(buf.f_flags);
|
||||
#elif defined(__FreeBSD__)
|
||||
FreeBsdPrintStatfsFlags(buf.f_flags);
|
||||
#elif defined(__DragonFly__)
|
||||
DragonFlyPrintStatfsFlags(buf.f_flags);
|
||||
#else
|
||||
log_write("\tFlags: 0x%08lX\n", buf.f_flags);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user