Sun Jan 4 02:21:49 2009 UTC ()
fix rootdev format.


(christos)
diff -r1.335.2.5 -r1.335.2.6 src/sys/kern/vfs_subr.c

cvs diff -r1.335.2.5 -r1.335.2.6 src/sys/kern/vfs_subr.c (expand / switch to unified diff)

--- src/sys/kern/vfs_subr.c 2008/12/30 18:50:25 1.335.2.5
+++ src/sys/kern/vfs_subr.c 2009/01/04 02:21:49 1.335.2.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: vfs_subr.c,v 1.335.2.5 2008/12/30 18:50:25 christos Exp $ */ 1/* $NetBSD: vfs_subr.c,v 1.335.2.6 2009/01/04 02:21:49 christos Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, 8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 * NASA Ames Research Center, by Charles M. Hannum, and by Andrew Doran. 9 * NASA Ames Research Center, by Charles M. Hannum, and by Andrew Doran.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -71,27 +71,27 @@ @@ -71,27 +71,27 @@
71 * 71 *
72 * At nearly all points it is known that v_usecount could be zero, the 72 * At nearly all points it is known that v_usecount could be zero, the
73 * vnode interlock will be held. 73 * vnode interlock will be held.
74 * 74 *
75 * To change v_usecount away from zero, the interlock must be held. To 75 * To change v_usecount away from zero, the interlock must be held. To
76 * change from a non-zero value to zero, again the interlock must be 76 * change from a non-zero value to zero, again the interlock must be
77 * held. 77 * held.
78 * 78 *
79 * Changing the usecount from a non-zero value to a non-zero value can 79 * Changing the usecount from a non-zero value to a non-zero value can
80 * safely be done using atomic operations, without the interlock held. 80 * safely be done using atomic operations, without the interlock held.
81 */ 81 */
82 82
83#include <sys/cdefs.h> 83#include <sys/cdefs.h>
84__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.335.2.5 2008/12/30 18:50:25 christos Exp $"); 84__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.335.2.6 2009/01/04 02:21:49 christos Exp $");
85 85
86#include "opt_ddb.h" 86#include "opt_ddb.h"
87#include "opt_compat_netbsd.h" 87#include "opt_compat_netbsd.h"
88#include "opt_compat_43.h" 88#include "opt_compat_43.h"
89 89
90#include <sys/param.h> 90#include <sys/param.h>
91#include <sys/systm.h> 91#include <sys/systm.h>
92#include <sys/conf.h> 92#include <sys/conf.h>
93#include <sys/proc.h> 93#include <sys/proc.h>
94#include <sys/kernel.h> 94#include <sys/kernel.h>
95#include <sys/mount.h> 95#include <sys/mount.h>
96#include <sys/fcntl.h> 96#include <sys/fcntl.h>
97#include <sys/vnode.h> 97#include <sys/vnode.h>
@@ -2312,27 +2312,28 @@ vfs_shutdown(void) @@ -2312,27 +2312,28 @@ vfs_shutdown(void)
2312int 2312int
2313vfs_mountroot(void) 2313vfs_mountroot(void)
2314{ 2314{
2315 struct vfsops *v; 2315 struct vfsops *v;
2316 int error = ENODEV; 2316 int error = ENODEV;
2317 2317
2318 if (root_device == NULL) 2318 if (root_device == NULL)
2319 panic("vfs_mountroot: root device unknown"); 2319 panic("vfs_mountroot: root device unknown");
2320 2320
2321 switch (device_class(root_device)) { 2321 switch (device_class(root_device)) {
2322 case DV_IFNET: 2322 case DV_IFNET:
2323 if (rootdev != NODEV) 2323 if (rootdev != NODEV)
2324 panic("vfs_mountroot: rootdev set for DV_IFNET " 2324 panic("vfs_mountroot: rootdev set for DV_IFNET "
2325 "(0x%llx -> %llu,%llu)", rootdev, 2325 "(0x%llx -> %llu,%llu)",
 2326 (unsigned long long)rootdev,
2326 (unsigned long long)major(rootdev), 2327 (unsigned long long)major(rootdev),
2327 (unsigned long long)minor(rootdev)); 2328 (unsigned long long)minor(rootdev));
2328 break; 2329 break;
2329 2330
2330 case DV_DISK: 2331 case DV_DISK:
2331 if (rootdev == NODEV) 2332 if (rootdev == NODEV)
2332 panic("vfs_mountroot: rootdev not set for DV_DISK"); 2333 panic("vfs_mountroot: rootdev not set for DV_DISK");
2333 if (bdevvp(rootdev, &rootvp)) 2334 if (bdevvp(rootdev, &rootvp))
2334 panic("vfs_mountroot: can't get vnode for rootdev"); 2335 panic("vfs_mountroot: can't get vnode for rootdev");
2335 error = VOP_OPEN(rootvp, FREAD, FSCRED); 2336 error = VOP_OPEN(rootvp, FREAD, FSCRED);
2336 if (error) { 2337 if (error) {
2337 printf("vfs_mountroot: can't open root device\n"); 2338 printf("vfs_mountroot: can't open root device\n");
2338 return (error); 2339 return (error);
@@ -2377,27 +2378,27 @@ vfs_mountroot(void) @@ -2377,27 +2378,27 @@ vfs_mountroot(void)
2377 mutex_enter(&vfs_list_lock); 2378 mutex_enter(&vfs_list_lock);
2378 v->vfs_refcount--; 2379 v->vfs_refcount--;
2379 if (!error) { 2380 if (!error) {
2380 aprint_normal("root file system type: %s\n", 2381 aprint_normal("root file system type: %s\n",
2381 v->vfs_name); 2382 v->vfs_name);
2382 break; 2383 break;
2383 } 2384 }
2384 } 2385 }
2385 mutex_exit(&vfs_list_lock); 2386 mutex_exit(&vfs_list_lock);
2386 2387
2387 if (v == NULL) { 2388 if (v == NULL) {
2388 printf("no file system for %s", device_xname(root_device)); 2389 printf("no file system for %s", device_xname(root_device));
2389 if (device_class(root_device) == DV_DISK) 2390 if (device_class(root_device) == DV_DISK)
2390 printf(" (dev 0x%llx)", rootdev); 2391 printf(" (dev 0x%llx)", (unsigned long long)rootdev);
2391 printf("\n"); 2392 printf("\n");
2392 error = EFTYPE; 2393 error = EFTYPE;
2393 } 2394 }
2394 2395
2395done: 2396done:
2396 if (error && device_class(root_device) == DV_DISK) { 2397 if (error && device_class(root_device) == DV_DISK) {
2397 VOP_CLOSE(rootvp, FREAD, FSCRED); 2398 VOP_CLOSE(rootvp, FREAD, FSCRED);
2398 vrele(rootvp); 2399 vrele(rootvp);
2399 } 2400 }
2400 return (error); 2401 return (error);
2401} 2402}
2402 2403
2403/* 2404/*