* [2.6 patch] loop.c: make two functions static
2004-11-25 10:12 ` Christoph Hellwig
@ 2004-11-29 12:28 ` Adrian Bunk
0 siblings, 0 replies; 4+ messages in thread
From: Adrian Bunk @ 2004-11-29 12:28 UTC (permalink / raw)
To: linux-kernel
The patch below makes two needlessly global functions static.
diffstat output:
drivers/block/loop.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
Signed-off-by: Adrian Bunk <bunk@stusta.de>
--- linux-2.6.10-rc1-mm3-full/drivers/block/loop.c.old 2004-11-06 20:09:10.000000000 +0100
+++ linux-2.6.10-rc1-mm3-full/drivers/block/loop.c 2004-11-06 20:09:31.000000000 +0100
@@ -1114,7 +1114,7 @@
EXPORT_SYMBOL(loop_register_transfer);
EXPORT_SYMBOL(loop_unregister_transfer);
-int __init loop_init(void)
+static int __init loop_init(void)
{
int i;
@@ -1189,7 +1189,7 @@
return -ENOMEM;
}
-void loop_exit(void)
+static void loop_exit(void)
{
int i;
^ permalink raw reply [flat|nested] 4+ messages in thread
* [2.6 patch] loop.c: make two functions static
@ 2005-01-23 10:17 Adrian Bunk
2005-01-23 10:32 ` andyliu
0 siblings, 1 reply; 4+ messages in thread
From: Adrian Bunk @ 2005-01-23 10:17 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel
This patch makes two needlessly global functions static.
Signed-off-by: Adrian Bunk <bunk@stusta.de>
---
drivers/block/loop.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
This patch was already sent on:
- 29 Nov 2004
--- linux-2.6.10-rc1-mm3-full/drivers/block/loop.c.old 2004-11-06 20:09:10.000000000 +0100
+++ linux-2.6.10-rc1-mm3-full/drivers/block/loop.c 2004-11-06 20:09:31.000000000 +0100
@@ -1114,7 +1114,7 @@
EXPORT_SYMBOL(loop_register_transfer);
EXPORT_SYMBOL(loop_unregister_transfer);
-int __init loop_init(void)
+static int __init loop_init(void)
{
int i;
@@ -1189,7 +1189,7 @@
return -ENOMEM;
}
-void loop_exit(void)
+static void loop_exit(void)
{
int i;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [2.6 patch] loop.c: make two functions static
2005-01-23 10:17 [2.6 patch] loop.c: make two functions static Adrian Bunk
@ 2005-01-23 10:32 ` andyliu
2005-01-23 11:03 ` Arjan van de Ven
0 siblings, 1 reply; 4+ messages in thread
From: andyliu @ 2005-01-23 10:32 UTC (permalink / raw)
To: Adrian Bunk; +Cc: linux-kernel
hi, adrian
i always see patches which set functions and variables to static.
what's the main difference between static and non-static things?
On Sun, 23 Jan 2005 11:17:10 +0100, Adrian Bunk <bunk@stusta.de> wrote:
> This patch makes two needlessly global functions static.
>
> Signed-off-by: Adrian Bunk <bunk@stusta.de>
>
> ---
>
> drivers/block/loop.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> This patch was already sent on:
> - 29 Nov 2004
>
> --- linux-2.6.10-rc1-mm3-full/drivers/block/loop.c.old 2004-11-06 20:09:10.000000000 +0100
> +++ linux-2.6.10-rc1-mm3-full/drivers/block/loop.c 2004-11-06 20:09:31.000000000 +0100
> @@ -1114,7 +1114,7 @@
> EXPORT_SYMBOL(loop_register_transfer);
> EXPORT_SYMBOL(loop_unregister_transfer);
>
> -int __init loop_init(void)
> +static int __init loop_init(void)
> {
> int i;
>
> @@ -1189,7 +1189,7 @@
> return -ENOMEM;
> }
>
> -void loop_exit(void)
> +static void loop_exit(void)
> {
> int i;
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
--
Yours andyliu
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [2.6 patch] loop.c: make two functions static
2005-01-23 10:32 ` andyliu
@ 2005-01-23 11:03 ` Arjan van de Ven
0 siblings, 0 replies; 4+ messages in thread
From: Arjan van de Ven @ 2005-01-23 11:03 UTC (permalink / raw)
To: andyliu; +Cc: Adrian Bunk, linux-kernel
On Sun, 2005-01-23 at 18:32 +0800, andyliu wrote:
> hi, adrian
>
> i always see patches which set functions and variables to static.
> what's the main difference between static and non-static things?
1) namespace; static functions/variables are not visible name wise to
other .c files
2) optimisation: because of 1), gcc can know that there are no outside
users (assuming also no address-off is taken, which gcc also knows), and
in that case gcc can do a series of extra optimisations (such as more
agressive inlining, since gcc knows the exact user count of the function
now, but also gcc 3.4 will do things like make the function be regparm=3
equivalent, tail/head optimisations are possible (eg partial inlining)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-01-23 11:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-23 10:17 [2.6 patch] loop.c: make two functions static Adrian Bunk
2005-01-23 10:32 ` andyliu
2005-01-23 11:03 ` Arjan van de Ven
-- strict thread matches above, loose matches on Subject: below --
2004-11-24 23:10 [2.6 patch] drivers/block/: some cleanups Adrian Bunk
2004-11-25 10:12 ` Christoph Hellwig
2004-11-29 12:28 ` [2.6 patch] loop.c: make two functions static Adrian Bunk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox