You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2020/03/18 12:02:52 UTC

[GitHub] [mynewt-mcumgr] nvlsianpu commented on a change in pull request #72: fs_mgmt: Fix file download for Zephyr

nvlsianpu commented on a change in pull request #72: fs_mgmt: Fix file download for Zephyr
URL: https://github.com/apache/mynewt-mcumgr/pull/72#discussion_r394293364
 
 

 ##########
 File path: cmd/fs_mgmt/include/fs_mgmt/fs_mgmt_config.h
 ##########
 @@ -30,7 +30,44 @@
 
 #elif defined __ZEPHYR__
 
-#define FS_MGMT_DL_CHUNK_SIZE   CONFIG_FS_MGMT_DL_CHUNK_SIZE
+#define MCUMGR_BUF_SIZE         CONFIG_MCUMGR_BUF_SIZE
+/* File chunk needs to fit into MCUMGR_BUF_SIZE with all required headers
+ * and other data fields; following information takes space off the
+ * MCUMGR_BUF_SIZE, N is CONFIG_FS_MGMT_MAX_OFFSET_LEN
+ *  MGMT_HDR_SIZE - header that is placed in front of buffer and not
+ *    visible for cbod encoder (see smp_handle_single_req);
+ *  9 + 1 -- bytes taken by definition of CBOR undefined length map and map
+ *    terminator (break) character;
+ *  1 + strlen("off") + [1, N] -- CBOR encoded pair of "off" marker and
+ *    offset of the chunk within the file;
+ *  1 + strlen("data") + [1, N] -- CBOR encoded "data" marker; this marker
+ *    will be followed by file chunk of size FS_MGMT_DL_CHUNK_SIZE
+ *  1 + strlen("rc") + 1 -- status code of operation;
+ *  1 + strlen("len") + [1, N] -- CBOR encoded "len" marker and complete
+ *    length of a file; this is only sent once when "off" is 0;
+ *
+ * FS_MGMT_DL_CHUNK_SIZE is calculated with most pessimistic estimations,
+ * that is with headers fields taking most space, i.e. N bytes.
+ */
+#define CBOR_AND_OTHER_HDR \
 
 Review comment:
   +1 for comprehensive description.

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


With regards,
Apache Git Services