From e1c45b607ef7c6cddebe93d96e8f6e0cd4987da6 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Tue, 18 Nov 2025 10:58:09 +0800
Subject: [PATCH] update config logger

---
 project/lightd/config.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/project/lightd/config.h b/project/lightd/config.h
index 85f47ff..0e9e131 100644
--- a/project/lightd/config.h
+++ b/project/lightd/config.h
@@ -13,6 +13,7 @@
 #ifndef  __CONF_H_
 #define  __CONF_H_
 
+#include <stddef.h>
 #include "gpio.h"
 
 enum
@@ -73,6 +74,10 @@
     mqtt_ctx_t      mqtt;
 } iotd_ctx_t;
 
+/* get iotd_ctx address by mqtt_ctx address */
+#define container_of(ptr, type, member) ((type *)((char *)(ptr) - offsetof(type, member)))
+#define to_iotd(ctx)	container_of(ctx, iotd_ctx_t, mqtt);
+
 extern int parser_conf(const char *conf_file, iotd_ctx_t *ctx, int debug);
 
 #endif   /* ----- #ifndef _CONF_H_  ----- */

--
Gitblit v1.9.1