VFS Rump: print file-system usage stats at mount time

Fix #3174
This commit is contained in:
Ehmry - 2019-02-20 10:21:26 +01:00 committed by Christian Helmuth
parent 6c7356072d
commit 20f7f5b64f
2 changed files with 21 additions and 0 deletions

View File

@ -5,6 +5,15 @@ ifeq ($(filter-out $(SPECS),arm),)
# rump include shadows some parts of 'machine' on ARM only,
# Therefore, it must be included before RUMP_BASE/include/machine
INC_DIR := $(RUMP_PORT_DIR)/src/sys/rump/include $(INC_DIR)
INC_DIR += $(RUMP_PORT_DIR)/src/sys/arch/arm/include
endif
ifeq ($(filter-out $(SPECS),x86_32),)
INC_DIR += $(RUMP_PORT_DIR)/src/sys/arch/i386/include
endif
ifeq ($(filter-out $(SPECS),x86_64),)
INC_DIR += $(RUMP_PORT_DIR)/src/sys/arch/amd64/include
endif
INC_DIR += $(LIBGCC_INC_DIR) \

View File

@ -29,6 +29,7 @@ extern "C" {
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/resource.h>
#include <sys/event.h>
#include <sys/time.h>
@ -413,6 +414,17 @@ class Vfs::Rump_file_system : public File_system
}
Genode::log(fs_type," file system mounted");
struct statvfs stats;
int err = rump_sys_statvfs1("/", &stats, ST_WAIT);
if (err == 0) {
double factor = 1.0 / (1<<30);
double available = factor * stats.f_bsize * stats.f_bavail;
double total = factor * stats.f_bsize * stats.f_blocks;
Genode::log("Space available: ", available, " GiB / ", total, " GiB");
Genode::log("Nodes available: ", stats.f_favail, "/", stats.f_files);
}
}
/***************************