[CRIU] [PATCH 05/15] fstype: "mount" callback introduced
Stanislav Kinsburskiy
skinsbursky at virtuozzo.com
Thu Dec 3 05:29:06 PST 2015
It will be used to mount AutoFS, because context creation is required in
addition to actual mount operation.
Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
---
include/proc_parse.h | 5 +++++
mount.c | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/include/proc_parse.h b/include/proc_parse.h
index e45d93f..051ff9a 100644
--- a/include/proc_parse.h
+++ b/include/proc_parse.h
@@ -101,12 +101,17 @@ struct proc_status_creds {
bool proc_status_creds_eq(struct proc_status_creds *o1, struct proc_status_creds *o2);
+typedef int (*mount_fn_t)(const char *source, const char *target,
+ const char *filesystemtype, unsigned long mountflags,
+ const void *data);
+
struct fstype {
char *name;
int code;
int (*dump)(struct mount_info *pm);
int (*restore)(struct mount_info *pm);
int (*parse)(struct mount_info *pm);
+ mount_fn_t mount;
};
struct vm_area_list;
diff --git a/mount.c b/mount.c
index 8b92538..03bd3c0 100644
--- a/mount.c
+++ b/mount.c
@@ -1962,6 +1962,7 @@ static int do_new_mount(struct mount_info *mi)
char *src;
struct fstype *tp = mi->fstype;
bool remount_ro = (tp->restore && mi->sb_flags & MS_RDONLY);
+ mount_fn_t do_mount = (tp->mount) ? tp->mount : mount;
src = resolve_source(mi);
if (!src)
@@ -1976,7 +1977,7 @@ static int do_new_mount(struct mount_info *mi)
if (remount_ro)
sflags &= ~MS_RDONLY;
- if (mount(src, mi->mountpoint, tp->name, sflags, mi->options) < 0) {
+ if (do_mount(src, mi->mountpoint, tp->name, sflags, mi->options) < 0) {
pr_perror("Can't mount at %s", mi->mountpoint);
return -1;
}
More information about the CRIU
mailing list