mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-14 09:47:06 +00:00
utils: switch to has_fs_type()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
parent
a035c53af1
commit
29a11a7f1b
@ -42,7 +42,6 @@
|
|||||||
#include <sys/prctl.h>
|
#include <sys/prctl.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/vfs.h>
|
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
@ -183,22 +182,24 @@ static int _recursive_rmdir(char *dirname, dev_t pdev,
|
|||||||
return failed ? -1 : 0;
|
return failed ? -1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we have two different magic values for overlayfs, yay */
|
/* We have two different magic values for overlayfs, yay. */
|
||||||
|
#ifndef OVERLAYFS_SUPER_MAGIC
|
||||||
#define OVERLAYFS_SUPER_MAGIC 0x794c764f
|
#define OVERLAYFS_SUPER_MAGIC 0x794c764f
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef OVERLAY_SUPER_MAGIC
|
||||||
#define OVERLAY_SUPER_MAGIC 0x794c7630
|
#define OVERLAY_SUPER_MAGIC 0x794c7630
|
||||||
/*
|
#endif
|
||||||
* In overlayfs, st_dev is unreliable. so on overlayfs we don't do
|
|
||||||
* the lxc_rmdir_onedev()
|
/* In overlayfs, st_dev is unreliable. So on overlayfs we don't do the
|
||||||
|
* lxc_rmdir_onedev()
|
||||||
*/
|
*/
|
||||||
static bool is_native_overlayfs(const char *path)
|
static bool is_native_overlayfs(const char *path)
|
||||||
{
|
{
|
||||||
struct statfs sb;
|
if (has_fs_type(path, OVERLAY_SUPER_MAGIC) ||
|
||||||
|
has_fs_type(path, OVERLAYFS_SUPER_MAGIC))
|
||||||
if (statfs(path, &sb) < 0)
|
|
||||||
return false;
|
|
||||||
if (sb.f_type == OVERLAYFS_SUPER_MAGIC ||
|
|
||||||
sb.f_type == OVERLAY_SUPER_MAGIC)
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <linux/loop.h>
|
#include <linux/loop.h>
|
||||||
|
#include <linux/magic.h>
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/vfs.h>
|
#include <sys/vfs.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user