mirror of
https://github.com/troglobit/finit.git
synced 2026-10-20 11:19:35 +00:00
Avoid remounting already mounted /run and /tmp directories
Adds the function fistmpfs to determine if a new tmpfs mount should be performed on /run and /tmp. The function supports cases where more complex mount hierarchies are in use, including overlayfs backed mounts. Signed-off-by: Mathias Thore <mathias.thore@atlascopco.com>
This commit is contained in:
1 parent
13b107b7b1
commit
a0685219cf
3 files changed
+19
-2
No files matched your search
+16
@@ -42,6 +42,8 @@
|
||||
# include <sys/ioctl.h>
|
||||
#endif
|
||||
#include <sys/sysinfo.h> /* sysinfo() */
|
||||
#include <sys/vfs.h> /* statfs */
|
||||
#include <linux/magic.h>
|
||||
#ifdef _LIBITE_LITE
|
||||
# include <libite/lite.h>
|
||||
#else
|
||||
@@ -572,6 +574,20 @@ int fismnt(char *dir)
|
||||
return ismnt("/proc/mounts", dir, NULL);
|
||||
}
|
||||
|
||||
/* Return 1 if dir is a backed by tmpfs or overlayfs */
|
||||
int fistmpfs(char *dir)
|
||||
{
|
||||
struct statfs info = {0};
|
||||
|
||||
if (statfs(dir, &info))
|
||||
return 0;
|
||||
|
||||
if (info.f_type == TMPFS_MAGIC || info.f_type == OVERLAYFS_SUPER_MAGIC)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
/*
|
||||
* Called by initctl, and by finit at boot and shutdown, to
|
||||
|
||||
Reference in new issue
Block a user