summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Pierre Bogler <jean-pierre.bogler@continental-corporation.com>2015-03-25 09:08:33 +0100
committerJean-Pierre Bogler <jean-pierre.bogler@continental-corporation.com>2015-03-26 13:58:59 +0100
commit851565499527e2d44047de3f6cbe9dd3a84a6c74 (patch)
tree0cc88c4adf0c5910b8be88c7ac73b3b431881f2c
parent401cca51de36c668cd81cb44161e52fb7db50266 (diff)
downloadnode-health-monitor-851565499527e2d44047de3f6cbe9dd3a84a6c74.tar.gz
Adaptions after GENIVI code review1.3.5
Improved the code and documentation based on the review comments from Jeremiah Foster, Jürnjakob Harder and Gianpaolo Macario. The follwing adaptions were done: - In the README: - a link to the public wiki is given - improved description of dependencies and build instructions - explained the unit test - Defined the CODE_STYLE - Fixed compiler warning, because of the deprecated "g_type_init" call for glib >= 2.36.0 Change-Id: I7872e85de1f501e895a88ea9971b7e7c366ab7af Signed-off-by: Jean-Pierre Bogler <jean-pierre.bogler@continental-corporation.com>
-rw-r--r--.gitignore47
-rw-r--r--CODING_STYLE118
-rw-r--r--ChangeLog6
-rw-r--r--NEWS5
-rw-r--r--README82
-rw-r--r--configure.ac2
-rw-r--r--src/nhm-main.c6
7 files changed, 252 insertions, 14 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3f8c0ca
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,47 @@
+.autotools
+.cproject
+.project
+Makefile
+Makefile.in
+aclocal.m4
+autom4te.cache/
+cfg/Makefile
+cfg/Makefile.in
+cfg/node-health-monitor.pc
+cfg/node-health-monitor.service
+cfg/org.genivi.NodeHealthMonitor.service
+compile
+config.log
+config.status
+configure
+depcomp
+gen/Makefile
+gen/Makefile.in
+gen/nhm-dbus-info.c
+gen/nhm-dbus-info.h
+gen/nsm-dbus-consumer.c
+gen/nsm-dbus-consumer.h
+gen/nsm-dbus-lc-consumer.c
+gen/nsm-dbus-lc-consumer.h
+gen/nsm-dbus-lc-control.c
+gen/nsm-dbus-lc-control.h
+inc/Makefile
+inc/Makefile.in
+install-sh
+missing
+mod/Makefile
+mod/Makefile.in
+src/.deps/
+src/Makefile
+src/Makefile.in
+src/node-health-monitor
+src/node_health_monitor-nhm-dbus-info.o
+src/node_health_monitor-nhm-helper.o
+src/node_health_monitor-nhm-main.o
+src/node_health_monitor-nhm-systemd.o
+src/node_health_monitor-nsm-dbus-consumer.o
+src/node_health_monitor-nsm-dbus-lc-consumer.o
+src/node_health_monitor-nsm-dbus-lc-control.o
+tst/.deps/
+tst/Makefile
+tst/Makefile.in
diff --git a/CODING_STYLE b/CODING_STYLE
new file mode 100644
index 0000000..3b0b93d
--- /dev/null
+++ b/CODING_STYLE
@@ -0,0 +1,118 @@
+Coding style
+============
+
+Many parts of the NodeHealthMonitor (NHM) are using the interface of the GNOME
+glib library and the gdbus binding. Because of the many glib calls, it made
+sense to align the remaining NHM code in a similar style. Please make sure to
+follow the definitions here, to make the code more easy to maintain!
+
+Project structure
+-----------------
+
+The sources of the NHM are located in different subfolders, based on their
+content. The following subfolders are used:
+
+ cfg: initial configuration, systemd service files, "package config" file
+ and other administrative files.
+ doc: Documentation
+ gen: Destination for generated code.
+ inc: Public header files (see chapter 5.2).
+ mod: models to generate code (e.g. dbus XML interfaces).
+ src: Source code of the NHM.
+ tst: Unit test for the NHM and stubs to replace system functions.
+
+The C source code of the project should be devided into seperate files.
+The source files should start with a comment, describing what they represent.
+
+Naming conventions
+------------------
+
+ - The source files should be named "nhm-<purpose>", where purpose describes
+ the functionality that the file implements.
+ - The functions/symbols should be named "nhm_<purpose>_<symbol>".
+ - There is no hungarian notation.
+
+
+Variable declaration
+--------------------
+
+Local variables may only be declared at the beginning of a function.
+
+
+Line width
+----------
+
+The monitors are getting bigger, but the integrated development environments
+(IDE) are getting more windows. Therefore, maximum line width should be 80
+wherever possible.
+
+
+Intendation
+-----------
+
+The intendation is two spaces, no tabs.
+
+
+Braces
+------
+
+ - All curly braces come into the next line (except for variable initializers)
+ - Curly braces are not intended
+
+
+if/else statements
+------------------
+
+ - All branches should be surrounded by curly braces.
+
+
+Comments
+--------
+
+Only the C89 comment symbols "/* */" may be used.
+
+
+White spaces
+------------
+
+There is no whitspace before parenthesis:
+
+ /* good */
+ void nhm_example_print_some_numbers()
+ {
+ for(i = 0; i < 1000; i++)
+ {
+ if(i % 10 == 0)
+ {
+ printf("%i\n", i);
+ }
+ }
+ }
+
+
+switch/case statements
+----------------------
+
+The "break" should have the same intendation level as the "case"
+to which it belongs:
+
+ /* good */
+ void nhm_example_define_to_text(const gint def)
+ {
+ switch(def)
+ {
+ case TEST1:
+ g_print("Test 1\n");
+ break;
+
+ case TEST2:
+ g_print("Test 2\n");
+ break;
+
+ default:
+ g_print("unknown\n");
+ break;
+ }
+ }
+
+
diff --git a/ChangeLog b/ChangeLog
index 738b201..2d271ac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+24th Mar 2015 Jean-Pierre Bogler <Jean-Pierre.Bogler@continental-corporation.com>
+ * Added CODING_STYLE file
+ * Updated README to provide more information about the package
+ * Added .gitignore
+ * Fix: Only call "g_type_init" if glib < 2.36.0 to avoid deprecated warning.
+
19th Nov 2013 Jean-Pierre Bogler <Jean-Pierre.Bogler@continental-corporation.com>
* Fixed memory leaks. The children returned by "g_variant_get_child_value" were
not freed. Instead of "g_variant_get_child_value", "g_variant_get_child" now
diff --git a/NEWS b/NEWS
index 99221fd..c2d7059 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+1.3.5
+=====
+* Documentation improved after code review
+* Removed compiler warning for glib >= 2.36.0
+
1.3.4
=====
* Bugfix for memory leak in systemd observation
diff --git a/README b/README
index ee2eb34..e01345a 100644
--- a/README
+++ b/README
@@ -1,28 +1,88 @@
NodeHealthMonitor (NHM) README
================================================================================
-This is the official source of the NodeHealthMonitor. At present, all
-relevant documentation for this project is available in the GENIVI wiki on:
+About
+-----
-https://collab.genivi.org/wiki/display/genivi/SysInfraEGLifecycleRequirements
+This is the official source of the NodeHealthMonitor (NHM). The NHM is a system
+software component that observes the system health and initiates configurable
+actions, if issues are identified. An overview about the architecture and how
+the component interacts with the other GENIVI components is available at:
+http://wiki.projects.genivi.org/index.php/Lifecycle_cluster
+
+Source repository
+-----------------
+
+The offical git repository of the NHM is located at:
+http://git.projects.genivi.org/lifecycle/node-health-monitor.git
+
+Mailing list
+------------
+
+The mailing list for the NHM and other GENIVI Lifecycle components is:
+https://lists.genivi.org/mailman/listinfo/genivi-lifecycle
+
+Bug reports
+------------
+
+NHM bugs can be reported at:
+http://bugs.genivi.org/
License
-------
For licensing info see the COPYING file, distributed along with this project.
+Authors
+-------
+
+Please see the AUTHORS file, distributed with the project.
+
+Coding style
+------------
+
+Please see the CODING_STYLE document, distributed with the project.
-Build Dependencies and Instructions
------------------------------------
+Requirements
+------------
+
+For compilation the NHM needs development versions of the following packages
+installed:
-The NodeHealthMonitor needs the following packages installed, to be compiled:
- automotive-dlt >= 2.2.0
- glib-2.0 >= 2.30.0
- node-state-manager >= 1.2.0.0
- - persistence_client_library
+ - persistence_client_library >= 7.0.0
+ - dbus >= 1.6.4
+ - systemd >= 187
+
+Include and library paths for the packages are obtained via "pkg-config".
+
+Build instructions
+------------------
+
+The NHM is a GNU Build system (autotools) project. An own version of the NHM can
+be set up, configured, compiled, checked and installed by using the following
+commands:
+
+autoreconf -vfi
+./configure <configure-flags>
+make
+make check
+make install
+
+An overview of the possible configuration parameters (especially needed for
+cross compilation) can be retrieved by calling "./configure --help".
+The generated Makefiles will support all "standard targets for users" defined
+by the GNU makefile conventions.
+
+Quality
+-------
+
+The NHM is delivered with a unit test that is executed when "make check" is
+called. The code coverage of the unit test can be measured with tools like
+"gcov". The coverage currently is > 80 % and shall always stay at this level.
+The unit test can be executed using "valgrind" to detect memory leaks. The
+source code of the NHM should be checked with Klocwork when it is available.
-Dependencies to "dbus-1" can be solved by passing "--with-dbussystemunitdir"
-and "--with-dbusinterfacesdir" to the configure script.
-Dependencies to "systemd" can be solved by passing "--with-systemdsystemunitdir"
-to the configure script. \ No newline at end of file
diff --git a/configure.ac b/configure.ac
index 1fe13c3..efbc281 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,7 +15,7 @@
################################################################################
# Initialize autoconf
-AC_INIT([node-health-monitor], [1.3.4])
+AC_INIT([node-health-monitor], [1.3.5])
AC_PREREQ([2.50])
AC_COPYRIGHT([Copyright (c) 2013 Continental Automotive GmbH])
diff --git a/src/nhm-main.c b/src/nhm-main.c
index cdf4641..51c7c15 100644
--- a/src/nhm-main.c
+++ b/src/nhm-main.c
@@ -2302,8 +2302,10 @@ main(void)
DLT_STRING("NHM: NodeHealthMonitor started."),
DLT_STRING("Version:"), DLT_STRING(VERSION ));
- /* Initialize glib for using "g" types */
- g_type_init();
+#if !GLIB_CHECK_VERSION(2,36,0)
+ /* Initialize glib for using "g" types. Only necessary until version 2.36 */
+ g_type_init();
+#endif
/* Initialize components variables */
nhm_main_init();