makefs: make buf generic
it has nothing to do with ffs and will eventually be moved. gc sectorsize. NetBSD versions: ffs.c 1.58 ffs/buf.c 1.14 1.18 ffs/buf.h 1.8 Obtained from: NetBSD Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
63128851f3
commit
15fc093acc
@ -144,7 +144,6 @@ static void *ffs_build_dinode2(struct ufs2_dinode *, dirbuf_t *, fsnode *,
|
||||
|
||||
|
||||
|
||||
int sectorsize; /* XXX: for buf.c::getblk() */
|
||||
/* publicly visible functions */
|
||||
|
||||
void
|
||||
@ -427,8 +426,6 @@ ffs_validate(const char *dir, fsnode *root, fsinfo_t *fsopts)
|
||||
printf("ffs_validate: dir %s; %lld bytes, %lld inodes\n",
|
||||
dir, (long long)fsopts->size, (long long)fsopts->inodes);
|
||||
}
|
||||
sectorsize = fsopts->sectorsize; /* XXX - see earlier */
|
||||
|
||||
/* now check calculated sizes vs requested sizes */
|
||||
if (fsopts->maxsize > 0 && fsopts->size > fsopts->maxsize) {
|
||||
errx(1, "`%s' size of %lld is larger than the maxsize of %lld.",
|
||||
|
@ -50,14 +50,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <util.h>
|
||||
|
||||
#include "makefs.h"
|
||||
|
||||
#include <ufs/ufs/dinode.h>
|
||||
#include <ufs/ffs/fs.h>
|
||||
|
||||
#include "ffs/buf.h"
|
||||
#include "ffs/ufs_inode.h"
|
||||
|
||||
extern int sectorsize; /* XXX: from ffs.c & mkfs.c */
|
||||
#include "buf.h"
|
||||
|
||||
TAILQ_HEAD(buftailhead,buf) buftail;
|
||||
|
||||
@ -67,16 +60,15 @@ bread(struct vnode *vp, daddr_t blkno, int size, struct ucred *u1 __unused,
|
||||
{
|
||||
off_t offset;
|
||||
ssize_t rv;
|
||||
struct fs *fs = vp->fs;
|
||||
fsinfo_t *fs = vp->fs;
|
||||
|
||||
assert (fs != NULL);
|
||||
assert (bpp != NULL);
|
||||
|
||||
if (debug & DEBUG_BUF_BREAD)
|
||||
printf("%s: blkno %lld size %d\n", __func__, (long long)blkno,
|
||||
size);
|
||||
*bpp = getblk(vp, blkno, size, 0, 0, 0);
|
||||
offset = (*bpp)->b_blkno * sectorsize; /* XXX */
|
||||
offset = (*bpp)->b_blkno * fs->sectorsize;
|
||||
if (debug & DEBUG_BUF_BREAD)
|
||||
printf("%s: blkno %lld offset %lld bcount %ld\n", __func__,
|
||||
(long long)(*bpp)->b_blkno, (long long) offset,
|
||||
@ -133,9 +125,10 @@ bwrite(struct buf *bp)
|
||||
{
|
||||
off_t offset;
|
||||
ssize_t rv;
|
||||
fsinfo_t *fs = bp->b_fs;
|
||||
|
||||
assert (bp != NULL);
|
||||
offset = bp->b_blkno * sectorsize; /* XXX */
|
||||
offset = bp->b_blkno * fs->sectorsize;
|
||||
if (debug & DEBUG_BUF_BWRITE)
|
||||
printf("bwrite: blkno %lld offset %lld bcount %ld\n",
|
||||
(long long)bp->b_blkno, (long long) offset,
|
||||
@ -184,11 +177,7 @@ getblk(struct vnode *vp, daddr_t blkno, int size, int u1 __unused,
|
||||
static int buftailinitted;
|
||||
struct buf *bp;
|
||||
void *n;
|
||||
int fd = vp->fd;
|
||||
struct fs *fs = vp->fs;
|
||||
|
||||
blkno += vp->offset;
|
||||
assert (fs != NULL);
|
||||
if (debug & DEBUG_BUF_GETBLK)
|
||||
printf("getblk: blkno %lld size %d\n", (long long)blkno, size);
|
||||
|
||||
@ -209,8 +198,8 @@ getblk(struct vnode *vp, daddr_t blkno, int size, int u1 __unused,
|
||||
bp = ecalloc(1, sizeof(*bp));
|
||||
bp->b_bufsize = 0;
|
||||
bp->b_blkno = bp->b_lblkno = blkno;
|
||||
bp->b_fd = fd;
|
||||
bp->b_fs = fs;
|
||||
bp->b_fd = vp->fd;
|
||||
bp->b_fs = vp->fs;
|
||||
bp->b_data = NULL;
|
||||
TAILQ_INSERT_HEAD(&buftail, bp, b_tailq);
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ struct buf {
|
||||
daddr_t b_blkno;
|
||||
daddr_t b_lblkno;
|
||||
int b_fd;
|
||||
struct fs * b_fs;
|
||||
void * b_fs;
|
||||
|
||||
TAILQ_ENTRY(buf) b_tailq;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user