This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit fe64034a743c68f077494053e0b002150a07dcdf
Author: yinshengkai <[email protected]>
AuthorDate: Mon Nov 11 22:20:27 2024 +0800

    note: Unify note length format
    
    The size of the structure is padded by default, but the data in noteram is 
not padded
    Mixing sizeof and nc_length in the code will cause errors during binary 
parsing
    
    Signed-off-by: yinshengkai <[email protected]>
---
 drivers/note/note_driver.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/note/note_driver.c b/drivers/note/note_driver.c
index 3f21d4c757f..bf6af9c7337 100644
--- a/drivers/note/note_driver.c
+++ b/drivers/note/note_driver.c
@@ -753,7 +753,7 @@ void sched_note_stop(FAR struct tcb_s *tcb)
 
       /* Add the note to circular buffer */
 
-      note_add(*driver, &note, sizeof(struct note_stop_s));
+      note_add(*driver, &note, note.nsp_cmn.nc_length);
     }
 }
 
@@ -792,7 +792,7 @@ void sched_note_suspend(FAR struct tcb_s *tcb)
 
       /* Add the note to circular buffer */
 
-      note_add(*driver, &note, sizeof(struct note_suspend_s));
+      note_add(*driver, &note, note.nsu_cmn.nc_length);
     }
 }
 
@@ -830,7 +830,7 @@ void sched_note_resume(FAR struct tcb_s *tcb)
 
       /* Add the note to circular buffer */
 
-      note_add(*driver, &note, sizeof(struct note_resume_s));
+      note_add(*driver, &note, note.nre_cmn.nc_length);
     }
 }
 
@@ -870,7 +870,7 @@ void sched_note_cpu_start(FAR struct tcb_s *tcb, int cpu)
 
       /* Add the note to circular buffer */
 
-      note_add(*driver, &note, sizeof(struct note_cpu_start_s));
+      note_add(*driver, &note, note.ncs_cmn.nc_length);
     }
 }
 
@@ -908,7 +908,7 @@ void sched_note_cpu_started(FAR struct tcb_s *tcb)
 
       /* Add the note to circular buffer */
 
-      note_add(*driver, &note, sizeof(struct note_cpu_started_s));
+      note_add(*driver, &note, note.ncs_cmn.nc_length);
     }
 }
 
@@ -947,7 +947,7 @@ void sched_note_cpu_pause(FAR struct tcb_s *tcb, int cpu)
 
       /* Add the note to circular buffer */
 
-      note_add(*driver, &note, sizeof(struct note_cpu_pause_s));
+      note_add(*driver, &note, note.ncp_cmn.nc_length);
     }
 }
 
@@ -985,7 +985,7 @@ void sched_note_cpu_paused(FAR struct tcb_s *tcb)
 
       /* Add the note to circular buffer */
 
-      note_add(*driver, &note, sizeof(struct note_cpu_paused_s));
+      note_add(*driver, &note, note.ncp_cmn.nc_length);
     }
 }
 
@@ -1024,7 +1024,7 @@ void sched_note_cpu_resume(FAR struct tcb_s *tcb, int cpu)
 
       /* Add the note to circular buffer */
 
-      note_add(*driver, &note, sizeof(struct note_cpu_resume_s));
+      note_add(*driver, &note, note.ncr_cmn.nc_length);
     }
 }
 
@@ -1062,7 +1062,7 @@ void sched_note_cpu_resumed(FAR struct tcb_s *tcb)
 
       /* Add the note to circular buffer */
 
-      note_add(*driver, &note, sizeof(struct note_cpu_resumed_s));
+      note_add(*driver, &note, note.ncr_cmn.nc_length);
     }
 }
 #endif /* CONFIG_SMP */
@@ -1106,7 +1106,7 @@ void sched_note_preemption(FAR struct tcb_s *tcb, bool 
locked)
 
       /* Add the note to circular buffer */
 
-      note_add(*driver, &note, sizeof(struct note_preempt_s));
+      note_add(*driver, &note, note.npr_cmn.nc_length);
     }
 
   spin_unlock_irqrestore_notrace(&g_note_lock, flags);
@@ -1151,7 +1151,7 @@ void sched_note_csection(FAR struct tcb_s *tcb, bool 
enter)
 
       /* Add the note to circular buffer */
 
-      note_add(*driver, &note, sizeof(struct note_csection_s));
+      note_add(*driver, &note, note.ncs_cmn.nc_length);
     }
 }
 #endif
@@ -1210,7 +1210,7 @@ void sched_note_spinlock(FAR struct tcb_s *tcb,
 
       /* Add the note to circular buffer */
 
-      note_add(*driver, &note, sizeof(struct note_spinlock_s));
+      note_add(*driver, &note, note.nsp_cmn.nc_length);
     }
 }
 
@@ -1366,7 +1366,7 @@ void sched_note_syscall_leave(int nr, uintptr_t result)
 
       /* Add the note to circular buffer */
 
-      note_add(*driver, &note, sizeof(struct note_syscall_leave_s));
+      note_add(*driver, &note, note.nsc_cmn.nc_length);
     }
 }
 #endif
@@ -1408,7 +1408,7 @@ void sched_note_irqhandler(int irq, FAR void *handler, 
bool enter)
 
       /* Add the note to circular buffer */
 
-      note_add(*driver, &note, sizeof(struct note_irqhandler_s));
+      note_add(*driver, &note, note.nih_cmn.nc_length);
     }
 }
 #endif
@@ -1445,7 +1445,7 @@ void sched_note_wdog(uint8_t event, FAR void *handler, 
FAR const void *arg)
 
       /* Add the note to circular buffer */
 
-      note_add(*driver, &note, sizeof(note));
+      note_add(*driver, &note, note.nwd_cmn.nc_length);
     }
 
   leave_critical_section_notrace(flags);
@@ -1490,7 +1490,7 @@ void sched_note_heap(uint8_t event, FAR void *heap, FAR 
void *mem,
 
       /* Add the note to circular buffer */
 
-      note_add(*driver, &note, sizeof(note));
+      note_add(*driver, &note, note.nhp_cmn.nc_length);
     }
 }
 #endif

Reply via email to