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
This commit is contained in:
parent
c297498757
commit
f080d33b66
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=109872
@ -61,9 +61,6 @@
|
|||||||
.Op Fl r
|
.Op Fl r
|
||||||
.Op Fl n
|
.Op Fl n
|
||||||
.Ar disk Ar protofile
|
.Ar disk Ar protofile
|
||||||
.Nm
|
|
||||||
.Op Fl NW
|
|
||||||
.Ar disk
|
|
||||||
.Pp
|
.Pp
|
||||||
.Nm
|
.Nm
|
||||||
.Fl B
|
.Fl B
|
||||||
@ -311,27 +308,6 @@ If
|
|||||||
is used, no data will be written to the device, and instead the
|
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
|
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.
|
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
|
.Ss Installing bootstraps
|
||||||
.Pp
|
.Pp
|
||||||
The final three forms of
|
The final three forms of
|
||||||
|
@ -163,20 +163,20 @@ char boot1[MAXPATHLEN];
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
UNSPEC, EDIT, NOWRITE, READ, RESTORE, WRITE, WRITEABLE, WRITEBOOT
|
UNSPEC, EDIT, READ, RESTORE, WRITE, WRITEBOOT
|
||||||
} op = UNSPEC;
|
} op = UNSPEC;
|
||||||
|
|
||||||
int rflag;
|
int rflag;
|
||||||
int disable_write; /* set to disable writing to disk label */
|
int disable_write; /* set to disable writing to disk label */
|
||||||
|
|
||||||
#define OPTIONS "BNRWb:enrs:w"
|
#define OPTIONS "BRb:enrs:w"
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct disklabel *lp;
|
struct disklabel *lp;
|
||||||
FILE *t;
|
FILE *t;
|
||||||
int ch, f = 0, flag, error = 0;
|
int ch, f = 0, error = 0;
|
||||||
char *name = 0;
|
char *name = 0;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, OPTIONS)) != -1)
|
while ((ch = getopt(argc, argv, OPTIONS)) != -1)
|
||||||
@ -194,11 +194,6 @@ main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
case 'N':
|
|
||||||
if (op != UNSPEC)
|
|
||||||
usage();
|
|
||||||
op = NOWRITE;
|
|
||||||
break;
|
|
||||||
case 'n':
|
case 'n':
|
||||||
disable_write = 1;
|
disable_write = 1;
|
||||||
break;
|
break;
|
||||||
@ -207,11 +202,6 @@ main(int argc, char *argv[])
|
|||||||
usage();
|
usage();
|
||||||
op = RESTORE;
|
op = RESTORE;
|
||||||
break;
|
break;
|
||||||
case 'W':
|
|
||||||
if (op != UNSPEC)
|
|
||||||
usage();
|
|
||||||
op = WRITEABLE;
|
|
||||||
break;
|
|
||||||
case 'e':
|
case 'e':
|
||||||
if (op != UNSPEC)
|
if (op != UNSPEC)
|
||||||
usage();
|
usage();
|
||||||
@ -276,12 +266,6 @@ main(int argc, char *argv[])
|
|||||||
error = edit(lp, f);
|
error = edit(lp, f);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NOWRITE:
|
|
||||||
flag = 0;
|
|
||||||
if (ioctl(f, DIOCWLABEL, (char *)&flag) < 0)
|
|
||||||
err(4, "ioctl DIOCWLABEL");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case READ:
|
case READ:
|
||||||
if (argc != 1)
|
if (argc != 1)
|
||||||
usage();
|
usage();
|
||||||
@ -330,12 +314,6 @@ main(int argc, char *argv[])
|
|||||||
error = writelabel(f, bootarea, lp);
|
error = writelabel(f, bootarea, lp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WRITEABLE:
|
|
||||||
flag = 1;
|
|
||||||
if (ioctl(f, DIOCWLABEL, (char *)&flag) < 0)
|
|
||||||
err(4, "ioctl DIOCWLABEL");
|
|
||||||
break;
|
|
||||||
|
|
||||||
#if NUMBOOT > 0
|
#if NUMBOOT > 0
|
||||||
case WRITEBOOT:
|
case WRITEBOOT:
|
||||||
{
|
{
|
||||||
|
@ -61,9 +61,6 @@
|
|||||||
.Op Fl r
|
.Op Fl r
|
||||||
.Op Fl n
|
.Op Fl n
|
||||||
.Ar disk Ar protofile
|
.Ar disk Ar protofile
|
||||||
.Nm
|
|
||||||
.Op Fl NW
|
|
||||||
.Ar disk
|
|
||||||
.Pp
|
.Pp
|
||||||
.Nm
|
.Nm
|
||||||
.Fl B
|
.Fl B
|
||||||
@ -311,27 +308,6 @@ If
|
|||||||
is used, no data will be written to the device, and instead the
|
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
|
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.
|
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
|
.Ss Installing bootstraps
|
||||||
.Pp
|
.Pp
|
||||||
The final three forms of
|
The final three forms of
|
||||||
|
@ -163,20 +163,20 @@ char boot1[MAXPATHLEN];
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
UNSPEC, EDIT, NOWRITE, READ, RESTORE, WRITE, WRITEABLE, WRITEBOOT
|
UNSPEC, EDIT, READ, RESTORE, WRITE, WRITEBOOT
|
||||||
} op = UNSPEC;
|
} op = UNSPEC;
|
||||||
|
|
||||||
int rflag;
|
int rflag;
|
||||||
int disable_write; /* set to disable writing to disk label */
|
int disable_write; /* set to disable writing to disk label */
|
||||||
|
|
||||||
#define OPTIONS "BNRWb:enrs:w"
|
#define OPTIONS "BRb:enrs:w"
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct disklabel *lp;
|
struct disklabel *lp;
|
||||||
FILE *t;
|
FILE *t;
|
||||||
int ch, f = 0, flag, error = 0;
|
int ch, f = 0, error = 0;
|
||||||
char *name = 0;
|
char *name = 0;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, OPTIONS)) != -1)
|
while ((ch = getopt(argc, argv, OPTIONS)) != -1)
|
||||||
@ -194,11 +194,6 @@ main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
case 'N':
|
|
||||||
if (op != UNSPEC)
|
|
||||||
usage();
|
|
||||||
op = NOWRITE;
|
|
||||||
break;
|
|
||||||
case 'n':
|
case 'n':
|
||||||
disable_write = 1;
|
disable_write = 1;
|
||||||
break;
|
break;
|
||||||
@ -207,11 +202,6 @@ main(int argc, char *argv[])
|
|||||||
usage();
|
usage();
|
||||||
op = RESTORE;
|
op = RESTORE;
|
||||||
break;
|
break;
|
||||||
case 'W':
|
|
||||||
if (op != UNSPEC)
|
|
||||||
usage();
|
|
||||||
op = WRITEABLE;
|
|
||||||
break;
|
|
||||||
case 'e':
|
case 'e':
|
||||||
if (op != UNSPEC)
|
if (op != UNSPEC)
|
||||||
usage();
|
usage();
|
||||||
@ -276,12 +266,6 @@ main(int argc, char *argv[])
|
|||||||
error = edit(lp, f);
|
error = edit(lp, f);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NOWRITE:
|
|
||||||
flag = 0;
|
|
||||||
if (ioctl(f, DIOCWLABEL, (char *)&flag) < 0)
|
|
||||||
err(4, "ioctl DIOCWLABEL");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case READ:
|
case READ:
|
||||||
if (argc != 1)
|
if (argc != 1)
|
||||||
usage();
|
usage();
|
||||||
@ -330,12 +314,6 @@ main(int argc, char *argv[])
|
|||||||
error = writelabel(f, bootarea, lp);
|
error = writelabel(f, bootarea, lp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WRITEABLE:
|
|
||||||
flag = 1;
|
|
||||||
if (ioctl(f, DIOCWLABEL, (char *)&flag) < 0)
|
|
||||||
err(4, "ioctl DIOCWLABEL");
|
|
||||||
break;
|
|
||||||
|
|
||||||
#if NUMBOOT > 0
|
#if NUMBOOT > 0
|
||||||
case WRITEBOOT:
|
case WRITEBOOT:
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user