RFC (fwd) Re: 5.3 tmpfs mount permissions
Giorgos Keramidas
keramida at freebsd.org
Mon Nov 8 05:31:33 PST 2004
On 2004-11-08 13:47, Giorgos Keramidas <keramida at ceid.upatras.gr> wrote:
> On 2004-11-08 12:01, "Simon L. Nielsen" <simon at freebsd.org> wrote:
> > On 2004.11.08 12:51:20 +0200, Giorgos Keramidas wrote:
> > > On 2004-11-08 02:50, Giorgos Keramidas <keramida at freebsd.org> wrote:
> > > > Hi,
> > > >
> > > > Does the change outlined below seem like something I should commit?
> > >
> > > The patch posted previously had a few obvious bugs. Here's an updated
> > > version, which I have tested too :-)
> >
> > For consistency shouldn't the same be done for a /var MFS?
>
> You're probably right. I saw varmfs near tmpfs in the rc.conf.5 manpage
> and thought about adding varoptions="" to rc.conf too. It's not very
> difficult, now that I found out how to do it for tmpfs.
Done, see below.
Another tunable option that some users might find interesting at times is the
softupdates support for the memory disks. The current behavior is to enable
softupdates. If the change in behavior is not truly annoying or stupid for
some reason that I haven't thought about, it would be nice if we used
something like this:
%%%
Index: etc/rc.subr
===================================================================
RCS file: /home/ncvs/src/etc/rc.subr,v
retrieving revision 1.31
diff -u -u -r1.31 rc.subr
--- etc/rc.subr 30 Jul 2004 17:19:35 -0000 1.31
+++ etc/rc.subr 8 Nov 2004 13:23:58 -0000
@@ -1290,11 +1290,24 @@
# $1 = size
# $2 = mount point
# $3 = (optional) bytes-per-inode
+# $4 = (optional) extra mount options
+# $5 = (optional) YES to enable softupdates
mount_md() {
+ if [ -n "$5" ]; then
+ case $5 in
+ [Yy][Ee][Ss])
+ sflag="-U" ;;
+ *)
+ sflag="-S" ;;
+ esac
+ fi
+ if [ -n "$4" ]; then
+ opt="-o $4"
+ fi
if [ -n "$3" ]; then
bpi="-i $3"
fi
- /sbin/mdmfs $bpi -s $1 -M md $2
+ /sbin/mdmfs $bpi $opt $sflag -s $1 -M md $2
}
fi
Index: etc/defaults/rc.conf
===================================================================
RCS file: /home/ncvs/src/etc/defaults/rc.conf,v
retrieving revision 1.226
diff -u -u -r1.226 rc.conf
--- etc/defaults/rc.conf 20 Oct 2004 16:58:27 -0000 1.226
+++ etc/defaults/rc.conf 8 Nov 2004 13:24:11 -0000
@@ -40,8 +40,12 @@
removable_interfaces="" # Removable network interfaces for /etc/pccard_ether.
tmpmfs="AUTO" # Set to YES to always create an mfs /tmp, NO to never
tmpsize="20m" # Size of mfs /tmp if created
+tmpoptions="noexec,nosuid,nodev" # Extra mount options for the mfs /tmp
+tmpsoftupdates="NO" # Set to YES to enable softupdates on the mfs /tmp
varmfs="AUTO" # Set to YES to always create an mfs /var, NO to never
varsize="32m" # Size of mfs /var if created
+varoptions="" # Extra mount options for the mfs /var
+varsoftupdates="NO" # Set to YES to enable softupdates on the mfs /var
populate_var="AUTO" # Set to YES to always (re)populate /var, NO to never
local_startup="/usr/local/etc/rc.d /usr/X11R6/etc/rc.d" # startup script dirs.
script_name_sep=" " # Change if your startup scripts' names contain spaces
Index: etc/rc.d/tmp
===================================================================
RCS file: /home/ncvs/src/etc/rc.d/tmp,v
retrieving revision 1.34
diff -u -u -r1.34 tmp
--- etc/rc.d/tmp 7 Oct 2004 13:55:26 -0000 1.34
+++ etc/rc.d/tmp 8 Nov 2004 13:20:47 -0000
@@ -42,7 +42,7 @@
#
case "${tmpmfs}" in
[Yy][Ee][Ss])
- mount_md ${tmpsize} /tmp
+ mount_md ${tmpsize} /tmp '' ${tmpoptions} ${tmpsoftupdates}
chmod 01777 /tmp
;;
[Nn][Oo])
@@ -56,7 +56,7 @@
echo "dropping into shell, ^D to continue anyway."
/bin/sh
else
- mount_md ${tmpsize} /tmp
+ mount_md ${tmpsize} /tmp '' ${tmpoptions} ${tmpsoftupdates}
chmod 01777 /tmp
fi
fi
Index: etc/rc.d/var
===================================================================
RCS file: /home/ncvs/src/etc/rc.d/var,v
retrieving revision 1.34
diff -u -u -r1.34 var
--- etc/rc.d/var 7 Oct 2004 13:55:26 -0000 1.34
+++ etc/rc.d/var 8 Nov 2004 13:21:09 -0000
@@ -61,7 +61,7 @@
#
case "${varmfs}" in
[Yy][Ee][Ss])
- mount_md ${varsize} /var
+ mount_md ${varsize} /var '' ${varoptions} ${varsoftupdates}
;;
[Nn][Oo])
;;
@@ -69,7 +69,7 @@
if (/bin/mkdir -p /var/.diskless 2> /dev/null); then
rmdir /var/.diskless
else
- mount_md ${varsize} /var
+ mount_md ${varsize} /var '' ${varoptions} ${varsoftupdates}
fi
esac
Index: share/man/man5/rc.conf.5
===================================================================
RCS file: /home/ncvs/src/share/man/man5/rc.conf.5,v
retrieving revision 1.232
diff -u -u -r1.232 rc.conf.5
--- share/man/man5/rc.conf.5 23 Oct 2004 18:35:35 -0000 1.232
+++ share/man/man5/rc.conf.5 8 Nov 2004 13:18:43 -0000
@@ -240,6 +240,20 @@
Controls the size of a created
.Pa /tmp
memory file system.
+.It Va tmpoptions
+Controls the
+.Xr mount 8
+options of a created
+.Pa /tmp
+memory file system.
+.It Va tmpsoftupdates
+.Pq Vt str
+Set to
+.Dq Li YES
+to enable softupdates on the memory file system mounted as
+.Pa /tmp .
+The default is
+.Dq Li NO .
.It Va varmfs
Controls the creation of a
.Pa /var
@@ -255,6 +269,20 @@
Controls the size of a created
.Pa /var
memory file system.
+.It Va varoptions
+Controls the
+.Xr mount 8
+options of a created
+.Pa /var
+memory file system.
+.It Va varsoftupdates
+.Pq Vt str
+Set to
+.Dq Li YES
+to enable softupdates on the memory file system mounted as
+.Pa /var .
+The default is
+.Dq Li NO .
.It Va populate_var
Controls the automatic population of the
.Pa /var
@@ -3095,6 +3123,7 @@
.Xr kldxref 8 ,
.Xr lpd 8 ,
.Xr mdconfig 8 ,
+.Xr mount 8 ,
.Xr mountd 8 ,
.Xr moused 8 ,
.Xr mrouted 8 ,
%%%
More information about the freebsd-rc
mailing list