Module Name: src
Committed By: tsutsui
Date: Thu Apr 16 14:46:34 UTC 2009
Modified Files:
src/sys/dev: md_root.c
Log Message:
- 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
To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/md_root.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/md_root.c
diff -u src/sys/dev/md_root.c:1.16 src/sys/dev/md_root.c:1.17
--- src/sys/dev/md_root.c:1.16 Fri Feb 6 18:50:29 2009
+++ src/sys/dev/md_root.c Thu Apr 16 14:46:33 2009
@@ -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 @@
#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[] = {
#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 @@
* 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 @@
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 @@
/*
* 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 */