Subject: Re: More on [r]dump
To: Chris Torek <torek@horse.ee.lbl.gov>
From: Havard Eidnes <Havard.Eidnes@runit.sintef.no>
List: netbsd-bugs
Date: 11/17/1993 19:03:55
------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
> Inode numbers do indeed start from 1. Craig Leres and I hacked
> some of this code quite a bit after net.2 and before 4.4BSD---I
> decided I could not stand the inconsitencies between the various
> inode loops, and made them all be of the form:
>
> for (ino = 1; ino < maxino; ino++)
>
> Note that this requires changing the code that sets maxino, which
> currently says something like:
>
> maxino = sblock->fs_ipg * sblock->fs_ncg - 1;
>
> with the `-1' factor existing to make `<=' correct.
>
> This code is tricky and nasty; beware!
Hmm, I should perhaps note that the modification I did was done more on
intuition than based on a thorough understanding of the code. So, let's
see if I got this right:
I now have
for (ino = 1; ino <= maxino; ino++) {
and
maxino = sblock->fs_ipg * sblock->fs_ncg - 1;
Are you telling me that this is a correct combination? (I have only
modified the first of these lines...) Furthermore, I guess (!) that the
other loops going through to maxino should be changed as well to start at 1
instead of 0 and go up to maxino inclusive? If this is correct, I have the
prepared the attached diffs to my NetBSD-current version (a few days old).
(I think the current getino() routine alsy may need a modification, eg.
initialize minino to 1?)
I openly admit that I am in over my head on this one.
- Havard
------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-Description: dump diffs
*** dumpmain.c.old Sun Nov 7 09:40:55 1993
--- dumpmain.c Wed Nov 17 18:56:25 1993
***************
*** 396,400 ****
msg("dumping (Pass III) [directories]\n");
! for (map = dumpdirmap, ino = 0; ino < maxino; ) {
if ((ino % NBBY) == 0)
dirty = *map++;
--- 396,400 ----
msg("dumping (Pass III) [directories]\n");
! for (map = dumpdirmap, ino = 1; ino <= maxino; ) {
if ((ino % NBBY) == 0)
dirty = *map++;
***************
*** 414,418 ****
msg("dumping (Pass IV) [regular files]\n");
! for (map = dumpinomap, ino = 0; ino < maxino; ) {
if ((ino % NBBY) == 0)
dirty = *map++;
--- 414,418 ----
msg("dumping (Pass IV) [regular files]\n");
! for (map = dumpinomap, ino = 1; ino <= maxino; ) {
if ((ino % NBBY) == 0)
dirty = *map++;
*** dumptraverse.c.old Sun Nov 7 09:40:58 1993
--- dumptraverse.c Wed Nov 17 19:00:34 1993
***************
*** 108,112 ****
int anydirskipped = 0;
! for (ino = 0; ino <= maxino; ino++) {
dp = getino(ino);
if ((mode = (dp->di_mode & IFMT)) == 0)
--- 108,112 ----
int anydirskipped = 0;
! for (ino = 1; ino <= maxino; ino++) {
dp = getino(ino);
if ((mode = (dp->di_mode & IFMT)) == 0)
***************
*** 159,163 ****
int ret, change = 0;
! for (map = dumpdirmap, ino = 0; ino < maxino; ) {
if ((ino % NBBY) == 0)
dirty = *map++;
--- 159,163 ----
int ret, change = 0;
! for (map = dumpdirmap, ino = 1; ino <= maxino; ) {
if ((ino % NBBY) == 0)
dirty = *map++;
------- =_aaaaaaaaaa0--
------------------------------------------------------------------------------