1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-17 15:27:36 +00:00

Overload the correct errno for attempts to set an in-core label with

a raw partition at a nonzero offset (EINVAL should have been EXDEV;
DIOCSDINFO was broken, and DIOCWDINFO was broken because it depended
on DIOCSDINFO).

A zero offset for the raw partition should probably be enforced in
setdisklabel(), and DIOCWDINFO should probably always be handled by
first calling setdisklabel() so that writedisklabel() doesn't need to
enforce it, but this has never been done; dsioctl() has a special
check.  Changes in this commit are limited to dsioctl() to preserve
bug for bug compatibility in drivers that don't use the slice code
(notably the ccd driver, which allows setting a bogus label in
DIOCWDINFO and doesn't undo the setting when writedisklabel() fails).
This commit is contained in:
Bruce Evans 1998-10-17 09:46:42 +00:00
parent 3044a22097
commit 95242f5a02
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=40473

View File

@ -43,7 +43,7 @@
* from: wd.c,v 1.55 1994/10/22 01:57:12 phk Exp $
* from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
* from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $
* $Id: subr_diskslice.c,v 1.57 1998/08/13 08:09:07 dfr Exp $
* $Id: subr_diskslice.c,v 1.58 1998/08/23 20:16:34 phk Exp $
*/
#include "opt_devfs.h"
@ -464,7 +464,7 @@ dsioctl(dname, dev, cmd, data, flags, sspp, strat, setgeom)
(u_long)openmask);
/* XXX why doesn't setdisklabel() check this? */
if (error == 0 && lp->d_partitions[RAW_PART].p_offset != 0)
error = EINVAL;
error = EXDEV;
if (error == 0) {
if (lp->d_secperunit > sp->ds_size)
error = ENOSPC;