Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/news68k/news68k Make readdisklabel(9) return more u...



details:   https://anonhg.NetBSD.org/src/rev/b0a031041302
branches:  trunk
changeset: 581091:b0a031041302
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Tue May 24 10:06:43 2005 +0000

description:
Make readdisklabel(9) return more usable default label
if disk doesn't have disklabel.

diffstat:

 sys/arch/news68k/news68k/disksubr.c |  23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

diffs (47 lines):

diff -r 27b9ae2d88ad -r b0a031041302 sys/arch/news68k/news68k/disksubr.c
--- a/sys/arch/news68k/news68k/disksubr.c       Tue May 24 09:49:55 2005 +0000
+++ b/sys/arch/news68k/news68k/disksubr.c       Tue May 24 10:06:43 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disksubr.c,v 1.20 2005/05/24 09:49:55 tsutsui Exp $    */
+/*     $NetBSD: disksubr.c,v 1.21 2005/05/24 10:06:43 tsutsui Exp $    */
 
 /*
  * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.20 2005/05/24 09:49:55 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.21 2005/05/24 10:06:43 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -56,13 +56,24 @@
        struct buf *bp;
        struct disklabel *dlp;
        char *msg = NULL;
+       int i;
 
+       if (lp->d_secsize == 0)
+               lp->d_secsize = DEV_BSIZE;
        if (lp->d_secperunit == 0)
                lp->d_secperunit = 0x1fffffff;
-       lp->d_npartitions = 1;
-       if (lp->d_partitions[0].p_size == 0)
-               lp->d_partitions[0].p_size = 0x1fffffff;
-       lp->d_partitions[0].p_offset = 0;
+       if (lp->d_npartitions < RAW_PART + 1)
+               lp->d_npartitions = RAW_PART + 1;
+       for (i = 0; i < RAW_PART; i++) {
+               lp->d_partitions[i].p_size = 0;
+               lp->d_partitions[i].p_offset = 0;
+       }
+       if (lp->d_partitions[RAW_PART].p_size == 0)
+               lp->d_partitions[RAW_PART].p_size = lp->d_secperunit;
+       lp->d_partitions[RAW_PART].p_offset = 0;
+
+       lp->d_partitions[0].p_size = lp->d_partitions[RAW_PART].p_size;
+       lp->d_partitions[0].p_fstype = FS_BSDFFS;
 
        bp = geteblk((int)lp->d_secsize);
        bp->b_dev = dev;



Home | Main Index | Thread Index | Old Index