Gary-Hobson commented on code in PR #7900: URL: https://github.com/apache/nuttx/pull/7900#discussion_r1056118108
########## drivers/note/note_driver.c: ########## @@ -435,6 +455,122 @@ static inline int note_isenabled_dump(void) } #endif +#if CONFIG_TASK_NAME_SIZE > 0 + +/**************************************************************************** + * Name: note_read_taskname + * + * Description: + * read task name info from the specified position in buffer + * + * Input Parameters: + * pos - position + * info - task name info buffer + * + * Returned Value: + * None + * + ****************************************************************************/ + +static void note_read_taskname(size_t pos, + FAR struct note_taskname_info_s *info) +{ + size_t space; + pos = pos % CONFIG_DRIVER_NOTERAM_TASKNAME_BUFSIZE; + space = CONFIG_DRIVER_NOTERAM_TASKNAME_BUFSIZE - pos; + if (space > sizeof(struct note_taskname_info_s)) + { + space = sizeof(struct note_taskname_info_s); + } + + memcpy(info, g_note_taskname.buffer + pos, space); + memcpy(((void *)info) + space, g_note_taskname.buffer, Review Comment: done ########## drivers/note/note_driver.c: ########## @@ -435,6 +455,122 @@ static inline int note_isenabled_dump(void) } #endif +#if CONFIG_TASK_NAME_SIZE > 0 + +/**************************************************************************** + * Name: note_read_taskname + * + * Description: + * read task name info from the specified position in buffer + * + * Input Parameters: + * pos - position + * info - task name info buffer + * + * Returned Value: + * None + * + ****************************************************************************/ + +static void note_read_taskname(size_t pos, + FAR struct note_taskname_info_s *info) +{ + size_t space; + pos = pos % CONFIG_DRIVER_NOTERAM_TASKNAME_BUFSIZE; + space = CONFIG_DRIVER_NOTERAM_TASKNAME_BUFSIZE - pos; + if (space > sizeof(struct note_taskname_info_s)) + { + space = sizeof(struct note_taskname_info_s); + } + + memcpy(info, g_note_taskname.buffer + pos, space); + memcpy(((void *)info) + space, g_note_taskname.buffer, + sizeof(struct note_taskname_info_s) - space); +} + +/**************************************************************************** + * Name: note_find_taskname + * + * Description: + * Find task name info corresponding to the specified PID + * + * Input Parameters: + * PID - Task ID + * + * Returned Value: + * Pointer to the task name info + * If the corresponding info doesn't exist in the buffer, NULL is returned. + * + ****************************************************************************/ + +static int note_find_taskname(pid_t pid, + FAR struct note_taskname_info_s *info) +{ + int n; + + for (n = g_note_taskname.tail; n < g_note_taskname.head; n += info->size) + { + note_read_taskname(n, info); Review Comment: done -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org