Commit 8e863a94 authored by Stanislav Kinsburskiy's avatar Stanislav Kinsburskiy Committed by Pavel Emelyanov

fstype: "mount" callback introduced

It will be used to mount AutoFS, because context creation is required in
addition to actual mount operation.
Signed-off-by: 's avatarStanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 1617579a
......@@ -101,12 +101,16 @@ struct proc_status_creds {
bool proc_status_creds_eq(struct proc_status_creds *o1, struct proc_status_creds *o2);
typedef int (*mount_fn_t)(struct mount_info *mi, const char *src, const
char *fstype, unsigned long mountflags);
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;
......
......@@ -2209,6 +2209,13 @@ static int fetch_rt_stat(struct mount_info *m, const char *where)
*/
#define MS_MNT_KNOWN_FLAGS (MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_NOATIME | \
MS_NODIRATIME | MS_RELATIME | MS_RDONLY)
static int do_simple_mount(struct mount_info *mi, const char *src, const
char *fstype, unsigned long mountflags)
{
return mount(src, mi->mountpoint, fstype, mountflags, mi->options);
}
static int do_new_mount(struct mount_info *mi)
{
unsigned long sflags = mi->sb_flags;
......@@ -2216,6 +2223,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 : do_simple_mount;
src = resolve_source(mi);
if (!src)
......@@ -2230,7 +2238,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(mi, src, tp->name, sflags) < 0) {
pr_perror("Can't mount at %s", mi->mountpoint);
return -1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment