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


   ## Summary
   
   When creating a new syslog file channel through `syslog_file_channel()`, any 
previous file channel was automatically destroyed and substituted by the new 
channel.
   
   This creates a couple of issues:
   * You couldn't have more than one file channels. I really don't see the 
reason for this limitation.
   * If the channel was already destroyed by any other means (e.g. by a call to 
`syslog_channel_remove()`), `syslog_file_channel()` would try to re-destroy an 
already non-existent channel. This will lead to a system crash.
   
   The later is very important, as with this limitation files cannot residue on 
removable storages (not efficiently at least).  
   You cannot create and destroy the channel as the medium is inserted/removed.
   
   This PR intends to fix this.  
   Channels are only created with `syslog_file_channel()` and only destroyed 
with `syslog_channel_remove()`.
   
   
   ## Impact
   
   Applications that were relying on `syslog_file_channel()` to clean-up any 
previous channels will now have to be changed to use 
   `syslog_channel_remove()` before the creation of the new channel.
   
   However this is not an expected use-case. There is no need to re-initialize 
a file channel ever.  
   
   If indeed the file residues on an external medium, the application must not 
call `syslog_file_channel()` again, as syslog_device already contains logic to 
re-open files in case of failure (i.e. the medium was removed).
   
   
   ## Testing
   
   Basic build test only, for an STM32F427 target.  
   I will un-draft it when testing is complete, I hope later today.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to