overlayfs: make mcoverlayfs compile for 4.14.0-115 (el7 arm64)

Use the 4.18 module as a base

Change-Id: I6c9ef66399800828e1932573da5a97573545c5da
This commit is contained in:
Dominique Martinet
2019-01-15 14:29:05 +09:00
parent 0fbdcc44b9
commit f5320fc2b4
7 changed files with 46 additions and 0 deletions

View File

@@ -15,6 +15,8 @@
#include <linux/ratelimit.h>
#include <linux/mount.h>
#include <linux/exportfs.h>
#include <linux/version.h>
#include <linux/kallsyms.h>
#include "overlayfs.h"
struct ovl_lookup_data {
@@ -94,6 +96,10 @@ invalid:
static int ovl_acceptable(void *ctx, struct dentry *dentry)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)
static bool (*is_subdir)(struct dentry *new_dentry, struct dentry *old_dentry);
#endif
/*
* A non-dir origin may be disconnected, which is fine, because
* we only need it for its unique inode number.
@@ -105,6 +111,13 @@ static int ovl_acceptable(void *ctx, struct dentry *dentry)
if (d_unhashed(dentry))
return 0;
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 16, 0)
if (!is_subdir) {
is_subdir = (void *)kallsyms_lookup_name("is_subdir");
WARN_ON(!is_subdir);
}
#endif
/* Check if directory belongs to the layer we are decoding from */
return is_subdir(dentry, ((struct vfsmount *)ctx)->mnt_root);
}