Re: Add support for rdonly keyword in fstab

2017-06-15 Thread Jérôme FRGACIC

On Wed, 14 Jun 2017 12:49:19 -0700, Klemens Nanni wrote:

fstab(5) has always used ro/rw for this exclusively, which is sufficient
enough imho.


I dare say mount(8) actually has too many ways to say the same thing:
-r
-o ro
-r norw
-o rdonly

How about removing some of those?


I think you're right, that's sound better. ;)



Re: Add support for rdonly keyword in fstab

2017-06-14 Thread Klemens Nanni

On Wed, Jun 14, 2017 at 07:54:48PM +0200, Jérôme FRGACIC wrote:
I recently realized that the word "rdonly" is not an alias for "ro" in 
the fstab file, which is inconsistent with the mount(1) command. I 
would suggest to add support for it with this small patch.

fstab(5) has always used ro/rw for this exclusively, which is sufficient
enough imho.

I dare say mount(8) actually has too many ways to say the same thing:
-r
-o ro
-r norw
-o rdonly

How about removing some of those?



Add support for rdonly keyword in fstab

2017-06-14 Thread Jérôme FRGACIC

Hi @tech,

I recently realized that the word "rdonly" is not an alias for "ro" in 
the fstab file, which is inconsistent with the mount(1) command. I would 
suggest to add support for it with this small patch.


Index: fstab.c
===
RCS file: /cvs/src/lib/libc/gen/fstab.c,v
retrieving revision 1.22
diff -u -p -u -r1.22 fstab.c
--- fstab.c 17 Mar 2016 23:48:42 -  1.22
+++ fstab.c 14 Jun 2017 17:53:24 -
@@ -116,8 +116,6 @@ fstabscan(void)
strlcpy(subline, _fs_fstab.fs_mntops, sizeof subline);
for (typexx = 0, cp = strtok_r(subline, ",", ); cp;
 cp = strtok_r(NULL, ",", )) {
-   if (strlen(cp) != 2)
-   continue;
if (!strcmp(cp, FSTAB_RW)) {
_fs_fstab.fs_type = FSTAB_RW;
break;
@@ -127,6 +125,10 @@ fstabscan(void)
break;
}
if (!strcmp(cp, FSTAB_RO)) {
+   _fs_fstab.fs_type = FSTAB_RO;
+   break;
+   }
+   if (!strcmp(cp, FSTAB_RDONLY)) {
_fs_fstab.fs_type = FSTAB_RO;
break;
}


Kind regards,


Jérôme FRGACIC