[dpdk-dev,03/10] eal: fix header guards

Message ID 1416692622-28886-4-git-send-email-thomas.monjalon@6wind.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Thomas Monjalon Nov. 22, 2014, 9:43 p.m. UTC
  Some guards are missing or have a wrong name.
Others have LINUXAPP in their name but are now common.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
 lib/librte_eal/common/eal_filesystem.h   | 6 +++---
 lib/librte_eal/common/eal_hugepages.h    | 6 +++---
 lib/librte_eal/common/eal_internal_cfg.h | 4 ++--
 lib/librte_eal/common/eal_options.h      | 4 ++++
 lib/librte_eal/common/eal_thread.h       | 6 +++---
 5 files changed, 15 insertions(+), 11 deletions(-)
  

Comments

Bruce Richardson Nov. 25, 2014, 10:28 a.m. UTC | #1
On Sat, Nov 22, 2014 at 10:43:35PM +0100, Thomas Monjalon wrote:
> Some guards are missing or have a wrong name.
> Others have LINUXAPP in their name but are now common.
> 
> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>

One minor comment below.

Acked-by: Bruce Richardson <bruce.richardson@intel.com>

> ---
>  lib/librte_eal/common/eal_filesystem.h   | 6 +++---
>  lib/librte_eal/common/eal_hugepages.h    | 6 +++---
>  lib/librte_eal/common/eal_internal_cfg.h | 4 ++--
>  lib/librte_eal/common/eal_options.h      | 4 ++++
>  lib/librte_eal/common/eal_thread.h       | 6 +++---
>  5 files changed, 15 insertions(+), 11 deletions(-)
> 
> diff --git a/lib/librte_eal/common/eal_filesystem.h b/lib/librte_eal/common/eal_filesystem.h
> index ce442c9..fdb4a70 100644
> --- a/lib/librte_eal/common/eal_filesystem.h
> +++ b/lib/librte_eal/common/eal_filesystem.h
> @@ -37,8 +37,8 @@
>   * on the filesystem for Linux, that are used by the Linux EAL.
>   */
>  
> -#ifndef _EAL_LINUXAPP_FILESYSTEM_H
> -#define _EAL_LINUXAPP_FILESYSTEM_H
> +#ifndef EAL_FILESYSTEM_H
> +#define EAL_FILESYSTEM_H
>  
>  /** Path of rte config file. */
>  #define RUNTIME_CONFIG_FMT "%s/.%s_config"

no ending comment for #endif - should one be added for completeness?

> @@ -115,4 +115,4 @@ eal_get_hugefile_temp_path(char *buffer, size_t buflen, const char *hugedir, int
>   * Used to read information from files on /sys */
>  int eal_parse_sysfs_value(const char *filename, unsigned long *val);
>  
> -#endif /* _EAL_LINUXAPP_FILESYSTEM_H */
> +#endif /* EAL_FILESYSTEM_H */
> diff --git a/lib/librte_eal/common/eal_hugepages.h b/lib/librte_eal/common/eal_hugepages.h
> index 51e090b..38edac0 100644
> --- a/lib/librte_eal/common/eal_hugepages.h
> +++ b/lib/librte_eal/common/eal_hugepages.h
> @@ -31,8 +31,8 @@
>   *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>   */
>  
> -#ifndef RTE_LINUXAPP_HUGEPAGES_H_
> -#define RTE_LINUXAPP_HUGEPAGES_H_
> +#ifndef EAL_HUGEPAGES_H
> +#define EAL_HUGEPAGES_H
>  
>  #include <stddef.h>
>  #include <stdint.h>
> @@ -64,4 +64,4 @@ struct hugepage_file {
>   */
>  int eal_hugepage_info_init(void);
>  
> -#endif /* EAL_HUGEPAGES_H_ */
> +#endif /* EAL_HUGEPAGES_H */
> diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h
> index 8749390..19c84e7 100644
> --- a/lib/librte_eal/common/eal_internal_cfg.h
> +++ b/lib/librte_eal/common/eal_internal_cfg.h
> @@ -36,8 +36,8 @@
>   * Holds the structures for the eal internal configuration
>   */
>  
> -#ifndef _EAL_LINUXAPP_INTERNAL_CFG
> -#define _EAL_LINUXAPP_INTERNAL_CFG
> +#ifndef EAL_INTERNAL_CFG_H
> +#define EAL_INTERNAL_CFG_H
>  
>  #include <rte_eal.h>
>  #include <rte_pci_dev_feature_defs.h>
> diff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/common/eal_options.h
> index 22819ec..7a08507 100644
> --- a/lib/librte_eal/common/eal_options.h
> +++ b/lib/librte_eal/common/eal_options.h
> @@ -30,6 +30,8 @@
>   *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>   */
>  
> +#ifndef EAL_OPTIONS_H
> +#define EAL_OPTIONS_H
>  
>  enum {
>  	/* long options mapped to a short option */
> @@ -82,3 +84,5 @@ extern const struct option eal_long_options[];
>  int eal_parse_common_option(int opt, const char *argv,
>  			    struct internal_config *conf);
>  void eal_common_usage(void);
> +
> +#endif /* EAL_OPTIONS_H */
> diff --git a/lib/librte_eal/common/eal_thread.h b/lib/librte_eal/common/eal_thread.h
> index d029ad3..b53b84d 100644
> --- a/lib/librte_eal/common/eal_thread.h
> +++ b/lib/librte_eal/common/eal_thread.h
> @@ -31,8 +31,8 @@
>   *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>   */
>  
> -#ifndef _EAL_LINUXAPP_THREAD_H_
> -#define _EAL_LINUXAPP_THREAD_H_
> +#ifndef EAL_THREAD_H
> +#define EAL_THREAD_H
>  
>  /**
>   * basic loop of thread, called for each thread by eal_init().
> @@ -50,4 +50,4 @@ __attribute__((noreturn)) void *eal_thread_loop(void *arg);
>   */
>  void eal_thread_init_master(unsigned lcore_id);
>  
> -#endif /* _EAL_LINUXAPP_PRIVATE_H_ */
> +#endif /* EAL_THREAD_H */
> -- 
> 2.1.3
>
  
Thomas Monjalon Nov. 25, 2014, 12:23 p.m. UTC | #2
Thanks for your review, Bruce.
More comments below.

2014-11-25 10:28, Bruce Richardson:
> On Sat, Nov 22, 2014 at 10:43:35PM +0100, Thomas Monjalon wrote:
> > Some guards are missing or have a wrong name.
> > Others have LINUXAPP in their name but are now common.
> > 
> > Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
> 
> One minor comment below.
> 
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
[...]
> > -#ifndef _EAL_LINUXAPP_FILESYSTEM_H
> > -#define _EAL_LINUXAPP_FILESYSTEM_H
> > +#ifndef EAL_FILESYSTEM_H
> > +#define EAL_FILESYSTEM_H
> >  
> >  /** Path of rte config file. */
> >  #define RUNTIME_CONFIG_FMT "%s/.%s_config"
> 
> no ending comment for #endif - should one be added for completeness?
> 
> > @@ -115,4 +115,4 @@ eal_get_hugefile_temp_path(char *buffer, size_t buflen, const char *hugedir, int
> >   * Used to read information from files on /sys */
> >  int eal_parse_sysfs_value(const char *filename, unsigned long *val);
> >  
> > -#endif /* _EAL_LINUXAPP_FILESYSTEM_H */
> > +#endif /* EAL_FILESYSTEM_H */

The ending comment is here.

> > --- a/lib/librte_eal/common/eal_internal_cfg.h
> > +++ b/lib/librte_eal/common/eal_internal_cfg.h
> > @@ -36,8 +36,8 @@
> >   * Holds the structures for the eal internal configuration
> >   */
> >  
> > -#ifndef _EAL_LINUXAPP_INTERNAL_CFG
> > -#define _EAL_LINUXAPP_INTERNAL_CFG
> > +#ifndef EAL_INTERNAL_CFG_H
> > +#define EAL_INTERNAL_CFG_H
> >  
> >  #include <rte_eal.h>
> >  #include <rte_pci_dev_feature_defs.h>

I've added an ending comment for this file.
Is it the one you thought about?
  
Bruce Richardson Nov. 25, 2014, 1:37 p.m. UTC | #3
On Tue, Nov 25, 2014 at 01:23:55PM +0100, Thomas Monjalon wrote:
> Thanks for your review, Bruce.
> More comments below.
> 
> 2014-11-25 10:28, Bruce Richardson:
> > On Sat, Nov 22, 2014 at 10:43:35PM +0100, Thomas Monjalon wrote:
> > > Some guards are missing or have a wrong name.
> > > Others have LINUXAPP in their name but are now common.
> > > 
> > > Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
> > 
> > One minor comment below.
> > 
> > Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> [...]
> > > -#ifndef _EAL_LINUXAPP_FILESYSTEM_H
> > > -#define _EAL_LINUXAPP_FILESYSTEM_H
> > > +#ifndef EAL_FILESYSTEM_H
> > > +#define EAL_FILESYSTEM_H
> > >  
> > >  /** Path of rte config file. */
> > >  #define RUNTIME_CONFIG_FMT "%s/.%s_config"
> > 
> > no ending comment for #endif - should one be added for completeness?
> > 
> > > @@ -115,4 +115,4 @@ eal_get_hugefile_temp_path(char *buffer, size_t buflen, const char *hugedir, int
> > >   * Used to read information from files on /sys */
> > >  int eal_parse_sysfs_value(const char *filename, unsigned long *val);
> > >  
> > > -#endif /* _EAL_LINUXAPP_FILESYSTEM_H */
> > > +#endif /* EAL_FILESYSTEM_H */
> 
> The ending comment is here.
> 
> > > --- a/lib/librte_eal/common/eal_internal_cfg.h
> > > +++ b/lib/librte_eal/common/eal_internal_cfg.h
> > > @@ -36,8 +36,8 @@
> > >   * Holds the structures for the eal internal configuration
> > >   */
> > >  
> > > -#ifndef _EAL_LINUXAPP_INTERNAL_CFG
> > > -#define _EAL_LINUXAPP_INTERNAL_CFG
> > > +#ifndef EAL_INTERNAL_CFG_H
> > > +#define EAL_INTERNAL_CFG_H
> > >  
> > >  #include <rte_eal.h>
> > >  #include <rte_pci_dev_feature_defs.h>
> 
> I've added an ending comment for this file.
> Is it the one you thought about?
>
Not sure, I just thought I missed seeing an ending comment on one of the pairs,
however, I'm sure you're on top of it (and if one is missed, it's no big deal
anyway).

/Bruce
  

Patch

diff --git a/lib/librte_eal/common/eal_filesystem.h b/lib/librte_eal/common/eal_filesystem.h
index ce442c9..fdb4a70 100644
--- a/lib/librte_eal/common/eal_filesystem.h
+++ b/lib/librte_eal/common/eal_filesystem.h
@@ -37,8 +37,8 @@ 
  * on the filesystem for Linux, that are used by the Linux EAL.
  */
 
-#ifndef _EAL_LINUXAPP_FILESYSTEM_H
-#define _EAL_LINUXAPP_FILESYSTEM_H
+#ifndef EAL_FILESYSTEM_H
+#define EAL_FILESYSTEM_H
 
 /** Path of rte config file. */
 #define RUNTIME_CONFIG_FMT "%s/.%s_config"
@@ -115,4 +115,4 @@  eal_get_hugefile_temp_path(char *buffer, size_t buflen, const char *hugedir, int
  * Used to read information from files on /sys */
 int eal_parse_sysfs_value(const char *filename, unsigned long *val);
 
-#endif /* _EAL_LINUXAPP_FILESYSTEM_H */
+#endif /* EAL_FILESYSTEM_H */
diff --git a/lib/librte_eal/common/eal_hugepages.h b/lib/librte_eal/common/eal_hugepages.h
index 51e090b..38edac0 100644
--- a/lib/librte_eal/common/eal_hugepages.h
+++ b/lib/librte_eal/common/eal_hugepages.h
@@ -31,8 +31,8 @@ 
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef RTE_LINUXAPP_HUGEPAGES_H_
-#define RTE_LINUXAPP_HUGEPAGES_H_
+#ifndef EAL_HUGEPAGES_H
+#define EAL_HUGEPAGES_H
 
 #include <stddef.h>
 #include <stdint.h>
@@ -64,4 +64,4 @@  struct hugepage_file {
  */
 int eal_hugepage_info_init(void);
 
-#endif /* EAL_HUGEPAGES_H_ */
+#endif /* EAL_HUGEPAGES_H */
diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h
index 8749390..19c84e7 100644
--- a/lib/librte_eal/common/eal_internal_cfg.h
+++ b/lib/librte_eal/common/eal_internal_cfg.h
@@ -36,8 +36,8 @@ 
  * Holds the structures for the eal internal configuration
  */
 
-#ifndef _EAL_LINUXAPP_INTERNAL_CFG
-#define _EAL_LINUXAPP_INTERNAL_CFG
+#ifndef EAL_INTERNAL_CFG_H
+#define EAL_INTERNAL_CFG_H
 
 #include <rte_eal.h>
 #include <rte_pci_dev_feature_defs.h>
diff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/common/eal_options.h
index 22819ec..7a08507 100644
--- a/lib/librte_eal/common/eal_options.h
+++ b/lib/librte_eal/common/eal_options.h
@@ -30,6 +30,8 @@ 
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifndef EAL_OPTIONS_H
+#define EAL_OPTIONS_H
 
 enum {
 	/* long options mapped to a short option */
@@ -82,3 +84,5 @@  extern const struct option eal_long_options[];
 int eal_parse_common_option(int opt, const char *argv,
 			    struct internal_config *conf);
 void eal_common_usage(void);
+
+#endif /* EAL_OPTIONS_H */
diff --git a/lib/librte_eal/common/eal_thread.h b/lib/librte_eal/common/eal_thread.h
index d029ad3..b53b84d 100644
--- a/lib/librte_eal/common/eal_thread.h
+++ b/lib/librte_eal/common/eal_thread.h
@@ -31,8 +31,8 @@ 
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef _EAL_LINUXAPP_THREAD_H_
-#define _EAL_LINUXAPP_THREAD_H_
+#ifndef EAL_THREAD_H
+#define EAL_THREAD_H
 
 /**
  * basic loop of thread, called for each thread by eal_init().
@@ -50,4 +50,4 @@  __attribute__((noreturn)) void *eal_thread_loop(void *arg);
  */
 void eal_thread_init_master(unsigned lcore_id);
 
-#endif /* _EAL_LINUXAPP_PRIVATE_H_ */
+#endif /* EAL_THREAD_H */