diff options
author | phk <phk@FreeBSD.org> | 2002-04-02 11:17:37 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2002-04-02 11:17:37 +0000 |
commit | bcba0677fbe7b038d8de4ccfa6a097ac2e97582c (patch) | |
tree | 098106583c9bc505ce361757e5c975bde3124067 /sys/geom/geom_ccd.c | |
parent | c8c4cb7ccd4bea58b8a215cc2a4922b7b73f44e0 (diff) | |
download | FreeBSD-src-bcba0677fbe7b038d8de4ccfa6a097ac2e97582c.zip FreeBSD-src-bcba0677fbe7b038d8de4ccfa6a097ac2e97582c.tar.gz |
One less user of the bogus DIOCGPART ioctl.
Diffstat (limited to 'sys/geom/geom_ccd.c')
-rw-r--r-- | sys/geom/geom_ccd.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/sys/geom/geom_ccd.c b/sys/geom/geom_ccd.c index 36ee08d..05ebb97 100644 --- a/sys/geom/geom_ccd.c +++ b/sys/geom/geom_ccd.c @@ -391,10 +391,11 @@ ccdinit(struct ccd_s *cs, char **cpaths, struct thread *td) struct vnode *vp; size_t minsize; int maxsecsize; - struct partinfo dpart; struct ccdgeom *ccg = &cs->sc_geom; char *tmppath = NULL; int error = 0; + off_t mediasize; + u_int sectorsize; #ifdef DEBUG if (ccddebug & (CCDB_FOLLOW|CCDB_INIT)) @@ -439,8 +440,9 @@ ccdinit(struct ccd_s *cs, char **cpaths, struct thread *td) /* * Get partition information for the component. */ - if ((error = VOP_IOCTL(vp, DIOCGPART, (caddr_t)&dpart, - FREAD, td->td_ucred, td)) != 0) { + error = VOP_IOCTL(vp, DIOCGMEDIASIZE, (caddr_t)&mediasize, + FREAD, td->td_ucred, td); + if (error != 0) { #ifdef DEBUG if (ccddebug & (CCDB_FOLLOW|CCDB_INIT)) printf("ccd%d: %s: ioctl failed, error = %d\n", @@ -448,20 +450,22 @@ ccdinit(struct ccd_s *cs, char **cpaths, struct thread *td) #endif goto fail; } - if (dpart.part->p_fstype == FS_BSDFFS) { - maxsecsize = - ((dpart.disklab->d_secsize > maxsecsize) ? - dpart.disklab->d_secsize : maxsecsize); - size = dpart.part->p_size - CCD_OFFSET; - } else { + /* + * Get partition information for the component. + */ + error = VOP_IOCTL(vp, DIOCGSECTORSIZE, (caddr_t)§orsize, + FREAD, td->td_ucred, td); + if (error != 0) { #ifdef DEBUG if (ccddebug & (CCDB_FOLLOW|CCDB_INIT)) - printf("ccd%d: %s: incorrect partition type\n", - cs->sc_unit, ci->ci_path); + printf("ccd%d: %s: ioctl failed, error = %d\n", + cs->sc_unit, ci->ci_path, error); #endif - error = EFTYPE; goto fail; } + if (sectorsize > maxsecsize) + maxsecsize = sectorsize; + size = mediasize / DEV_BSIZE - CCD_OFFSET; /* * Calculate the size, truncating to an interleave |