1
0
Эх сурвалжийг харах

update mkromfs script.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1287 bbd45198-f89e-11dd-88c7-29a3b14d5316
bernard.xiong@gmail.com 14 жил өмнө
parent
commit
ead014f966

+ 5 - 5
components/dfs/filesystems/romfs/dfs_romfs.c

@@ -165,11 +165,11 @@ int dfs_romfs_stat(struct dfs_filesystem* fs, const char *path, struct stat *st)
 	if (dirent == RT_NULL) return -DFS_STATUS_ENOENT;
 	if (dirent == RT_NULL) return -DFS_STATUS_ENOENT;
 
 
 	st->st_dev = 0;
 	st->st_dev = 0;
-	st->st_mode = DFS_S_IFREG | DFS_S_IRUSR | DFS_S_IRGRP | DFS_S_IROTH |
-	DFS_S_IWUSR | DFS_S_IWGRP | DFS_S_IWOTH;
+	st->st_mode = DFS_S_IFREG | DFS_S_IRUSR | DFS_S_IRGRP | DFS_S_IROTH |
+	DFS_S_IWUSR | DFS_S_IWGRP | DFS_S_IWOTH;
 
 
 	if (dirent->type == ROMFS_DIRENT_DIR)
 	if (dirent->type == ROMFS_DIRENT_DIR)
-	{
+	{
 		st->st_mode &= ~DFS_S_IFREG;
 		st->st_mode &= ~DFS_S_IFREG;
 		st->st_mode |= DFS_S_IFDIR | DFS_S_IXUSR | DFS_S_IXGRP | DFS_S_IXOTH;
 		st->st_mode |= DFS_S_IFDIR | DFS_S_IXUSR | DFS_S_IXGRP | DFS_S_IXOTH;
 	}
 	}
@@ -202,7 +202,7 @@ int dfs_romfs_getdents(struct dfs_fd* file, struct dirent* dirp, rt_uint32_t cou
 	for (index = 0; index < count && file->pos < file->size; index ++)
 	for (index = 0; index < count && file->pos < file->size; index ++)
 	{
 	{
 		d = dirp + index;
 		d = dirp + index;
-
+
 		sub_dirent = &dirent[file->pos];
 		sub_dirent = &dirent[file->pos];
 		name = sub_dirent->name;
 		name = sub_dirent->name;
 
 
@@ -212,7 +212,7 @@ int dfs_romfs_getdents(struct dfs_fd* file, struct dirent* dirp, rt_uint32_t cou
 		else
 		else
 			d->d_type = DFS_DT_REG;
 			d->d_type = DFS_DT_REG;
 
 
-		d->d_namlen = rt_strlen(name);
+		d->d_namlen = rt_strlen(name);
 		d->d_reclen = (rt_uint16_t)sizeof(struct dirent);
 		d->d_reclen = (rt_uint16_t)sizeof(struct dirent);
 		rt_strncpy(d->d_name, name, rt_strlen(name) + 1);
 		rt_strncpy(d->d_name, name, rt_strlen(name) + 1);
 
 

+ 2 - 2
components/dfs/filesystems/romfs/mkromfs.py

@@ -85,7 +85,7 @@ def mkromfs_dir(dirname, is_root = False):
         if not os.path.isfile(fullpath):
         if not os.path.isfile(fullpath):
             l = os.listdir(fullpath)
             l = os.listdir(fullpath)
             if len(l):
             if len(l):
-                mkromfs_output(('\t{ROMFS_DIRENT_DIR, "%s", %s, sizeof(%s)/sizeof(%s[0])},\n' % (fn, item_name, item_name, item_name)))
+                mkromfs_output(('\t{ROMFS_DIRENT_DIR, "%s", (rt_uint8_t*) %s, sizeof(%s)/sizeof(%s[0])},\n' % (fn, item_name, item_name, item_name)))
             else:
             else:
                 mkromfs_output(('\t{ROMFS_DIRENT_DIR, "%s", RT_NULL, 0},\n' % fn))
                 mkromfs_output(('\t{ROMFS_DIRENT_DIR, "%s", RT_NULL, 0},\n' % fn))
 
 
@@ -122,4 +122,4 @@ if __name__ == "__main__":
     mkromfs_output("#include <dfs_romfs.h>\n\n")
     mkromfs_output("#include <dfs_romfs.h>\n\n")
     mkromfs_dir(basename, is_root = True)
     mkromfs_dir(basename, is_root = True)
     
     
-    mkromfs_output("const struct romfs_dirent romfs_root = {ROMFS_DIRENT_DIR, \"/\", _root_dirent, sizeof(_root_dirent)/sizeof(_root_dirent[0])};\n\n")
+    mkromfs_output("const struct romfs_dirent romfs_root = {ROMFS_DIRENT_DIR, \"/\", (rt_uint8_t*) _root_dirent, sizeof(_root_dirent)/sizeof(_root_dirent[0])};\n\n")