1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-02-08 11:43:36 +00:00

dosfs support in libstand is broken since r298230

Apparently the libstand dosfs optimization is a bit too optimistic
and did introduce possible memory corruption.

This patch is backing out the bad part and since this results in
dosfs reading full blocks now, we can also remove extra offset argument
from dv_strategy callback.

The analysis of the issue and the backout patch is provided by Mikhail Kupchik.

PR:		214423
Submitted by:	Mikhail Kupchik
Reported by:	Mikhail Kupchik
Reviewed by:	bapt, allanjude
Approved by:	allanjude (mentor)
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D8644
This commit is contained in:
Toomas Soome 2016-12-30 19:06:29 +00:00
parent 7a432b84e8
commit 1ecc859193
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=310850
30 changed files with 129 additions and 163 deletions

View File

@ -143,7 +143,7 @@ susp_lookup_record(struct open_file *f, const char *identifier,
if (bcmp(sh->type, SUSP_CONTINUATION, 2) == 0) {
shc = (ISO_RRIP_CONT *)sh;
error = f->f_dev->dv_strategy(f->f_devdata, F_READ,
cdb2devb(isonum_733(shc->location)), 0,
cdb2devb(isonum_733(shc->location)),
ISO_DEFAULT_BLOCK_SIZE, susp_buffer, &read);
/* Bail if it fails. */
@ -288,7 +288,7 @@ cd9660_open(const char *path, struct open_file *f)
for (bno = 16;; bno++) {
twiddle(1);
rc = f->f_dev->dv_strategy(f->f_devdata, F_READ, cdb2devb(bno),
0, ISO_DEFAULT_BLOCK_SIZE, buf, &read);
ISO_DEFAULT_BLOCK_SIZE, buf, &read);
if (rc)
goto out;
if (read != ISO_DEFAULT_BLOCK_SIZE) {
@ -322,7 +322,7 @@ cd9660_open(const char *path, struct open_file *f)
twiddle(1);
rc = f->f_dev->dv_strategy
(f->f_devdata, F_READ,
cdb2devb(bno + boff), 0,
cdb2devb(bno + boff),
ISO_DEFAULT_BLOCK_SIZE,
buf, &read);
if (rc)
@ -387,7 +387,7 @@ cd9660_open(const char *path, struct open_file *f)
bno = isonum_733(rec.extent) + isonum_711(rec.ext_attr_length);
twiddle(1);
rc = f->f_dev->dv_strategy(f->f_devdata, F_READ, cdb2devb(bno),
0, ISO_DEFAULT_BLOCK_SIZE, buf, &read);
ISO_DEFAULT_BLOCK_SIZE, buf, &read);
if (rc)
goto out;
if (read != ISO_DEFAULT_BLOCK_SIZE) {
@ -444,7 +444,7 @@ buf_read_file(struct open_file *f, char **buf_p, size_t *size_p)
twiddle(16);
rc = f->f_dev->dv_strategy(f->f_devdata, F_READ,
cdb2devb(blkno), 0, ISO_DEFAULT_BLOCK_SIZE,
cdb2devb(blkno), ISO_DEFAULT_BLOCK_SIZE,
fp->f_buf, &read);
if (rc)
return (rc);

View File

@ -154,7 +154,7 @@ static int fatcnt(DOS_FS *, u_int);
static int fatget(DOS_FS *, u_int *);
static int fatend(u_int, u_int);
static int ioread(DOS_FS *, u_int, void *, u_int);
static int ioget(struct open_file *, daddr_t, size_t, void *, u_int);
static int ioget(struct open_file *, daddr_t, void *, u_int);
static void
dos_read_fat(DOS_FS *fs, struct open_file *fd)
@ -172,7 +172,7 @@ dos_read_fat(DOS_FS *fs, struct open_file *fd)
fat.buf = malloc(secbyt(fs->spf));
if (fat.buf != NULL) {
if (ioget(fd, fs->lsnfat, 0, fat.buf, secbyt(fs->spf)) == 0) {
if (ioget(fd, fs->lsnfat, fat.buf, secbyt(fs->spf)) == 0) {
fat.size = fs->spf;
fat.unit = dd->d_unit;
return;
@ -199,7 +199,7 @@ dos_mount(DOS_FS *fs, struct open_file *fd)
fs->fd = fd;
if ((err = !(buf = malloc(secbyt(1))) ? errno : 0) ||
(err = ioget(fs->fd, 0, 0, buf, secbyt(1))) ||
(err = ioget(fs->fd, 0, buf, secbyt(1))) ||
(err = parsebs(fs, (DOS_BS *)buf))) {
if (buf != NULL)
free(buf);
@ -619,7 +619,7 @@ lookup(DOS_FS *fs, u_int clus, const char *name, DOS_DE **dep)
else
return (EINVAL);
for (sec = 0; sec < nsec; sec++) {
if ((err = ioget(fs->fd, lsec + sec, 0, dir, secbyt(1))))
if ((err = ioget(fs->fd, lsec + sec, dir, secbyt(1))))
return (err);
for (ent = 0; ent < DEPSEC; ent++) {
if (!*dir[ent].de.name)
@ -768,8 +768,7 @@ static int
fatget(DOS_FS *fs, u_int *c)
{
u_char buf[4];
u_char *s;
u_int x, offset, off, n, nbyte, lsec;
u_int x, offset, n, nbyte;
struct devdesc *dd = fs->fd->f_devdata;
int err = 0;
@ -783,25 +782,9 @@ fatget(DOS_FS *fs, u_int *c)
offset = fatoff(fs->fatsz, *c);
nbyte = fs->fatsz != 32 ? 2 : 4;
s = buf;
if ((off = offset & (SECSIZ - 1))) {
offset -= off;
lsec = bytsec(offset);
offset += SECSIZ;
if ((n = SECSIZ - off) > nbyte)
n = nbyte;
memcpy(s, fat.buf + secbyt(lsec) + off, n);
s += n;
nbyte -= n;
}
n = nbyte & (SECSIZ - 1);
if (nbyte -= n) {
memcpy(s, fat.buf + secbyt(bytsec(offset)), nbyte);
offset += nbyte;
s += nbyte;
}
if (n)
memcpy(s, fat.buf + secbyt(bytsec(offset)), n);
if (offset + nbyte > secbyt(fat.size))
return (EINVAL);
memcpy(buf, fat.buf + offset, nbyte);
}
x = fs->fatsz != 32 ? cv2(buf) : cv4(buf);
@ -827,28 +810,31 @@ ioread(DOS_FS *fs, u_int offset, void *buf, u_int nbyte)
char *s;
u_int off, n;
int err;
u_char local_buf[SECSIZ];
s = buf;
if ((off = offset & (SECSIZ - 1))) {
offset -= off;
if ((n = SECSIZ - off) > nbyte)
n = nbyte;
if ((err = ioget(fs->fd, bytsec(offset), off, s, n)))
if ((err = ioget(fs->fd, bytsec(offset), local_buf, sizeof(local_buf))))
return (err);
memcpy(s, local_buf + off, n);
offset += SECSIZ;
s += n;
nbyte -= n;
}
n = nbyte & (SECSIZ - 1);
if (nbyte -= n) {
if ((err = ioget(fs->fd, bytsec(offset), 0, s, nbyte)))
if ((err = ioget(fs->fd, bytsec(offset), s, nbyte)))
return (err);
offset += nbyte;
s += nbyte;
}
if (n) {
if ((err = ioget(fs->fd, bytsec(offset), 0, s, n)))
if ((err = ioget(fs->fd, bytsec(offset), local_buf, sizeof(local_buf))))
return (err);
memcpy(s, local_buf, n);
}
return (0);
}
@ -857,8 +843,8 @@ ioread(DOS_FS *fs, u_int offset, void *buf, u_int nbyte)
* Sector-based I/O primitive
*/
static int
ioget(struct open_file *fd, daddr_t lsec, size_t offset, void *buf, u_int size)
ioget(struct open_file *fd, daddr_t lsec, void *buf, u_int size)
{
return ((fd->f_dev->dv_strategy)(fd->f_devdata, F_READ, lsec, offset,
return ((fd->f_dev->dv_strategy)(fd->f_devdata, F_READ, lsec,
size, buf, NULL));
}

View File

@ -355,7 +355,7 @@ ext2fs_open(const char *upath, struct open_file *f)
fp->f_fs = fs;
twiddle(1);
error = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
EXT2_SBLOCK, 0, EXT2_SBSIZE, (char *)fs, &buf_size);
EXT2_SBLOCK, EXT2_SBSIZE, (char *)fs, &buf_size);
if (error)
goto out;
@ -397,7 +397,7 @@ ext2fs_open(const char *upath, struct open_file *f)
fp->f_bg = malloc(len);
twiddle(1);
error = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
EXT2_SBLOCK + EXT2_SBSIZE / DEV_BSIZE, 0, len,
EXT2_SBLOCK + EXT2_SBSIZE / DEV_BSIZE, len,
(char *)fp->f_bg, &buf_size);
if (error)
goto out;
@ -509,7 +509,7 @@ ext2fs_open(const char *upath, struct open_file *f)
twiddle(1);
error = (f->f_dev->dv_strategy)(f->f_devdata,
F_READ, fsb_to_db(fs, disk_block), 0,
F_READ, fsb_to_db(fs, disk_block),
fs->fs_bsize, buf, &buf_size);
if (error)
goto out;
@ -570,7 +570,7 @@ read_inode(ino_t inumber, struct open_file *f)
buf = malloc(fs->fs_bsize);
twiddle(1);
error = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
ino_to_db(fs, fp->f_bg, inumber), 0, fs->fs_bsize, buf, &rsize);
ino_to_db(fs, fp->f_bg, inumber), fs->fs_bsize, buf, &rsize);
if (error)
goto out;
if (rsize != fs->fs_bsize) {
@ -667,7 +667,7 @@ block_map(struct open_file *f, daddr_t file_block, daddr_t *disk_block_p)
malloc(fs->fs_bsize);
twiddle(1);
error = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
fsb_to_db(fp->f_fs, ind_block_num), 0, fs->fs_bsize,
fsb_to_db(fp->f_fs, ind_block_num), fs->fs_bsize,
fp->f_blk[level], &fp->f_blksize[level]);
if (error)
return (error);
@ -725,7 +725,7 @@ buf_read_file(struct open_file *f, char **buf_p, size_t *size_p)
} else {
twiddle(4);
error = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
fsb_to_db(fs, disk_block), 0, block_size,
fsb_to_db(fs, disk_block), block_size,
fp->f_buf, &fp->f_buf_size);
if (error)
goto done;

View File

@ -1024,7 +1024,7 @@ ioread(struct open_file *f, off_t pos, void *buf, u_int length)
buffer = malloc(nsec * bsize);
err = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, pos, 0,
err = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, pos,
nsec * bsize, buffer, NULL);
memcpy(buf, (void *)((uintptr_t)buffer + off), length);

View File

@ -79,7 +79,7 @@ read(int fd, void *dest, size_t bcount)
if (f->f_flags & F_RAW) {
twiddle(4);
errno = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
btodb(f->f_offset), 0, bcount, dest, &resid);
btodb(f->f_offset), bcount, dest, &resid);
if (errno)
return (-1);
f->f_offset += resid;

View File

@ -139,7 +139,7 @@ struct devsw {
int dv_type; /* opaque type constant, arch-dependant */
int (*dv_init)(void); /* early probe call */
int (*dv_strategy)(void *devdata, int rw, daddr_t blk,
size_t offset, size_t size, char *buf, size_t *rsize);
size_t size, char *buf, size_t *rsize);
int (*dv_open)(struct open_file *f, ...);
int (*dv_close)(struct open_file *f);
int (*dv_ioctl)(struct open_file *f, u_long cmd, void *data);

View File

@ -157,7 +157,7 @@ read_inode(inumber, f)
buf = malloc(fs->fs_bsize);
twiddle(1);
rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
fsbtodb(fs, ino_to_fsba(fs, inumber)), 0, fs->fs_bsize,
fsbtodb(fs, ino_to_fsba(fs, inumber)), fs->fs_bsize,
buf, &rsize);
if (rc)
goto out;
@ -267,7 +267,7 @@ block_map(f, file_block, disk_block_p)
malloc(fs->fs_bsize);
twiddle(1);
rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
fsbtodb(fp->f_fs, ind_block_num), 0,
fsbtodb(fp->f_fs, ind_block_num),
fs->fs_bsize,
fp->f_blk[level],
&fp->f_blksize[level]);
@ -348,7 +348,7 @@ buf_write_file(f, buf_p, size_p)
twiddle(4);
rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
fsbtodb(fs, disk_block), 0,
fsbtodb(fs, disk_block),
block_size, fp->f_buf, &fp->f_buf_size);
if (rc)
return (rc);
@ -367,7 +367,7 @@ buf_write_file(f, buf_p, size_p)
twiddle(4);
rc = (f->f_dev->dv_strategy)(f->f_devdata, F_WRITE,
fsbtodb(fs, disk_block), 0,
fsbtodb(fs, disk_block),
block_size, fp->f_buf, &fp->f_buf_size);
return (rc);
}
@ -408,7 +408,7 @@ buf_read_file(f, buf_p, size_p)
} else {
twiddle(4);
rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
fsbtodb(fs, disk_block), 0,
fsbtodb(fs, disk_block),
block_size, fp->f_buf, &fp->f_buf_size);
if (rc)
return (rc);
@ -521,7 +521,7 @@ ufs_open(upath, f)
*/
for (i = 0; sblock_try[i] != -1; i++) {
rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
sblock_try[i] / DEV_BSIZE, 0, SBLOCKSIZE,
sblock_try[i] / DEV_BSIZE, SBLOCKSIZE,
(char *)fs, &buf_size);
if (rc)
goto out;
@ -651,7 +651,7 @@ ufs_open(upath, f)
twiddle(1);
rc = (f->f_dev->dv_strategy)(f->f_devdata,
F_READ, fsbtodb(fs, disk_block), 0,
F_READ, fsbtodb(fs, disk_block),
fs->fs_bsize, buf, &buf_size);
if (rc)
goto out;

View File

@ -82,7 +82,7 @@ write(fd, dest, bcount)
if (f->f_flags & F_RAW) {
twiddle(4);
errno = (f->f_dev->dv_strategy)(f->f_devdata, F_WRITE,
btodb(f->f_offset), 0, bcount, dest, &resid);
btodb(f->f_offset), bcount, dest, &resid);
if (errno)
return (-1);
f->f_offset += resid;

View File

@ -182,8 +182,8 @@ bcache_free(void *cache)
* cache with the new values.
*/
static int
write_strategy(void *devdata, int rw, daddr_t blk, size_t offset,
size_t size, char *buf, size_t *rsize)
write_strategy(void *devdata, int rw, daddr_t blk, size_t size,
char *buf, size_t *rsize)
{
struct bcache_devdata *dd = (struct bcache_devdata *)devdata;
struct bcache *bc = dd->dv_cache;
@ -197,7 +197,7 @@ write_strategy(void *devdata, int rw, daddr_t blk, size_t offset,
}
/* Write the blocks */
return (dd->dv_strategy(dd->dv_devdata, rw, blk, offset, size, buf, rsize));
return (dd->dv_strategy(dd->dv_devdata, rw, blk, size, buf, rsize));
}
/*
@ -206,8 +206,8 @@ write_strategy(void *devdata, int rw, daddr_t blk, size_t offset,
* device I/O and then use the I/O results to populate the cache.
*/
static int
read_strategy(void *devdata, int rw, daddr_t blk, size_t offset,
size_t size, char *buf, size_t *rsize)
read_strategy(void *devdata, int rw, daddr_t blk, size_t size,
char *buf, size_t *rsize)
{
struct bcache_devdata *dd = (struct bcache_devdata *)devdata;
struct bcache *bc = dd->dv_cache;
@ -225,7 +225,7 @@ read_strategy(void *devdata, int rw, daddr_t blk, size_t offset,
*rsize = 0;
nblk = size / bcache_blksize;
if ((nblk == 0 && size != 0) || offset != 0)
if (nblk == 0 && size != 0)
nblk++;
result = 0;
complete = 1;
@ -246,8 +246,7 @@ read_strategy(void *devdata, int rw, daddr_t blk, size_t offset,
if (complete) { /* whole set was in cache, return it */
if (bc->ra < BCACHE_READAHEAD)
bc->ra <<= 1; /* increase read ahead */
bcopy(bc->bcache_data + (bcache_blksize * BHASH(bc, blk)) + offset,
buf, size);
bcopy(bc->bcache_data + (bcache_blksize * BHASH(bc, blk)), buf, size);
goto done;
}
@ -282,7 +281,7 @@ read_strategy(void *devdata, int rw, daddr_t blk, size_t offset,
* in either case we should return the data in bcache and only
* return error if there is no data.
*/
result = dd->dv_strategy(dd->dv_devdata, rw, p_blk, 0,
result = dd->dv_strategy(dd->dv_devdata, rw, p_blk,
p_size * bcache_blksize, p_buf, &r_size);
r_size /= bcache_blksize;
@ -307,8 +306,7 @@ read_strategy(void *devdata, int rw, daddr_t blk, size_t offset,
size = i * bcache_blksize;
if (size != 0) {
bcopy(bc->bcache_data + (bcache_blksize * BHASH(bc, blk)) + offset,
buf, size);
bcopy(bc->bcache_data + (bcache_blksize * BHASH(bc, blk)), buf, size);
result = 0;
}
@ -323,8 +321,8 @@ read_strategy(void *devdata, int rw, daddr_t blk, size_t offset,
* directly to the disk. XXX tune this.
*/
int
bcache_strategy(void *devdata, int rw, daddr_t blk, size_t offset,
size_t size, char *buf, size_t *rsize)
bcache_strategy(void *devdata, int rw, daddr_t blk, size_t size,
char *buf, size_t *rsize)
{
struct bcache_devdata *dd = (struct bcache_devdata *)devdata;
struct bcache *bc = dd->dv_cache;
@ -339,23 +337,16 @@ bcache_strategy(void *devdata, int rw, daddr_t blk, size_t offset,
/* bypass large requests, or when the cache is inactive */
if (bc == NULL ||
(offset == 0 && ((size * 2 / bcache_blksize) > bcache_nblks))) {
((size * 2 / bcache_blksize) > bcache_nblks)) {
DEBUG("bypass %d from %d", size / bcache_blksize, blk);
bcache_bypasses++;
return (dd->dv_strategy(dd->dv_devdata, rw, blk, offset, size, buf,
rsize));
}
/* normalize offset */
while (offset >= bcache_blksize) {
blk++;
offset -= bcache_blksize;
return (dd->dv_strategy(dd->dv_devdata, rw, blk, size, buf, rsize));
}
switch (rw) {
case F_READ:
nblk = size / bcache_blksize;
if (offset || (size != 0 && nblk == 0))
if (size != 0 && nblk == 0)
nblk++; /* read at least one block */
ret = 0;
@ -366,14 +357,10 @@ bcache_strategy(void *devdata, int rw, daddr_t blk, size_t offset,
if (size <= bcache_blksize)
csize = size;
else {
else
csize = cblk * bcache_blksize;
if (offset)
csize -= (bcache_blksize - offset);
}
ret = read_strategy(devdata, rw, blk, offset,
csize, buf+total, &isize);
ret = read_strategy(devdata, rw, blk, csize, buf+total, &isize);
/*
* we may have error from read ahead, if we have read some data
@ -384,8 +371,7 @@ bcache_strategy(void *devdata, int rw, daddr_t blk, size_t offset,
ret = 0;
break;
}
blk += (offset+isize) / bcache_blksize;
offset = 0;
blk += isize / bcache_blksize;
total += isize;
size -= isize;
nblk = size / bcache_blksize;
@ -396,7 +382,7 @@ bcache_strategy(void *devdata, int rw, daddr_t blk, size_t offset,
return (ret);
case F_WRITE:
return write_strategy(devdata, rw, blk, offset, size, buf, rsize);
return write_strategy(devdata, rw, blk, size, buf, rsize);
}
return -1;
}

View File

@ -77,8 +77,8 @@ void bcache_init(u_int nblks, size_t bsize);
void bcache_add_dev(int);
void *bcache_allocate(void);
void bcache_free(void *);
int bcache_strategy(void *devdata, int rw, daddr_t blk, size_t offset,
size_t size, char *buf, size_t *rsize);
int bcache_strategy(void *devdata, int rw, daddr_t blk, size_t size,
char *buf, size_t *rsize);
/*
* Disk block cache
@ -86,7 +86,7 @@ int bcache_strategy(void *devdata, int rw, daddr_t blk, size_t offset,
struct bcache_devdata
{
int (*dv_strategy)(void *devdata, int rw, daddr_t blk,
size_t offset, size_t size, char *buf, size_t *rsize);
size_t size, char *buf, size_t *rsize);
void *dv_devdata;
void *dv_cache;
};

View File

@ -178,7 +178,7 @@ ptblread(void *d, void *buf, size_t blocks, off_t offset)
dev = (struct disk_devdesc *)d;
od = (struct open_disk *)dev->d_opendata;
return (dev->d_dev->dv_strategy(dev, F_READ, offset, 0,
return (dev->d_dev->dv_strategy(dev, F_READ, offset,
blocks * od->sectorsize, (char *)buf, NULL));
}
@ -244,7 +244,7 @@ disk_read(struct disk_devdesc *dev, void *buf, off_t offset, u_int blocks)
int ret;
od = (struct open_disk *)dev->d_opendata;
ret = dev->d_dev->dv_strategy(dev, F_READ, dev->d_offset + offset, 0,
ret = dev->d_dev->dv_strategy(dev, F_READ, dev->d_offset + offset,
blocks * od->sectorsize, buf, NULL);
return (ret);
@ -257,7 +257,7 @@ disk_write(struct disk_devdesc *dev, void *buf, off_t offset, u_int blocks)
int ret;
od = (struct open_disk *)dev->d_opendata;
ret = dev->d_dev->dv_strategy(dev, F_WRITE, dev->d_offset + offset, 0,
ret = dev->d_dev->dv_strategy(dev, F_WRITE, dev->d_offset + offset,
blocks * od->sectorsize, buf, NULL);
return (ret);

View File

@ -60,7 +60,7 @@ static struct {
/* devsw I/F */
static int md_init(void);
static int md_strategy(void *, int, daddr_t, size_t, size_t, char *, size_t *);
static int md_strategy(void *, int, daddr_t, size_t, char *, size_t *);
static int md_open(struct open_file *, ...);
static int md_close(struct open_file *);
static int md_print(int);
@ -84,7 +84,7 @@ md_init(void)
}
static int
md_strategy(void *devdata, int rw, daddr_t blk, size_t offset, size_t size,
md_strategy(void *devdata, int rw, daddr_t blk, size_t size,
char *buf, size_t *rsize)
{
struct devdesc *dev = (struct devdesc *)devdata;

View File

@ -41,10 +41,8 @@ __FBSDID("$FreeBSD$");
static EFI_GUID blkio_guid = BLOCK_IO_PROTOCOL;
static int efipart_init(void);
static int efipart_strategy(void *, int, daddr_t, size_t, size_t, char *,
size_t *);
static int efipart_realstrategy(void *, int, daddr_t, size_t, size_t, char *,
size_t *);
static int efipart_strategy(void *, int, daddr_t, size_t, char *, size_t *);
static int efipart_realstrategy(void *, int, daddr_t, size_t, char *, size_t *);
static int efipart_open(struct open_file *, ...);
static int efipart_close(struct open_file *);
static int efipart_print(int);
@ -289,8 +287,8 @@ efipart_readwrite(EFI_BLOCK_IO *blkio, int rw, daddr_t blk, daddr_t nblks,
}
static int
efipart_strategy(void *devdata, int rw, daddr_t blk, size_t offset,
size_t size, char *buf, size_t *rsize)
efipart_strategy(void *devdata, int rw, daddr_t blk, size_t size,
char *buf, size_t *rsize)
{
struct bcache_devdata bcd;
struct devdesc *dev;
@ -299,13 +297,12 @@ efipart_strategy(void *devdata, int rw, daddr_t blk, size_t offset,
bcd.dv_strategy = efipart_realstrategy;
bcd.dv_devdata = devdata;
bcd.dv_cache = PD(dev).pd_bcache;
return (bcache_strategy(&bcd, rw, blk, offset, size,
buf, rsize));
return (bcache_strategy(&bcd, rw, blk, size, buf, rsize));
}
static int
efipart_realstrategy(void *devdata, int rw, daddr_t blk, size_t offset,
size_t size, char *buf, size_t *rsize)
efipart_realstrategy(void *devdata, int rw, daddr_t blk, size_t size,
char *buf, size_t *rsize)
{
struct devdesc *dev = (struct devdesc *)devdata;
EFI_BLOCK_IO *blkio;

View File

@ -66,7 +66,7 @@ struct crom_src_buf {
static int fw_init(void);
static int fw_strategy(void *devdata, int flag, daddr_t dblk,
size_t offset, size_t size, char *buf, size_t *rsize);
size_t size, char *buf, size_t *rsize);
static int fw_open(struct open_file *f, ...);
static int fw_close(struct open_file *f);
static int fw_print(int verbose);
@ -210,7 +210,7 @@ fw_cleanup()
}
static int
fw_strategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size,
fw_strategy(void *devdata, int rw, daddr_t dblk, size_t size,
char *buf, size_t *rsize)
{
return (EIO);

View File

@ -95,9 +95,9 @@ static int nbcinfo = 0;
static int bc_read(int unit, daddr_t dblk, int blks, caddr_t dest);
static int bc_init(void);
static int bc_strategy(void *devdata, int flag, daddr_t dblk,
size_t offset, size_t size, char *buf, size_t *rsize);
size_t size, char *buf, size_t *rsize);
static int bc_realstrategy(void *devdata, int flag, daddr_t dblk,
size_t offset, size_t size, char *buf, size_t *rsize);
size_t size, char *buf, size_t *rsize);
static int bc_open(struct open_file *f, ...);
static int bc_close(struct open_file *f);
static int bc_print(int verbose);
@ -237,7 +237,7 @@ bc_close(struct open_file *f)
}
static int
bc_strategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size,
bc_strategy(void *devdata, int rw, daddr_t dblk, size_t size,
char *buf, size_t *rsize)
{
struct bcache_devdata bcd;
@ -248,11 +248,11 @@ bc_strategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size,
bcd.dv_devdata = devdata;
bcd.dv_cache = BC(dev).bc_bcache;
return (bcache_strategy(&bcd, rw, dblk, offset, size, buf, rsize));
return (bcache_strategy(&bcd, rw, dblk, size, buf, rsize));
}
static int
bc_realstrategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size,
bc_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size,
char *buf, size_t *rsize)
{
struct i386_devdesc *dev;

View File

@ -128,10 +128,10 @@ static int bd_write(struct disk_devdesc *dev, daddr_t dblk, int blks,
static int bd_int13probe(struct bdinfo *bd);
static int bd_init(void);
static int bd_strategy(void *devdata, int flag, daddr_t dblk, size_t offset,
size_t size, char *buf, size_t *rsize);
static int bd_realstrategy(void *devdata, int flag, daddr_t dblk, size_t offset,
size_t size, char *buf, size_t *rsize);
static int bd_strategy(void *devdata, int flag, daddr_t dblk, size_t size,
char *buf, size_t *rsize);
static int bd_realstrategy(void *devdata, int flag, daddr_t dblk, size_t size,
char *buf, size_t *rsize);
static int bd_open(struct open_file *f, ...);
static int bd_close(struct open_file *f);
static int bd_ioctl(struct open_file *f, u_long cmd, void *data);
@ -502,7 +502,7 @@ bd_ioctl(struct open_file *f, u_long cmd, void *data)
}
static int
bd_strategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size,
bd_strategy(void *devdata, int rw, daddr_t dblk, size_t size,
char *buf, size_t *rsize)
{
struct bcache_devdata bcd;
@ -512,12 +512,12 @@ bd_strategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size,
bcd.dv_strategy = bd_realstrategy;
bcd.dv_devdata = devdata;
bcd.dv_cache = BD(dev).bd_bcache;
return (bcache_strategy(&bcd, rw, dblk + dev->d_offset, offset,
return (bcache_strategy(&bcd, rw, dblk + dev->d_offset,
size, buf, rsize));
}
static int
bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size,
bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size,
char *buf, size_t *rsize)
{
struct disk_devdesc *dev = (struct disk_devdesc *)devdata;

View File

@ -72,7 +72,7 @@ static void bangpxe_call(int func);
static int pxe_init(void);
static int pxe_strategy(void *devdata, int flag, daddr_t dblk,
size_t offset, size_t size, char *buf, size_t *rsize);
size_t size, char *buf, size_t *rsize);
static int pxe_open(struct open_file *f, ...);
static int pxe_close(struct open_file *f);
static int pxe_print(int verbose);
@ -247,8 +247,8 @@ pxe_init(void)
static int
pxe_strategy(void *devdata, int flag, daddr_t dblk, size_t offset, size_t size,
char *buf, size_t *rsize)
pxe_strategy(void *devdata, int flag, daddr_t dblk, size_t size,
char *buf, size_t *rsize)
{
return (EIO);
}

View File

@ -45,7 +45,7 @@ static int beri_cfi_disk_init(void);
static int beri_cfi_disk_open(struct open_file *, ...);
static int beri_cfi_disk_close(struct open_file *);
static void beri_cfi_disk_cleanup(void);
static int beri_cfi_disk_strategy(void *, int, daddr_t, size_t, size_t,
static int beri_cfi_disk_strategy(void *, int, daddr_t, size_t,
char *, size_t *);
static int beri_cfi_disk_print(int);
@ -69,8 +69,8 @@ beri_cfi_disk_init(void)
}
static int
beri_cfi_disk_strategy(void *devdata, int flag, daddr_t dblk, size_t offset,
size_t size, char *buf, size_t *rsizep)
beri_cfi_disk_strategy(void *devdata, int flag, daddr_t dblk, size_t size,
char *buf, size_t *rsizep)
{
int error;

View File

@ -45,7 +45,7 @@ static int beri_sdcard_disk_init(void);
static int beri_sdcard_disk_open(struct open_file *, ...);
static int beri_sdcard_disk_close(struct open_file *);
static void beri_sdcard_disk_cleanup(void);
static int beri_sdcard_disk_strategy(void *, int, daddr_t, size_t, size_t,
static int beri_sdcard_disk_strategy(void *, int, daddr_t, size_t,
char *, size_t *);
static int beri_sdcard_disk_print(int);
@ -69,8 +69,8 @@ beri_sdcard_disk_init(void)
}
static int
beri_sdcard_disk_strategy(void *devdata, int flag, daddr_t dblk, size_t offset,
size_t size, char *buf, size_t *rsizep)
beri_sdcard_disk_strategy(void *devdata, int flag, daddr_t dblk, size_t size,
char *buf, size_t *rsizep)
{
int error;

View File

@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$");
static int ofwd_init(void);
static int ofwd_strategy(void *devdata, int flag, daddr_t dblk,
size_t offset, size_t size, char *buf, size_t *rsize);
size_t size, char *buf, size_t *rsize);
static int ofwd_open(struct open_file *f, ...);
static int ofwd_close(struct open_file *f);
static int ofwd_ioctl(struct open_file *f, u_long cmd, void *data);
@ -83,8 +83,8 @@ ofwd_init(void)
}
static int
ofwd_strategy(void *devdata, int flag __unused, daddr_t dblk, size_t offset,
size_t size, char *buf, size_t *rsize)
ofwd_strategy(void *devdata, int flag __unused, daddr_t dblk, size_t size,
char *buf, size_t *rsize)
{
struct ofw_devdesc *dp = (struct ofw_devdesc *)devdata;
daddr_t pos;

View File

@ -94,9 +94,9 @@ static int nbcinfo = 0;
static int bc_read(int unit, daddr_t dblk, int blks, caddr_t dest);
static int bc_init(void);
static int bc_strategy(void *devdata, int flag, daddr_t dblk,
size_t offset, size_t size, char *buf, size_t *rsize);
size_t size, char *buf, size_t *rsize);
static int bc_realstrategy(void *devdata, int flag, daddr_t dblk,
size_t offset, size_t size, char *buf, size_t *rsize);
size_t size, char *buf, size_t *rsize);
static int bc_open(struct open_file *f, ...);
static int bc_close(struct open_file *f);
static int bc_print(int verbose);
@ -233,7 +233,7 @@ bc_close(struct open_file *f)
}
static int
bc_strategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size,
bc_strategy(void *devdata, int rw, daddr_t dblk, size_t size,
char *buf, size_t *rsize)
{
struct bcache_devdata bcd;
@ -244,11 +244,11 @@ bc_strategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size,
bcd.dv_devdata = devdata;
bcd.dv_cache = BC(dev).bc_bcache;
return (bcache_strategy(&bcd, rw, dblk, offset, size, buf, rsize));
return (bcache_strategy(&bcd, rw, dblk, size, buf, rsize));
}
static int
bc_realstrategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size,
bc_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size,
char *buf, size_t *rsize)
{
struct i386_devdesc *dev;

View File

@ -118,9 +118,9 @@ static int bd_printbsdslice(struct open_disk *od, daddr_t offset,
static int bd_init(void);
static int bd_strategy(void *devdata, int flag, daddr_t dblk,
size_t offset, size_t size, char *buf, size_t *rsize);
size_t size, char *buf, size_t *rsize);
static int bd_realstrategy(void *devdata, int flag, daddr_t dblk,
size_t offset, size_t size, char *buf, size_t *rsize);
size_t size, char *buf, size_t *rsize);
static int bd_open(struct open_file *f, ...);
static int bd_close(struct open_file *f);
static int bd_print(int verbose);
@ -746,7 +746,7 @@ bd_closedisk(struct open_disk *od)
}
static int
bd_strategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size,
bd_strategy(void *devdata, int rw, daddr_t dblk, size_t size,
char *buf, size_t *rsize)
{
struct bcache_devdata bcd;
@ -756,12 +756,11 @@ bd_strategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size,
bcd.dv_strategy = bd_realstrategy;
bcd.dv_devdata = devdata;
bcd.dv_cache = BD(dev).bd_bcache;
return(bcache_strategy(&bcd, rw, dblk+od->od_boff, offset,
size, buf, rsize));
return(bcache_strategy(&bcd, rw, dblk+od->od_boff, size, buf, rsize));
}
static int
bd_realstrategy(void *devdata, int rw, daddr_t dblk, size_t offset,
bd_realstrategy(void *devdata, int rw, daddr_t dblk,
size_t size, char *buf, size_t *rsize)
{
struct open_disk *od = (struct open_disk *)(((struct i386_devdesc *)devdata)->d_kind.biosdisk.data);

View File

@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$");
static int hostdisk_init(void);
static int hostdisk_strategy(void *devdata, int flag, daddr_t dblk,
size_t offset, size_t size, char *buf, size_t *rsize);
size_t size, char *buf, size_t *rsize);
static int hostdisk_open(struct open_file *f, ...);
static int hostdisk_close(struct open_file *f);
static int hostdisk_ioctl(struct open_file *f, u_long cmd, void *data);
@ -58,8 +58,8 @@ hostdisk_init(void)
}
static int
hostdisk_strategy(void *devdata, int flag, daddr_t dblk, size_t offset,
size_t size, char *buf, size_t *rsize)
hostdisk_strategy(void *devdata, int flag, daddr_t dblk, size_t size,
char *buf, size_t *rsize)
{
struct devdesc *desc = devdata;
daddr_t pos;

View File

@ -46,7 +46,7 @@
static int ps3cdrom_init(void);
static int ps3cdrom_strategy(void *devdata, int flag, daddr_t dblk,
size_t offset, size_t size, char *buf, size_t *rsize);
size_t size, char *buf, size_t *rsize);
static int ps3cdrom_open(struct open_file *f, ...);
static int ps3cdrom_close(struct open_file *f);
static int ps3cdrom_print(int verbose);
@ -76,7 +76,7 @@ static int ps3cdrom_init(void)
}
static int ps3cdrom_strategy(void *devdata, int flag, daddr_t dblk,
size_t offset, size_t size, char *buf, size_t *rsize)
size_t size, char *buf, size_t *rsize)
{
struct ps3_devdesc *dev = (struct ps3_devdesc *) devdata;
int err;

View File

@ -58,7 +58,7 @@ static void ps3disk_uuid_letoh(uuid_t *uuid);
static int ps3disk_init(void);
static int ps3disk_strategy(void *devdata, int flag, daddr_t dblk,
size_t offset, size_t size, char *buf, size_t *rsize);
size_t size, char *buf, size_t *rsize);
static int ps3disk_open(struct open_file *f, ...);
static int ps3disk_close(struct open_file *f);
static int ps3disk_print(int verbose);
@ -109,7 +109,7 @@ static int ps3disk_init(void)
}
static int ps3disk_strategy(void *devdata, int flag, daddr_t dblk,
size_t offset, size_t size, char *buf, size_t *rsize)
size_t size, char *buf, size_t *rsize)
{
struct ps3_devdesc *dev = (struct ps3_devdesc *) devdata;
struct open_dev *od = (struct open_dev *) dev->d_disk.data;

View File

@ -73,8 +73,7 @@ static int stor_readdev(struct disk_devdesc *, daddr_t, size_t, char *);
/* devsw I/F */
static int stor_init(void);
static int stor_strategy(void *, int, daddr_t, size_t, size_t, char *,
size_t *);
static int stor_strategy(void *, int, daddr_t, size_t, char *, size_t *);
static int stor_open(struct open_file *, ...);
static int stor_close(struct open_file *);
static int stor_ioctl(struct open_file *f, u_long cmd, void *data);
@ -144,7 +143,7 @@ stor_cleanup(void)
}
static int
stor_strategy(void *devdata, int rw, daddr_t blk, size_t offset, size_t size,
stor_strategy(void *devdata, int rw, daddr_t blk, size_t size,
char *buf, size_t *rsize)
{
struct disk_devdesc *dev = (struct disk_devdesc *)devdata;

View File

@ -48,8 +48,7 @@ static int umass_disk_open(struct open_file *,...);
static int umass_disk_close(struct open_file *);
static void umass_disk_cleanup(void);
static int umass_disk_ioctl(struct open_file *, u_long, void *);
static int umass_disk_strategy(void *, int, daddr_t, size_t, size_t, char *,
size_t *);
static int umass_disk_strategy(void *, int, daddr_t, size_t, char *, size_t *);
static int umass_disk_print(int);
struct devsw umass_disk = {
@ -85,8 +84,8 @@ umass_disk_init(void)
}
static int
umass_disk_strategy(void *devdata, int flag, daddr_t dblk, size_t offset,
size_t size, char *buf, size_t *rsizep)
umass_disk_strategy(void *devdata, int flag, daddr_t dblk, size_t size,
char *buf, size_t *rsizep)
{
if (umass_uaa.device == NULL)
return (ENXIO);

View File

@ -171,8 +171,8 @@ host_dev_close(struct open_file *f)
}
static int
host_dev_strategy(void *devdata, int rw, daddr_t dblk, size_t offset,
size_t size, char *buf, size_t *rsize)
host_dev_strategy(void *devdata, int rw, daddr_t dblk, size_t size,
char *buf, size_t *rsize)
{
return (ENOSYS);

View File

@ -54,9 +54,9 @@ static struct userdisk_info *ud_info;
static int userdisk_init(void);
static void userdisk_cleanup(void);
static int userdisk_strategy(void *devdata, int flag, daddr_t dblk,
size_t offset, size_t size, char *buf, size_t *rsize);
size_t size, char *buf, size_t *rsize);
static int userdisk_realstrategy(void *devdata, int flag, daddr_t dblk,
size_t offset, size_t size, char *buf, size_t *rsize);
size_t size, char *buf, size_t *rsize);
static int userdisk_open(struct open_file *f, ...);
static int userdisk_close(struct open_file *f);
static int userdisk_ioctl(struct open_file *f, u_long cmd, void *data);
@ -189,8 +189,8 @@ userdisk_close(struct open_file *f)
}
static int
userdisk_strategy(void *devdata, int rw, daddr_t dblk, size_t offset,
size_t size, char *buf, size_t *rsize)
userdisk_strategy(void *devdata, int rw, daddr_t dblk, size_t size,
char *buf, size_t *rsize)
{
struct bcache_devdata bcd;
struct disk_devdesc *dev;
@ -199,13 +199,13 @@ userdisk_strategy(void *devdata, int rw, daddr_t dblk, size_t offset,
bcd.dv_strategy = userdisk_realstrategy;
bcd.dv_devdata = devdata;
bcd.dv_cache = ud_info[dev->d_unit].ud_bcache;
return (bcache_strategy(&bcd, rw, dblk + dev->d_offset, offset,
return (bcache_strategy(&bcd, rw, dblk + dev->d_offset,
size, buf, rsize));
}
static int
userdisk_realstrategy(void *devdata, int rw, daddr_t dblk, size_t offset,
size_t size, char *buf, size_t *rsize)
userdisk_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size,
char *buf, size_t *rsize)
{
struct disk_devdesc *dev = devdata;
uint64_t off;

View File

@ -589,7 +589,7 @@ zfs_dev_close(struct open_file *f)
}
static int
zfs_dev_strategy(void *devdata, int rw, daddr_t dblk, size_t offset, size_t size, char *buf, size_t *rsize)
zfs_dev_strategy(void *devdata, int rw, daddr_t dblk, size_t size, char *buf, size_t *rsize)
{
return (ENOSYS);