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/15 01:49:29 UTC
[incubator-nuttx-apps] 04/05: examples/romfs/romfs_main.c: Appease
nxstyle
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 473fef4e58c4c9d43f8b2fd41441c66f06a78c23
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Sat Nov 14 08:53:18 2020 +0900
examples/romfs/romfs_main.c: Appease nxstyle
---
examples/romfs/romfs_main.c | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/examples/romfs/romfs_main.c b/examples/romfs/romfs_main.c
index 200c9ea..da9f428 100644
--- a/examples/romfs/romfs_main.c
+++ b/examples/romfs/romfs_main.c
@@ -244,6 +244,7 @@ static struct node_s *findindirectory(struct node_s *entry, const char *name)
return entry;
}
}
+
return NULL;
}
@@ -266,7 +267,8 @@ static void checkattributes(const char *path, mode_t mode, size_t size)
if (mode != buf.st_mode)
{
- printf(" -- ERROR: Expected mode %08x, got %08x\n", mode, buf.st_mode);
+ printf(" -- ERROR: Expected mode %08x, got %08x\n", mode,
+ buf.st_mode);
g_nerrors++;
}
@@ -322,8 +324,9 @@ static void checkfile(const char *path, struct node_s *node)
/* Memory map and verify the file contents */
- filedata = (char*)mmap(NULL, node->size, PROT_READ, MAP_SHARED|MAP_FILE, fd, 0);
- if (!filedata || filedata == (char*)MAP_FAILED)
+ filedata = (char *)mmap(NULL, node->size, PROT_READ, MAP_SHARED | MAP_FILE,
+ fd, 0);
+ if (!filedata || filedata == (char *)MAP_FAILED)
{
printf(" -- ERROR: mmap of %s failed: %d\n", path, errno);
g_nerrors++;
@@ -334,11 +337,13 @@ static void checkfile(const char *path, struct node_s *node)
{
memcpy(g_scratchbuffer, filedata, node->size);
g_scratchbuffer[node->size] = '\0';
- printf(" -- ERROR: Mapped file content read does not match expectation:\n");
+ printf(" -- ERROR: Mapped file content read does not match "
+ "expectation:\n");
printf(" -- Memory: [%s]\n", filedata);
printf(" -- Expected: [%s]\n", node->u.filecontent);
g_nerrors++;
}
+
munmap(filedata, node->size);
}
@@ -373,7 +378,8 @@ static void readdirectories(const char *path, struct node_s *entry)
for (direntry = readdir(dirp); direntry; direntry = readdir(dirp))
{
- if (strcmp(direntry->d_name, ".") == 0 || strcmp(direntry->d_name, "..") == 0)
+ if (strcmp(direntry->d_name, ".") == 0 ||
+ strcmp(direntry->d_name, "..") == 0)
{
printf(" Skipping %s\n", direntry->d_name);
continue;
@@ -421,6 +427,7 @@ static void readdirectories(const char *path, struct node_s *entry)
checkfile(fullpath, node);
}
}
+
free(fullpath);
}
@@ -435,7 +442,7 @@ static void checkdirectories(struct node_s *entry)
{
for (; entry; entry = entry->peer)
{
- if (!entry->found )
+ if (!entry->found)
{
printf("ERROR: %s never found\n", entry->name);
g_nerrors++;
@@ -458,12 +465,13 @@ static void checkdirectories(struct node_s *entry)
int main(int argc, FAR char *argv[])
{
- int ret;
+ int ret;
/* Create a RAM disk for the test */
ret = romdisk_register(CONFIG_EXAMPLES_ROMFS_RAMDEVNO, testdir_img,
- NSECTORS(testdir_img_len), CONFIG_EXAMPLES_ROMFS_SECTORSIZE);
+ NSECTORS(testdir_img_len),
+ CONFIG_EXAMPLES_ROMFS_SECTORSIZE);
if (ret < 0)
{
printf("ERROR: Failed to create RAM disk\n");
@@ -475,7 +483,8 @@ int main(int argc, FAR char *argv[])
printf("Mounting ROMFS filesystem at target=%s with source=%s\n",
CONFIG_EXAMPLES_ROMFS_MOUNTPOINT, MOUNT_DEVNAME);
- ret = mount(MOUNT_DEVNAME, CONFIG_EXAMPLES_ROMFS_MOUNTPOINT, "romfs", MS_RDONLY, NULL);
+ ret = mount(MOUNT_DEVNAME, CONFIG_EXAMPLES_ROMFS_MOUNTPOINT, "romfs",
+ MS_RDONLY, NULL);
if (ret < 0)
{
printf("ERROR: Mount failed: %d\n", errno);