diff for src/sys/kern/vfs_subr.c

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

diff for src/sys/kern/vfs_subr.c

antipsychic@hotmail.com
Hello,

Compiling macppc/conf/RAMDISK with 'option DEBUG' enabled fails in  
vfs_subr.c due to vprint not being defined.

Cheers,
Jake



Index: sys/kern/vfs_subr.c
===================================================================
RCS file: /cvs/src/sys/kern/vfs_subr.c,v
retrieving revision 1.134
diff -u -p -r1.134 vfs_subr.c
--- sys/kern/vfs_subr.c 30 Oct 2006 00:34:01 -0000  1.134
+++ sys/kern/vfs_subr.c 16 Nov 2006 18:04:06 -0000
@@ -110,6 +110,10 @@ void vputonfreelist(struct vnode *);

int vflush_vnode(struct vnode *, void *);

+#if defined(DEBUG) || defined(DIAGNOSTIC)
+void vprint(char *, struct vnode *);
+#endif
+
#ifdef DEBUG
void printlockedvnodes(void);
#endif
@@ -1267,7 +1271,7 @@ loop:
     return (count);
}

-#ifdef DIAGNOSTIC
+#if defined(DEBUG) || defined(DIAGNOSTIC)
/*
   * Print out a description of a vnode.
   */

Reply | Threaded
Open this post in threaded view
|

Re: diff for src/sys/kern/vfs_subr.c

Michael Shalayeff-2
On Thu, Nov 16, 2006 at 05:26:27PM -0600, [hidden email] wrote:
> Hello,
re

> Compiling macppc/conf/RAMDISK with 'option DEBUG' enabled fails in  
> vfs_subr.c due to vprint not being defined.

actually this is the main problem:

Index: vnode.h
===================================================================
RCS file: /cvs/src/sys/sys/vnode.h,v
retrieving revision 1.71
diff -u -r1.71 vnode.h
--- vnode.h 2 Aug 2006 21:55:27 -0000 1.71
+++ vnode.h 17 Nov 2006 11:30:48 -0000
@@ -448,9 +448,7 @@
 void vput(struct vnode *);
 int vrecycle(struct vnode *, struct simplelock *, struct proc *);
 void vrele(struct vnode *);
-#ifdef DIAGNOSTIC
 void vprint(char *, struct vnode *);
-#endif
 
 /* vfs_getcwd.c */
 int vfs_getcwd_scandir(struct vnode **, struct vnode **, char **, char *,

--
    paranoic mickey       (my employers have changed but, the name has remained)

Reply | Threaded
Open this post in threaded view
|

Re: diff for src/sys/kern/vfs_subr.c

Tom Cosgrove-2
>>> mickey 17-Nov-06 11:31 >>>
>
> On Thu, Nov 16, 2006 at 05:26:27PM -0600, [hidden email] wrote:
> > Hello,
> re
>
> > Compiling macppc/conf/RAMDISK with 'option DEBUG' enabled fails in  
> > vfs_subr.c due to vprint not being defined.
>
> actually this is the main problem:
>
> Index: vnode.h
> ===================================================================
> RCS file: /cvs/src/sys/sys/vnode.h,v
> retrieving revision 1.71
> diff -u -r1.71 vnode.h
> --- vnode.h 2 Aug 2006 21:55:27 -0000 1.71
> +++ vnode.h 17 Nov 2006 11:30:48 -0000
> @@ -448,9 +448,7 @@
>  void vput(struct vnode *);
>  int vrecycle(struct vnode *, struct simplelock *, struct proc *);
>  void vrele(struct vnode *);
> -#ifdef DIAGNOSTIC
>  void vprint(char *, struct vnode *);
> -#endif

No, because vprint() is currently only defined within #ifdef DIAGNOSTIC
in vfs_subr.c.

And if you remove *that* #ifdef-#endif pair, you will increase the
size of the RAMDISK kernel.

I think the OP is correct, but the declaration of vprint() should be
also be removed from vnode.h.

Tom

Reply | Threaded
Open this post in threaded view
|

Re: diff for src/sys/kern/vfs_subr.c

Miod Vallat
> No, because vprint() is currently only defined within #ifdef DIAGNOSTIC
> in vfs_subr.c.

Put it should be #if defined(DIAGNOSTIC) || defined(DEBUG).

> I think the OP is correct, but the declaration of vprint() should be
> also be removed from vnode.h.

There is no harm in keeping it unconditionally defined in vnode.h. That's
just a prototype, and code outside of vfs_subr.c may want to invoke vprint()
in the future.

Miod

Reply | Threaded
Open this post in threaded view
|

Re: diff for src/sys/kern/vfs_subr.c

Michael Shalayeff-2
In reply to this post by Tom Cosgrove-2
On Fri, Nov 17, 2006 at 03:08:17PM +0000, Tom Cosgrove wrote:

> >>> mickey 17-Nov-06 11:31 >>>
> >
> > On Thu, Nov 16, 2006 at 05:26:27PM -0600, [hidden email] wrote:
> > > Hello,
> > re
> >
> > > Compiling macppc/conf/RAMDISK with 'option DEBUG' enabled fails in  
> > > vfs_subr.c due to vprint not being defined.
> >
> > actually this is the main problem:
> >
> > Index: vnode.h
> > ===================================================================
> > RCS file: /cvs/src/sys/sys/vnode.h,v
> > retrieving revision 1.71
> > diff -u -r1.71 vnode.h
> > --- vnode.h 2 Aug 2006 21:55:27 -0000 1.71
> > +++ vnode.h 17 Nov 2006 11:30:48 -0000
> > @@ -448,9 +448,7 @@
> >  void vput(struct vnode *);
> >  int vrecycle(struct vnode *, struct simplelock *, struct proc *);
> >  void vrele(struct vnode *);
> > -#ifdef DIAGNOSTIC
> >  void vprint(char *, struct vnode *);
> > -#endif
>
> No, because vprint() is currently only defined within #ifdef DIAGNOSTIC
> in vfs_subr.c.
>
> And if you remove *that* #ifdef-#endif pair, you will increase the
> size of the RAMDISK kernel.

what have you been smoking dude?
it's a prototype. hows does that ever increase anything?

> I think the OP is correct, but the declaration of vprint() should be
> also be removed from vnode.h.

yeah. let's get rid of .h files and put all
the prototypes in every .c file that requires 'em!

cu
--
    paranoic mickey       (my employers have changed but, the name has remained)

Reply | Threaded
Open this post in threaded view
|

Re: diff for src/sys/kern/vfs_subr.c

Tom Cosgrove-2
Mickey

You misunderstand me :)

>>> mickey 17-Nov-06 16:42 >>>
>
> > >>> mickey 17-Nov-06 11:31 >>>
> > >
> > > actually this is the main problem:
> > >
> > > Index: vnode.h
> > > ===================================================================
> > > RCS file: /cvs/src/sys/sys/vnode.h,v
> > > retrieving revision 1.71
> > > diff -u -r1.71 vnode.h
> > > --- vnode.h 2 Aug 2006 21:55:27 -0000 1.71
> > > +++ vnode.h 17 Nov 2006 11:30:48 -0000
> > > @@ -448,9 +448,7 @@
> > >  void vput(struct vnode *);
> > >  int vrecycle(struct vnode *, struct simplelock *, struct proc *);
> > >  void vrele(struct vnode *);
> > > -#ifdef DIAGNOSTIC
> > >  void vprint(char *, struct vnode *);
> > > -#endif

That snippet says "the main problem is that vprint() is declared with
#ifdef DIAGNOSTIC".

This is not the main problem.

The main problem is that if you compile with DEBUG but without
DIAGNOSTIC then vfs_subr.c won't compile, because code in #ifdef DEBUG
calls vprint(), but vprint() is only defined when DIAGNOSTIC is defined.

> > No, because vprint() is currently only defined within #ifdef DIAGNOSTIC
> > in vfs_subr.c.

I said that you are wrong about what the main problem is; just removing
the two lines you suggested will not fix the problem.

> > And if you remove *that* #ifdef-#endif pair, you will increase the
> > size of the RAMDISK kernel.
>
> what have you been smoking dude?
> it's a prototype. hows does that ever increase anything?

Read what I said again:

    No, because vprint() is currently only defined within #ifdef
    DIAGNOSTIC in vfs_subr.c.

    And if you remove *that* #ifdef-#endif pair, you will increase the
    size of the RAMDISK kernel.

If you remove the #ifdef DIAGNOSTIC around vprint(), you will increase
the size of the RAMDISK kernel.  This is true.

> > I think the OP is correct, but the declaration of vprint() should be
> > also be removed from vnode.h.
>
> yeah. let's get rid of .h files and put all
> the prototypes in every .c file that requires 'em!

No, but when debugging functions are declared in .c files when certain
compilation options (only) are present, *yes*, let's put the prototypes
in those .c files.

Tom

Reply | Threaded
Open this post in threaded view
|

Re: diff for src/sys/kern/vfs_subr.c

Michael Shalayeff-2
On Fri, Nov 17, 2006 at 05:04:47PM +0000, Tom Cosgrove wrote:
> Mickey
>
> You misunderstand me :)

or did you perhaps? (;

> >>> mickey 17-Nov-06 16:42 >>>
> >
> > > >>> mickey 17-Nov-06 11:31 >>>
> > > >
> > > > actually this is the main problem:
> > > >
> > > > Index: vnode.h
> > > > ===================================================================
> > > > RCS file: /cvs/src/sys/sys/vnode.h,v
> > > > retrieving revision 1.71
> > > > diff -u -r1.71 vnode.h
> > > > --- vnode.h 2 Aug 2006 21:55:27 -0000 1.71
> > > > +++ vnode.h 17 Nov 2006 11:30:48 -0000
> > > > @@ -448,9 +448,7 @@
> > > >  void vput(struct vnode *);
> > > >  int vrecycle(struct vnode *, struct simplelock *, struct proc *);
> > > >  void vrele(struct vnode *);
> > > > -#ifdef DIAGNOSTIC
> > > >  void vprint(char *, struct vnode *);
> > > > -#endif
>
> That snippet says "the main problem is that vprint() is declared with
> #ifdef DIAGNOSTIC".
>
> This is not the main problem.
>
> The main problem is that if you compile with DEBUG but without
> DIAGNOSTIC then vfs_subr.c won't compile, because code in #ifdef DEBUG
> calls vprint(), but vprint() is only defined when DIAGNOSTIC is defined.

olrite .c changes needed too

> > > No, because vprint() is currently only defined within #ifdef DIAGNOSTIC
> > > in vfs_subr.c.
>
> I said that you are wrong about what the main problem is; just removing
> the two lines you suggested will not fix the problem.
>
> > > And if you remove *that* #ifdef-#endif pair, you will increase the
> > > size of the RAMDISK kernel.
> >
> > what have you been smoking dude?
> > it's a prototype. hows does that ever increase anything?
>
> Read what I said again:
>
>     No, because vprint() is currently only defined within #ifdef
>     DIAGNOSTIC in vfs_subr.c.
>
>     And if you remove *that* #ifdef-#endif pair, you will increase the
>     size of the RAMDISK kernel.

i did not suggest removing on that.
that's all your own wrong assumptions.

> If you remove the #ifdef DIAGNOSTIC around vprint(), you will increase
> the size of the RAMDISK kernel.b This is true.

i did not suggest that.

> > > I think the OP is correct, but the declaration of vprint() should be
> > > also be removed from vnode.h.
> >
> > yeah. let's get rid of .h files and put all
> > the prototypes in every .c file that requires 'em!
>
> No, but when debugging functions are declared in .c files when certain
> compilation options (only) are present, *yes*, let's put the prototypes
> in those .c files.

vprint() is used in many places.
it's not a local function to one file and already has
a prototype in .h file. having that unconfitional does
not make anything bigger or worse.
in fact less ifdef's makes compile faster. (;
cu
--
    paranoic mickey       (my employers have changed but, the name has remained)

Reply | Threaded
Open this post in threaded view
|

Re: diff for src/sys/kern/vfs_subr.c

antipsychic@hotmail.com
In reply to this post by Michael Shalayeff-2
Revised.

Aloha Friday!
Jake


Index: sys/kern/vfs_subr.c
===================================================================
RCS file: /cvs/src/sys/kern/vfs_subr.c,v
retrieving revision 1.134
diff -u -p -r1.134 vfs_subr.c
--- sys/kern/vfs_subr.c 30 Oct 2006 00:34:01 -0000      1.134
+++ sys/kern/vfs_subr.c 17 Nov 2006 20:47:31 -0000
@@ -1267,7 +1267,7 @@ loop:
         return (count);
}
-#ifdef DIAGNOSTIC
+#if defined(DEBUG) || defined(DIAGNOSTIC)
/*
   * Print out a description of a vnode.
   */
Index: sys/sys/vnode.h
===================================================================
RCS file: /cvs/src/sys/sys/vnode.h,v
retrieving revision 1.71
diff -u -p -r1.71 vnode.h
--- sys/sys/vnode.h     2 Aug 2006 21:55:27 -0000       1.71
+++ sys/sys/vnode.h     17 Nov 2006 20:42:22 -0000
@@ -448,9 +448,8 @@ void        vwakeup(struct vnode *);
void   vput(struct vnode *);
int    vrecycle(struct vnode *, struct simplelock *, struct proc *);
void   vrele(struct vnode *);
-#ifdef DIAGNOSTIC
+/* Used for DEBUG || DIAGNOSTIC */
void   vprint(char *, struct vnode *);
-#endif
/* vfs_getcwd.c */
int vfs_getcwd_scandir(struct vnode **, struct vnode **, char **,  
char *,