You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2020/11/20 15:29:52 UTC

[incubator-nuttx-apps] branch master updated (73fb7ba -> e4584b0)

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git.


    from 73fb7ba  webclient: Distinguish request size and buffer size in body callback
     new 2319502  fsutils/mkfatfs/mkfatfs.c: Fix syslog formats
     new b92526a  fsutils/mkfatfs/configfat.c: Appease nxstyle
     new 2c0c033  fsutils/mkfatfs/configfat.c: Fix syslog formats
     new 807fab7  fsutils/mkfatfs/writefat.c: Appease nxstyle
     new e4584b0  fsutils/mkfatfs/writefat.c: Fix syslog formats

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 fsutils/mkfatfs/configfat.c | 211 ++++++++++++++++++++++++++------------------
 fsutils/mkfatfs/mkfatfs.c   |   8 +-
 fsutils/mkfatfs/writefat.c  | 139 ++++++++++++++++++-----------
 3 files changed, 218 insertions(+), 140 deletions(-)


[incubator-nuttx-apps] 01/05: fsutils/mkfatfs/mkfatfs.c: Fix syslog formats

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit 2319502ea35837f1062b0727e0e5b45ae2c30d6d
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Fri Nov 20 19:33:06 2020 +0900

    fsutils/mkfatfs/mkfatfs.c: Fix syslog formats
---
 fsutils/mkfatfs/mkfatfs.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/fsutils/mkfatfs/mkfatfs.c b/fsutils/mkfatfs/mkfatfs.c
index 6b38358..4418576 100644
--- a/fsutils/mkfatfs/mkfatfs.c
+++ b/fsutils/mkfatfs/mkfatfs.c
@@ -141,7 +141,7 @@ static inline int mkfatfs_getgeometry(FAR struct fat_format_s *fmt,
 
   if (!geometry.geo_available || !geometry.geo_writeenabled)
     {
-      ferr("ERROR: Media is not available\n", ret);
+      ferr("ERROR: Media is not available\n");
       return -ENODEV;
     }
 
@@ -153,7 +153,8 @@ static inline int mkfatfs_getgeometry(FAR struct fat_format_s *fmt,
     {
       if (fmt->ff_nsectors > geometry.geo_nsectors)
         {
-          ferr("ERROR: User maxblocks (%d) exceeds blocks on device (%d)\n",
+          ferr("ERROR: User maxblocks (%" PRId32
+               ") exceeds blocks on device (%d)\n",
                fmt->ff_nsectors, geometry.geo_nsectors);
 
           return -EINVAL;
@@ -188,7 +189,8 @@ static inline int mkfatfs_getgeometry(FAR struct fat_format_s *fmt,
         break;
 
       default:
-        ferr("ERROR: Unsupported sector size: %d\n", var->fv_sectorsize);
+        ferr("ERROR: Unsupported sector size: %" PRId32 "\n",
+             var->fv_sectorsize);
         return -EPERM;
     }
 


[incubator-nuttx-apps] 04/05: fsutils/mkfatfs/writefat.c: Appease nxstyle

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit 807fab7836f6f0ea2d8d1b91ba87ef9850cf54c1
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Fri Nov 20 19:53:58 2020 +0900

    fsutils/mkfatfs/writefat.c: Appease nxstyle
---
 fsutils/mkfatfs/writefat.c | 122 ++++++++++++++++++++++++++++-----------------
 1 file changed, 77 insertions(+), 45 deletions(-)

diff --git a/fsutils/mkfatfs/writefat.c b/fsutils/mkfatfs/writefat.c
index 31792a5..dc0fa9f 100644
--- a/fsutils/mkfatfs/writefat.c
+++ b/fsutils/mkfatfs/writefat.c
@@ -60,7 +60,8 @@
  * Name: mkfatfs_devwrite
  *
  * Description:
- *   Write the content of the dedicate sector buffer beginning to the specified sector
+ *   Write the content of the dedicate sector buffer beginning to the
+ *   specified sector
  *
  * Input:
  *    fmt  - User specified format parameters
@@ -174,7 +175,8 @@ static inline void mkfatfs_initmbr(FAR struct fat_format_s *fmt,
   MBR_PUTROOTENTCNT(var->fv_sect, fmt->ff_rootdirentries);
 
   /* 2@19: FAT12/16: Must be 0, see MBR_TOTSEC32.
-   * Handled with 4@32: Total count of sectors on the volume */
+   * Handled with 4@32: Total count of sectors on the volume
+   */
 
   if (fmt->ff_nsectors >= 65536)
     {
@@ -189,9 +191,13 @@ static inline void mkfatfs_initmbr(FAR struct fat_format_s *fmt,
 
   MBR_PUTMEDIA(var->fv_sect, FAT_DEFAULT_MEDIA_TYPE); /* Only "hard drive" supported */
 
-  /* 2@22: FAT12/16: Must be 0, see MBR32_FATSZ32  -- handled in FAT specific logic */
+  /* 2@22: FAT12/16: Must be 0, see MBR32_FATSZ32  -- handled in FAT
+   * specific logic
+   */
 
-  /* 2@24: Sectors per track geometry value and 2@26: Number of heads geometry value */
+  /* 2@24: Sectors per track geometry value and 2@26: Number of heads
+   * geometry value
+   */
 
   MBR_PUTSECPERTRK(var->fv_sect, FAT_DEFAULT_SECPERTRK);
   MBR_PUTNUMHEADS(var->fv_sect, FAT_DEFAULT_NUMHEADS);
@@ -211,8 +217,11 @@ static inline void mkfatfs_initmbr(FAR struct fat_format_s *fmt,
       MBR_PUTFATSZ16(var->fv_sect, (uint16_t)var->fv_nfatsects);
 
       /* The following fields are only valid for FAT12/16 */
+
       /*  1@36: Drive number for MSDOS bootstrap -- left zero */
+
       /*  1@37: Reserved (zero) */
+
       /*  1@38: Extended boot signature: 0x29 if following valid */
 
       MBR_PUTBOOTSIG16(var->fv_sect, EXTBOOT_SIGNATURE);
@@ -238,17 +247,21 @@ static inline void mkfatfs_initmbr(FAR struct fat_format_s *fmt,
 
       /* Boot code may be placed in the remainder of the sector */
 
-      memcpy(&var->fv_sect[MBR16_BOOTCODE], var->fv_bootcode, var->fv_bootcodesize);
+      memcpy(&var->fv_sect[MBR16_BOOTCODE], var->fv_bootcode,
+             var->fv_bootcodesize);
     }
   else
     {
       /* The following fields are only valid for FAT32 */
+
       /*  4@36: Count of sectors occupied by one FAT */
 
       MBR_PUTFATSZ32(var->fv_sect, var->fv_nfatsects);
 
       /* 2@40: 0-3:Active FAT, 7=0 both FATS, 7=1 one FAT -- left zero */
+
       /* 2@42: MSB:Major LSB:Minor revision number (0.0) -- left zero */
+
       /* 4@44: Cluster no. of 1st cluster of root dir */
 
       MBR_PUTROOTCLUS(var->fv_sect, FAT32_DEFAULT_ROOT_CLUSTER);
@@ -262,8 +275,11 @@ static inline void mkfatfs_initmbr(FAR struct fat_format_s *fmt,
       MBR_PUTBKBOOTSEC(var->fv_sect, fmt->ff_backupboot);
 
       /* 12@52: Reserved (zero) */
+
       /*  1@64: Drive number for MSDOS bootstrap -- left zero */
+
       /*  1@65: Reserved (zero) */
+
       /*  1@66: Extended boot signature: 0x29 if following valid */
 
       MBR_PUTBOOTSIG32(var->fv_sect, EXTBOOT_SIGNATURE);
@@ -282,10 +298,12 @@ static inline void mkfatfs_initmbr(FAR struct fat_format_s *fmt,
 
       /* Boot code may be placed in the remainder of the sector */
 
-      memcpy(&var->fv_sect[MBR32_BOOTCODE], var->fv_bootcode, var->fv_bootcodesize);
+      memcpy(&var->fv_sect[MBR32_BOOTCODE], var->fv_bootcode,
+             var->fv_bootcodesize);
     }
 
   /* The magic bytes at the end of the MBR are common to FAT12/16/32 */
+
   /*  2@510: Valid MBRs have 0x55aa here */
 
   MBR_PUTSIGNATURE(var->fv_sect, BOOT_SIGNATURE16);
@@ -316,6 +334,7 @@ static inline void mkfatfs_initfsinfo(FAR struct fat_format_s *fmt,
   FSI_PUTLEADSIG(var->fv_sect, 0x41615252);
 
   /* 480@4: Reserved (zero) */
+
   /* 4@484: 0x61417272 = "rrAa" */
 
   FSI_PUTSTRUCTSIG(var->fv_sect, 0x61417272);
@@ -329,6 +348,7 @@ static inline void mkfatfs_initfsinfo(FAR struct fat_format_s *fmt,
   FSI_PUTNXTFREE(var->fv_sect, FAT32_DEFAULT_ROOT_CLUSTER);
 
   /* 12@496: Reserved (zero) */
+
   /* 4@508:  0xaa550000 */
 
   FSI_PUTTRAILSIG(var->fv_sect, BOOT_SIGNATURE32);
@@ -344,7 +364,8 @@ static inline void mkfatfs_initfsinfo(FAR struct fat_format_s *fmt,
  *    fmt  - User specified format parameters
  *    var  - Other format parameters that are not user specifiable
  *    sectno - On FAT32, the root directory is a cluster chain.
- *        This value indicates which sector of the cluster should be produced.
+ *        This value indicates which sector of the cluster should be
+ *        produced.
  *
  * Return:
  *    None; caller is responsible for providing valid parameters.
@@ -357,7 +378,9 @@ static inline void mkfatfs_initrootdir(FAR struct fat_format_s *fmt,
   memset(var->fv_sect, 0, var->fv_sectorsize);
   if (sectno == 0)
     {
-      /* It is only necessary to set data in the first sector of the directory */
+      /* It is only necessary to set data in the first sector of the
+       * directory
+       */
 
       if (memcmp(fmt->ff_volumelabel, "           ", 11))
         {
@@ -475,60 +498,69 @@ static inline int mkfatfs_writefat(FAR struct fat_format_s *fmt,
     {
       /* Loop for each sector in the FAT */
 
-       for (sectno = 0; sectno < var->fv_nfatsects; sectno++)
-         {
-           memset(var->fv_sect, 0, var->fv_sectorsize);
+      for (sectno = 0; sectno < var->fv_nfatsects; sectno++)
+        {
+          memset(var->fv_sect, 0, var->fv_sectorsize);
 
           /* Mark cluster allocations in sector one of each FAT */
 
-           if (sectno == 0)
-             {
-               memset(var->fv_sect, 0, var->fv_sectorsize);
-               switch (fmt->ff_fattype)
-                 {
-                   case 12:
-                     /* Mark the first two full FAT entries -- 24 bits, 3 bytes total */
+          if (sectno == 0)
+            {
+              memset(var->fv_sect, 0, var->fv_sectorsize);
+              switch (fmt->ff_fattype)
+                {
+                  case 12:
+                    /* Mark the first two full FAT entries -- 24 bits,
+                     * 3 bytes total
+                     */
 
-                     memset(var->fv_sect, 0xff, 3);
-                     break;
+                    memset(var->fv_sect, 0xff, 3);
+                    break;
 
-                   case 16:
-                     /* Mark the first two full FAT entries -- 32 bits, 4 bytes total */
+                  case 16:
+                    /* Mark the first two full FAT entries -- 32 bits,
+                     * 4 bytes total
+                     */
 
-                     memset(var->fv_sect, 0xff, 4);
-                     break;
+                    memset(var->fv_sect, 0xff, 4);
+                    break;
 
-                   case 32:
-                   default: /* Shouldn't happen */
-                     /* Mark the first two full FAT entries -- 64 bits, 8 bytes total */
+                  case 32:
+                  default: /* Shouldn't happen */
 
-                     memset(var->fv_sect, 0xff, 8);
+                    /* Mark the first two full FAT entries -- 64 bits,
+                     * 8 bytes total
+                     */
 
-                     /* Cluster 2 is used as the root directory.  Mark as EOF */
+                    memset(var->fv_sect, 0xff, 8);
 
-                     var->fv_sect[8] =  0xf8;
-                     memset(&var->fv_sect[9], 0xff, 3);
-                     break;
-                 }
+                    /* Cluster 2 is used as the root directory.
+                     * Mark as EOF
+                     */
 
-               /* Save the media type in the first byte of the FAT */
+                    var->fv_sect[8] =  0xf8;
+                    memset(&var->fv_sect[9], 0xff, 3);
+                    break;
+                }
 
-               var->fv_sect[0] = FAT_DEFAULT_MEDIA_TYPE;
+              /* Save the media type in the first byte of the FAT */
+
+              var->fv_sect[0] = FAT_DEFAULT_MEDIA_TYPE;
             }
 
-           /* Write the FAT sector */
+          /* Write the FAT sector */
 
-           ret = mkfatfs_devwrite(fmt, var, offset);
-           if (ret < 0)
-             {
-               return ret;
-             }
+          ret = mkfatfs_devwrite(fmt, var, offset);
+          if (ret < 0)
+            {
+              return ret;
+            }
 
-           offset++;
-         }
-     }
+          offset++;
+        }
+    }
 
-   return OK;
+  return OK;
 }
 
 /****************************************************************************


[incubator-nuttx-apps] 05/05: fsutils/mkfatfs/writefat.c: Fix syslog formats

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit e4584b00d6a3ad92559f87957077ce74cd83f989
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Fri Nov 20 19:57:59 2020 +0900

    fsutils/mkfatfs/writefat.c: Fix syslog formats
---
 fsutils/mkfatfs/writefat.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/fsutils/mkfatfs/writefat.c b/fsutils/mkfatfs/writefat.c
index dc0fa9f..5e98e89 100644
--- a/fsutils/mkfatfs/writefat.c
+++ b/fsutils/mkfatfs/writefat.c
@@ -41,6 +41,7 @@
 #include <nuttx/config.h>
 
 #include <sys/types.h>
+#include <inttypes.h>
 #include <stdint.h>
 #include <string.h>
 #include <errno.h>
@@ -84,7 +85,7 @@ static int mkfatfs_devwrite(FAR const struct fat_format_s *fmt,
 
   if (sector < 0 || sector >= fmt->ff_nsectors)
     {
-      ferr("sector out of range: %lu\n", (unsigned long)sector);
+      ferr("sector out of range: %ju\n", (intmax_t)sector);
       return -ESPIPE;
     }
 
@@ -96,13 +97,13 @@ static int mkfatfs_devwrite(FAR const struct fat_format_s *fmt,
   if (seekpos == (off_t)-1)
     {
       ret = -errno;
-      ferr("ERROR: lseek to %lu failed: %d\n", (unsigned long)fpos, ret);
+      ferr("ERROR: lseek to %jd failed: %d\n", (intmax_t)fpos, ret);
       return ret;
     }
   else if (seekpos != fpos)
     {
-      ferr("ERROR: lseek failed: %lu vs %lu\n",
-           (unsigned)seekpos, (unsigned long) fpos);
+      ferr("ERROR: lseek failed: %ju vs %ju\n",
+           (intmax_t)seekpos, (intmax_t)fpos);
       return -EINVAL;
     }
 
@@ -112,14 +113,14 @@ static int mkfatfs_devwrite(FAR const struct fat_format_s *fmt,
   if (nwritten < 0)
     {
       ret = -errno;
-      ferr("ERROR:  write failed: size=%lu pos=%lu error=%d\n",
-           (unsigned)var->fv_sectorsize, (unsigned long)fpos, ret);
+      ferr("ERROR:  write failed: size=%" PRIu32 " pos=%jd error=%d\n",
+           var->fv_sectorsize, (intmax_t)fpos, ret);
       return ret;
     }
   else if (nwritten != (ssize_t)var->fv_sectorsize)
     {
-      ferr("ERROR:  Partial write: size=%lu written=%lu\n",
-           (unsigned)var->fv_sectorsize, (unsigned long)nwritten);
+      ferr("ERROR:  Partial write: size=%" PRIu32 " written=%zd\n",
+           var->fv_sectorsize, nwritten);
       return -ENODATA;
     }
 


[incubator-nuttx-apps] 03/05: fsutils/mkfatfs/configfat.c: Fix syslog formats

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit 2c0c033b43a7eb06ed8e7878ed6acfe326533741
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Fri Nov 20 19:48:43 2020 +0900

    fsutils/mkfatfs/configfat.c: Fix syslog formats
---
 fsutils/mkfatfs/configfat.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/fsutils/mkfatfs/configfat.c b/fsutils/mkfatfs/configfat.c
index b260f9c..687fa50 100644
--- a/fsutils/mkfatfs/configfat.c
+++ b/fsutils/mkfatfs/configfat.c
@@ -39,6 +39,7 @@
 
 #include <nuttx/config.h>
 
+#include <inttypes.h>
 #include <stdint.h>
 #include <string.h>
 #include <debug.h>
@@ -473,7 +474,8 @@ mkfatfs_tryfat12(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var,
           maxnclusters = FAT_MAXCLUST12;
         }
 
-      finfo("nfatsects=%u nclusters=%u (max=%u)\n",
+      finfo("nfatsects=%" PRIu32 " nclusters=%" PRIu32
+            " (max=%" PRIu32 ")\n",
             config->fc_nfatsects, config->fc_nclusters, maxnclusters);
 
       /* Check if this number of clusters would overflow the maximum for
@@ -482,7 +484,8 @@ mkfatfs_tryfat12(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var,
 
       if (config->fc_nclusters + 2 > maxnclusters)
         {
-          fwarn("WARNING:  Too many clusters for FAT12: %d > %d\n",
+          fwarn("WARNING:  Too many clusters for FAT12: %"
+                PRId32 " > %" PRId32 "\n",
                 config->fc_nclusters, maxnclusters - 2);
 
           return -ENFILE;
@@ -545,7 +548,8 @@ mkfatfs_tryfat16(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var,
           maxnclusters = FAT_MAXCLUST16;
         }
 
-      finfo("nfatsects=%u nclusters=%u (min=%u max=%u)\n",
+      finfo("nfatsects=%" PRIu32 " nclusters=%" PRIu32
+            " (min=%u max=%" PRIu32 ")\n",
             config->fc_nfatsects, config->fc_nclusters, FAT_MINCLUST16,
             maxnclusters);
 
@@ -561,7 +565,7 @@ mkfatfs_tryfat16(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var,
           (config->fc_nclusters < FAT_MINCLUST16))
         {
           fwarn("WARNING:  Too few or too many clusters for FAT16: "
-                "%d < %d < %d\n",
+                "%d < %" PRId32 " < %" PRId32 "\n",
                 FAT_MINCLUST16, config->fc_nclusters, maxnclusters - 2);
 
           return -ENFILE;
@@ -624,7 +628,8 @@ mkfatfs_tryfat32(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var,
           maxnclusters = FAT_MAXCLUST32;
         }
 
-      finfo("nfatsects=%u nclusters=%u (max=%u)\n",
+      finfo("nfatsects=%" PRIu32 " nclusters=%" PRIu32
+            " (max=%" PRIu32 ")\n",
             config->fc_nfatsects, config->fc_nclusters, maxnclusters);
 
       /* Check if this number of clusters would overflow the maximum for
@@ -635,7 +640,7 @@ mkfatfs_tryfat32(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var,
           (config->fc_nclusters < FAT_MINCLUST32))
         {
           fwarn("WARNING:  Too few or too many clusters for FAT32: "
-                "%d < %d < %d\n",
+                "%d < %" PRId32 " < %" PRId32 "\n",
                 FAT_MINCLUST32, config->fc_nclusters, maxnclusters - 3);
 
           return -ENFILE;


[incubator-nuttx-apps] 02/05: fsutils/mkfatfs/configfat.c: Appease nxstyle

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit b92526ab2bb12ce035b47768c30f14c050c424a7
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Fri Nov 20 19:41:39 2020 +0900

    fsutils/mkfatfs/configfat.c: Appease nxstyle
---
 fsutils/mkfatfs/configfat.c | 198 ++++++++++++++++++++++++++------------------
 1 file changed, 118 insertions(+), 80 deletions(-)

diff --git a/fsutils/mkfatfs/configfat.c b/fsutils/mkfatfs/configfat.c
index 24bdd73..b260f9c 100644
--- a/fsutils/mkfatfs/configfat.c
+++ b/fsutils/mkfatfs/configfat.c
@@ -134,17 +134,18 @@ mkfatfs_nfatsect12(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var,
                    uint32_t navailsects)
 {
 #ifdef CONFIG_HAVE_LONG_LONG
-   uint64_t denom;
-   uint64_t number;
+  uint64_t denom;
+  uint64_t number;
 #else
-   uint32_t denom;
-   uint32_t number;
+  uint32_t denom;
+  uint32_t number;
 #endif
 
-  /* For FAT12, the cluster number is held in a 12-bit number or 1.5 bytes per
-   * cluster reference.  So each FAT sector will hold sectorsize/1.5 cluster
-   * references (except for the first sector of each FAT which has two reserved
-   * 12-bit values).  And the total number of FAT sectors needed is:
+  /* For FAT12, the cluster number is held in a 12-bit number or 1.5 bytes
+   * per cluster reference.  So each FAT sector will hold sectorsize/1.5
+   * cluster references (except for the first sector of each FAT which has
+   * two reserved 12-bit values).  And the total number of FAT sectors needed
+   * is:
    *
    *   nfatsects = (1.5 * (ndataclust + 2) / sectorsize)
    *
@@ -175,7 +176,8 @@ mkfatfs_nfatsect12(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var,
       denom = (fmt->ff_nfats << 1) + fmt->ff_nfats
             + (var->fv_sectorsize << (fmt->ff_clustshift + 1));
       number = (navailsects << 1) + navailsects
-            + (1 << (fmt->ff_clustshift + 2)) + (1 << (fmt->ff_clustshift + 1));
+            + (1 << (fmt->ff_clustshift + 2))
+            + (1 << (fmt->ff_clustshift + 1));
       return (uint32_t)((number + denom - 1) / denom);
 
 #ifndef CONFIG_HAVE_LONG_LONG
@@ -212,17 +214,17 @@ mkfatfs_nfatsect16(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var,
                    uint32_t navailsects)
 {
 #ifdef CONFIG_HAVE_LONG_LONG
-   uint64_t denom;
-   uint64_t number;
+  uint64_t denom;
+  uint64_t number;
 #else
-   uint32_t denom;
-   uint32_t number;
+  uint32_t denom;
+  uint32_t number;
 #endif
 
   /* For FAT16, the cluster number is held in a 16-bit number or 2 bytes per
    * cluster reference.  So each FAT sector will hold sectorsize/2 cluster
-   * references (except for the first sector of each FAT which has two reserved
-   * 16-bit values).  And the total number of FAT sectors needed is:
+   * references (except for the first sector of each FAT which has two
+   * reserved 16-bit values).  And the total number of FAT sectors needed is:
    *
    *   nfatsects = (2 * (ndataclust + 2) / sectorsize)
    *
@@ -248,7 +250,8 @@ mkfatfs_nfatsect16(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var,
     }
   else
     {
-      denom = fmt->ff_nfats + (var->fv_sectorsize << (fmt->ff_clustshift - 1));
+      denom = fmt->ff_nfats +
+              (var->fv_sectorsize << (fmt->ff_clustshift - 1));
       number = navailsects + (1 << (fmt->ff_clustshift + 1));
     }
 
@@ -280,17 +283,17 @@ mkfatfs_nfatsect32(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var,
                    uint32_t navailsects)
 {
 #ifdef CONFIG_HAVE_LONG_LONG
-   uint64_t denom;
-   uint64_t number;
+  uint64_t denom;
+  uint64_t number;
 #else
-   uint32_t denom;
-   uint32_t number;
+  uint32_t denom;
+  uint32_t number;
 #endif
 
   /* For FAT32, the cluster number is held in a 32-bit number or 4 bytes per
    * cluster reference.  So each FAT sector will hold sectorsize/4 cluster
-   * references (except for the first sector of each FAT which has three reserved
-   * 32-bit values).  And the total number of FAT sectors needed is:
+   * references (except for the first sector of each FAT which has three
+   * reserved 32-bit values).  And the total number of FAT sectors needed is:
    *
    *   nfatsects = (4 * (ndataclust + 3) / sectorsize)
    *
@@ -321,8 +324,10 @@ mkfatfs_nfatsect32(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var,
     }
   else
     {
-      denom = fmt->ff_nfats + (var->fv_sectorsize << (fmt->ff_clustshift - 2));
-      number = navailsects + (1 << (fmt->ff_clustshift + 1)) + (1 << fmt->ff_clustshift);
+      denom = fmt->ff_nfats +
+              (var->fv_sectorsize << (fmt->ff_clustshift - 2));
+      number = navailsects + (1 << (fmt->ff_clustshift + 1)) +
+               (1 << fmt->ff_clustshift);
     }
 
   return (uint32_t)((number + denom - 1) / denom);
@@ -347,12 +352,13 @@ mkfatfs_nfatsect32(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var,
  ****************************************************************************/
 
 static inline uint8_t
-mkfatfs_clustersearchlimits(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var)
+mkfatfs_clustersearchlimits(FAR struct fat_format_s *fmt,
+                            FAR struct fat_var_s *var)
 {
   uint8_t mxclustshift;
 
-  /* Did the caller already pick the cluster size?  If not, the clustshift value
-   * will be 0xff
+  /* Did the caller already pick the cluster size?  If not, the clustshift
+   * value will be 0xff
    */
 
   if (fmt->ff_clustshift == 0xff)
@@ -362,31 +368,37 @@ mkfatfs_clustersearchlimits(FAR struct fat_format_s *fmt, FAR struct fat_var_s *
       if (fmt->ff_nsectors < 2048)
         {
           /* 2k sectors, start with 1 sector/cluster. */
+
           fmt->ff_clustshift = 0;
         }
       else if (fmt->ff_nsectors  < 4096)
         {
           /* 4k sectors, start with 2 sector/cluster. */
+
           fmt->ff_clustshift = 1;
         }
       else if (fmt->ff_nsectors  < 8192)
         {
           /* 8k sectors, start with 4 sector/cluster. */
+
           fmt->ff_clustshift = 2;
         }
       else if (fmt->ff_nsectors  < 16384)
         {
           /* 16k sectors, start with 8 sector/cluster. */
+
           fmt->ff_clustshift = 3;
         }
       else if (fmt->ff_nsectors  < 32768)
         {
           /* 32k sectors, start with 16 sector/cluster. */
+
           fmt->ff_clustshift = 4;
         }
       else
         {
           /* Otherwise, 32 sector/cluster. */
+
           fmt->ff_clustshift = 5;
         }
 
@@ -437,19 +449,20 @@ mkfatfs_tryfat12(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var,
    * available sectors.
    */
 
-  config->fc_nfatsects = mkfatfs_nfatsect12(fmt, var, config->fc_navailsects);
+  config->fc_nfatsects = mkfatfs_nfatsect12(fmt, var,
+                                            config->fc_navailsects);
   if (config->fc_nfatsects > 0)
     {
-      /* Calculate the number of clusters available given the number of available
-       * sectors and the number of those that will be used for FAT:
+      /* Calculate the number of clusters available given the number of
+       * available sectors and the number of those that will be used for FAT:
        */
 
       config->fc_nclusters =
         (config->fc_navailsects -
           fmt->ff_nfats * config->fc_nfatsects) >> fmt->ff_clustshift;
 
-      /* Calculate the maximum number of clusters that could be supported by a
-       * FAT of this size.
+      /* Calculate the maximum number of clusters that could be supported by
+       * a FAT of this size.
        *
        *   maxnclusters = nfatsects * sectorsize / 1.5 - 2
        */
@@ -508,19 +521,20 @@ mkfatfs_tryfat16(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var,
    * available sectors.
    */
 
-  config->fc_nfatsects = mkfatfs_nfatsect16(fmt, var, config->fc_navailsects);
+  config->fc_nfatsects = mkfatfs_nfatsect16(fmt, var,
+                                            config->fc_navailsects);
   if (config->fc_nfatsects > 0)
     {
-      /* Calculate the number of clusters available given the number of available
-       * sectors and the number of those that will be used for FAT:
+      /* Calculate the number of clusters available given the number of
+       * available sectors and the number of those that will be used for FAT:
        */
 
       config->fc_nclusters =
         (config->fc_navailsects -
           fmt->ff_nfats * config->fc_nfatsects) >> fmt->ff_clustshift;
 
-      /* Calculate the maximum number of clusters that could be supported by a
-       * FAT of this size.
+      /* Calculate the maximum number of clusters that could be supported by
+       * a FAT of this size.
        *
        *   maxnclusters = nfatsects * sectorsize / 2 - 2
        */
@@ -537,16 +551,17 @@ mkfatfs_tryfat16(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var,
 
       /* Check if this number of clusters would overflow the maximum for
        * FAT16 (remembering that two FAT cluster slots are reserved).
-       * Check the lower limit as well.  The FAT12 is distinguished from FAT16
-       * by comparing the number of clusters on the device against a known
-       * threshold.  If a small FAT16 file system were created, then it would
-       * be confused as a FAT12 at mount time.
+       * Check the lower limit as well.  The FAT12 is distinguished from
+       * FAT16 by comparing the number of clusters on the device against a
+       * known threshold.  If a small FAT16 file system were created, then
+       * it would be confused as a FAT12 at mount time.
        */
 
       if ((config->fc_nclusters + 2 > maxnclusters) ||
           (config->fc_nclusters < FAT_MINCLUST16))
         {
-          fwarn("WARNING:  Too few or too many clusters for FAT16: %d < %d < %d\n",
+          fwarn("WARNING:  Too few or too many clusters for FAT16: "
+                "%d < %d < %d\n",
                 FAT_MINCLUST16, config->fc_nclusters, maxnclusters - 2);
 
           return -ENFILE;
@@ -585,19 +600,20 @@ mkfatfs_tryfat32(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var,
    * available sectors.
    */
 
-  config->fc_nfatsects = mkfatfs_nfatsect32(fmt, var, config->fc_navailsects);
+  config->fc_nfatsects = mkfatfs_nfatsect32(fmt, var,
+                                            config->fc_navailsects);
   if (config->fc_nfatsects > 0)
     {
-      /* Calculate the number of clusters available given the number of available
-       * sectors and the number of those that will be used for FAT:
+      /* Calculate the number of clusters available given the number of
+       * available sectors and the number of those that will be used for FAT:
        */
 
       config->fc_nclusters =
         (config->fc_navailsects -
           fmt->ff_nfats * config->fc_nfatsects) >> fmt->ff_clustshift;
 
-      /* Calculate the maximum number of clusters that could be supported by a
-       * FAT of this size.
+      /* Calculate the maximum number of clusters that could be supported by
+       * a FAT of this size.
        *
        *   maxnclusters = nfatsects * sectorsize / 4 - 2
        */
@@ -618,7 +634,8 @@ mkfatfs_tryfat32(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var,
       if ((config->fc_nclusters + 3 > maxnclusters) ||
           (config->fc_nclusters < FAT_MINCLUST32))
         {
-          fwarn("WARNING:  Too few or too many clusters for FAT32: %d < %d < %d\n",
+          fwarn("WARNING:  Too few or too many clusters for FAT32: "
+                "%d < %d < %d\n",
                 FAT_MINCLUST32, config->fc_nclusters, maxnclusters - 3);
 
           return -ENFILE;
@@ -676,7 +693,8 @@ mkfatfs_selectfat(int fattype, FAR struct fat_format_s *fmt,
  ****************************************************************************/
 
 static inline int
-mkfatfs_clustersearch(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var)
+mkfatfs_clustersearch(FAR struct fat_format_s *fmt,
+                      FAR struct fat_var_s *var)
 {
   struct fat_config_s fatconfig[3];
   uint8_t  mxclustshift;
@@ -721,7 +739,8 @@ mkfatfs_clustersearch(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var)
        */
 
       var->fv_nrootdirsects =
-        ((fmt->ff_rootdirentries << DIR_SHIFT) + var->fv_sectorsize - 1) >> var->fv_sectshift;
+        ((fmt->ff_rootdirentries << DIR_SHIFT) +
+        var->fv_sectorsize - 1) >> var->fv_sectshift;
 
       /* The number of data sectors available (includes the fat itself)
        * This value is a constant for FAT12/16, but not FAT32 because the
@@ -730,11 +749,12 @@ mkfatfs_clustersearch(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var)
 
       fatconfig12.fc_navailsects =
         fatconfig16.fc_navailsects =
-          fmt->ff_nsectors - var->fv_nrootdirsects - fatconfig12.fc_rsvdseccount;
-   }
+        fmt->ff_nsectors - var->fv_nrootdirsects -
+        fatconfig12.fc_rsvdseccount;
+    }
 
-  /* Select an initial and terminal cluster size to use in the search (if these
-   * values were not provided by the caller)
+  /* Select an initial and terminal cluster size to use in the search
+   * (if these values were not provided by the caller)
    */
 
   mxclustshift = mkfatfs_clustersearchlimits(fmt, var);
@@ -782,19 +802,22 @@ mkfatfs_clustersearch(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var)
 
       if (fatconfig12.fc_nclusters || fatconfig16.fc_nclusters)
         {
-          if ((!var->fv_fattype && fatconfig16.fc_nclusters > fatconfig12.fc_nclusters) ||
+          if ((!var->fv_fattype &&
+               fatconfig16.fc_nclusters > fatconfig12.fc_nclusters) ||
               (var ->fv_fattype == 16))
             {
-              /* The caller has selected FAT16 -OR- no FAT type has been selected, but
-               * the FAT16 selection has more clusters. Select FAT16.
+              /* The caller has selected FAT16 -OR- no FAT type has been
+               * selected, but the FAT16 selection has more clusters.
+               * Select FAT16.
                */
 
               mkfatfs_selectfat(16, fmt, var, &fatconfig16);
             }
           else
             {
-              /* The caller has selected FAT12 -OR- no FAT type has been selected, but
-               * the FAT12 selected has more clusters.  Selected FAT12
+              /* The caller has selected FAT12 -OR- no FAT type has been
+               * selected, but the FAT12 selected has more clusters.
+               * Selected FAT12
                */
 
               mkfatfs_selectfat(12, fmt, var, &fatconfig12);
@@ -814,11 +837,14 @@ mkfatfs_clustersearch(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var)
 #endif
         {
           /* The number of data sectors available (includes the fat itself)
-           * This value is a constant with respect to cluster sizefor FAT12/16, but not FAT32
-           * because the size of the root directory cluster changes with cluster size.
+           * This value is a constant with respect to cluster size for
+           * FAT12/16, but not FAT32 because the size of the root directory
+           * cluster changes with cluster size.
            */
 
-          fatconfig32.fc_navailsects = fmt->ff_nsectors - (1 << fmt->ff_clustshift) - fatconfig32.fc_rsvdseccount;
+          fatconfig32.fc_navailsects = fmt->ff_nsectors -
+                                       (1 << fmt->ff_clustshift) -
+                                       fatconfig32.fc_rsvdseccount;
 
           /* Try to configure a FAT32 file system with this cluster size */
 
@@ -839,7 +865,9 @@ mkfatfs_clustersearch(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var)
             }
         }
 
-      /* Otherwise, bump up the sectors/cluster for the next time around the loop. */
+      /* Otherwise, bump up the sectors/cluster for the next time around
+       * the loop.
+       */
 
       fmt->ff_clustshift++;
     }
@@ -874,27 +902,29 @@ int mkfatfs_configfatfs(FAR struct fat_format_s *fmt,
 {
   int ret;
 
-  /* Select the number of root directory entries (FAT12/16 only).  If FAT32 is selected,
-   * this value will be cleared later
+  /* Select the number of root directory entries (FAT12/16 only).
+   * If FAT32 is selected, this value will be cleared later
    */
 
   if (!fmt->ff_rootdirentries)
     {
-      /* The caller did not specify the number of root directory entries; use a default of 512. */
+      /* The caller did not specify the number of root directory entries;
+       * use a default of 512.
+       */
 
       fmt->ff_rootdirentries = 512;
     }
 
-  /* Search to determine the smallest (reasonable) cluster size.  A by-product
-   * of this search will be the selection of the FAT size (12/16/32) if the
-   * caller has not specified the FAT size
+  /* Search to determine the smallest (reasonable) cluster size.
+   * A by-product of this search will be the selection of the FAT size
+   * (12/16/32) if the caller has not specified the FAT size
    */
 
   ret = mkfatfs_clustersearch(fmt, var);
   if (ret < 0)
     {
-       ferr("WARNING:  Failed to set cluster size\n");
-       return ret;
+      ferr("WARNING:  Failed to set cluster size\n");
+      return ret;
     }
 
   /* Perform FAT specific initialization */
@@ -922,34 +952,42 @@ int mkfatfs_configfatfs(FAR struct fat_format_s *fmt,
       var->fv_jump[1]   = MBR32_BOOTCODE - 2;
       g_bootcodeblob[3] = MBR32_BOOTCODE + BOOTCODE_MSGOFFSET;
 
-      /* The root directory is a cluster chain... its is initialize size is one cluster */
+      /* The root directory is a cluster chain... its is initialize size is
+       * one cluster
+       */
 
       var->fv_nrootdirsects = 1 << fmt->ff_clustshift;
 
-      /* The number of reported root directory entries should should be zero for
-       * FAT32 because the root directory is a cluster chain.
+      /* The number of reported root directory entries should should be zero
+       * for FAT32 because the root directory is a cluster chain.
        */
 
       fmt->ff_rootdirentries = 0;
 
       /* Verify the caller's backupboot selection */
 
-      if (fmt->ff_backupboot <= 1 || fmt->ff_backupboot >= fmt->ff_rsvdseccount)
+      if (fmt->ff_backupboot <= 1 ||
+          fmt->ff_backupboot >= fmt->ff_rsvdseccount)
         {
-          ferr("WARNING:  Invalid backup boot sector: %d\n", fmt->ff_backupboot);
+          ferr("WARNING:  Invalid backup boot sector: %d\n",
+               fmt->ff_backupboot);
           fmt->ff_backupboot = 0;
         }
 
-     /* Check if the caller has selected a location for the backup boot record */
+      /* Check if the caller has selected a location for the backup boot
+       * record
+       */
 
       if (!fmt->ff_backupboot)
         {
-          /* There must be reserved sectors in order to have a backup boot sector */
+          /* There must be reserved sectors in order to have a backup boot
+           * sector
+           */
 
           if (fmt->ff_rsvdseccount >= 2)
             {
-              /* Sector 0 is the MBR; 1... ff_rsvdseccount are reserved.  Try the next
-               * the last reserved sector.
+              /* Sector 0 is the MBR; 1... ff_rsvdseccount are reserved.
+               * Try the next the last reserved sector.
                */
 
               fmt->ff_backupboot = fmt->ff_rsvdseccount - 1;