Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/makefs/msdos use pcbmap instead of the open coded h...



details:   https://anonhg.NetBSD.org/src/rev/2974e8004397
branches:  trunk
changeset: 784409:2974e8004397
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Jan 28 00:16:48 2013 +0000

description:
use pcbmap instead of the open coded hack now the pcbmap works.

diffstat:

 usr.sbin/makefs/msdos/msdosfs_vnops.c |  25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

diffs (57 lines):

diff -r 9d8a305f1cb1 -r 2974e8004397 usr.sbin/makefs/msdos/msdosfs_vnops.c
--- a/usr.sbin/makefs/msdos/msdosfs_vnops.c     Mon Jan 28 00:16:24 2013 +0000
+++ b/usr.sbin/makefs/msdos/msdosfs_vnops.c     Mon Jan 28 00:16:48 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msdosfs_vnops.c,v 1.12 2013/01/27 22:52:19 christos Exp $ */
+/*     $NetBSD: msdosfs_vnops.c,v 1.13 2013/01/28 00:16:48 christos Exp $ */
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -51,7 +51,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.12 2013/01/27 22:52:19 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.13 2013/01/28 00:16:48 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/mman.h>
@@ -424,6 +424,7 @@
        struct msdosfsmount *pmp = dep->de_pmp;
        struct buf *bp;
        char *dat;
+       u_long cn = 0;
 
        DPRINTF(("%s(diroff %lu, dirclust %lu, startcluster %lu)\n", __func__,
            dep->de_diroffset, dep->de_dirclust, dep->de_StartCluster));
@@ -464,17 +465,23 @@
        for (offs = 0; offs < nsize;) {
                int blsize, cpsize;
                daddr_t bn;
-               u_long lbn = dep->de_StartCluster;
                u_long on = offs & pmp->pm_crbomask;
-
-               if (lbn == MSDOSFSROOT) {
-                       DPRINTF(("%s: bad lbn %lu", __func__, lbn));
+#ifdef HACK
+               cn = dep->de_StartCluster;
+               if (cn == MSDOSFSROOT) {
+                       DPRINTF(("%s: bad lbn %lu", __func__, cn));
                        goto out;
                }
-               bn = cntobn(pmp, lbn);
+               bn = cntobn(pmp, cn);
                blsize = pmp->pm_bpcluster;
-               DPRINTF(("%s(lbn=%lu, bn=%llu/%llu, blsize=%d)\n", __func__,
-                   lbn, (unsigned long long)bn,
+#else
+               if ((error = pcbmap(dep, cn++, &bn, NULL, &blsize)) != 0) {
+                       DPRINTF(("%s: pcbmap %lu", __func__, bn));
+                       goto out;
+               }
+#endif
+               DPRINTF(("%s(cn=%lu, bn=%llu/%llu, blsize=%d)\n", __func__,
+                   cn, (unsigned long long)bn,
                    (unsigned long long)de_bn2kb(pmp, bn), blsize));
                if ((error = bread(pmp->pm_devvp, de_bn2kb(pmp, bn), blsize,
                    NULL, 0, &bp)) != 0) {



Home | Main Index | Thread Index | Old Index