summaryrefslogtreecommitdiffstats
path: root/sbin/bsdlabel
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-01-26 11:11:19 +0000
committerphk <phk@FreeBSD.org>2003-01-26 11:11:19 +0000
commitdc7edb5afb32d0456fc06e8ef281c1349abe894a (patch)
tree9f62c6ce4618bd7ff5fb809caebbabc83543513c /sbin/bsdlabel
parent680c2aca55d1bb75a321735e31280c7281782f2c (diff)
downloadFreeBSD-src-dc7edb5afb32d0456fc06e8ef281c1349abe894a.zip
FreeBSD-src-dc7edb5afb32d0456fc06e8ef281c1349abe894a.tar.gz
Retire the "-N" and "-W" options which implemented write-protection
for the disklabel: This facility is OBE. First of all, we cannot sensibly implement this in a properly stacked environment. Second, if we did, it would confuse the heck out of users who wouldn't be able to "start from scratch" by dd(8)'ing /dev/zero onto /dev/da0. Third, the offered protection is not comprehensive: no other software would respect it. Fourth and finally, the disklabel is already protected against tampering if it controls open partitions. Uselessness of these options discussed with: peter
Diffstat (limited to 'sbin/bsdlabel')
-rw-r--r--sbin/bsdlabel/bsdlabel.824
-rw-r--r--sbin/bsdlabel/bsdlabel.c28
2 files changed, 3 insertions, 49 deletions
diff --git a/sbin/bsdlabel/bsdlabel.8 b/sbin/bsdlabel/bsdlabel.8
index 1e908c2..b3df66e 100644
--- a/sbin/bsdlabel/bsdlabel.8
+++ b/sbin/bsdlabel/bsdlabel.8
@@ -61,9 +61,6 @@
.Op Fl r
.Op Fl n
.Ar disk Ar protofile
-.Nm
-.Op Fl NW
-.Ar disk
.Pp
.Nm
.Fl B
@@ -311,27 +308,6 @@ If
is used, no data will be written to the device, and instead the
disklabel that would have been written will be printed to stdout. This is
useful to see how a partitioning scheme will work out for a specific disk.
-.Ss Enabling and disabling writing to the disk label area
-.Pp
-By default, it is not possible to write to the disk label area at the beginning
-of a disk. The disk driver arranges for
-.Xr write 2
-and similar system calls
-to return
-.Er EROFS
-on any attempt to do so. If you need
-to write to this area (for example, to obliterate the label), use the form
-.Pp
-.Nm
-.Fl W
-.Ar disk
-.Pp
-To disallow writing to the label area after previously allowing it, use the
-command
-.Pp
-.Nm
-.Fl N
-.Ar disk
.Ss Installing bootstraps
.Pp
The final three forms of
diff --git a/sbin/bsdlabel/bsdlabel.c b/sbin/bsdlabel/bsdlabel.c
index bbcf0d0..bcb721c 100644
--- a/sbin/bsdlabel/bsdlabel.c
+++ b/sbin/bsdlabel/bsdlabel.c
@@ -163,20 +163,20 @@ char boot1[MAXPATHLEN];
#endif
enum {
- UNSPEC, EDIT, NOWRITE, READ, RESTORE, WRITE, WRITEABLE, WRITEBOOT
+ UNSPEC, EDIT, READ, RESTORE, WRITE, WRITEBOOT
} op = UNSPEC;
int rflag;
int disable_write; /* set to disable writing to disk label */
-#define OPTIONS "BNRWb:enrs:w"
+#define OPTIONS "BRb:enrs:w"
int
main(int argc, char *argv[])
{
struct disklabel *lp;
FILE *t;
- int ch, f = 0, flag, error = 0;
+ int ch, f = 0, error = 0;
char *name = 0;
while ((ch = getopt(argc, argv, OPTIONS)) != -1)
@@ -194,11 +194,6 @@ main(int argc, char *argv[])
break;
#endif
#endif
- case 'N':
- if (op != UNSPEC)
- usage();
- op = NOWRITE;
- break;
case 'n':
disable_write = 1;
break;
@@ -207,11 +202,6 @@ main(int argc, char *argv[])
usage();
op = RESTORE;
break;
- case 'W':
- if (op != UNSPEC)
- usage();
- op = WRITEABLE;
- break;
case 'e':
if (op != UNSPEC)
usage();
@@ -276,12 +266,6 @@ main(int argc, char *argv[])
error = edit(lp, f);
break;
- case NOWRITE:
- flag = 0;
- if (ioctl(f, DIOCWLABEL, (char *)&flag) < 0)
- err(4, "ioctl DIOCWLABEL");
- break;
-
case READ:
if (argc != 1)
usage();
@@ -330,12 +314,6 @@ main(int argc, char *argv[])
error = writelabel(f, bootarea, lp);
break;
- case WRITEABLE:
- flag = 1;
- if (ioctl(f, DIOCWLABEL, (char *)&flag) < 0)
- err(4, "ioctl DIOCWLABEL");
- break;
-
#if NUMBOOT > 0
case WRITEBOOT:
{
OpenPOWER on IntegriCloud