Put use of DIOCWLABEL under #ifdef NO_GEOM
This commit is contained in:
parent
5a5469f26a
commit
e70e846243
sys/dev/vinum
@ -564,7 +564,9 @@ daemon_save_config(void)
|
|||||||
struct drive *drive; /* point to current drive info */
|
struct drive *drive; /* point to current drive info */
|
||||||
struct vinum_hdr *vhdr; /* and as header */
|
struct vinum_hdr *vhdr; /* and as header */
|
||||||
char *config; /* point to config data */
|
char *config; /* point to config data */
|
||||||
|
#ifdef NO_GEOM
|
||||||
int wlabel_on; /* to set writing label on/off */
|
int wlabel_on; /* to set writing label on/off */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* don't save the configuration while we're still working on it */
|
/* don't save the configuration while we're still working on it */
|
||||||
if (vinum_conf.flags & VF_CONFIGURING)
|
if (vinum_conf.flags & VF_CONFIGURING)
|
||||||
@ -614,23 +616,27 @@ daemon_save_config(void)
|
|||||||
sizeof(vhdr->label));
|
sizeof(vhdr->label));
|
||||||
if ((drive->state != drive_unallocated)
|
if ((drive->state != drive_unallocated)
|
||||||
&& (drive->state != drive_referenced)) { /* and it's a real drive */
|
&& (drive->state != drive_referenced)) { /* and it's a real drive */
|
||||||
|
#ifdef NO_GEOM
|
||||||
wlabel_on = 1; /* enable writing the label */
|
wlabel_on = 1; /* enable writing the label */
|
||||||
(void) (*devsw(drive->dev)->d_ioctl) (drive->dev, /* make the label writeable */
|
(void) (*devsw(drive->dev)->d_ioctl) (drive->dev, /* make the label writeable */
|
||||||
DIOCWLABEL,
|
DIOCWLABEL,
|
||||||
(caddr_t) & wlabel_on,
|
(caddr_t) & wlabel_on,
|
||||||
FWRITE,
|
FWRITE,
|
||||||
curthread);
|
curthread);
|
||||||
|
#endif
|
||||||
error = write_drive(drive, (char *) vhdr, VINUMHEADERLEN, VINUM_LABEL_OFFSET);
|
error = write_drive(drive, (char *) vhdr, VINUMHEADERLEN, VINUM_LABEL_OFFSET);
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
error = write_drive(drive, config, MAXCONFIG, VINUM_CONFIG_OFFSET); /* first config copy */
|
error = write_drive(drive, config, MAXCONFIG, VINUM_CONFIG_OFFSET); /* first config copy */
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
error = write_drive(drive, config, MAXCONFIG, VINUM_CONFIG_OFFSET + MAXCONFIG); /* second copy */
|
error = write_drive(drive, config, MAXCONFIG, VINUM_CONFIG_OFFSET + MAXCONFIG); /* second copy */
|
||||||
|
#ifdef NO_GEOM
|
||||||
wlabel_on = 0; /* enable writing the label */
|
wlabel_on = 0; /* enable writing the label */
|
||||||
(void) (*devsw(drive->dev)->d_ioctl) (drive->dev, /* make the label non-writeable again */
|
(void) (*devsw(drive->dev)->d_ioctl) (drive->dev, /* make the label non-writeable again */
|
||||||
DIOCWLABEL,
|
DIOCWLABEL,
|
||||||
(caddr_t) & wlabel_on,
|
(caddr_t) & wlabel_on,
|
||||||
FWRITE,
|
FWRITE,
|
||||||
curthread);
|
curthread);
|
||||||
|
#endif
|
||||||
unlockdrive(drive);
|
unlockdrive(drive);
|
||||||
if (error) {
|
if (error) {
|
||||||
log(LOG_ERR,
|
log(LOG_ERR,
|
||||||
|
@ -402,6 +402,7 @@ vinumioctl(dev_t dev,
|
|||||||
case DIOCSDINFO: /* set partition info */
|
case DIOCSDINFO: /* set partition info */
|
||||||
return 0; /* not a titty */
|
return 0; /* not a titty */
|
||||||
|
|
||||||
|
#ifdef NO_GEOM
|
||||||
case DIOCWLABEL: /* set or reset label writeable */
|
case DIOCWLABEL: /* set or reset label writeable */
|
||||||
if ((flag & FWRITE) == 0) /* not writeable? */
|
if ((flag & FWRITE) == 0) /* not writeable? */
|
||||||
return EACCES; /* no, die */
|
return EACCES; /* no, die */
|
||||||
@ -410,7 +411,7 @@ vinumioctl(dev_t dev,
|
|||||||
else
|
else
|
||||||
vol->flags &= ~VF_WLABEL; /* no, reset */
|
vol->flags &= ~VF_WLABEL; /* no, reset */
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return ENOTTY; /* not my kind of ioctl */
|
return ENOTTY; /* not my kind of ioctl */
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user