diff options
| author | Ed Maste <emaste@FreeBSD.org> | 2017-05-26 15:49:20 +0000 |
|---|---|---|
| committer | Ed Maste <emaste@FreeBSD.org> | 2017-05-26 15:49:20 +0000 |
| commit | b79f050a884c1442e8ead094fa600c0e505e2b06 (patch) | |
| tree | e918dcc42a4a1e1a46276e63f2ee35e3f1249f2f /usr.sbin/makefs/ffs | |
| parent | 32ecf81aff79682a76602a1053975f62d3282767 (diff) | |
Notes
Diffstat (limited to 'usr.sbin/makefs/ffs')
| -rw-r--r-- | usr.sbin/makefs/ffs/buf.c | 4 | ||||
| -rw-r--r-- | usr.sbin/makefs/ffs/mkfs.c | 8 |
2 files changed, 5 insertions, 7 deletions
diff --git a/usr.sbin/makefs/ffs/buf.c b/usr.sbin/makefs/ffs/buf.c index 5a0fa8acee797..2820bcafa0e0a 100644 --- a/usr.sbin/makefs/ffs/buf.c +++ b/usr.sbin/makefs/ffs/buf.c @@ -68,7 +68,7 @@ bread(struct vnode *vp, daddr_t blkno, int size, struct ucred *u1 __unused, printf("%s: blkno %lld size %d\n", __func__, (long long)blkno, size); *bpp = getblk(vp, blkno, size, 0, 0, 0); - offset = (*bpp)->b_blkno * fsinfo->sectorsize; + offset = (*bpp)->b_blkno * fsinfo->sectorsize + fsinfo->offset; if (debug & DEBUG_BUF_BREAD) printf("%s: blkno %lld offset %lld bcount %ld\n", __func__, (long long)(*bpp)->b_blkno, (long long) offset, @@ -128,7 +128,7 @@ bwrite(struct buf *bp) fsinfo_t *fs = bp->b_fs; assert (bp != NULL); - offset = bp->b_blkno * fs->sectorsize; + offset = bp->b_blkno * fs->sectorsize + fs->offset; if (debug & DEBUG_BUF_BWRITE) printf("bwrite: blkno %lld offset %lld bcount %ld\n", (long long)bp->b_blkno, (long long) offset, diff --git a/usr.sbin/makefs/ffs/mkfs.c b/usr.sbin/makefs/ffs/mkfs.c index bf70f3d09a04c..3be9c6edcce4c 100644 --- a/usr.sbin/makefs/ffs/mkfs.c +++ b/usr.sbin/makefs/ffs/mkfs.c @@ -774,8 +774,7 @@ ffs_rdfs(daddr_t bno, int size, void *bf, const fsinfo_t *fsopts) int n; off_t offset; - offset = bno; - offset *= fsopts->sectorsize; + offset = bno * fsopts->sectorsize + fsopts->offset; if (lseek(fsopts->fd, offset, SEEK_SET) < 0) err(1, "%s: seek error for sector %lld", __func__, (long long)bno); @@ -799,11 +798,10 @@ ffs_wtfs(daddr_t bno, int size, void *bf, const fsinfo_t *fsopts) int n; off_t offset; - offset = bno; - offset *= fsopts->sectorsize; + offset = bno * fsopts->sectorsize + fsopts->offset; if (lseek(fsopts->fd, offset, SEEK_SET) < 0) err(1, "%s: seek error for sector %lld", __func__, - (long long)bno ); + (long long)bno); n = write(fsopts->fd, bf, size); if (n == -1) err(1, "%s: write error for sector %lld", __func__, |
