diff mbox series

[v2,12/12] mini-os: make files array private to sys.c

Message ID 20220111151215.22955-13-jgross@suse.com (mailing list archive)
State New, archived
Headers show
Series mini-os: remove device specific struct file members | expand

Commit Message

Jürgen Groß Jan. 11, 2022, 3:12 p.m. UTC
There is no user of the files[] array outside of lib/sys.c left, so
it can be made static.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 include/lib.h | 2 --
 lib/sys.c     | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

Comments

Samuel Thibault Jan. 11, 2022, 8:42 p.m. UTC | #1
Juergen Gross, le mar. 11 janv. 2022 16:12:15 +0100, a ecrit:
> There is no user of the files[] array outside of lib/sys.c left, so
> it can be made static.

Yay!

> Signed-off-by: Juergen Gross <jgross@suse.com>

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

> ---
>  include/lib.h | 2 --
>  lib/sys.c     | 2 +-
>  2 files changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/include/lib.h b/include/lib.h
> index c171fe8..80e804b 100644
> --- a/include/lib.h
> +++ b/include/lib.h
> @@ -199,8 +199,6 @@ struct file {
>      };
>  };
>  
> -extern struct file files[];
> -
>  struct file *get_file_from_fd(int fd);
>  int alloc_fd(unsigned int type);
>  void close_all_files(void);
> diff --git a/lib/sys.c b/lib/sys.c
> index 0f42e97..c0cad87 100644
> --- a/lib/sys.c
> +++ b/lib/sys.c
> @@ -89,7 +89,7 @@ extern void minios_evtchn_close_fd(int fd);
>  extern void minios_gnttab_close_fd(int fd);
>  
>  pthread_mutex_t fd_lock = PTHREAD_MUTEX_INITIALIZER;
> -struct file files[NOFILE] = {
> +static struct file files[NOFILE] = {
>      { .type = FTYPE_CONSOLE }, /* stdin */
>      { .type = FTYPE_CONSOLE }, /* stdout */
>      { .type = FTYPE_CONSOLE }, /* stderr */
> -- 
> 2.26.2
>
diff mbox series

Patch

diff --git a/include/lib.h b/include/lib.h
index c171fe8..80e804b 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -199,8 +199,6 @@  struct file {
     };
 };
 
-extern struct file files[];
-
 struct file *get_file_from_fd(int fd);
 int alloc_fd(unsigned int type);
 void close_all_files(void);
diff --git a/lib/sys.c b/lib/sys.c
index 0f42e97..c0cad87 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -89,7 +89,7 @@  extern void minios_evtchn_close_fd(int fd);
 extern void minios_gnttab_close_fd(int fd);
 
 pthread_mutex_t fd_lock = PTHREAD_MUTEX_INITIALIZER;
-struct file files[NOFILE] = {
+static struct file files[NOFILE] = {
     { .type = FTYPE_CONSOLE }, /* stdin */
     { .type = FTYPE_CONSOLE }, /* stdout */
     { .type = FTYPE_CONSOLE }, /* stderr */