2 * XXX replace all the checks on object validity with
3 * calls to valid<object>
6 * Copyright (c) 1997, 1998, 1999
7 * Nan Yang Computer Services Limited. All rights reserved.
9 * Parts copyright (c) 1997, 1998 Cybernet Corporation, NetMAX project.
11 * Written by Greg Lehey
13 * This software is distributed under the so-called ``Berkeley
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
19 * 1. Redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution.
24 * 3. All advertising materials mentioning features or use of this software
25 * must display the following acknowledgement:
26 * This product includes software developed by Nan Yang Computer
28 * 4. Neither the name of the Company nor the names of its contributors
29 * may be used to endorse or promote products derived from this software
30 * without specific prior written permission.
32 * This software is provided ``as is'', and any express or implied
33 * warranties, including, but not limited to, the implied warranties of
34 * merchantability and fitness for a particular purpose are disclaimed.
35 * In no event shall the company or contributors be liable for any
36 * direct, indirect, incidental, special, exemplary, or consequential
37 * damages (including, but not limited to, procurement of substitute
38 * goods or services; loss of use, data, or profits; or business
39 * interruption) however caused and on any theory of liability, whether
40 * in contract, strict liability, or tort (including negligence or
41 * otherwise) arising in any way out of the use of this software, even if
42 * advised of the possibility of such damage.
44 * $Id: vinumioctl.c,v 1.14 2000/10/27 03:07:53 grog Exp grog $
45 * $FreeBSD: src/sys/dev/vinum/vinumioctl.c,v 1.25.2.4 2002/02/03 00:44:19 grog Exp $
46 * $DragonFly: src/sys/dev/raid/vinum/vinumioctl.c,v 1.10 2007/06/16 20:48:34 swildner Exp $
53 #include <sys/reboot.h>
56 void attachobject(struct vinum_ioctl_msg
*);
57 void detachobject(struct vinum_ioctl_msg
*);
58 void renameobject(struct vinum_rename_msg
*);
59 void replaceobject(struct vinum_ioctl_msg
*);
60 void moveobject(struct vinum_ioctl_msg
*);
62 jmp_buf command_fail
; /* return on a failed command */
66 vinumioctl(struct dev_ioctl_args
*ap
)
68 cdev_t dev
= ap
->a_head
.a_dev
;
69 u_long cmd
= ap
->a_cmd
;
70 caddr_t data
= ap
->a_data
;
72 unsigned int index
; /* for transferring config info */
73 unsigned int sdno
; /* for transferring config info */
74 int fe
; /* free list element number */
75 struct _ioctl_reply
*ioctl_reply
= (struct _ioctl_reply
*) data
; /* struct to return */
77 /* First, decide what we're looking at */
78 switch (DEVTYPE(dev
)) {
79 case VINUM_SUPERDEV_TYPE
: /* ordinary super device */
80 ioctl_reply
= (struct _ioctl_reply
*) data
; /* save the address to reply to */
84 if (((struct debuginfo
*) data
)->changeit
) /* change debug settings */
85 debug
= (((struct debuginfo
*) data
)->param
);
87 if (debug
& DEBUG_REMOTEGDB
)
88 boothowto
|= RB_GDB
; /* serial debug line */
90 boothowto
&= ~RB_GDB
; /* local ddb */
91 Debugger("vinum debug");
93 ioctl_reply
= (struct _ioctl_reply
*) data
; /* reinstate the address to reply to */
94 ioctl_reply
->error
= 0;
98 case VINUM_CREATE
: /* create a vinum object */
99 error
= lock_config(); /* get the config for us alone */
100 if (error
) /* can't do it, */
101 return error
; /* give up */
102 error
= setjmp(command_fail
); /* come back here on error */
103 if (error
== 0) /* first time, */
104 ioctl_reply
->error
= parse_user_config((char *) data
, /* update the config */
106 else if (ioctl_reply
->error
== 0) { /* longjmp, but no error status */
107 ioctl_reply
->error
= EINVAL
; /* note that something's up */
108 ioctl_reply
->msg
[0] = '\0'; /* no message? */
111 return 0; /* must be 0 to return the real error info */
113 case VINUM_GETCONFIG
: /* get the configuration information */
114 bcopy(&vinum_conf
, data
, sizeof(vinum_conf
));
117 /* start configuring the subsystem */
118 case VINUM_STARTCONFIG
:
119 return start_config(*(int *) data
); /* just lock it. Parameter is 'force' */
122 * Move the individual parts of the config to user space.
124 * Specify the index of the object in the first word of data,
125 * and return the object there
127 case VINUM_DRIVECONFIG
:
128 index
= *(int *) data
; /* get the index */
129 if (index
>= (unsigned) vinum_conf
.drives_allocated
) /* can't do it */
130 return ENXIO
; /* bang */
131 bcopy(&DRIVE
[index
], data
, sizeof(struct drive
)); /* copy the config item out */
135 index
= *(int *) data
; /* get the index */
136 if (index
>= (unsigned) vinum_conf
.subdisks_allocated
) /* can't do it */
137 return ENXIO
; /* bang */
138 bcopy(&SD
[index
], data
, sizeof(struct sd
)); /* copy the config item out */
141 case VINUM_PLEXCONFIG
:
142 index
= *(int *) data
; /* get the index */
143 if (index
>= (unsigned) vinum_conf
.plexes_allocated
) /* can't do it */
144 return ENXIO
; /* bang */
145 bcopy(&PLEX
[index
], data
, sizeof(struct plex
)); /* copy the config item out */
148 case VINUM_VOLCONFIG
:
149 index
= *(int *) data
; /* get the index */
150 if (index
>= (unsigned) vinum_conf
.volumes_allocated
) /* can't do it */
151 return ENXIO
; /* bang */
152 bcopy(&VOL
[index
], data
, sizeof(struct volume
)); /* copy the config item out */
155 case VINUM_PLEXSDCONFIG
:
156 index
= *(int *) data
; /* get the plex index */
157 sdno
= ((int *) data
)[1]; /* and the sd index */
158 if ((index
>= (unsigned) vinum_conf
.plexes_allocated
) /* plex doesn't exist */
159 ||(sdno
>= PLEX
[index
].subdisks
)) /* or it doesn't have this many subdisks */
160 return ENXIO
; /* bang */
161 bcopy(&SD
[PLEX
[index
].sdnos
[sdno
]], /* copy the config item out */
167 * We get called in two places: one from the
168 * userland config routines, which call us
169 * to complete the config and save it. This
170 * call supplies the value 0 as a parameter.
172 * The other place is from the user "saveconfig"
173 * routine, which can only work if we're *not*
174 * configuring. In this case, supply parameter 1.
176 case VINUM_SAVECONFIG
:
177 if (VFLAGS
& VF_CONFIGURING
) { /* must be us, the others are asleep */
178 if (*(int *) data
== 0) /* finish config */
179 finish_config(1); /* finish the configuration and update it */
181 return EBUSY
; /* can't do it now */
183 save_config(); /* save configuration to disk */
186 case VINUM_RELEASECONFIG
: /* release the config */
187 if (VFLAGS
& VF_CONFIGURING
) { /* must be us, the others are asleep */
188 finish_config(0); /* finish the configuration, don't change it */
189 save_config(); /* save configuration to disk */
191 error
= EINVAL
; /* release what config? */
195 ioctl_reply
= (struct _ioctl_reply
*) data
; /* reinstate the address to reply to */
196 ioctl_reply
->error
= 0;
199 case VINUM_RESETCONFIG
:
200 if (vinum_inactive(0)) { /* if the volumes are not active */
202 * Note the open count. We may be called from v, so we'll be open.
203 * Keep the count so we don't underflow
205 free_vinum(1); /* clean up everything */
206 log(LOG_NOTICE
, "vinum: CONFIGURATION OBLITERATED\n");
207 ioctl_reply
= (struct _ioctl_reply
*) data
; /* reinstate the address to reply to */
208 ioctl_reply
->error
= 0;
214 setstate((struct vinum_ioctl_msg
*) data
); /* set an object state */
218 * Set state by force, without changing
221 case VINUM_SETSTATE_FORCE
:
222 setstate_by_force((struct vinum_ioctl_msg
*) data
); /* set an object state */
230 case VINUM_MALLOCINFO
:
231 return vinum_mallocinfo(data
);
234 return vinum_rqinfo(data
);
238 remove((struct vinum_ioctl_msg
*) data
); /* remove an object */
241 case VINUM_GETFREELIST
: /* get a drive free list element */
242 index
= *(int *) data
; /* get the drive index */
243 fe
= ((int *) data
)[1]; /* and the free list element */
244 if ((index
>= (unsigned) vinum_conf
.drives_allocated
) /* plex doesn't exist */
245 ||(DRIVE
[index
].state
== drive_unallocated
))
247 if (fe
>= DRIVE
[index
].freelist_entries
) /* no such entry */
249 bcopy(&DRIVE
[index
].freelist
[fe
],
251 sizeof(struct drive_freelist
));
254 case VINUM_RESETSTATS
:
255 resetstats((struct vinum_ioctl_msg
*) data
); /* reset object stats */
258 /* attach an object to a superordinate object */
260 attachobject((struct vinum_ioctl_msg
*) data
);
263 /* detach an object from a superordinate object */
265 detachobject((struct vinum_ioctl_msg
*) data
);
268 /* rename an object */
270 renameobject((struct vinum_rename_msg
*) data
);
273 /* replace an object */
275 replaceobject((struct vinum_ioctl_msg
*) data
);
279 vinum_daemon(); /* perform the daemon */
282 case VINUM_FINDDAEMON
: /* check for presence of daemon */
283 return vinum_finddaemon();
286 case VINUM_SETDAEMON
: /* set daemon flags */
287 return vinum_setdaemonopts(*(int *) data
);
289 case VINUM_GETDAEMON
: /* get daemon flags */
290 *(int *) data
= daemon_options
;
293 case VINUM_PARITYOP
: /* check/rebuild RAID-4/5 parity */
294 parityops((struct vinum_ioctl_msg
*) data
);
299 moveobject((struct vinum_ioctl_msg
*) data
);
307 case VINUM_DRIVE_TYPE
:
309 case VINUM_RAWSD_TYPE
:
310 case VINUM_RAWPLEX_TYPE
:
311 case VINUM_PLEX_TYPE
:
312 case VINUM_VOLUME_TYPE
:
315 "vinumioctl: invalid ioctl from process %d (%s): %lx\n",
325 * The following four functions check the supplied
326 * object index and return a pointer to the object
327 * if it exists. Otherwise they longjump out via
331 validdrive(int driveno
, struct _ioctl_reply
*reply
)
333 if ((driveno
< vinum_conf
.drives_allocated
)
334 && (DRIVE
[driveno
].state
> drive_referenced
))
335 return &DRIVE
[driveno
];
336 strcpy(reply
->msg
, "No such drive");
337 reply
->error
= ENOENT
;
342 validsd(int sdno
, struct _ioctl_reply
*reply
)
344 if ((sdno
< vinum_conf
.subdisks_allocated
)
345 && (SD
[sdno
].state
> sd_referenced
))
347 strcpy(reply
->msg
, "No such subdisk");
348 reply
->error
= ENOENT
;
353 validplex(int plexno
, struct _ioctl_reply
*reply
)
355 if ((plexno
< vinum_conf
.plexes_allocated
)
356 && (PLEX
[plexno
].state
> plex_referenced
))
357 return &PLEX
[plexno
];
358 strcpy(reply
->msg
, "No such plex");
359 reply
->error
= ENOENT
;
364 validvol(int volno
, struct _ioctl_reply
*reply
)
366 if ((volno
< vinum_conf
.volumes_allocated
)
367 && (VOL
[volno
].state
> volume_uninit
))
369 strcpy(reply
->msg
, "No such volume");
370 reply
->error
= ENOENT
;
374 /* reset an object's stats */
376 resetstats(struct vinum_ioctl_msg
*msg
)
378 struct _ioctl_reply
*reply
= (struct _ioctl_reply
*) msg
;
382 if (msg
->index
< vinum_conf
.drives_allocated
) {
383 struct drive
*drive
= &DRIVE
[msg
->index
];
384 if (drive
->state
> drive_referenced
) {
385 drive
->reads
= 0; /* number of reads on this drive */
386 drive
->writes
= 0; /* number of writes on this drive */
387 drive
->bytes_read
= 0; /* number of bytes read */
388 drive
->bytes_written
= 0; /* number of bytes written */
392 reply
->error
= EINVAL
;
396 if (msg
->index
< vinum_conf
.subdisks_allocated
) {
397 struct sd
*sd
= &SD
[msg
->index
];
398 if (sd
->state
> sd_referenced
) {
399 sd
->reads
= 0; /* number of reads on this subdisk */
400 sd
->writes
= 0; /* number of writes on this subdisk */
401 sd
->bytes_read
= 0; /* number of bytes read */
402 sd
->bytes_written
= 0; /* number of bytes written */
406 reply
->error
= EINVAL
;
412 if (msg
->index
< vinum_conf
.plexes_allocated
) {
413 struct plex
*plex
= &PLEX
[msg
->index
];
414 if (plex
->state
> plex_referenced
) {
416 plex
->writes
= 0; /* number of writes on this plex */
417 plex
->bytes_read
= 0; /* number of bytes read */
418 plex
->bytes_written
= 0; /* number of bytes written */
419 plex
->recovered_reads
= 0; /* number of recovered read operations */
420 plex
->degraded_writes
= 0; /* number of degraded writes */
421 plex
->parityless_writes
= 0; /* number of parityless writes */
422 plex
->multiblock
= 0; /* requests that needed more than one block */
423 plex
->multistripe
= 0; /* requests that needed more than one stripe */
427 reply
->error
= EINVAL
;
433 if (msg
->index
< vinum_conf
.volumes_allocated
) {
434 struct volume
*vol
= &VOL
[msg
->index
];
435 if (vol
->state
> volume_uninit
) {
436 vol
->bytes_read
= 0; /* number of bytes read */
437 vol
->bytes_written
= 0; /* number of bytes written */
438 vol
->reads
= 0; /* number of reads on this volume */
439 vol
->writes
= 0; /* number of writes on this volume */
440 vol
->recovered_reads
= 0; /* reads recovered from another plex */
444 reply
->error
= EINVAL
;
447 case invalid_object
: /* can't get this */
448 reply
->error
= EINVAL
;
453 /* attach an object to a superior object */
455 attachobject(struct vinum_ioctl_msg
*msg
)
457 struct _ioctl_reply
*reply
= (struct _ioctl_reply
*) msg
;
464 case drive_object
: /* you can't attach a drive to anything */
465 case volume_object
: /* nor a volume */
466 case invalid_object
: /* "this can't happen" */
467 reply
->error
= EINVAL
;
468 reply
->msg
[0] = '\0'; /* vinum(8) doesn't do this */
472 sd
= validsd(msg
->index
, reply
);
473 if (sd
== NULL
) /* not a valid subdisk */
475 plex
= validplex(msg
->otherobject
, reply
);
478 * We should be more intelligent about this.
479 * We should be able to reattach a dead
480 * subdisk, but if we want to increase the total
481 * number of subdisks, we have a lot of reshuffling
484 if ((plex
->organization
!= plex_concat
) /* can't attach to striped and RAID-4/5 */
485 &&(!msg
->force
)) { /* without using force */
486 reply
->error
= EINVAL
; /* no message, the user should check */
487 strcpy(reply
->msg
, "Can't attach to this plex organization");
490 if (sd
->plexno
>= 0) { /* already belong to a plex */
491 reply
->error
= EBUSY
; /* no message, the user should check */
492 reply
->msg
[0] = '\0';
495 sd
->plexoffset
= msg
->offset
; /* this is where we want it */
496 set_sd_state(sd
->sdno
, sd_stale
, setstate_force
); /* make sure it's stale */
497 give_sd_to_plex(plex
->plexno
, sd
->sdno
); /* and give it to the plex */
498 update_sd_config(sd
->sdno
, 0);
501 if (sd
->state
== sd_reviving
)
502 reply
->error
= EAGAIN
; /* need to revive it */
508 plex
= validplex(msg
->index
, reply
); /* get plex */
511 vol
= validvol(msg
->otherobject
, reply
); /* and volume information */
513 if ((vol
->plexes
== MAXPLEX
) /* we have too many already */
514 ||(plex
->volno
>= 0)) { /* or the plex has an owner */
515 reply
->error
= EINVAL
; /* no message, the user should check */
516 reply
->msg
[0] = '\0';
519 for (sdno
= 0; sdno
< plex
->subdisks
; sdno
++) {
520 sd
= &SD
[plex
->sdnos
[sdno
]];
522 if (sd
->state
> sd_down
) /* real subdisk, vaguely accessible */
523 set_sd_state(plex
->sdnos
[sdno
], sd_stale
, setstate_force
); /* make it stale */
525 set_plex_state(plex
->plexno
, plex_up
, setstate_none
); /* update plex state */
526 give_plex_to_volume(msg
->otherobject
, msg
->index
); /* and give it to the volume */
527 update_plex_config(plex
->plexno
, 0);
533 /* detach an object from a superior object */
535 detachobject(struct vinum_ioctl_msg
*msg
)
537 struct _ioctl_reply
*reply
= (struct _ioctl_reply
*) msg
;
545 case drive_object
: /* you can't detach a drive from anything */
546 case volume_object
: /* nor a volume */
547 case invalid_object
: /* "this can't happen" */
548 reply
->error
= EINVAL
;
549 reply
->msg
[0] = '\0'; /* vinum(8) doesn't do this */
553 sd
= validsd(msg
->index
, reply
);
556 if (sd
->plexno
< 0) { /* doesn't belong to a plex */
557 reply
->error
= ENOENT
;
558 strcpy(reply
->msg
, "Subdisk is not attached");
560 } else { /* valid plex number */
561 plex
= &PLEX
[sd
->plexno
];
562 if ((!msg
->force
) /* don't force things */
563 &&((plex
->state
== plex_up
) /* and the plex is up */
564 ||((plex
->state
== plex_flaky
) && sd
->state
== sd_up
))) { /* or flaky with this sd up */
565 reply
->error
= EBUSY
; /* we need this sd */
566 reply
->msg
[0] = '\0';
569 sd
->plexno
= -1; /* anonymous sd */
570 if (plex
->subdisks
== 1) { /* this was the only subdisk */
571 Free(plex
->sdnos
); /* free the subdisk array */
572 plex
->sdnos
= NULL
; /* and note the fact */
573 plex
->subdisks_allocated
= 0; /* no subdisk space */
575 for (sdno
= 0; sdno
< plex
->subdisks
; sdno
++) {
576 if (plex
->sdnos
[sdno
] == msg
->index
) /* found our subdisk */
579 if (sdno
< (plex
->subdisks
- 1)) /* not the last one, compact */
580 bcopy(&plex
->sdnos
[sdno
+ 1],
582 (plex
->subdisks
- 1 - sdno
) * sizeof(int));
585 if (!bcmp(plex
->name
, sd
->name
, strlen(plex
->name
) + 1))
586 /* this subdisk is named after the plex */
590 min(strlen(sd
->name
) + 1, MAXSDNAME
- 3));
591 bcopy("ex-", sd
->name
, 3);
592 sd
->name
[MAXSDNAME
- 1] = '\0';
594 update_plex_config(plex
->plexno
, 0);
595 if (isstriped(plex
)) /* we've just mutilated our plex, */
596 set_plex_state(plex
->plexno
,
598 setstate_force
| setstate_configuring
);
605 plex
= validplex(msg
->index
, reply
); /* get plex */
608 if (plex
->volno
>= 0) {
609 int volno
= plex
->volno
;
612 if ((!msg
->force
) /* don't force things */
613 &&((vol
->state
== volume_up
) /* and the volume is up */
614 &&(vol
->plexes
== 1))) { /* and this is the last plex */
616 * XXX As elsewhere, check whether we will lose
617 * mapping by removing this plex
619 reply
->error
= EBUSY
; /* we need this plex */
620 reply
->msg
[0] = '\0';
623 plex
->volno
= -1; /* anonymous plex */
624 for (plexno
= 0; plexno
< vol
->plexes
; plexno
++) {
625 if (vol
->plex
[plexno
] == msg
->index
) /* found our plex */
628 if (plexno
< (vol
->plexes
- 1)) /* not the last one, compact */
629 bcopy(&vol
->plex
[plexno
+ 1],
631 (vol
->plexes
- 1 - plexno
) * sizeof(int));
633 vol
->last_plex_read
= 0; /* don't go beyond the end */
634 if (!bcmp(vol
->name
, plex
->name
, strlen(vol
->name
) + 1))
635 /* this plex is named after the volume */
637 /* First, check if the subdisks are the same */
641 for (sdno
= 0; sdno
< plex
->subdisks
; sdno
++) {
642 struct sd
*sd
= &SD
[plex
->sdnos
[sdno
]];
644 if (!bcmp(plex
->name
, sd
->name
, strlen(plex
->name
) + 1))
645 /* subdisk is named after the plex */
649 min(strlen(sd
->name
) + 1, MAXSDNAME
- 3));
650 bcopy("ex-", sd
->name
, 3);
651 sd
->name
[MAXSDNAME
- 1] = '\0';
657 min(strlen(plex
->name
) + 1, MAXPLEXNAME
- 3));
658 bcopy("ex-", plex
->name
, 3);
659 plex
->name
[MAXPLEXNAME
- 1] = '\0';
661 update_volume_config(volno
, 0);
665 reply
->error
= ENOENT
;
666 strcpy(reply
->msg
, "Plex is not attached");
672 renameobject(struct vinum_rename_msg
*msg
)
674 struct _ioctl_reply
*reply
= (struct _ioctl_reply
*) msg
;
681 case drive_object
: /* you can't attach a drive to anything */
682 if (find_drive(msg
->newname
, 0) >= 0) { /* we have that name already, */
683 reply
->error
= EEXIST
;
684 reply
->msg
[0] = '\0';
687 drive
= validdrive(msg
->index
, reply
);
689 bcopy(msg
->newname
, drive
->label
.name
, MAXDRIVENAME
);
695 case sd_object
: /* you can't attach a subdisk to anything */
696 if (find_subdisk(msg
->newname
, 0) >= 0) { /* we have that name already, */
697 reply
->error
= EEXIST
;
698 reply
->msg
[0] = '\0';
701 sd
= validsd(msg
->index
, reply
);
703 bcopy(msg
->newname
, sd
->name
, MAXSDNAME
);
704 update_sd_config(sd
->sdno
, 0);
710 case plex_object
: /* you can't attach a plex to anything */
711 if (find_plex(msg
->newname
, 0) >= 0) { /* we have that name already, */
712 reply
->error
= EEXIST
;
713 reply
->msg
[0] = '\0';
716 plex
= validplex(msg
->index
, reply
);
718 bcopy(msg
->newname
, plex
->name
, MAXPLEXNAME
);
719 update_plex_config(plex
->plexno
, 0);
725 case volume_object
: /* you can't attach a volume to anything */
726 if (find_volume(msg
->newname
, 0) >= 0) { /* we have that name already, */
727 reply
->error
= EEXIST
;
728 reply
->msg
[0] = '\0';
731 vol
= validvol(msg
->index
, reply
);
733 bcopy(msg
->newname
, vol
->name
, MAXVOLNAME
);
734 update_volume_config(msg
->index
, 0);
741 reply
->error
= EINVAL
;
742 reply
->msg
[0] = '\0';
747 * Replace one object with another.
748 * Currently only for drives.
749 * message->index is the drive number of the old drive
750 * message->otherobject is the drive number of the new drive
753 replaceobject(struct vinum_ioctl_msg
*msg
)
755 struct _ioctl_reply
*reply
= (struct _ioctl_reply
*) msg
;
757 reply
->error
= ENODEV
; /* until I know how to do this */
758 strcpy(reply
->msg
, "replace not implemented yet");
759 /* save_config (); */
763 moveobject(struct vinum_ioctl_msg
*msg
)
765 struct _ioctl_reply
*reply
= (struct _ioctl_reply
*) msg
;
769 /* Check that our objects are valid (i.e. they exist) */
770 drive
= validdrive(msg
->index
, (struct _ioctl_reply
*) msg
);
773 sd
= validsd(msg
->otherobject
, (struct _ioctl_reply
*) msg
);
776 if (sd
->driveno
== msg
->index
) /* sd already belongs to drive */
779 if (sd
->state
> sd_stale
)
780 set_sd_state(sd
->sdno
, sd_stale
, setstate_force
); /* make the subdisk stale */
782 sd
->state
= sd_empty
;
783 if (sd
->plexno
>= 0) /* part of a plex, */
784 update_plex_state(sd
->plexno
); /* update its state */
786 /* Return the space on the old drive */
787 if ((sd
->driveno
>= 0) /* we have a drive, */
788 &&(sd
->sectors
> 0)) /* and some space on it */
789 return_drive_space(sd
->driveno
, /* return the space */
793 /* Reassign the old subdisk */
794 sd
->driveno
= msg
->index
;
795 sd
->driveoffset
= -1; /* let the drive decide where to put us */
796 give_sd_to_drive(sd
->sdno
);
800 /* Local Variables: */
801 /* fill-column: 50 */