bool scan_mounted_volumes() { for (size_t i = 0; i < g_mounts_state.size(); ++i) { delete g_mounts_state[i];
}
g_mounts_state.clear();
// Open and read mount table entries.
FILE* fp = setmntent("/proc/mounts", "re"); if (fp == NULL) { returnfalse;
}
mntent* e; while ((e = getmntent(fp)) != NULL) {
MountedVolume* v = new MountedVolume;
v->device = e->mnt_fsname;
v->mount_point = e->mnt_dir;
v->filesystem = e->mnt_type;
v->flags = e->mnt_opts;
g_mounts_state.push_back(v);
}
endmntent(fp); returntrue;
}
MountedVolume* find_mounted_volume_by_mount_point(constchar* mount_point) { for (size_t i = 0; i < g_mounts_state.size(); ++i) { if (g_mounts_state[i]->mount_point == mount_point) return g_mounts_state[i];
} return nullptr;
}
int unmount_mounted_volume(MountedVolume* volume) { // Intentionally pass the empty string to umount if the caller tries to unmount a volume they // already unmounted using this function.
std::string mount_point = volume->mount_point;
volume->mount_point.clear(); int result = umount(mount_point.c_str()); if (result == -1) {
PLOG(WARNING) << "Failed to umount " << mount_point;
} return result;
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.0 Sekunden
(vorverarbeitet am 2026-07-01)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.