[CRIU] [PATCH 2/9] proc_parse: Remember a type of FS provided by a kernel

Cyrill Gorcunov gorcunov at gmail.com
Tue Dec 3 10:36:00 PST 2013


On Tue, Dec 03, 2013 at 10:33:26PM +0400, Pavel Emelyanov wrote:
> On 12/03/2013 07:58 PM, Cyrill Gorcunov wrote:
> > 
> > We will need it for btrfs handling. Also print out the
> > FS type for easier debug
> > 
> >  | (00.003545)     type unsupported (cgroup) source cgroup 1c / @ /sys/fs/cgroup/blkio flags 30000e options blkio,
> >  | (00.003558)     type unsupported (cgroup) source cgroup 1d / @ /sys/fs/cgroup/perf_event flags 30000e options perf_event,
> >  | (00.003571)     type unsupported (cgroup) source cgroup 1e / @ /sys/fs/cgroup/hugetlb flags 30000e options hugetlb,
> >  | (00.003584)     type unsupported (ext4) source /dev/sda2 800002 / @ / flags 300000 options data=ordered,
> >  | (00.003670)     type tmpfs (tmpfs) source tmpfs 20 / @ /tmp flags 100000 options
> >  | (00.003696)     type unsupported (mqueue) source mqueue d / @ /dev/mqueue flags 300000 options
> > 
> > Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> > ---
> >  include/proc_parse.h | 1 +
> >  mount.c              | 1 +
> >  proc_parse.c         | 7 +++++--
> >  3 files changed, 7 insertions(+), 2 deletions(-)
> > 
> 
> 
> > @@ -107,6 +107,7 @@ struct mount_info {
> >  	int		master_id;
> >  	int		shared_id;
> >  	struct fstype	*fstype;
> > +	char		*kfstype;
> 
> Why is fstype->name not enough?

We suppress "name" to own array

static struct fstype fstypes[] = {
	[FSTYPE__UNSUPPORTED]	= { "unsupported" },
	[FSTYPE__PROC]		= { "proc" },
	[FSTYPE__SYSFS]		= { "sysfs" },
	[FSTYPE__DEVTMPFS]	= { "devtmpfs" },
	[FSTYPE__BINFMT_MISC]	= { "binfmt_misc", binfmt_misc_dump },
	[FSTYPE__TMPFS]		= { "tmpfs", tmpfs_dump, tmpfs_restore },
	[FSTYPE__DEVPTS]	= { "devpts" },
	[FSTYPE__SIMFS]		= { "simfs" },
};

struct fstype *find_fstype_by_name(char *fst)
{
	int i;

	/*
	 * This fn is required for two things.
	 * 1st -- to check supported filesystems (as just mounting
	 * anything is wrong, almost every fs has its own features)
	 * 2nd -- save some space in the image (since we scan all
	 * names anyway)
	 */

	for (i = 0; i < ARRAY_SIZE(fstypes); i++)
		if (!strcmp(fstypes[i].name, fst))
			return fstypes + i;

	return &fstypes[0];
}

thus all ext4/btrfs and such are "unsupported", so I needed own copy for name.


More information about the CRIU mailing list