NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/38735: cgd on dk
>Number: 38735
>Category: kern
>Synopsis: cgd can't be backed by dk (patch)
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat May 24 15:40:01 +0000 2008
>Originator: Jonathan A. Kollasch
>Release: NetBSD 4.99.58
>Organization:
>Environment:
System: NetBSD wormulon.kollasch.net 4.99.58 NetBSD 4.99.58 (WORMULON) #14: Thu
May 22 14:22:56 UTC 2008
root%wormulon.kollasch.net@localhost:/usr/src/sys/arch/amd64/compile/WORMULON
amd64
Architecture: x86_64
Machine: amd64
>Description:
cgd can't be configured on a disk wedge.
>How-To-Repeat:
try to cgdconfig on a dk(4)
>Fix:
Index: cgd.c
===================================================================
RCS file: /cvsroot/src/sys/dev/cgd.c,v
retrieving revision 1.51
diff -u -r1.51 cgd.c
--- cgd.c 21 Mar 2008 21:54:59 -0000 1.51
+++ cgd.c 24 May 2008 15:29:56 -0000
@@ -611,15 +611,18 @@
{
struct dk_geom *pdg;
struct partinfo dpart;
+ struct dkwedge_info dkw;
struct vattr va;
size_t size;
- int maxsecsize = 0;
+// int maxsecsize = 0;
int ret;
char *tmppath;
cs->sc_dksc.sc_size = 0;
cs->sc_tvn = vp;
cs->sc_tpath = NULL;
+
+ size = 0;
tmppath = malloc(MAXPATHLEN, M_TEMP, M_WAITOK);
ret = copyinstr(cpath, tmppath, MAXPATHLEN, &cs->sc_tpathlen);
@@ -634,13 +637,19 @@
cs->sc_tdev = va.va_rdev;
ret = VOP_IOCTL(vp, DIOCGPART, &dpart, FREAD, l->l_cred);
- if (ret)
- goto bail;
+ if (ret == 0)
+ size = dpart.part->p_size;
+ ret = VOP_IOCTL(vp, DIOCGWEDGEINFO, &dkw, FREAD, l->l_cred);
+ if (ret == 0)
+ size = dkw.dkw_size;
+
+#if 0
maxsecsize =
((dpart.disklab->d_secsize > maxsecsize) ?
dpart.disklab->d_secsize : maxsecsize);
size = dpart.part->p_size;
+#endif
if (!size) {
ret = ENODEV;
some notes on the patch:
'int maxsecsize' seemed to be a dead variable.
Home |
Main Index |
Thread Index |
Old Index