This update adds the support for != 512 byte sector SCSI devices to
the sd & od drivers. There is also slight changes to fdisk & newfs in order to comply with different sectorsizes. Currently sectors of size 512, 1024 & 2048 are supported, the only restriction beeing in fdisk, which hunts for the sectorsize of the device. This is based on patches to od.c and the other system files by John Gumb & Barry Scott, minor changes and the sd.c patches by me. There also exist some patches for the msdos filesys code, but I havn't been able to test those (yet). John Gumb (john@talisker.demon.co.uk) Barry Scott (barry@scottb.demon.co.uk)
This commit is contained in:
parent
79c2a5b3ff
commit
7cb29d3394
@ -54,7 +54,9 @@ static char lbuf[LBUF];
|
||||
|
||||
#define RoundCyl(x) ((((x) + cylsecs - 1) / cylsecs) * cylsecs)
|
||||
|
||||
#define SECSIZE 512
|
||||
#define MAX_SEC_SIZE 2048 /* maximum section size that is supported */
|
||||
#define MIN_SEC_SIZE 512 /* the sector size to start sensing at */
|
||||
int secsize = 0; /* the sensed sector size */
|
||||
|
||||
const char *disk;
|
||||
const char *disks[] =
|
||||
@ -74,6 +76,8 @@ struct mboot
|
||||
unsigned char bootinst[DOSPARTOFF];
|
||||
struct dos_partition parts[4];
|
||||
unsigned short int signature;
|
||||
/* room to read in MBRs that are bigger then DEV_BSIZE */
|
||||
unsigned char large_sector_overflow[MAX_SEC_SIZE-MIN_SEC_SIZE];
|
||||
};
|
||||
struct mboot mboot;
|
||||
|
||||
@ -367,6 +371,7 @@ main(int argc, char *argv[])
|
||||
if (read_s0())
|
||||
init_sector0(1);
|
||||
|
||||
printf("Media sector size is %d\n", secsize);
|
||||
printf("Warning: BIOS sector numbering starts with sector 1\n");
|
||||
printf("Information from DOS bootblock is:\n");
|
||||
if (partition == -1)
|
||||
@ -433,7 +438,7 @@ struct dos_partition *partp = ((struct dos_partition *) &mboot.parts) + i;
|
||||
printf("sysid %d,(%s)\n", partp->dp_typ, get_type(partp->dp_typ));
|
||||
printf(" start %ld, size %ld (%ld Meg), flag %x\n",
|
||||
partp->dp_start,
|
||||
partp->dp_size, partp->dp_size * 512 / (1024 * 1024),
|
||||
partp->dp_size, partp->dp_size * secsize / (1024 * 1024),
|
||||
partp->dp_flag);
|
||||
printf("\tbeg: cyl %d/ sector %d/ head %d;\n\tend: cyl %d/ sector %d/ head %d\n"
|
||||
,DPCYL(partp->dp_scyl, partp->dp_ssect)
|
||||
@ -538,7 +543,7 @@ print_params()
|
||||
printf("cylinders=%d heads=%d sectors/track=%d (%d blks/cyl)\n\n"
|
||||
,cyls,heads,sectors,cylsecs);
|
||||
if((dos_sectors > 63) || (dos_cyls > 1023) || (dos_heads > 255))
|
||||
printf(" Figures below won't work with BIOS for partitions not in cyl 1\n");
|
||||
printf("Figures below won't work with BIOS for partitions not in cyl 1\n");
|
||||
printf("parameters to be used for BIOS calculations are:\n");
|
||||
printf("cylinders=%d heads=%d sectors/track=%d (%d blks/cyl)\n\n"
|
||||
,dos_cyls,dos_heads,dos_sectors,dos_cylsecs);
|
||||
@ -646,14 +651,28 @@ static ssize_t
|
||||
read_disk(off_t sector, void *buf)
|
||||
{
|
||||
lseek(fd,(sector * 512), 0);
|
||||
return read(fd, buf, 512);
|
||||
if( secsize == 0 )
|
||||
for( secsize = MIN_SEC_SIZE; secsize <= MAX_SEC_SIZE; secsize *= 2 )
|
||||
{
|
||||
/* try the read */
|
||||
int size = read(fd, buf, secsize);
|
||||
if( size == secsize )
|
||||
/* it worked so return */
|
||||
return secsize;
|
||||
}
|
||||
else
|
||||
return read( fd, buf, secsize );
|
||||
|
||||
/* we failed to read at any of the sizes */
|
||||
return -1;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
write_disk(off_t sector, void *buf)
|
||||
{
|
||||
lseek(fd,(sector * 512), 0);
|
||||
return write(fd, buf, 512);
|
||||
/* write out in the size that the read_disk found worked */
|
||||
return write(fd, buf, secsize);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -54,7 +54,9 @@ static char lbuf[LBUF];
|
||||
|
||||
#define RoundCyl(x) ((((x) + cylsecs - 1) / cylsecs) * cylsecs)
|
||||
|
||||
#define SECSIZE 512
|
||||
#define MAX_SEC_SIZE 2048 /* maximum section size that is supported */
|
||||
#define MIN_SEC_SIZE 512 /* the sector size to start sensing at */
|
||||
int secsize = 0; /* the sensed sector size */
|
||||
|
||||
const char *disk;
|
||||
const char *disks[] =
|
||||
@ -74,6 +76,8 @@ struct mboot
|
||||
unsigned char bootinst[DOSPARTOFF];
|
||||
struct dos_partition parts[4];
|
||||
unsigned short int signature;
|
||||
/* room to read in MBRs that are bigger then DEV_BSIZE */
|
||||
unsigned char large_sector_overflow[MAX_SEC_SIZE-MIN_SEC_SIZE];
|
||||
};
|
||||
struct mboot mboot;
|
||||
|
||||
@ -367,6 +371,7 @@ main(int argc, char *argv[])
|
||||
if (read_s0())
|
||||
init_sector0(1);
|
||||
|
||||
printf("Media sector size is %d\n", secsize);
|
||||
printf("Warning: BIOS sector numbering starts with sector 1\n");
|
||||
printf("Information from DOS bootblock is:\n");
|
||||
if (partition == -1)
|
||||
@ -433,7 +438,7 @@ struct dos_partition *partp = ((struct dos_partition *) &mboot.parts) + i;
|
||||
printf("sysid %d,(%s)\n", partp->dp_typ, get_type(partp->dp_typ));
|
||||
printf(" start %ld, size %ld (%ld Meg), flag %x\n",
|
||||
partp->dp_start,
|
||||
partp->dp_size, partp->dp_size * 512 / (1024 * 1024),
|
||||
partp->dp_size, partp->dp_size * secsize / (1024 * 1024),
|
||||
partp->dp_flag);
|
||||
printf("\tbeg: cyl %d/ sector %d/ head %d;\n\tend: cyl %d/ sector %d/ head %d\n"
|
||||
,DPCYL(partp->dp_scyl, partp->dp_ssect)
|
||||
@ -538,7 +543,7 @@ print_params()
|
||||
printf("cylinders=%d heads=%d sectors/track=%d (%d blks/cyl)\n\n"
|
||||
,cyls,heads,sectors,cylsecs);
|
||||
if((dos_sectors > 63) || (dos_cyls > 1023) || (dos_heads > 255))
|
||||
printf(" Figures below won't work with BIOS for partitions not in cyl 1\n");
|
||||
printf("Figures below won't work with BIOS for partitions not in cyl 1\n");
|
||||
printf("parameters to be used for BIOS calculations are:\n");
|
||||
printf("cylinders=%d heads=%d sectors/track=%d (%d blks/cyl)\n\n"
|
||||
,dos_cyls,dos_heads,dos_sectors,dos_cylsecs);
|
||||
@ -646,14 +651,28 @@ static ssize_t
|
||||
read_disk(off_t sector, void *buf)
|
||||
{
|
||||
lseek(fd,(sector * 512), 0);
|
||||
return read(fd, buf, 512);
|
||||
if( secsize == 0 )
|
||||
for( secsize = MIN_SEC_SIZE; secsize <= MAX_SEC_SIZE; secsize *= 2 )
|
||||
{
|
||||
/* try the read */
|
||||
int size = read(fd, buf, secsize);
|
||||
if( size == secsize )
|
||||
/* it worked so return */
|
||||
return secsize;
|
||||
}
|
||||
else
|
||||
return read( fd, buf, secsize );
|
||||
|
||||
/* we failed to read at any of the sizes */
|
||||
return -1;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
write_disk(off_t sector, void *buf)
|
||||
{
|
||||
lseek(fd,(sector * 512), 0);
|
||||
return write(fd, buf, 512);
|
||||
/* write out in the size that the read_disk found worked */
|
||||
return write(fd, buf, secsize);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -82,6 +82,7 @@ extern int nsectors; /* # sectors/track */
|
||||
extern int nphyssectors; /* # sectors/track including spares */
|
||||
extern int secpercyl; /* sectors per cylinder */
|
||||
extern int sectorsize; /* bytes/sector */
|
||||
extern int realsectorsize; /* bytes/sector in hardware*/
|
||||
extern int rpm; /* revolutions/minute of drive */
|
||||
extern int interleave; /* hardware sector interleave */
|
||||
extern int trackskew; /* sector 0 skew, per track */
|
||||
@ -209,7 +210,8 @@ mkfs(pp, fsys, fi, fo)
|
||||
*/
|
||||
if (fssize <= 0)
|
||||
printf("preposterous size %d\n", fssize), exit(13);
|
||||
wtfs(fssize - 1, sectorsize, (char *)&sblock);
|
||||
wtfs(fssize - (realsectorsize / DEV_BSIZE), realsectorsize,
|
||||
(char *)&sblock);
|
||||
/*
|
||||
* collect and verify the sector and track info
|
||||
*/
|
||||
|
@ -167,9 +167,7 @@ int secpercyl; /* sectors per cylinder */
|
||||
int trackspares = -1; /* spare sectors per track */
|
||||
int cylspares = -1; /* spare sectors per cylinder */
|
||||
int sectorsize; /* bytes/sector */
|
||||
#ifdef tahoe
|
||||
int realsectorsize; /* bytes/sector in hardware */
|
||||
#endif
|
||||
int rpm; /* revolutions/minute of drive */
|
||||
int interleave; /* hardware sector interleave */
|
||||
int trackskew = -1; /* sector 0 skew, per track */
|
||||
@ -530,11 +528,26 @@ main(argc, argv)
|
||||
fssize /= secperblk;
|
||||
pp->p_size /= secperblk;
|
||||
}
|
||||
#else
|
||||
realsectorsize = sectorsize;
|
||||
if (sectorsize != DEV_BSIZE) { /* XXX */
|
||||
int secperblk = sectorsize / DEV_BSIZE;
|
||||
|
||||
sectorsize = DEV_BSIZE;
|
||||
nsectors *= secperblk;
|
||||
nphyssectors *= secperblk;
|
||||
secpercyl *= secperblk;
|
||||
fssize *= secperblk;
|
||||
pp->p_size *= secperblk;
|
||||
}
|
||||
#endif
|
||||
mkfs(pp, special, fsi, fso);
|
||||
#ifdef tahoe
|
||||
if (realsectorsize != DEV_BSIZE)
|
||||
pp->p_size *= DEV_BSIZE / realsectorsize;
|
||||
#else
|
||||
if (realsectorsize != DEV_BSIZE)
|
||||
pp->p_size /= realsectorsize /DEV_BSIZE;
|
||||
#endif
|
||||
if (!Nflag)
|
||||
close(fso);
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ufs_disksubr.c 8.5 (Berkeley) 1/21/94
|
||||
* $Id: ufs_disksubr.c,v 1.25 1996/05/08 04:29:08 gpalmer Exp $
|
||||
* $Id: ufs_disksubr.c,v 1.26 1996/09/20 17:39:44 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -182,7 +182,7 @@ readdisklabel(dev, strat, lp)
|
||||
|
||||
bp = geteblk((int)lp->d_secsize);
|
||||
bp->b_dev = dev;
|
||||
bp->b_blkno = LABELSECTOR;
|
||||
bp->b_blkno = LABELSECTOR * ((int)lp->d_secsize/DEV_BSIZE);
|
||||
bp->b_bcount = lp->d_secsize;
|
||||
bp->b_flags &= ~B_INVAL;
|
||||
bp->b_flags |= B_BUSY | B_READ;
|
||||
@ -284,7 +284,7 @@ writedisklabel(dev, strat, lp)
|
||||
}
|
||||
bp = geteblk((int)lp->d_secsize);
|
||||
bp->b_dev = dkmodpart(dev, labelpart);
|
||||
bp->b_blkno = LABELSECTOR;
|
||||
bp->b_blkno = LABELSECTOR * ((int)lp->d_secsize/DEV_BSIZE);
|
||||
bp->b_bcount = lp->d_secsize;
|
||||
#if 1
|
||||
/*
|
||||
|
@ -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.29 1996/09/20 17:39:20 bde Exp $
|
||||
* $Id: subr_diskslice.c,v 1.30 1996/10/29 13:15:30 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -210,6 +210,8 @@ if (labelsect != 0) Debugger("labelsect != 0 in dscheck()");
|
||||
ic->ic_prev_iodone_chain = bp->b_iodone_chain;
|
||||
ic->ic_args[0].ia_long = (LABELSECTOR + labelsect - blkno)
|
||||
<< DEV_BSHIFT;
|
||||
if (lp)
|
||||
ic->ic_args[0].ia_long *= lp->d_secsize / DEV_BSIZE;
|
||||
ic->ic_args[1].ia_ptr = sp;
|
||||
bp->b_flags |= B_CALL;
|
||||
bp->b_iodone = dsiodone;
|
||||
|
@ -28,7 +28,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: od.c,v 1.22 1996/09/06 23:09:11 phk Exp $
|
||||
* $Id: od.c,v 1.23 1996/11/06 17:31:14 joerg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -446,6 +446,7 @@ od_strategy(struct buf *bp, struct scsi_link *sc_link)
|
||||
u_int32_t opri;
|
||||
struct scsi_data *od;
|
||||
u_int32_t unit;
|
||||
int secsize;
|
||||
|
||||
odstrats++;
|
||||
unit = ODUNIT((bp->b_dev));
|
||||
@ -462,15 +463,58 @@ od_strategy(struct buf *bp, struct scsi_link *sc_link)
|
||||
/*
|
||||
* Odd number of bytes or negative offset
|
||||
*/
|
||||
if (bp->b_blkno < 0 || bp->b_bcount % DEV_BSIZE != 0) {
|
||||
if (bp->b_blkno < 0 ) {
|
||||
bp->b_error = EINVAL;
|
||||
printf("od_strategy: Negative block number: 0x%x\n", bp->b_blkno);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
|
||||
secsize = od->params.secsiz;
|
||||
|
||||
/* make sure the blkno is scalable */
|
||||
if( (bp->b_blkno % (secsize/DEV_BSIZE)) != 0 ) {
|
||||
bp->b_error = EINVAL;
|
||||
printf("od_strategy: Block number is not multiple of sector size (2): 0x%x\n", bp->b_blkno);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
/* make sure that the transfer size is a multiple of the sector size */
|
||||
if( (bp->b_bcount % secsize) != 0 ) {
|
||||
bp->b_error = EINVAL;
|
||||
printf("od_strategy: Invalid b_bcount %d at block number: 0x%x\n", bp->b_bcount, bp->b_blkno);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
/*
|
||||
* Do bounds checking, adjust transfer, set b_cylin and b_pbklno.
|
||||
*/
|
||||
if (dscheck(bp, od->dk_slices) <= 0)
|
||||
{
|
||||
int status;
|
||||
int sec_blk_ratio = secsize/DEV_BSIZE;
|
||||
/* save original block number and size */
|
||||
int b_blkno = bp->b_blkno;
|
||||
int b_bcount = bp->b_bcount;
|
||||
|
||||
/* replace with scaled values */
|
||||
bp->b_blkno /= sec_blk_ratio;
|
||||
bp->b_bcount /= sec_blk_ratio;
|
||||
|
||||
/* have dscheck enforce limits and map to physical block number */
|
||||
status = dscheck(bp, od->dk_slices);
|
||||
|
||||
/* restore original values to prevent bad side effects in block system */
|
||||
bp->b_blkno = b_blkno;
|
||||
bp->b_bcount = b_bcount;
|
||||
/* scale resid */
|
||||
bp->b_resid *= sec_blk_ratio;
|
||||
|
||||
/* see if the mapping failed */
|
||||
if (status <= 0)
|
||||
{
|
||||
goto done; /* XXX check b_resid */
|
||||
}
|
||||
}
|
||||
|
||||
opri = SPLOD();
|
||||
|
||||
@ -579,12 +623,12 @@ odstart(u_int32_t unit, u_int32_t flags)
|
||||
* With this thing..
|
||||
*/
|
||||
secsize = od->params.secsiz;
|
||||
blkno = bp->b_pblkno / (secsize / DEV_BSIZE);
|
||||
blkno = bp->b_pblkno;
|
||||
if (bp->b_bcount & (secsize - 1))
|
||||
{
|
||||
goto bad;
|
||||
}
|
||||
nblk = (bp->b_bcount + (secsize - 1)) / secsize;
|
||||
nblk = bp->b_bcount / secsize;
|
||||
|
||||
/*
|
||||
* Fill out the scsi command
|
||||
|
@ -14,7 +14,7 @@
|
||||
*
|
||||
* Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992
|
||||
*
|
||||
* $Id: sd.c,v 1.94 1996/09/06 23:09:18 phk Exp $
|
||||
* $Id: sd.c,v 1.95 1996/09/14 04:31:09 bde Exp $
|
||||
*/
|
||||
|
||||
#include "opt_bounce.h"
|
||||
@ -314,6 +314,7 @@ sd_open(dev, mode, fmt, p, sc_link)
|
||||
/*
|
||||
* Load the physical device parameters
|
||||
*/
|
||||
#if 0
|
||||
sd_get_parms(unit, 0); /* sets SDEV_MEDIA_LOADED */
|
||||
if (sd->params.secsiz != SECSIZE) { /* XXX One day... */
|
||||
printf("sd%ld: Can't deal with %d bytes logical blocks\n",
|
||||
@ -322,6 +323,22 @@ sd_open(dev, mode, fmt, p, sc_link)
|
||||
errcode = ENXIO;
|
||||
goto bad;
|
||||
}
|
||||
#else
|
||||
if(errcode = sd_get_parms(unit, 0)) /* sets SDEV_MEDIA_LOADED */
|
||||
goto bad;
|
||||
switch (sd->params.secsiz) {
|
||||
case SECSIZE: /* 512 */
|
||||
case 1024:
|
||||
case 2048:
|
||||
break;
|
||||
default:
|
||||
printf("sd%ld: Can't deal with %d bytes logical blocks\n",
|
||||
unit, sd->params.secsiz);
|
||||
Debugger("sd");
|
||||
errcode = ENXIO;
|
||||
goto bad;
|
||||
}
|
||||
#endif
|
||||
SC_DEBUG(sc_link, SDEV_DB3, ("Params loaded "));
|
||||
|
||||
/* Lock the pack in. */
|
||||
@ -391,7 +408,7 @@ sd_strategy(struct buf *bp, struct scsi_link *sc_link)
|
||||
{
|
||||
u_int32_t opri;
|
||||
struct scsi_data *sd;
|
||||
u_int32_t unit;
|
||||
u_int32_t unit, secsize;
|
||||
|
||||
sdstrats++;
|
||||
unit = SDUNIT((bp->b_dev));
|
||||
@ -409,6 +426,7 @@ sd_strategy(struct buf *bp, struct scsi_link *sc_link)
|
||||
*/
|
||||
scsi_minphys(bp,&sd_switch);
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Odd number of bytes or negative offset
|
||||
*/
|
||||
@ -421,7 +439,61 @@ sd_strategy(struct buf *bp, struct scsi_link *sc_link)
|
||||
*/
|
||||
if (dscheck(bp, sd->dk_slices) <= 0)
|
||||
goto done; /* XXX check b_resid */
|
||||
#else
|
||||
/*
|
||||
* Odd number of bytes or negative offset
|
||||
*/
|
||||
if (bp->b_blkno < 0 ) {
|
||||
bp->b_error = EINVAL;
|
||||
printf("sd_strategy: Negative block number: 0x%x\n", bp->b_blkno);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
secsize = sd->params.secsiz;
|
||||
|
||||
/* make sure the blkno is scalable */
|
||||
if( (bp->b_blkno % (secsize/DEV_BSIZE)) != 0 ) {
|
||||
bp->b_error = EINVAL;
|
||||
printf("sd_strategy: Block number is not multiple of sector size (2): 0x%x\n", bp->b_blkno);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
/* make sure that the transfer size is a multiple of the sector size */
|
||||
if( (bp->b_bcount % secsize) != 0 ) {
|
||||
bp->b_error = EINVAL;
|
||||
printf("sd_strategy: Invalid b_bcount %d at block number: 0x%x\n", bp->b_bcount, bp->b_blkno);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
/*
|
||||
* Do bounds checking, adjust transfer, set b_cylin and b_pbklno.
|
||||
*/
|
||||
{
|
||||
int status;
|
||||
int sec_blk_ratio = secsize/DEV_BSIZE;
|
||||
/* save original block number and size */
|
||||
int b_blkno = bp->b_blkno;
|
||||
int b_bcount = bp->b_bcount;
|
||||
|
||||
/* replace with scaled values */
|
||||
bp->b_blkno /= sec_blk_ratio;
|
||||
bp->b_bcount /= sec_blk_ratio;
|
||||
|
||||
/* enforce limits and map to physical block number */
|
||||
status = dscheck(bp, sd->dk_slices);
|
||||
|
||||
/* prevent bad side effects in block system */
|
||||
bp->b_blkno = b_blkno;
|
||||
bp->b_bcount = b_bcount;
|
||||
|
||||
/* scale resid */
|
||||
bp->b_resid *= sec_blk_ratio;
|
||||
|
||||
/* see if the mapping failed */
|
||||
if (status <= 0)
|
||||
goto done; /* XXX check b_resid */
|
||||
}
|
||||
#endif
|
||||
opri = SPLSD();
|
||||
/*
|
||||
* Use a bounce buffer if necessary
|
||||
@ -493,7 +565,7 @@ sdstart(u_int32_t unit, u_int32_t flags)
|
||||
register struct scsi_data *sd = sc_link->sd;
|
||||
struct buf *bp = NULL;
|
||||
struct scsi_rw_big cmd;
|
||||
u_int32_t blkno, nblk;
|
||||
u_int32_t blkno, nblk, secsize;
|
||||
|
||||
SC_DEBUG(sc_link, SDEV_DB2, ("sdstart "));
|
||||
/*
|
||||
@ -530,12 +602,13 @@ sdstart(u_int32_t unit, u_int32_t flags)
|
||||
* We have a buf, now we know we are going to go through
|
||||
* With this thing..
|
||||
*/
|
||||
secsize = sd->params.secsiz;
|
||||
blkno = bp->b_pblkno;
|
||||
if (bp->b_bcount & (SECSIZE - 1))
|
||||
if (bp->b_bcount & (secsize - 1))
|
||||
{
|
||||
goto bad;
|
||||
}
|
||||
nblk = bp->b_bcount >> 9;
|
||||
nblk = bp->b_bcount / secsize;
|
||||
|
||||
/*
|
||||
* Fill out the scsi command
|
||||
@ -996,7 +1069,7 @@ sddump(dev_t dev)
|
||||
xs->error = XS_NOERROR;
|
||||
xs->bp = 0;
|
||||
xs->data = (u_char *) CADDR1; /* XXX use pmap_enter() */
|
||||
xs->datalen = blkcnt * SECSIZE;
|
||||
xs->datalen = blkcnt * sd->params.secsiz;
|
||||
|
||||
/*
|
||||
* Pass all this info to the scsi driver.
|
||||
@ -1017,7 +1090,7 @@ sddump(dev_t dev)
|
||||
/* update block count */
|
||||
num -= blkcnt;
|
||||
blknum += blkcnt;
|
||||
(int) addr += SECSIZE * blkcnt;
|
||||
(int) addr += blkcnt * sd->params.secsiz;
|
||||
|
||||
/* operator aborting dump? */
|
||||
if (cncheckc() != -1)
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ufs_disksubr.c 8.5 (Berkeley) 1/21/94
|
||||
* $Id: ufs_disksubr.c,v 1.25 1996/05/08 04:29:08 gpalmer Exp $
|
||||
* $Id: ufs_disksubr.c,v 1.26 1996/09/20 17:39:44 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -182,7 +182,7 @@ readdisklabel(dev, strat, lp)
|
||||
|
||||
bp = geteblk((int)lp->d_secsize);
|
||||
bp->b_dev = dev;
|
||||
bp->b_blkno = LABELSECTOR;
|
||||
bp->b_blkno = LABELSECTOR * ((int)lp->d_secsize/DEV_BSIZE);
|
||||
bp->b_bcount = lp->d_secsize;
|
||||
bp->b_flags &= ~B_INVAL;
|
||||
bp->b_flags |= B_BUSY | B_READ;
|
||||
@ -284,7 +284,7 @@ writedisklabel(dev, strat, lp)
|
||||
}
|
||||
bp = geteblk((int)lp->d_secsize);
|
||||
bp->b_dev = dkmodpart(dev, labelpart);
|
||||
bp->b_blkno = LABELSECTOR;
|
||||
bp->b_blkno = LABELSECTOR * ((int)lp->d_secsize/DEV_BSIZE);
|
||||
bp->b_bcount = lp->d_secsize;
|
||||
#if 1
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user