mergerfs/src/fs_mounts.cpp

41 lines
562 B
C++
Raw Normal View History

#include "fs_mounts.hpp"
#include <cstdio>
2025-09-29 00:17:51 -04:00
#ifdef __linux__
#include <mntent.h>
void
fs::mounts(fs::MountVec &mounts_)
{
FILE *f;
f = ::setmntent("/proc/mounts","r");
if(f == NULL)
return;
struct mntent *entry;
while((entry = ::getmntent(f)) != NULL)
{
fs::Mount m;
m.dir = entry->mnt_dir;
m.fsname = entry->mnt_fsname;
m.type = entry->mnt_type;
m.opts = entry->mnt_opts;
mounts_.emplace_back(std::move(m));
}
::endmntent(f);
}
2025-09-29 00:17:51 -04:00
#else
2025-09-29 00:17:51 -04:00
void
fs::mounts(fs::MountVec &mounts_)
{
}
2025-09-29 00:17:51 -04:00
#endif