From d63da4f2685ab70f955565ea758093c8519ec9d4 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Tue, 5 Mar 2024 21:37:34 -0800 Subject: [PATCH] [posix] add missing header guards, style fixes (#9892) This commit contains smaller changes in the `posix` platform modules: - Adds missing header guard checks. - Use consistent names for header guard defines. - Fix/update comments. --- src/posix/platform/config_file.hpp | 6 +++--- src/posix/platform/configuration.hpp | 6 +++--- src/posix/platform/hdlc_interface.hpp | 7 ++++--- src/posix/platform/infra_if.hpp | 5 +++++ src/posix/platform/ip6_utils.hpp | 5 +++++ src/posix/platform/mainloop.hpp | 2 +- src/posix/platform/openthread-posix-config.h | 6 +++--- src/posix/platform/platform-posix.h | 6 +++--- src/posix/platform/power.hpp | 6 +++--- src/posix/platform/radio.hpp | 6 +++--- src/posix/platform/radio_url.hpp | 6 +++--- src/posix/platform/resolver.hpp | 14 +++++--------- src/posix/platform/settings.hpp | 6 +++--- src/posix/platform/spi_interface.hpp | 6 +++--- src/posix/platform/vendor_interface.hpp | 6 +++--- 15 files changed, 50 insertions(+), 43 deletions(-) diff --git a/src/posix/platform/config_file.hpp b/src/posix/platform/config_file.hpp index 51d16ca0e..1590ed284 100644 --- a/src/posix/platform/config_file.hpp +++ b/src/posix/platform/config_file.hpp @@ -26,8 +26,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef POSIX_PLATFORM_CONFIG_FILE_HPP_ -#define POSIX_PLATFORM_CONFIG_FILE_HPP_ +#ifndef OT_POSIX_PLATFORM_CONFIG_FILE_HPP_ +#define OT_POSIX_PLATFORM_CONFIG_FILE_HPP_ #include #include @@ -125,4 +125,4 @@ private: } // namespace Posix } // namespace ot -#endif // POSIX_PLATFORM_CONFIG_FILE_HPP_ +#endif // OT_POSIX_PLATFORM_CONFIG_FILE_HPP_ diff --git a/src/posix/platform/configuration.hpp b/src/posix/platform/configuration.hpp index 71c479ddb..0296eb959 100644 --- a/src/posix/platform/configuration.hpp +++ b/src/posix/platform/configuration.hpp @@ -26,8 +26,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef POSIX_PLATFORM_CONFIGURATION_HPP_ -#define POSIX_PLATFORM_CONFIGURATION_HPP_ +#ifndef OT_POSIX_PLATFORM_CONFIGURATION_HPP_ +#define OT_POSIX_PLATFORM_CONFIGURATION_HPP_ #include "openthread-posix-config.h" @@ -150,4 +150,4 @@ private: } // namespace ot #endif // OPENTHREAD_POSIX_CONFIG_CONFIGURATION_FILE_ENABLE -#endif // POSIX_PLATFORM_CONFIGURATION_HPP_ +#endif // OT_POSIX_PLATFORM_CONFIGURATION_HPP_ diff --git a/src/posix/platform/hdlc_interface.hpp b/src/posix/platform/hdlc_interface.hpp index 6078135d5..bd5c37ea0 100644 --- a/src/posix/platform/hdlc_interface.hpp +++ b/src/posix/platform/hdlc_interface.hpp @@ -31,8 +31,8 @@ * This file includes definitions for the HDLC interface to radio (RCP). */ -#ifndef POSIX_PLATFORM_HDLC_INTERFACE_HPP_ -#define POSIX_PLATFORM_HDLC_INTERFACE_HPP_ +#ifndef OT_POSIX_PLATFORM_HDLC_INTERFACE_HPP_ +#define OT_POSIX_PLATFORM_HDLC_INTERFACE_HPP_ #include "openthread-posix-config.h" #include "platform-posix.h" @@ -272,4 +272,5 @@ private: } // namespace Posix } // namespace ot -#endif // POSIX_PLATFORM_HDLC_INTERFACE_HPP_ + +#endif // OT_POSIX_PLATFORM_HDLC_INTERFACE_HPP_ diff --git a/src/posix/platform/infra_if.hpp b/src/posix/platform/infra_if.hpp index a1ad7305d..db69cbe87 100644 --- a/src/posix/platform/infra_if.hpp +++ b/src/posix/platform/infra_if.hpp @@ -31,6 +31,9 @@ * This file implements the infrastructure interface for posix. */ +#ifndef OT_POSIX_PLATFORM_INFRA_IF_HPP_ +#define OT_POSIX_PLATFORM_INFRA_IF_HPP_ + #include "openthread-posix-config.h" #include @@ -248,3 +251,5 @@ private: } // namespace Posix } // namespace ot #endif // OPENTHREAD_POSIX_CONFIG_INFRA_IF_ENABLE + +#endif // OT_POSIX_PLATFORM_INFRA_IF_HPP_ diff --git a/src/posix/platform/ip6_utils.hpp b/src/posix/platform/ip6_utils.hpp index 39c7bc168..4626a8361 100644 --- a/src/posix/platform/ip6_utils.hpp +++ b/src/posix/platform/ip6_utils.hpp @@ -26,6 +26,9 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#ifndef OT_POSIX_PLATFORM_IP6_UTILS_HPP_ +#define OT_POSIX_PLATFORM_IP6_UTILS_HPP_ + #include "openthread-posix-config.h" #include "platform-posix.h" @@ -68,3 +71,5 @@ private: } // namespace Ip6Utils } // namespace Posix } // namespace ot + +#endif // OT_POSIX_PLATFORM_IP6_UTILS_HPP_ diff --git a/src/posix/platform/mainloop.hpp b/src/posix/platform/mainloop.hpp index 6e11e5645..a9ce981c4 100644 --- a/src/posix/platform/mainloop.hpp +++ b/src/posix/platform/mainloop.hpp @@ -28,7 +28,7 @@ /** * @file - * This file includes definitions for the SPI interface to radio (RCP). + * This file includes definitions for the mainloop events and manager. */ #ifndef OT_POSIX_PLATFORM_MAINLOOP_HPP_ diff --git a/src/posix/platform/openthread-posix-config.h b/src/posix/platform/openthread-posix-config.h index f39c6f2ac..ade8ab2c6 100644 --- a/src/posix/platform/openthread-posix-config.h +++ b/src/posix/platform/openthread-posix-config.h @@ -26,8 +26,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef OPENTHREAD_PLATFORM_CONFIG_H_ -#define OPENTHREAD_PLATFORM_CONFIG_H_ +#ifndef OPENTHREAD_PLATFORM_POSIX_CONFIG_H_ +#define OPENTHREAD_PLATFORM_POSIX_CONFIG_H_ #include "openthread-core-config.h" @@ -429,4 +429,4 @@ #define OPENTHREAD_POSIX_CONFIG_TREL_TX_PACKET_POOL_SIZE 5 #endif -#endif // OPENTHREAD_PLATFORM_CONFIG_H_ +#endif // OPENTHREAD_PLATFORM_POSIX_CONFIG_H_ diff --git a/src/posix/platform/platform-posix.h b/src/posix/platform/platform-posix.h index 912ceb590..a5d3a302d 100644 --- a/src/posix/platform/platform-posix.h +++ b/src/posix/platform/platform-posix.h @@ -32,8 +32,8 @@ * This file includes the platform-specific initializers. */ -#ifndef PLATFORM_POSIX_H_ -#define PLATFORM_POSIX_H_ +#ifndef OT_PLATFORM_POSIX_H_ +#define OT_PLATFORM_POSIX_H_ #include "openthread-posix-config.h" @@ -424,4 +424,4 @@ void platformBacktraceInit(void); #ifdef __cplusplus } #endif -#endif // PLATFORM_POSIX_H_ +#endif // OT_PLATFORM_POSIX_H_ diff --git a/src/posix/platform/power.hpp b/src/posix/platform/power.hpp index 4edbcb2d5..f4481f152 100644 --- a/src/posix/platform/power.hpp +++ b/src/posix/platform/power.hpp @@ -26,8 +26,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef POSIX_PLATFORM_POWER_H -#define POSIX_PLATFORM_POWER_H +#ifndef OT_POSIX_PLATFORM_POWER_HPP_ +#define OT_POSIX_PLATFORM_POWER_HPP_ #include #include @@ -286,4 +286,4 @@ private: }; } // namespace Power } // namespace ot -#endif // POSIX_PLATFORM_POWER_H +#endif // OT_POSIX_PLATFORM_POWER_HPP_ diff --git a/src/posix/platform/radio.hpp b/src/posix/platform/radio.hpp index 49cdfdf3d..8fe2be781 100644 --- a/src/posix/platform/radio.hpp +++ b/src/posix/platform/radio.hpp @@ -26,8 +26,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef POSIX_PLATFORM_RADIO_HPP_ -#define POSIX_PLATFORM_RADIO_HPP_ +#ifndef OT_POSIX_PLATFORM_RADIO_HPP_ +#define OT_POSIX_PLATFORM_RADIO_HPP_ #include "common/code_utils.hpp" #include "lib/spinel/radio_spinel.hpp" @@ -123,4 +123,4 @@ private: } // namespace Posix } // namespace ot -#endif // POSIX_PLATFORM_RADIO_HPP_ +#endif // OT_POSIX_PLATFORM_RADIO_HPP_ diff --git a/src/posix/platform/radio_url.hpp b/src/posix/platform/radio_url.hpp index 02460705b..0e088cb90 100644 --- a/src/posix/platform/radio_url.hpp +++ b/src/posix/platform/radio_url.hpp @@ -26,8 +26,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef POSIX_PLATFORM_RADIO_URL_HPP_ -#define POSIX_PLATFORM_RADIO_URL_HPP_ +#ifndef OT_POSIX_PLATFORM_RADIO_URL_HPP_ +#define OT_POSIX_PLATFORM_RADIO_URL_HPP_ #include #include @@ -78,4 +78,4 @@ private: } // namespace Posix } // namespace ot -#endif // POSIX_PLATFORM_RADIO_URL_HPP_ +#endif // OT_POSIX_PLATFORM_RADIO_URL_HPP_ diff --git a/src/posix/platform/resolver.hpp b/src/posix/platform/resolver.hpp index 8446a4763..9b0c1046d 100644 --- a/src/posix/platform/resolver.hpp +++ b/src/posix/platform/resolver.hpp @@ -26,8 +26,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef POSIX_PLATFORM_RESOLVER_HPP_ -#define POSIX_PLATFORM_RESOLVER_HPP_ +#ifndef OT_POSIX_PLATFORM_RESOLVER_HPP_ +#define OT_POSIX_PLATFORM_RESOLVER_HPP_ #include #include @@ -73,10 +73,7 @@ public: /** * Updates the file descriptor sets with file descriptors used by the radio driver. * - * @param[in,out] aReadFdSet A reference to the read file descriptors. - * @param[in,out] aErrorFdSet A reference to the error file descriptors. - * @param[in,out] aMaxFd A reference to the max file descriptor. - * @param[in,out] aTimeout A reference to the timeout. + * @param[in,out] aContext The mainloop context. * */ void UpdateFdSet(otSysMainloopContext &aContext); @@ -84,8 +81,7 @@ public: /** * Handles the result of select. * - * @param[in] aReadFdSet A reference to the read file descriptors. - * @param[in] aErrorFdSet A reference to the error file descriptors. + * @param[in] aContext The mainloop context. * */ void Process(const otSysMainloopContext &aContext); @@ -122,4 +118,4 @@ private: #endif // OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE -#endif // POSIX_PLATFORM_RESOLVER_HPP_ +#endif // OT_POSIX_PLATFORM_RESOLVER_HPP_ diff --git a/src/posix/platform/settings.hpp b/src/posix/platform/settings.hpp index d2009aa37..bf2cabd6d 100644 --- a/src/posix/platform/settings.hpp +++ b/src/posix/platform/settings.hpp @@ -26,8 +26,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef POSIX_PLATFORM_SETTINGS_HPP_ -#define POSIX_PLATFORM_SETTINGS_HPP_ +#ifndef OT_POSIX_PLATFORM_SETTINGS_HPP_ +#define OT_POSIX_PLATFORM_SETTINGS_HPP_ namespace ot { namespace Posix { @@ -100,4 +100,4 @@ void PlatformSettingsGetSensitiveKeys(otInstance *aInstance, const uint16_t **aK } // namespace Posix } // namespace ot -#endif // POSIX_PLATFORM_SETTINGS_HPP_ +#endif // OT_POSIX_PLATFORM_SETTINGS_HPP_ diff --git a/src/posix/platform/spi_interface.hpp b/src/posix/platform/spi_interface.hpp index 095214a79..8986b5ae3 100644 --- a/src/posix/platform/spi_interface.hpp +++ b/src/posix/platform/spi_interface.hpp @@ -31,8 +31,8 @@ * This file includes definitions for the SPI interface to radio (RCP). */ -#ifndef POSIX_PLATFORM_SPI_INTERFACE_HPP_ -#define POSIX_PLATFORM_SPI_INTERFACE_HPP_ +#ifndef OT_POSIX_PLATFORM_SPI_INTERFACE_HPP_ +#define OT_POSIX_PLATFORM_SPI_INTERFACE_HPP_ #include "openthread-posix-config.h" @@ -258,4 +258,4 @@ private: } // namespace Posix } // namespace ot -#endif // POSIX_PLATFORM_SPI_INTERFACE_HPP_ +#endif // OT_POSIX_PLATFORM_SPI_INTERFACE_HPP_ diff --git a/src/posix/platform/vendor_interface.hpp b/src/posix/platform/vendor_interface.hpp index 4ee7a1ae8..449ebe5fd 100644 --- a/src/posix/platform/vendor_interface.hpp +++ b/src/posix/platform/vendor_interface.hpp @@ -31,8 +31,8 @@ * This file includes definitions for the vendor interface to radio (RCP). */ -#ifndef POSIX_APP_VENDOR_INTERFACE_HPP_ -#define POSIX_APP_VENDOR_INTERFACE_HPP_ +#ifndef OT_POSIX_APP_VENDOR_INTERFACE_HPP_ +#define OT_POSIX_APP_VENDOR_INTERFACE_HPP_ #include "openthread-posix-config.h" @@ -171,4 +171,4 @@ public: } // namespace Posix } // namespace ot -#endif // POSIX_APP_VENDOR_INTERFACE_HPP_ +#endif // OT_POSIX_APP_VENDOR_INTERFACE_HPP_