On 2005-09-25 14:00, Giorgos Keramidas <[EMAIL PROTECTED]> wrote:
> On 2005-09-24 20:26, Frank Mayhar <[EMAIL PROTECTED]> wrote:
> > I've been using libufs as the I/O mechanism for my (heavy) modification
> > of sysutils/ffsrecov.  It's working to my needs and now I'm poking at
> > other bits and pieces to maybe get it suitable for release into the
> > wild.  I just looked at cgread() to see what it does and noticed that
> > there seems to be a redundant line:
> >
> >     .
> >     .
> >         if (c >= fs->fs_ncg) {
> >                 return (0);
> >         }
> >         ccg = fsbtodb(fs, cgtod(fs, c)) * disk->d_bsize;
> >         if (bread(disk, fsbtodb(fs, cgtod(fs, c)), disk->d_cgunion.d_buf,
> >     .
> >     .
> >
> > That assignment up there looks redundant, as ccg is never used.  I
> > suspect that it's a relic of an old lseek()/read() pair that's long
> > gone.
>
> It's probably easy to verify that without this assignment 'ccg' is an
> unused var:
>
>       - Comment it out
>       - Rebuild with an elevated WARNS level
>
> if a warning about 'unused ccg var' is printed, then you are certain
> that ccg was only used for the assignment.

FWIW,
libufs built with the following patch seems to pass at least a build
test fine, even with WARNS=6

%%%
Index: cgroup.c
===================================================================
RCS file: /home/ncvs/src/lib/libufs/cgroup.c,v
retrieving revision 1.3
diff -u -r1.3 cgroup.c
--- cgroup.c    9 Jun 2003 09:32:29 -0000       1.3
+++ cgroup.c    26 Sep 2005 02:09:07 -0000
@@ -55,14 +55,12 @@
 cgread1(struct uufsd *disk, int c)
 {
        struct fs *fs;
-       off_t ccg;
 
        fs = &disk->d_fs;
 
        if (c >= fs->fs_ncg) {
                return (0);
        }
-       ccg = fsbtodb(fs, cgtod(fs, c)) * disk->d_bsize;
        if (bread(disk, fsbtodb(fs, cgtod(fs, c)), disk->d_cgunion.d_buf,
            fs->fs_bsize) == -1) {
                ERROR(disk, "unable to read cylinder group");
%%%
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to