aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Farrugia <mark.farrugia@fiberdyne.com.au>2018-10-31 13:38:07 +1100
committerMark Farrugia <mark.farrugia@fiberdyne.com.au>2018-10-31 13:38:07 +1100
commit691f74d3bb6a06e56f895a5b844ad7dad297a860 (patch)
treed1756b43d058d2f8be46626c781e91bf2e3e656f
parent097c14c281388b746b4f438d38b35e37e28e3ef2 (diff)
Add check for configfs filesystem
Check /proc/filesystems for the configfs filesystem. If the kernel does not support configfs, we cannot use AVIRT Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
-rw-r--r--src/avirt-config.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/avirt-config.c b/src/avirt-config.c
index 96c9cd4..e1b60b9 100644
--- a/src/avirt-config.c
+++ b/src/avirt-config.c
@@ -61,7 +61,30 @@ static bool card_sealed = false;
static int mount_configfs()
{
int err;
+ char fsline[100];
+ bool configfs_supported = false;
+ FILE *procfs;
struct stat st = {0};
+
+ // Check for /proc/filesystem for configfs support
+ procfs = fopen("/proc/filesystems", "r");
+ if (!procfs)
+ return -1;
+
+ while (fgets(fsline, 100, procfs))
+ {
+ if (!strstr(fsline, "configfs"))
+ continue;
+ configfs_supported = true;
+ }
+
+ if (!configfs_supported)
+ {
+ AVIRT_ERROR("configfs is not supported !");
+ return -1;
+ }
+
+ // Check whether /config dir exists, if not, create it
if (stat("/config", &st) == -1)
mkdir("/config", S_IRWXU | S_IRWXG | S_IRWXO);