From 71398f5cf5e05453bc3594cda56c003343f7f811 Mon Sep 17 00:00:00 2001 From: Tycho Andersen Date: Thu, 9 Apr 2015 21:54:00 +0300 Subject: [PATCH] mnt: add matching on fs kernel subtypes Signed-off-by: Tycho Andersen Signed-off-by: Pavel Emelyanov --- mount.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/mount.c b/mount.c index fff7eb447..15d571684 100644 --- a/mount.c +++ b/mount.c @@ -1127,11 +1127,26 @@ struct fstype *find_fstype_by_name(char *fst) * anything is wrong, almost every fs has its own features) * 2nd -- save some space in the image (since we scan all * names anyway) + * + * The kernel reports "subtypes" sometimes and the valid + * type-vs-subtype delimiter is the dot symbol. We disregard any + * subtypes for the purpose of finding the fstype. */ + char fstype[1024]; - for (i = 0; i < ARRAY_SIZE(fstypes); i++) - if (!strcmp(fstypes[i].name, fst)) + for (i = 0; fst[i] && i < sizeof(fstype) - 1; i++) { + if (fst[i] == '.') + break; + + fstype[i] = fst[i]; + } + + fstype[i] = 0; + + for (i = 0; i < ARRAY_SIZE(fstypes); i++) { + if (!strcmp(fstypes[i].name, fstype)) return fstypes + i; + } return &fstypes[0]; }