You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/05/31 12:51:33 UTC

[GitHub] [incubator-nuttx] Donny9 opened a new pull request #3808: Ramlog: recover last crash log from ram buffer.

Donny9 opened a new pull request #3808:
URL: https://github.com/apache/incubator-nuttx/pull/3808


   ## Summary
   Ramlog: recover last crash log from ram buffer.
   We need place ram buffer to a fixed section, it will not be initialized on boot.
   ## Impact
   
   ## Testing
   daily test.
   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] gustavonihei merged pull request #3808: Ramlog: recover last crash log from ram buffer.

Posted by GitBox <gi...@apache.org>.
gustavonihei merged pull request #3808:
URL: https://github.com/apache/incubator-nuttx/pull/3808


   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] gustavonihei commented on a change in pull request #3808: Ramlog: recover last crash log from ram buffer.

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #3808:
URL: https://github.com/apache/incubator-nuttx/pull/3808#discussion_r642489076



##########
File path: drivers/syslog/Kconfig
##########
@@ -34,6 +34,14 @@ config RAMLOG
 		details as needed to support logging.
 
 if RAMLOG
+config RAMLOG_BUFFER_SECTION
+	string "The section where ramlog buffer is located"
+	default ".bss"
+	depends on RAMLOG_SYSLOG
+	---help---
+		The section where ramlog buffer is located, this section cannot
+		be initialized each time when the system boot.

Review comment:
       nit: Suggestion for trying to improve the help text.
   ```suggestion
   		The section where ramlog buffer is located.
   		This section shall not be initialized on system boot.
   ```




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] Donny9 commented on a change in pull request #3808: Ramlog: recover last crash log from ram buffer.

Posted by GitBox <gi...@apache.org>.
Donny9 commented on a change in pull request #3808:
URL: https://github.com/apache/incubator-nuttx/pull/3808#discussion_r642501719



##########
File path: drivers/syslog/ramlog.c
##########
@@ -639,6 +643,60 @@ int ramlog_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
   return ret;
 }
 
+/****************************************************************************
+ * Name: ramlog_initbuf
+ *
+ * Description:
+ *  Initialize g_sysdev based on the current system ramlog buffer.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_RAMLOG_SYSLOG
+static void ramlog_initbuf(void)
+{
+  FAR struct ramlog_dev_s *priv = &g_sysdev;
+  char prev, cur;
+  size_t i;
+
+  if (priv->rl_head != CONFIG_RAMLOG_BUFSIZE ||
+      priv->rl_tail != CONFIG_RAMLOG_BUFSIZE)
+    {
+      return;
+    }
+
+  prev = priv->rl_buffer[priv->rl_bufsize - 1];
+
+  for (i = 0; i < priv->rl_bufsize; i++)
+    {
+      cur = priv->rl_buffer[i];
+
+      if (!isascii(cur))
+        {
+          goto out;
+        }
+
+      if (prev && !cur)
+        {
+          priv->rl_head = i;
+        }
+
+      if (!prev && cur)
+        {
+          priv->rl_tail = i;
+        }
+
+      prev = cur;
+    }
+
+out:
+  if (i != priv->rl_bufsize)
+    {
+      priv->rl_head = priv->rl_tail = 0;

Review comment:
       Done. Thank you.

##########
File path: drivers/syslog/ramlog.c
##########
@@ -639,6 +643,60 @@ int ramlog_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
   return ret;
 }
 
+/****************************************************************************
+ * Name: ramlog_initbuf
+ *
+ * Description:
+ *  Initialize g_sysdev based on the current system ramlog buffer.

Review comment:
       Done. Thank you.

##########
File path: drivers/syslog/Kconfig
##########
@@ -34,6 +34,14 @@ config RAMLOG
 		details as needed to support logging.
 
 if RAMLOG
+config RAMLOG_BUFFER_SECTION
+	string "The section where ramlog buffer is located"
+	default ".bss"
+	depends on RAMLOG_SYSLOG
+	---help---
+		The section where ramlog buffer is located, this section cannot
+		be initialized each time when the system boot.

Review comment:
       Done. Thank you.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #3808: Ramlog: recover last crash log from ram buffer.

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #3808:
URL: https://github.com/apache/incubator-nuttx/pull/3808#issuecomment-852327867


   @gustavonihei Do you have more comment?


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] gustavonihei commented on a change in pull request #3808: Ramlog: recover last crash log from ram buffer.

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #3808:
URL: https://github.com/apache/incubator-nuttx/pull/3808#discussion_r642492881



##########
File path: drivers/syslog/ramlog.c
##########
@@ -639,6 +643,60 @@ int ramlog_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
   return ret;
 }
 
+/****************************************************************************
+ * Name: ramlog_initbuf
+ *
+ * Description:
+ *  Initialize g_sysdev based on the current system ramlog buffer.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_RAMLOG_SYSLOG
+static void ramlog_initbuf(void)
+{
+  FAR struct ramlog_dev_s *priv = &g_sysdev;
+  char prev, cur;
+  size_t i;
+
+  if (priv->rl_head != CONFIG_RAMLOG_BUFSIZE ||
+      priv->rl_tail != CONFIG_RAMLOG_BUFSIZE)
+    {
+      return;
+    }
+
+  prev = priv->rl_buffer[priv->rl_bufsize - 1];
+
+  for (i = 0; i < priv->rl_bufsize; i++)
+    {
+      cur = priv->rl_buffer[i];
+
+      if (!isascii(cur))
+        {
+          goto out;
+        }
+
+      if (prev && !cur)
+        {
+          priv->rl_head = i;
+        }
+
+      if (!prev && cur)
+        {
+          priv->rl_tail = i;
+        }
+
+      prev = cur;
+    }
+
+out:
+  if (i != priv->rl_bufsize)
+    {
+      priv->rl_head = priv->rl_tail = 0;

Review comment:
       ```suggestion
         priv->rl_head = 0;
         priv->rl_tail = 0;
   ```
   This is a violation to the One Statement per Line rule of the coding standard:
   https://cwiki.apache.org/confluence/display/NUTTX/Coding+Standard#onestatement




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] gustavonihei commented on a change in pull request #3808: Ramlog: recover last crash log from ram buffer.

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #3808:
URL: https://github.com/apache/incubator-nuttx/pull/3808#discussion_r642490172



##########
File path: drivers/syslog/ramlog.c
##########
@@ -639,6 +643,60 @@ int ramlog_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
   return ret;
 }
 
+/****************************************************************************
+ * Name: ramlog_initbuf
+ *
+ * Description:
+ *  Initialize g_sysdev based on the current system ramlog buffer.

Review comment:
       ```suggestion
    *   Initialize g_sysdev based on the current system ramlog buffer.
   ```




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org