diff options
author | Phil Davis <phil.davis@world.inf.org> | 2012-11-15 09:45:25 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@world.inf.org> | 2012-11-15 09:45:25 +0545 |
commit | 41cc7a540236f73c34c10f4df3cb008e1abc3e8b (patch) | |
tree | bbf83bd0e8471504eb51d8d80720715dd6489976 /usr/local/www/diag_nanobsd.php | |
parent | 96cecadbe7aab4b17634cf522fccbae9ba6982ac (diff) | |
download | pfsense-41cc7a540236f73c34c10f4df3cb008e1abc3e8b.zip pfsense-41cc7a540236f73c34c10f4df3cb008e1abc3e8b.tar.gz |
Enhance reporting read-write setting
If the user has already selected Current Read/Write Status to be Read-Write, then they also choose Permanent Read/Write the mount refcount becomes 2. Then if they turn off Permanent Read/Write the setting is saved, but the refcount goes back to 1. This results in the file system still being mounted Read-Write.
This would be unexpected behaviour IMO - a user who came back some days later to turn off Permanent Read-Write would expect the file system to switch back to Read-Only in real time, as well as changing back the config setting.
This corrects the above behaviour.
I also added display of the refcount if it is more than 1. If for some reason multiple other things leave the file system mounted then this can be immediately seen on the GUI.
Note: The "Switch to Read-Only" button only decrements the refcount by 1 each time. So if the refcount is >1 the user has to press a few times to get the count back to zero and the file system read-only. I think this is reasonable behaviour.
Diffstat (limited to 'usr/local/www/diag_nanobsd.php')
-rwxr-xr-x | usr/local/www/diag_nanobsd.php | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/usr/local/www/diag_nanobsd.php b/usr/local/www/diag_nanobsd.php index 353f9ba..c88aa1b 100755 --- a/usr/local/www/diag_nanobsd.php +++ b/usr/local/www/diag_nanobsd.php @@ -118,7 +118,9 @@ if ($_POST['changero']) { if ($_POST['setrw']) { if (isset($_POST['nanobsd_force_rw'])) { - conf_mount_rw(); + if (!is_writable("/")) { + conf_mount_rw(); + } $config['system']['nanobsd_force_rw'] = true; } else { unset($config['system']['nanobsd_force_rw']); @@ -181,7 +183,13 @@ if ($savemsg) <td valign="top" class="vncell"> <form action="diag_nanobsd.php" method="post" name="iform"> <?php if (is_writable("/")) { - echo gettext("Read/Write"); + $refcount = refcount_read(1000); + if ($refcount == 1) { + $refdisplay = ""; + } else { + $refdisplay = " (reference count " . $refcount . ")"; + } + echo gettext("Read/Write") . $refdisplay; if (!isset($config['system']['nanobsd_force_rw'])) echo "<br/><input type='submit' name='changero' value='" . gettext("Switch to Read-Only") . "'>"; } else { |