Re: [-mm patch] unionfs: make functions static

2007-07-02 Thread Josef Sipek
On Mon, Jul 02, 2007 at 04:27:59AM +0200, Adrian Bunk wrote:
> On Sun, Jul 01, 2007 at 09:42:49PM -0400, Josef Sipek wrote:
> > On Sun, Jul 01, 2007 at 10:23:30PM +0200, Adrian Bunk wrote:
> > > This patch makes some needlessly global functions static.
> > > 
> > ...
> > > --- linux-2.6.22-rc6-mm1/fs/unionfs/lookup.c.old  2007-07-01 
> > > 00:05:02.0 +0200
> > > +++ linux-2.6.22-rc6-mm1/fs/unionfs/lookup.c  2007-07-01 
> > > 00:06:05.0 +0200
> > > @@ -18,6 +18,8 @@
> > >  
> > >  #include "union.h"
> > >  
> > > +static int realloc_dentry_private_data(struct dentry *dentry);
> > > +
> > >  /* is the filename valid == !(whiteout for a file or opaque dir marker) 
> > > */
> > 
> > I forget who said it, but someone wasn't very happy with prototypes like
> > that in .c files. What's the prefered way - are they ok for static symbols?
> 
> It might have even been me who said this - but about global functions.
> 
> For global functions, prototypes in header files allow gcc to check 
> whether the prototype matches the actual function. With a prototype
> in the C file of the caller that's not possible, and if they are 
> different it can result in nasty runtime errors.
> 
> For static functions that's not an issue since gcc sees both the 
> prototype and the actual function.
 
Ok, fair enough. Applied & pushed to korg tree.

Thanks.

Josef "Jeff" Sipek.

-- 
Once you have their hardware. Never give it back.
(The First Rule of Hardware Acquisition)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [-mm patch] unionfs: make functions static

2007-07-02 Thread Josef Sipek
On Mon, Jul 02, 2007 at 04:27:59AM +0200, Adrian Bunk wrote:
 On Sun, Jul 01, 2007 at 09:42:49PM -0400, Josef Sipek wrote:
  On Sun, Jul 01, 2007 at 10:23:30PM +0200, Adrian Bunk wrote:
   This patch makes some needlessly global functions static.
   
  ...
   --- linux-2.6.22-rc6-mm1/fs/unionfs/lookup.c.old  2007-07-01 
   00:05:02.0 +0200
   +++ linux-2.6.22-rc6-mm1/fs/unionfs/lookup.c  2007-07-01 
   00:06:05.0 +0200
   @@ -18,6 +18,8 @@

#include union.h

   +static int realloc_dentry_private_data(struct dentry *dentry);
   +
/* is the filename valid == !(whiteout for a file or opaque dir marker) 
   */
  
  I forget who said it, but someone wasn't very happy with prototypes like
  that in .c files. What's the prefered way - are they ok for static symbols?
 
 It might have even been me who said this - but about global functions.
 
 For global functions, prototypes in header files allow gcc to check 
 whether the prototype matches the actual function. With a prototype
 in the C file of the caller that's not possible, and if they are 
 different it can result in nasty runtime errors.
 
 For static functions that's not an issue since gcc sees both the 
 prototype and the actual function.
 
Ok, fair enough. Applied  pushed to korg tree.

Thanks.

Josef Jeff Sipek.

-- 
Once you have their hardware. Never give it back.
(The First Rule of Hardware Acquisition)
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [-mm patch] unionfs: make functions static

2007-07-01 Thread Adrian Bunk
On Sun, Jul 01, 2007 at 09:42:49PM -0400, Josef Sipek wrote:
> On Sun, Jul 01, 2007 at 10:23:30PM +0200, Adrian Bunk wrote:
> > This patch makes some needlessly global functions static.
> > 
> ...
> > --- linux-2.6.22-rc6-mm1/fs/unionfs/lookup.c.old2007-07-01 
> > 00:05:02.0 +0200
> > +++ linux-2.6.22-rc6-mm1/fs/unionfs/lookup.c2007-07-01 
> > 00:06:05.0 +0200
> > @@ -18,6 +18,8 @@
> >  
> >  #include "union.h"
> >  
> > +static int realloc_dentry_private_data(struct dentry *dentry);
> > +
> >  /* is the filename valid == !(whiteout for a file or opaque dir marker) */
> 
> I forget who said it, but someone wasn't very happy with prototypes like
> that in .c files. What's the prefered way - are they ok for static symbols?

It might have even been me who said this - but about global functions.

For global functions, prototypes in header files allow gcc to check 
whether the prototype matches the actual function. With a prototype
in the C file of the caller that's not possible, and if they are 
different it can result in nasty runtime errors.

For static functions that's not an issue since gcc sees both the 
prototype and the actual function.

> Josef "Jeff" Sipek.

cu
Adrian

-- 

   "Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
   "Only a promise," Lao Er said.
   Pearl S. Buck - Dragon Seed

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [-mm patch] unionfs: make functions static

2007-07-01 Thread Satyam Sharma

Hi,

[ Cc:'s trimmed ]

On 7/2/07, Josef Sipek <[EMAIL PROTECTED]> wrote:

On Sun, Jul 01, 2007 at 10:23:30PM +0200, Adrian Bunk wrote:
> This patch makes some needlessly global functions static.
>
...
> --- linux-2.6.22-rc6-mm1/fs/unionfs/lookup.c.old  2007-07-01 
00:05:02.0 +0200
> +++ linux-2.6.22-rc6-mm1/fs/unionfs/lookup.c  2007-07-01 00:06:05.0 
+0200
> @@ -18,6 +18,8 @@
>
>  #include "union.h"
>
> +static int realloc_dentry_private_data(struct dentry *dentry);
> +
>  /* is the filename valid == !(whiteout for a file or opaque dir marker) */

I forget who said it, but someone wasn't very happy with prototypes like
that in .c files. What's the prefered way - are they ok for static symbols?


The preferred way is to push static functions' definitions above the
callsites (caller functions) in the same file, if possible.
Perhaps Adrian was in a hurry so didn't do that ...

Satyam
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [-mm patch] unionfs: make functions static

2007-07-01 Thread Josef Sipek
On Sun, Jul 01, 2007 at 10:23:30PM +0200, Adrian Bunk wrote:
> This patch makes some needlessly global functions static.
> 
...
> --- linux-2.6.22-rc6-mm1/fs/unionfs/lookup.c.old  2007-07-01 
> 00:05:02.0 +0200
> +++ linux-2.6.22-rc6-mm1/fs/unionfs/lookup.c  2007-07-01 00:06:05.0 
> +0200
> @@ -18,6 +18,8 @@
>  
>  #include "union.h"
>  
> +static int realloc_dentry_private_data(struct dentry *dentry);
> +
>  /* is the filename valid == !(whiteout for a file or opaque dir marker) */

I forget who said it, but someone wasn't very happy with prototypes like
that in .c files. What's the prefered way - are they ok for static symbols?

Josef "Jeff" Sipek.

-- 
We have joy, we have fun, we have Linux on a Sun...
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[-mm patch] unionfs: make functions static

2007-07-01 Thread Adrian Bunk
This patch makes some needlessly global functions static.

Signed-off-by: Adrian Bunk <[EMAIL PROTECTED]>

---

 fs/unionfs/lookup.c |4 +++-
 fs/unionfs/mmap.c   |   14 +++---
 fs/unionfs/union.h  |1 -
 3 files changed, 10 insertions(+), 9 deletions(-)

--- linux-2.6.22-rc6-mm1/fs/unionfs/union.h.old 2007-07-01 00:01:19.0 
+0200
+++ linux-2.6.22-rc6-mm1/fs/unionfs/union.h 2007-07-01 00:01:26.0 
+0200
@@ -242,7 +242,6 @@
unionfs_lock_dentry(d2);
 }
 
-extern int realloc_dentry_private_data(struct dentry *dentry);
 extern int new_dentry_private_data(struct dentry *dentry);
 extern void free_dentry_private_data(struct dentry *dentry);
 extern void update_bstart(struct dentry *dentry);
--- linux-2.6.22-rc6-mm1/fs/unionfs/lookup.c.old2007-07-01 
00:05:02.0 +0200
+++ linux-2.6.22-rc6-mm1/fs/unionfs/lookup.c2007-07-01 00:06:05.0 
+0200
@@ -18,6 +18,8 @@
 
 #include "union.h"
 
+static int realloc_dentry_private_data(struct dentry *dentry);
+
 /* is the filename valid == !(whiteout for a file or opaque dir marker) */
 static int is_validname(const char *name)
 {
@@ -488,7 +490,7 @@
 }
 
 /* UNIONFS_D(dentry)->lock must be locked */
-int realloc_dentry_private_data(struct dentry *dentry)
+static int realloc_dentry_private_data(struct dentry *dentry)
 {
if (!__realloc_dentry_private_data(dentry))
return 0;
--- linux-2.6.22-rc6-mm1/fs/unionfs/mmap.c.old  2007-07-01 00:08:07.0 
+0200
+++ linux-2.6.22-rc6-mm1/fs/unionfs/mmap.c  2007-07-01 00:12:05.0 
+0200
@@ -52,7 +52,7 @@
  * such day as Linux can better support address_space_ops in a stackable
  * fashion.
  */
-int unionfs_writepage(struct page *page, struct writeback_control *wbc)
+static int unionfs_writepage(struct page *page, struct writeback_control *wbc)
 {
int err = -EIO;
struct inode *inode;
@@ -198,7 +198,7 @@
return err;
 }
 
-int unionfs_readpage(struct file *file, struct page *page)
+static int unionfs_readpage(struct file *file, struct page *page)
 {
int err;
 
@@ -225,8 +225,8 @@
return err;
 }
 
-int unionfs_prepare_write(struct file *file, struct page *page, unsigned from,
- unsigned to)
+static int unionfs_prepare_write(struct file *file, struct page *page,
+unsigned from, unsigned to)
 {
int err;
 
@@ -239,8 +239,8 @@
return err;
 }
 
-int unionfs_commit_write(struct file *file, struct page *page, unsigned from,
-unsigned to)
+static int unionfs_commit_write(struct file *file, struct page *page,
+   unsigned from, unsigned to)
 {
int err = -ENOMEM;
struct inode *inode, *lower_inode;
@@ -308,7 +308,7 @@
return err; /* assume all is ok */
 }
 
-void unionfs_sync_page(struct page *page)
+static void unionfs_sync_page(struct page *page)
 {
struct inode *inode;
struct inode *lower_inode;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[-mm patch] unionfs: make functions static

2007-07-01 Thread Adrian Bunk
This patch makes some needlessly global functions static.

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]

---

 fs/unionfs/lookup.c |4 +++-
 fs/unionfs/mmap.c   |   14 +++---
 fs/unionfs/union.h  |1 -
 3 files changed, 10 insertions(+), 9 deletions(-)

--- linux-2.6.22-rc6-mm1/fs/unionfs/union.h.old 2007-07-01 00:01:19.0 
+0200
+++ linux-2.6.22-rc6-mm1/fs/unionfs/union.h 2007-07-01 00:01:26.0 
+0200
@@ -242,7 +242,6 @@
unionfs_lock_dentry(d2);
 }
 
-extern int realloc_dentry_private_data(struct dentry *dentry);
 extern int new_dentry_private_data(struct dentry *dentry);
 extern void free_dentry_private_data(struct dentry *dentry);
 extern void update_bstart(struct dentry *dentry);
--- linux-2.6.22-rc6-mm1/fs/unionfs/lookup.c.old2007-07-01 
00:05:02.0 +0200
+++ linux-2.6.22-rc6-mm1/fs/unionfs/lookup.c2007-07-01 00:06:05.0 
+0200
@@ -18,6 +18,8 @@
 
 #include union.h
 
+static int realloc_dentry_private_data(struct dentry *dentry);
+
 /* is the filename valid == !(whiteout for a file or opaque dir marker) */
 static int is_validname(const char *name)
 {
@@ -488,7 +490,7 @@
 }
 
 /* UNIONFS_D(dentry)-lock must be locked */
-int realloc_dentry_private_data(struct dentry *dentry)
+static int realloc_dentry_private_data(struct dentry *dentry)
 {
if (!__realloc_dentry_private_data(dentry))
return 0;
--- linux-2.6.22-rc6-mm1/fs/unionfs/mmap.c.old  2007-07-01 00:08:07.0 
+0200
+++ linux-2.6.22-rc6-mm1/fs/unionfs/mmap.c  2007-07-01 00:12:05.0 
+0200
@@ -52,7 +52,7 @@
  * such day as Linux can better support address_space_ops in a stackable
  * fashion.
  */
-int unionfs_writepage(struct page *page, struct writeback_control *wbc)
+static int unionfs_writepage(struct page *page, struct writeback_control *wbc)
 {
int err = -EIO;
struct inode *inode;
@@ -198,7 +198,7 @@
return err;
 }
 
-int unionfs_readpage(struct file *file, struct page *page)
+static int unionfs_readpage(struct file *file, struct page *page)
 {
int err;
 
@@ -225,8 +225,8 @@
return err;
 }
 
-int unionfs_prepare_write(struct file *file, struct page *page, unsigned from,
- unsigned to)
+static int unionfs_prepare_write(struct file *file, struct page *page,
+unsigned from, unsigned to)
 {
int err;
 
@@ -239,8 +239,8 @@
return err;
 }
 
-int unionfs_commit_write(struct file *file, struct page *page, unsigned from,
-unsigned to)
+static int unionfs_commit_write(struct file *file, struct page *page,
+   unsigned from, unsigned to)
 {
int err = -ENOMEM;
struct inode *inode, *lower_inode;
@@ -308,7 +308,7 @@
return err; /* assume all is ok */
 }
 
-void unionfs_sync_page(struct page *page)
+static void unionfs_sync_page(struct page *page)
 {
struct inode *inode;
struct inode *lower_inode;

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [-mm patch] unionfs: make functions static

2007-07-01 Thread Josef Sipek
On Sun, Jul 01, 2007 at 10:23:30PM +0200, Adrian Bunk wrote:
 This patch makes some needlessly global functions static.
 
...
 --- linux-2.6.22-rc6-mm1/fs/unionfs/lookup.c.old  2007-07-01 
 00:05:02.0 +0200
 +++ linux-2.6.22-rc6-mm1/fs/unionfs/lookup.c  2007-07-01 00:06:05.0 
 +0200
 @@ -18,6 +18,8 @@
  
  #include union.h
  
 +static int realloc_dentry_private_data(struct dentry *dentry);
 +
  /* is the filename valid == !(whiteout for a file or opaque dir marker) */

I forget who said it, but someone wasn't very happy with prototypes like
that in .c files. What's the prefered way - are they ok for static symbols?

Josef Jeff Sipek.

-- 
We have joy, we have fun, we have Linux on a Sun...
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [-mm patch] unionfs: make functions static

2007-07-01 Thread Satyam Sharma

Hi,

[ Cc:'s trimmed ]

On 7/2/07, Josef Sipek [EMAIL PROTECTED] wrote:

On Sun, Jul 01, 2007 at 10:23:30PM +0200, Adrian Bunk wrote:
 This patch makes some needlessly global functions static.

...
 --- linux-2.6.22-rc6-mm1/fs/unionfs/lookup.c.old  2007-07-01 
00:05:02.0 +0200
 +++ linux-2.6.22-rc6-mm1/fs/unionfs/lookup.c  2007-07-01 00:06:05.0 
+0200
 @@ -18,6 +18,8 @@

  #include union.h

 +static int realloc_dentry_private_data(struct dentry *dentry);
 +
  /* is the filename valid == !(whiteout for a file or opaque dir marker) */

I forget who said it, but someone wasn't very happy with prototypes like
that in .c files. What's the prefered way - are they ok for static symbols?


The preferred way is to push static functions' definitions above the
callsites (caller functions) in the same file, if possible.
Perhaps Adrian was in a hurry so didn't do that ...

Satyam
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [-mm patch] unionfs: make functions static

2007-07-01 Thread Adrian Bunk
On Sun, Jul 01, 2007 at 09:42:49PM -0400, Josef Sipek wrote:
 On Sun, Jul 01, 2007 at 10:23:30PM +0200, Adrian Bunk wrote:
  This patch makes some needlessly global functions static.
  
 ...
  --- linux-2.6.22-rc6-mm1/fs/unionfs/lookup.c.old2007-07-01 
  00:05:02.0 +0200
  +++ linux-2.6.22-rc6-mm1/fs/unionfs/lookup.c2007-07-01 
  00:06:05.0 +0200
  @@ -18,6 +18,8 @@
   
   #include union.h
   
  +static int realloc_dentry_private_data(struct dentry *dentry);
  +
   /* is the filename valid == !(whiteout for a file or opaque dir marker) */
 
 I forget who said it, but someone wasn't very happy with prototypes like
 that in .c files. What's the prefered way - are they ok for static symbols?

It might have even been me who said this - but about global functions.

For global functions, prototypes in header files allow gcc to check 
whether the prototype matches the actual function. With a prototype
in the C file of the caller that's not possible, and if they are 
different it can result in nasty runtime errors.

For static functions that's not an issue since gcc sees both the 
prototype and the actual function.

 Josef Jeff Sipek.

cu
Adrian

-- 

   Is there not promise of rain? Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
   Only a promise, Lao Er said.
   Pearl S. Buck - Dragon Seed

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/