diff --git a/.cppcheck_suppressions b/.cppcheck_suppressions index da350352..40c6d7b6 100644 --- a/.cppcheck_suppressions +++ b/.cppcheck_suppressions @@ -1,6 +1,6 @@ *:*/test/* -uninitvar:*/agnocast_kmod/agnocast.c +uninitvar:*/agnocast_kmod/* checkersReport missingInclude diff --git a/.github/workflows/cppcheck-differential.yaml b/.github/workflows/cppcheck-differential.yaml index 50572291..dfa3611c 100644 --- a/.github/workflows/cppcheck-differential.yaml +++ b/.github/workflows/cppcheck-differential.yaml @@ -77,7 +77,7 @@ jobs: - name: Add kmod to paths id: add-kmod run: | - echo "filtered-full-paths=${{ steps.add-header-paths.outputs.target-paths }} $(realpath agnocast_kmod/agnocast.c)" >> $GITHUB_OUTPUT + echo "filtered-full-paths=${{ steps.add-header-paths.outputs.target-paths }} $(realpath agnocast_kmod/agnocast_main.c)" >> $GITHUB_OUTPUT - name: Run Cppcheck on modified packages if: ${{ steps.add-kmod.outputs.filtered-full-paths != '' }} diff --git a/README.md b/README.md index c6f4af1d..cec90d86 100644 --- a/README.md +++ b/README.md @@ -80,15 +80,15 @@ To use dynamic_debug for dynamically outputting debug logs, please run the follo ```bash sudo su -echo 'file agnocast.c +p' > /sys/kernel/debug/dynamic_debug/control +echo 'file agnocast_main.c +p' > /sys/kernel/debug/dynamic_debug/control ``` Check if dynamic_debug is enabled by running the following command. If the right side of the `=` is `p`, it is enabled. (If it's `_`, it is disabled.) ```bash -sudo cat /sys/kernel/debug/dynamic_debug/control | grep "agnocast.c" -/.../agnocast/agnocast_kmod/agnocast.c:810 [agnocast]release_msgs_to_meet_depth =p "Release oldest message in the publisher_queue (publisher_pid=%d) of the topic (topic_name=%s) with qos_depth %d. (release_msgs_to_meet_depth)\012" -/.../agnocast/agnocast_kmod/agnocast.c:367 [agnocast]insert_message_entry =p "Insert an entry (topic_name=%s publisher_pid=%d msg_virtual_address=%lld timestamp=%lld). (insert_message_entry)" +sudo cat /sys/kernel/debug/dynamic_debug/control | grep "agnocast_main.c" +/.../agnocast/agnocast_kmod/agnocast_main.c:810 [agnocast]release_msgs_to_meet_depth =p "Release oldest message in the publisher_queue (publisher_pid=%d) of the topic (topic_name=%s) with qos_depth %d. (release_msgs_to_meet_depth)\012" +/.../agnocast/agnocast_kmod/agnocast_main.c:367 [agnocast]insert_message_entry =p "Insert an entry (topic_name=%s publisher_pid=%d msg_virtual_address=%lld timestamp=%lld). (insert_message_entry)" ``` To use dynamic_debug, the Linux kernel configuration must have CONFIG_DYNAMIC_DEBUG set to `y`. diff --git a/agnocast_kmod/Makefile b/agnocast_kmod/Makefile index b4bf47dc..9a367e5c 100644 --- a/agnocast_kmod/Makefile +++ b/agnocast_kmod/Makefile @@ -2,10 +2,11 @@ ccflags-y += -Wall -Werror ifneq ($(KUNIT_BUILD),y) obj-m := agnocast.o + agnocast-objs := agnocast_main.o else ifeq ($(CONFIG_KUNIT)$(CONFIG_GCOV_KERNEL),yy) obj-m := agnocast_kunit.o - agnocast_kunit-m := agnocast_kunit_main.o agnocast.o \ + agnocast_kunit-objs := agnocast_kunit_main.o agnocast_main.o \ agnocast_kunit/agnocast_kunit_subscriber_add.o \ agnocast_kunit/agnocast_kunit_publisher_add.o \ agnocast_kunit/agnocast_kunit_increment_rc.o \ diff --git a/agnocast_kmod/agnocast.h b/agnocast_kmod/agnocast.h index 29983176..cfcbc329 100644 --- a/agnocast_kmod/agnocast.h +++ b/agnocast_kmod/agnocast.h @@ -172,7 +172,7 @@ union ioctl_topic_info_args { #define AGNOCAST_GET_NODE_PUBLISHER_TOPICS_CMD _IOR('R', 5, union ioctl_node_info_args) // ================================================ -// public functions in agnocast.c +// public functions in agnocast_main.c void agnocast_init_mutexes(void); int agnocast_init_sysfs(void); diff --git a/agnocast_kmod/agnocast.c b/agnocast_kmod/agnocast_main.c similarity index 100% rename from agnocast_kmod/agnocast.c rename to agnocast_kmod/agnocast_main.c