Define BIOSDISK_DEFAULT_SECSIZE in biosdisk_ll.h and replace BIOSDISK_SECSIZE

with it.
This commit is contained in:
junyoung 2005-06-23 20:20:37 +00:00
parent de90d49d68
commit 1bd0f2a02e
3 changed files with 11 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: boot1.c,v 1.7 2005/06/22 15:06:19 junyoung Exp $ */
/* $NetBSD: boot1.c,v 1.8 2005/06/23 20:20:37 junyoung Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: boot1.c,v 1.7 2005/06/22 15:06:19 junyoung Exp $");
__RCSID("$NetBSD: boot1.c,v 1.8 2005/06/23 20:20:37 junyoung Exp $");
#include <lib/libsa/stand.h>
#include <lib/libkern/libkern.h>
@ -51,8 +51,6 @@ __RCSID("$NetBSD: boot1.c,v 1.7 2005/06/22 15:06:19 junyoung Exp $");
#define XSTR(x) #x
#define STR(x) XSTR(x)
#define BIOSDISK_SECSIZE 512 /* XXX */
static uint32_t bios_sector;
static struct biosdisk_ll d;
@ -136,14 +134,15 @@ blkdevstrategy(void *devdata, int flag, daddr_t dblk, size_t size, void *buf, si
if (flag != F_READ)
return EROFS;
if (size & (BIOSDISK_SECSIZE - 1))
if (size & (BIOSDISK_DEFAULT_SECSIZE - 1))
return EINVAL;
if (rsize)
*rsize = size;
if (size != 0 && readsects(&d, bios_sector + dblk,
size / BIOSDISK_SECSIZE, buf, 1) != 0)
size / BIOSDISK_DEFAULT_SECSIZE,
buf, 1) != 0)
return EIO;
return 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: biosdisk_ll.h,v 1.11 2005/06/22 06:06:34 junyoung Exp $ */
/* $NetBSD: biosdisk_ll.h,v 1.12 2005/06/23 20:20:37 junyoung Exp $ */
/*
* Copyright (c) 1996
@ -120,5 +120,7 @@ struct biosdisk_ext13info {
#define EXT13_LOCKABLE 0x0020 /* device is lockable */
#define EXT13_MAXGEOM 0x0040 /* geometry set to max; no media */
#define BIOSDISK_DEFAULT_SECSIZE 512
int set_geometry(struct biosdisk_ll *, struct biosdisk_ext13info *);
int readsects(struct biosdisk_ll *, daddr_t, int, char *, int);

View File

@ -1,4 +1,4 @@
/* $NetBSD: bootinfo_biosgeom.c,v 1.16 2005/06/22 06:09:47 junyoung Exp $ */
/* $NetBSD: bootinfo_biosgeom.c,v 1.17 2005/06/23 20:20:37 junyoung Exp $ */
/*
* Copyright (c) 1997
@ -37,8 +37,6 @@
#include "biosdisk_ll.h"
#include "bootinfo.h"
#define BIOSDISK_SECSIZE 512 /* XXX */
#ifdef BIOSDISK_EXT13INFO_V3
static struct {
char *name;
@ -67,7 +65,7 @@ bi_getbiosgeom(void)
unsigned int cksum;
struct biosdisk_ll d;
struct biosdisk_ext13info ed;
char buf[BIOSDISK_SECSIZE];
char buf[BIOSDISK_DEFAULT_SECSIZE];
nhd = get_harddrives();
#ifdef GEOM_DEBUG
@ -168,7 +166,7 @@ bi_getbiosgeom(void)
}
#endif
for (j = 0, cksum = 0; j < BIOSDISK_SECSIZE; j++)
for (j = 0, cksum = 0; j < BIOSDISK_DEFAULT_SECSIZE; j++)
cksum += buf[j];
bibg->disk[nvalid].cksum = cksum;
memcpy(bibg->disk[nvalid].dosparts, &buf[MBR_PART_OFFSET],