util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libmount: fix support of comma-separated fs types lists
@ 2012-09-27 16:18 Gleb Fotengauer-Malinovskiy
  2012-09-27 16:48 ` [PATCH v2] " Gleb Fotengauer-Malinovskiy
  0 siblings, 1 reply; 3+ messages in thread
From: Gleb Fotengauer-Malinovskiy @ 2012-09-27 16:18 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

	# 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

Signed-off-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
---
 libmount/src/context_mount.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c
index f3d8ff1..efd7e7b 100644
--- a/libmount/src/context_mount.c
+++ b/libmount/src/context_mount.c
@@ -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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2] libmount: fix support of comma-separated fs types lists
  2012-09-27 16:18 [PATCH] libmount: fix support of comma-separated fs types lists Gleb Fotengauer-Malinovskiy
@ 2012-09-27 16:48 ` Gleb Fotengauer-Malinovskiy
  2012-10-01 15:41   ` Karel Zak
  0 siblings, 1 reply; 3+ messages in thread
From: Gleb Fotengauer-Malinovskiy @ 2012-09-27 16:48 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

	# 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

Signed-off-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
---
 libmount/src/context_mount.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c
index f3d8ff1..867e644 100644
--- a/libmount/src/context_mount.c
+++ b/libmount/src/context_mount.c
@@ -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)

-- 
	glebfm
	Глеб Фотенгауэр-Малиновский


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] libmount: fix support of comma-separated fs types lists
  2012-09-27 16:48 ` [PATCH v2] " Gleb Fotengauer-Malinovskiy
@ 2012-10-01 15:41   ` Karel Zak
  0 siblings, 0 replies; 3+ messages in thread
From: Karel Zak @ 2012-10-01 15:41 UTC (permalink / raw)
  To: Gleb Fotengauer-Malinovskiy; +Cc: util-linux


 Hi,

On Thu, Sep 27, 2012 at 08:48:34PM +0400, Gleb Fotengauer-Malinovskiy wrote:
> 	# 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.

> 	# mount -t udf,iso9660 /dev/sr0 /media/cdrom
> 	mount: /dev/sr0 is write-protected, mounting read-only
> 
> Signed-off-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
> ---
>  libmount/src/context_mount.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c
> index f3d8ff1..867e644 100644
> --- a/libmount/src/context_mount.c
> +++ b/libmount/src/context_mount.c
> @@ -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);

 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

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-10-01 15:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-27 16:18 [PATCH] libmount: fix support of comma-separated fs types lists Gleb Fotengauer-Malinovskiy
2012-09-27 16:48 ` [PATCH v2] " Gleb Fotengauer-Malinovskiy
2012-10-01 15:41   ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).