system: Fix nxstyle errors

error: Long line found
This commit is contained in:
simbit18 2023-05-10 13:13:03 +02:00 committed by CeDeROM
parent cb292d0608
commit b810ac0b7e
2 changed files with 119 additions and 102 deletions

View File

@ -1,4 +1,4 @@
/************************************************************************************ /****************************************************************************
* apps/system/sched_note/note_main.c * apps/system/sched_note/note_main.c
* *
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
@ -16,11 +16,11 @@
* License for the specific language governing permissions and limitations * License for the specific language governing permissions and limitations
* under the License. * under the License.
* *
************************************************************************************/ ****************************************************************************/
/************************************************************************************ /****************************************************************************
* Included Files * Included Files
************************************************************************************/ ****************************************************************************/
#include <nuttx/config.h> #include <nuttx/config.h>
@ -36,18 +36,18 @@
#include <nuttx/sched_note.h> #include <nuttx/sched_note.h>
/************************************************************************************ /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
************************************************************************************/ ****************************************************************************/
# define syslog_time(priority, fmt, ...) \ # define syslog_time(priority, fmt, ...) \
syslog(priority, "%08lx: " fmt, \ syslog(priority, "%08lx: " fmt, \
(unsigned long)systime, \ (unsigned long)systime, \
__VA_ARGS__) __VA_ARGS__)
/************************************************************************************ /****************************************************************************
* Private Data * Private Data
************************************************************************************/ ****************************************************************************/
static bool g_note_daemon_started; static bool g_note_daemon_started;
static uint8_t g_note_buffer[CONFIG_SYSTEM_NOTE_BUFFERSIZE]; static uint8_t g_note_buffer[CONFIG_SYSTEM_NOTE_BUFFERSIZE];
@ -73,13 +73,13 @@ static FAR const char *g_statenames[] =
#define NSTATES (sizeof(g_statenames)/sizeof(FAR const char *)) #define NSTATES (sizeof(g_statenames)/sizeof(FAR const char *))
#endif #endif
/************************************************************************************ /****************************************************************************
* Private Functions * Private Functions
************************************************************************************/ ****************************************************************************/
/************************************************************************************ /****************************************************************************
* Name: trace_dump_unflatten * Name: trace_dump_unflatten
************************************************************************************/ ****************************************************************************/
static void trace_dump_unflatten(FAR void *dst, static void trace_dump_unflatten(FAR void *dst,
FAR uint8_t *src, size_t len) FAR uint8_t *src, size_t len)
@ -95,9 +95,9 @@ static void trace_dump_unflatten(FAR void *dst,
#endif #endif
} }
/************************************************************************************ /****************************************************************************
* Name: dump_notes * Name: dump_notes
************************************************************************************/ ****************************************************************************/
static void dump_notes(size_t nread) static void dump_notes(size_t nread)
{ {
@ -175,8 +175,8 @@ static void dump_notes(size_t nread)
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
syslog_time(LOG_INFO, syslog_time(LOG_INFO,
"Task %u stopped, CPU%u, priority %u\n", "Task %u stopped, CPU%u, priority %u\n",
(unsigned int)pid, (unsigned int)pid, (unsigned int)note->nc_cpu,
(unsigned int)note->nc_cpu, (unsigned int)note->nc_priority); (unsigned int)note->nc_priority);
#else #else
syslog_time(LOG_INFO, syslog_time(LOG_INFO,
"Task %u stopped, priority %u\n", "Task %u stopped, priority %u\n",
@ -391,21 +391,23 @@ static void dump_notes(size_t nread)
return; return;
} }
trace_dump_unflatten(&count, note_preempt->npr_count, sizeof(count)); trace_dump_unflatten(&count, note_preempt->npr_count,
sizeof(count));
if (note->nc_type == NOTE_PREEMPT_LOCK) if (note->nc_type == NOTE_PREEMPT_LOCK)
{ {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
syslog_time(LOG_INFO, syslog_time(LOG_INFO,
"Task %u locked, CPU%u, priority %u, count=%u\n", "Task %u locked, CPU%u, priority %u, count=%u\n",
(unsigned int)pid, (unsigned int)pid, (unsigned int)note->nc_cpu,
(unsigned int)note->nc_cpu, (unsigned int)note->nc_priority,
(unsigned int)note->nc_priority, (unsigned int)count); (unsigned int)count);
#else #else
syslog_time(LOG_INFO, syslog_time(LOG_INFO,
"Task %u locked, priority %u, count=%u\n", "Task %u locked, priority %u, count=%u\n",
(unsigned int)pid, (unsigned int)pid,
(unsigned int)note->nc_priority, (unsigned int)count); (unsigned int)note->nc_priority,
(unsigned int)count);
#endif #endif
} }
else else
@ -413,14 +415,15 @@ static void dump_notes(size_t nread)
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
syslog_time(LOG_INFO, syslog_time(LOG_INFO,
"Task %u unlocked, CPU%u, priority %u, count=%u\n", "Task %u unlocked, CPU%u, priority %u, count=%u\n",
(unsigned int)pid, (unsigned int)pid, (unsigned int)note->nc_cpu,
(unsigned int)note->nc_cpu, (unsigned int)note->nc_priority,
(unsigned int)note->nc_priority, (unsigned int)count); (unsigned int)count);
#else #else
syslog_time(LOG_INFO, syslog_time(LOG_INFO,
"Task %u unlocked, priority %u, count=%u\n", "Task %u unlocked, priority %u, count=%u\n",
(unsigned int)pid, (unsigned int)pid,
(unsigned int)note->nc_priority, (unsigned int)count); (unsigned int)note->nc_priority,
(unsigned int)count);
#endif #endif
} }
} }
@ -447,38 +450,41 @@ static void dump_notes(size_t nread)
} }
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
trace_dump_unflatten(&count, note_csection->ncs_count, sizeof(count)); trace_dump_unflatten(&count, note_csection->ncs_count,
sizeof(count));
if (note->nc_type == NOTE_CSECTION_ENTER) if (note->nc_type == NOTE_CSECTION_ENTER)
{ {
syslog_time(LOG_INFO, syslog_time(LOG_INFO,
"Task %u enter csection, CPU%u, priority %u, " "Task %u enter csection, CPU%u, priority %u, "
"count=%u\n", "count=%u\n",
(unsigned int)pid, (unsigned int)pid, (unsigned int)note->nc_cpu,
(unsigned int)note->nc_cpu, (unsigned int)note->nc_priority,
(unsigned int)note->nc_priority, (unsigned int)count); (unsigned int)count);
} }
else else
{ {
syslog_time(LOG_INFO, syslog_time(LOG_INFO,
"Task %u leave csection, CPU%u, priority %u, " "Task %u leave csection, CPU%u, priority %u, "
"count=%u\n", "count=%u\n",
(unsigned int)pid, (unsigned int)pid, (unsigned int)note->nc_cpu,
(unsigned int)note->nc_cpu, (unsigned int)note->nc_priority,
(unsigned int)note->nc_priority, (unsigned int)count); (unsigned int)count);
} }
#else #else
if (note->nc_type == NOTE_CSECTION_ENTER) if (note->nc_type == NOTE_CSECTION_ENTER)
{ {
syslog_time(LOG_INFO, "Task %u enter csection, priority %u\n", syslog_time(LOG_INFO,
(unsigned int)pid, "Task %u enter csection, priority %u\n",
(unsigned int)note->nc_priority); (unsigned int)pid,
(unsigned int)note->nc_priority);
} }
else else
{ {
syslog_time(LOG_INFO, "Task %u leave csection, priority %u\n", syslog_time(LOG_INFO,
(unsigned int)pid, "Task %u leave csection, priority %u\n",
(unsigned int)note->nc_priority); (unsigned int)pid,
(unsigned int)note->nc_priority);
} }
#endif #endif
} }
@ -552,8 +558,8 @@ static void dump_notes(size_t nread)
case NOTE_SPINLOCK_ABORT: case NOTE_SPINLOCK_ABORT:
{ {
syslog_time(LOG_INFO, syslog_time(LOG_INFO,
"Task %u CPU%u abort wait on spinlock=%p value=%u " "Task %u CPU%u abort wait on spinlock=%p "
"priority %u\n", "value=%u priority %u\n",
(unsigned int)pid, (unsigned int)pid,
(unsigned int)note->nc_cpu, (unsigned int)note->nc_cpu,
spinlock, spinlock,
@ -623,7 +629,8 @@ static void dump_notes(size_t nread)
if (note->nc_length < SIZEOF_NOTE_SYSCALL_ENTER(0)) if (note->nc_length < SIZEOF_NOTE_SYSCALL_ENTER(0))
{ {
syslog(LOG_ERR, syslog(LOG_ERR,
"Size incorrect for \"SYSCALL enter\" note: %d\n", "Size incorrect for \"SYSCALL enter\" note: "
"%d\n",
note->nc_length); note->nc_length);
return; return;
} }
@ -641,10 +648,12 @@ static void dump_notes(size_t nread)
(FAR struct note_syscall_leave_s *)note; (FAR struct note_syscall_leave_s *)note;
uintptr_t result; uintptr_t result;
if (note->nc_length != sizeof(struct note_syscall_leave_s)) if (note->nc_length !=
sizeof(struct note_syscall_leave_s))
{ {
syslog(LOG_ERR, syslog(LOG_ERR,
"Size incorrect for \"SYSCALL leave\" note: %d\n", "Size incorrect for \"SYSCALL leave\" note: "
"%d\n",
note->nc_length); note->nc_length);
return; return;
} }
@ -677,10 +686,10 @@ static void dump_notes(size_t nread)
} }
syslog_time(LOG_INFO, syslog_time(LOG_INFO,
"Task %u %s IRQ %d\n", "Task %u %s IRQ %d\n",
(unsigned int)pid, (unsigned int)pid,
note->nc_type == NOTE_IRQ_ENTER ? "Enter" : "Leave", note->nc_type == NOTE_IRQ_ENTER ? "Enter" : "Leave",
note_irq->nih_irq); note_irq->nih_irq);
} }
break; break;
#endif #endif
@ -717,7 +726,8 @@ static void dump_notes(size_t nread)
int ret = 0; int ret = 0;
int i; int i;
count = note->nc_length - sizeof(struct note_binary_s) + 1; count =
note->nc_length - sizeof(struct note_binary_s) + 1;
if (count < 0) if (count < 0)
{ {
@ -759,9 +769,9 @@ static void dump_notes(size_t nread)
} }
} }
/************************************************************************************ /****************************************************************************
* Name: note_daemon * Name: note_daemon
************************************************************************************/ ****************************************************************************/
static int note_daemon(int argc, char *argv[]) static int note_daemon(int argc, char *argv[])
{ {
@ -780,7 +790,8 @@ static int note_daemon(int argc, char *argv[])
if (fd < 0) if (fd < 0)
{ {
int errcode = errno; int errcode = errno;
syslog(LOG_ERR, "note_daemon: ERROR: Failed to open /dev/note/ram: %d\n", syslog(LOG_ERR, "note_daemon: ERROR: Failed to open /dev/note/ram: "
"%d\n",
errcode); errcode);
goto errout; goto errout;
} }
@ -807,13 +818,13 @@ errout:
return EXIT_FAILURE; return EXIT_FAILURE;
} }
/************************************************************************************ /****************************************************************************
* Public Functions * Public Functions
************************************************************************************/ ****************************************************************************/
/************************************************************************************ /****************************************************************************
* Name: note_main * Name: note_main
************************************************************************************/ ****************************************************************************/
int main(int argc, FAR char *argv[]) int main(int argc, FAR char *argv[])
{ {

View File

@ -1,4 +1,4 @@
/************************************************************************************ /****************************************************************************
* apps/system/termcurses/tcurses_vt100.c * apps/system/termcurses/tcurses_vt100.c
* *
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
@ -16,11 +16,11 @@
* License for the specific language governing permissions and limitations * License for the specific language governing permissions and limitations
* under the License. * under the License.
* *
************************************************************************************/ ****************************************************************************/
/************************************************************************************ /****************************************************************************
* Included Files * Included Files
************************************************************************************/ ****************************************************************************/
#include <nuttx/config.h> #include <nuttx/config.h>
@ -44,9 +44,9 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <nuttx/kmalloc.h> #include <nuttx/kmalloc.h>
/************************************************************************************ /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
************************************************************************************/ ****************************************************************************/
#define KEY_DOWN 0x102 /* Down arrow key */ #define KEY_DOWN 0x102 /* Down arrow key */
#define KEY_UP 0x103 /* Up arrow key */ #define KEY_UP 0x103 /* Up arrow key */
@ -61,9 +61,9 @@
#define TINFO_ENTRY(n, d, c) d, c #define TINFO_ENTRY(n, d, c) d, c
#endif #endif
/************************************************************************************ /****************************************************************************
* Private Types * Private Types
************************************************************************************/ ****************************************************************************/
struct tcurses_vt100_s struct tcurses_vt100_s
{ {
@ -78,14 +78,15 @@ struct tcurses_vt100_s
tcflag_t lflag; tcflag_t lflag;
}; };
/************************************************************************************ /****************************************************************************
* Private Function Prototypes * Private Function Prototypes
************************************************************************************/ ****************************************************************************/
static FAR struct termcurses_s *tcurses_vt100_initialize(int in_fd, int out_fd); static FAR struct termcurses_s *tcurses_vt100_initialize(int in_fd,
int out_fd);
static int tcurses_vt100_clear(FAR struct termcurses_s *dev, int type); static int tcurses_vt100_clear(FAR struct termcurses_s *dev, int type);
static int tcurses_vt100_move(FAR struct termcurses_s *dev, int type, int col, static int tcurses_vt100_move(FAR struct termcurses_s *dev, int type,
int row); int col, int row);
static int tcurses_vt100_getwinsize(FAR struct termcurses_s *dev, static int tcurses_vt100_getwinsize(FAR struct termcurses_s *dev,
FAR struct winsize *winsz); FAR struct winsize *winsz);
static int tcurses_vt100_setcolors(FAR struct termcurses_s *dev, static int tcurses_vt100_setcolors(FAR struct termcurses_s *dev,
@ -97,9 +98,9 @@ static int tcurses_vt100_getkeycode(FAR struct termcurses_s *dev,
static bool tcurses_vt100_checkkey(FAR struct termcurses_s *dev); static bool tcurses_vt100_checkkey(FAR struct termcurses_s *dev);
static int tcurses_vt100_terminate(FAR struct termcurses_s *dev); static int tcurses_vt100_terminate(FAR struct termcurses_s *dev);
/************************************************************************************ /****************************************************************************
* Private Data * Private Data
************************************************************************************/ ****************************************************************************/
static const struct termcurses_ops_s g_vt100_ops = static const struct termcurses_ops_s g_vt100_ops =
{ {
@ -713,9 +714,9 @@ static const struct keycodes_s g_ctrl_keycodes[] =
}; };
#endif /* CONFIG_SYSTEM_TERMCURSES_VT100_OSX_ALT_CODES */ #endif /* CONFIG_SYSTEM_TERMCURSES_VT100_OSX_ALT_CODES */
/************************************************************************************ /****************************************************************************
* Public Data * Public Data
************************************************************************************/ ****************************************************************************/
struct termcurses_dev_s g_vt100_tcurs = struct termcurses_dev_s g_vt100_tcurs =
{ {
@ -724,13 +725,13 @@ struct termcurses_dev_s g_vt100_tcurs =
"vt100, vt102, ansi" /* List of supported terminals */ "vt100, vt102, ansi" /* List of supported terminals */
}; };
/************************************************************************************ /****************************************************************************
* Private Functions * Private Functions
************************************************************************************/ ****************************************************************************/
/************************************************************************************ /****************************************************************************
* Clear screen / line operations * Clear screen / line operations
************************************************************************************/ ****************************************************************************/
static int tcurses_vt100_clear(FAR struct termcurses_s *dev, int type) static int tcurses_vt100_clear(FAR struct termcurses_s *dev, int type)
{ {
@ -774,9 +775,9 @@ static int tcurses_vt100_clear(FAR struct termcurses_s *dev, int type)
return ret; return ret;
} }
/************************************************************************************ /****************************************************************************
* Move cursor operations * Move cursor operations
************************************************************************************/ ****************************************************************************/
static int tcurses_vt100_move(FAR struct termcurses_s *dev, int type, static int tcurses_vt100_move(FAR struct termcurses_s *dev, int type,
int col, int row) int col, int row)
@ -812,9 +813,9 @@ static int tcurses_vt100_move(FAR struct termcurses_s *dev, int type,
return ret; return ret;
} }
/************************************************************************************ /****************************************************************************
* Calculates an ANSI 256 color index based on the 24-bit RGB value given. * Calculates an ANSI 256 color index based on the 24-bit RGB value given.
************************************************************************************/ ****************************************************************************/
static uint8_t tcurses_vt100_getcolorindex(int red, int green, int blue) static uint8_t tcurses_vt100_getcolorindex(int red, int green, int blue)
{ {
@ -898,9 +899,9 @@ static uint8_t tcurses_vt100_getcolorindex(int red, int green, int blue)
return 16 + r * 36 + g * 6 + b; return 16 + r * 36 + g * 6 + b;
} }
/************************************************************************************ /****************************************************************************
* Set fg / bg colors * Set fg / bg colors
************************************************************************************/ ****************************************************************************/
static int tcurses_vt100_setcolors(FAR struct termcurses_s *dev, static int tcurses_vt100_setcolors(FAR struct termcurses_s *dev,
FAR struct termcurses_colors_s *colors) FAR struct termcurses_colors_s *colors)
@ -927,7 +928,8 @@ static int tcurses_vt100_setcolors(FAR struct termcurses_s *dev,
if ((colors->color_mask & TCURS_COLOR_BG) != 0) if ((colors->color_mask & TCURS_COLOR_BG) != 0)
{ {
if (colors->bg_red != 0 || colors->bg_green != 0 || colors->bg_blue != 0) if (colors->bg_red != 0 || colors->bg_green != 0 ||
colors->bg_blue != 0)
{ {
colors->bg_red = 0; colors->bg_red = 0;
} }
@ -948,9 +950,9 @@ static int tcurses_vt100_setcolors(FAR struct termcurses_s *dev,
return ret; return ret;
} }
/************************************************************************************ /****************************************************************************
* Get windows size from terminal emulator connected to serial port * Get windows size from terminal emulator connected to serial port
************************************************************************************/ ****************************************************************************/
static int tcurses_vt100_getwinsize(FAR struct termcurses_s *dev, static int tcurses_vt100_getwinsize(FAR struct termcurses_s *dev,
FAR struct winsize *winsz) FAR struct winsize *winsz)
@ -1045,9 +1047,9 @@ static int tcurses_vt100_getwinsize(FAR struct termcurses_s *dev,
return -ENOSYS; return -ENOSYS;
} }
/************************************************************************************ /****************************************************************************
* Set display attributes * Set display attributes
************************************************************************************/ ****************************************************************************/
static int tcurses_vt100_setattributes(FAR struct termcurses_s *dev, static int tcurses_vt100_setattributes(FAR struct termcurses_s *dev,
unsigned long attrib) unsigned long attrib)
@ -1118,11 +1120,11 @@ static int tcurses_vt100_setattributes(FAR struct termcurses_s *dev,
return ret; return ret;
} }
/************************************************************************************ /****************************************************************************
* Get keycode from the terminal, translating special escape sequences into * Get keycode from the terminal, translating special escape sequences into
* special key values. * special key values.
* *
************************************************************************************/ ****************************************************************************/
static int tcurses_vt100_getkeycode(FAR struct termcurses_s *dev, static int tcurses_vt100_getkeycode(FAR struct termcurses_s *dev,
FAR int *specialkey, FAR int *specialkey,
@ -1168,7 +1170,9 @@ static int tcurses_vt100_getkeycode(FAR struct termcurses_s *dev,
tv.tv_sec = 0; tv.tv_sec = 0;
tv.tv_usec = 1000; tv.tv_usec = 1000;
/* Loop until we have a valid key code, taking escape sequences into account */ /* Loop until we have a valid key code, taking escape sequences
* into account
*/
keycode = -1; keycode = -1;
*keymodifiers = 0; *keymodifiers = 0;
@ -1237,7 +1241,7 @@ static int tcurses_vt100_getkeycode(FAR struct termcurses_s *dev,
continue; continue;
} }
/* No more characters waiting in the queue. Must be ESC key. */ /* No more characters waiting in the queue. Must be ESC key. */
return '\x1b'; return '\x1b';
} }
@ -1409,10 +1413,10 @@ static int tcurses_vt100_getkeycode(FAR struct termcurses_s *dev,
return keycode; return keycode;
} }
/************************************************************************************ /****************************************************************************
* Check if a key is cached for processing. * Check if a key is cached for processing.
* *
************************************************************************************/ ****************************************************************************/
static bool tcurses_vt100_checkkey(FAR struct termcurses_s *dev) static bool tcurses_vt100_checkkey(FAR struct termcurses_s *dev)
{ {
@ -1451,18 +1455,19 @@ static bool tcurses_vt100_checkkey(FAR struct termcurses_s *dev)
return false; return false;
} }
/************************************************************************************ /****************************************************************************
* Public Functions * Public Functions
************************************************************************************/ ****************************************************************************/
/************************************************************************************ /****************************************************************************
* Name: tcurses_vt100_initialize * Name: tcurses_vt100_initialize
* *
* Description: * Description:
* Initialize a specific instance of the VT100 TermCurses handler and bind it to * Initialize a specific instance of the VT100 TermCurses handler and
* a specific file descriptor pair (input/output ... typically stdin / stdout). * bind it to a specific file descriptor pair
* (input/output ... typically stdin / stdout).
* *
************************************************************************************/ ****************************************************************************/
FAR struct termcurses_s *tcurses_vt100_initialize(int in_fd, int out_fd) FAR struct termcurses_s *tcurses_vt100_initialize(int in_fd, int out_fd)
{ {
@ -1471,7 +1476,8 @@ FAR struct termcurses_s *tcurses_vt100_initialize(int in_fd, int out_fd)
/* Allocate a new device structure */ /* Allocate a new device structure */
priv = (FAR struct tcurses_vt100_s *)zalloc(sizeof(struct tcurses_vt100_s)); priv =
(FAR struct tcurses_vt100_s *)zalloc(sizeof(struct tcurses_vt100_s));
if (priv == NULL) if (priv == NULL)
{ {
return NULL; return NULL;
@ -1515,13 +1521,13 @@ FAR struct termcurses_s *tcurses_vt100_initialize(int in_fd, int out_fd)
return (FAR struct termcurses_s *)priv; return (FAR struct termcurses_s *)priv;
} }
/************************************************************************************ /****************************************************************************
* Name: tcurses_vt100_terminate * Name: tcurses_vt100_terminate
* *
* Description: * Description:
* Terminates a specific instance of the VT100 TermCurses handler. * Terminates a specific instance of the VT100 TermCurses handler.
* *
************************************************************************************/ ****************************************************************************/
static int tcurses_vt100_terminate(FAR struct termcurses_s *dev) static int tcurses_vt100_terminate(FAR struct termcurses_s *dev)
{ {