libmount: fix support of comma-separated fs types lists
PATCH 1/1 libmount: fix support of comma-separated fs types lists
# grep cdrom /etc/fstab /dev/sr0 /media/cdrom udf,iso9660 ro,noauto,user,utf8 0 0 # mount /media/cdrom mount: unknown filesystem type 'udf,iso9660'
# mount -t udf,iso9660 /dev/sr0 /media/cdrom mount: /dev/sr0 is write-protected, mounting read-only
--- libmount/src/context_mount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
libmount/src/context_mount.c +0 -0
@@ -691,7 +691,7 @@ int mnt_context_do_mount(struct libmnt_context *cxt) cxt->mountdata =3D (char *) mnt_fs_get_fs_options(cxt->fs);
=20
type =3D mnt_fs_get_fstype(cxt->fs);
- if (type)
+ if (type && !strchr(type, ','))
res =3D do_mount(cxt, NULL);
else
res =3D do_mount_by_pattern(cxt, cxt->fstype_pattern);
--=20
glebfm =E7=CC=C5=C2 =E6=CF=D4=C5=CE=C7=C1=D5=DC=D2-=ED=C1=CC=C9=CE=CF=D7=D3=CB=C9=
=CA
PATCH v2 1/1 libmount: fix support of comma-separated fs types lists
# grep cdrom /etc/fstab /dev/sr0 /media/cdrom udf,iso9660 ro,noauto,user,utf8 0 0 # mount /media/cdrom mount: unknown filesystem type 'udf,iso9660'
# mount -t udf,iso9660 /dev/sr0 /media/cdrom mount: /dev/sr0 is write-protected, mounting read-only
--- libmount/src/context_mount.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
libmount/src/context_mount.c +6 -3
@@ -691,9 +691,12 @@ int mnt_context_do_mount(struct libmnt_context *cxt) cxt->mountdata = (char *)mnt_fs_get_fs_options (cxt->fs); type =mnt_fs_get_fstype (cxt->fs); -if (type) - res =do_mount (cxt,NULL ); -else +if (type) { +if (strchr (type,',' )) + res =do_mount_by_pattern (cxt, type); +else + res =do_mount (cxt,NULL ); + }else res =do_mount_by_pattern (cxt, cxt->fstype_pattern); if (mnt_context_get_status(cxt)
Signature · 2 lines
glebfm Глеб Фотенгауэр-Малиновский
Karel Zak
maintainerHi,
Quoted 4 lines · Gleb Fotengauer-Malinovskiy
# grep cdrom /etc/fstab /dev/sr0 /media/cdrom udf,iso9660 ro,noauto,user,utf8 0 0 # mount /media/cdrom mount: unknown filesystem type 'udf,iso9660'
this first time I see that someone has a pattern in fstab, it seems undocumented and very probably unsupported on many places. But it seems that old (non-libmount) supported this feature too.
Quoted 16 lines
# mount -t udf,iso9660 /dev/sr0 /media/cdrom mount: /dev/sr0 is write-protected, mounting read-onlySigned-off-by Gleb Fotengauer-Malinovskiy <[email protected]>--- libmount/src/context_mount.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)libmount/src/context_mount.c +0
-0@@ -691,9 +691,12 @@ int mnt_context_do_mount(struct libmnt_context *cxt) cxt->mountdata = (char *)mnt_fs_get_fs_options (cxt->fs); type =mnt_fs_get_fstype (cxt->fs);
libmount/src/context_mount.c int mnt_context_do_mount(struct libmnt_context *cxt) · line 700
Quoted 10 lines
libmount/src/context_mount.c +6
-3-if (type) - res =do_mount (cxt,NULL ); -else +if (type) { +if (strchr (type,',' )) + res =do_mount_by_pattern (cxt, type); +else + res =do_mount (cxt,NULL ); + }else res =do_mount_by_pattern (cxt, cxt->fstype_pattern);
This is hack ;-)
It would be better to improve mnt_context_apply_fstab() to initialize cxt->fstype_pattern (see mnt_context_set_fstype_pattern()) and zeroize cxt->fs->type if the fstab entry contains a pattern rather than a real fstype.
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com