update mkromfs script.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1287 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
54228a0518
commit
ead014f966
@ -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;
|
||||
|
||||
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)
|
||||
{
|
||||
{
|
||||
st->st_mode &= ~DFS_S_IFREG;
|
||||
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 ++)
|
||||
{
|
||||
d = dirp + index;
|
||||
|
||||
|
||||
sub_dirent = &dirent[file->pos];
|
||||
name = sub_dirent->name;
|
||||
|
||||
@ -212,7 +212,7 @@ int dfs_romfs_getdents(struct dfs_fd* file, struct dirent* dirp, rt_uint32_t cou
|
||||
else
|
||||
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);
|
||||
rt_strncpy(d->d_name, name, rt_strlen(name) + 1);
|
||||
|
||||
|
@ -85,7 +85,7 @@ def mkromfs_dir(dirname, is_root = False):
|
||||
if not os.path.isfile(fullpath):
|
||||
l = os.listdir(fullpath)
|
||||
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:
|
||||
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_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")
|
||||
|
Loading…
x
Reference in New Issue
Block a user