- remove a redundant decl of boothowto; it's in <sys/systm.h>

- replace a magic number passed to format_bytes(9) with explicit strings
- some KNF
This commit is contained in:
tsutsui 2009-04-16 14:46:33 +00:00
parent a8ca89b280
commit 89de08c2ca

View File

@ -1,4 +1,4 @@
/* $NetBSD: md_root.c,v 1.16 2009/02/06 18:50:29 jym Exp $ */
/* $NetBSD: md_root.c,v 1.17 2009/04/16 14:46:33 tsutsui Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: md_root.c,v 1.16 2009/02/06 18:50:29 jym Exp $");
__KERNEL_RCSID(0, "$NetBSD: md_root.c,v 1.17 2009/04/16 14:46:33 tsutsui Exp $");
#include "opt_md.h"
@ -40,8 +40,6 @@ __KERNEL_RCSID(0, "$NetBSD: md_root.c,v 1.16 2009/02/06 18:50:29 jym Exp $");
#include <dev/md.h>
extern int boothowto;
#ifdef MEMORY_DISK_DYNAMIC
#ifdef MEMORY_DISK_IMAGE
#error MEMORY_DISK_DYNAMIC is not compatible with MEMORY_DISK_IMAGE
@ -57,7 +55,7 @@ char *md_root_image;
char md_root_image[] = {
#include "md_root_image.h"
};
u_int32_t md_root_size = sizeof(md_root_image) & ~(DEV_BSIZE - 1);
uint32_t md_root_size = sizeof(md_root_image) & ~(DEV_BSIZE - 1);
#else /* MEMORY_DISK_IMAGE */
@ -70,7 +68,7 @@ u_int32_t md_root_size = sizeof(md_root_image) & ~(DEV_BSIZE - 1);
* This array will be patched to contain a file-system image.
* See the program mdsetimage(8) for details.
*/
u_int32_t md_root_size = ROOTBYTES;
uint32_t md_root_size = ROOTBYTES;
char md_root_image[ROOTBYTES] = "|This is the root ramdisk!\n";
#endif /* MEMORY_DISK_IMAGE */
#endif /* MEMORY_DISK_DYNAMIC */
@ -83,6 +81,7 @@ char md_root_image[ROOTBYTES] = "|This is the root ramdisk!\n";
void
md_root_setconf(char *addr, size_t size)
{
md_is_root = 1;
md_root_image = addr;
md_root_size = size;
@ -92,10 +91,12 @@ md_root_setconf(char *addr, size_t size)
/*
* This is called during pseudo-device attachment.
*/
#define PBUFLEN sizeof("99999 KB")
void
md_attach_hook(int unit, struct md_conf *md)
{
char pbuf[9];
char pbuf[PBUFLEN];
if (unit == 0 && md_is_root) {
/* Setup root ramdisk */