tools/gencromfs.c: Was duplicating all mode bits in source directory in CROMFS directory. Some make no sense. In particular, all write-able bits are cleard unconditionally. Executable bits are still copying because there is really no way for the tool to know if the file is executable or not.

This commit is contained in:
Gregory Nutt 2018-03-24 15:05:22 -06:00
parent 67e0603b5a
commit db3b507a41
2 changed files with 4 additions and 17 deletions

View File

@ -120,7 +120,7 @@ struct cromfs_volume_s
struct cromfs_node_s
{
uint16_t cn_mode; /* File type, attributes, and access mode bits */
uint16_t cn_pad; /* Not used */
uint16_t cn_pad; /* Not used */
uint32_t cn_name; /* Offset from the beginning of the volume header to the
* node name string. NUL-terminated. */
uint32_t cn_size; /* Size of the uncompressed data (in bytes) */

View File

@ -842,16 +842,13 @@ static uint16_t get_mode(mode_t mode)
{
uint16_t ret = 0;
/* Convert mode to CROMFS NuttX read-only mode */
if ((mode & S_IXOTH) != 0)
{
ret |= NUTTX_IXOTH;
}
if ((mode & S_IWOTH) != 0)
{
ret |= NUTTX_IWOTH;
}
if ((mode & S_IROTH) != 0)
{
ret |= NUTTX_IROTH;
@ -862,11 +859,6 @@ static uint16_t get_mode(mode_t mode)
ret |= NUTTX_IXGRP;
}
if ((mode & S_IWGRP) != 0)
{
ret |= NUTTX_IWGRP;
}
if ((mode & S_IRGRP) != 0)
{
ret |= NUTTX_IRGRP;
@ -877,11 +869,6 @@ static uint16_t get_mode(mode_t mode)
ret |= NUTTX_IXUSR;
}
if ((mode & S_IWUSR) != 0)
{
ret |= NUTTX_IWUSR;
}
if ((mode & S_IRUSR) != 0)
{
ret |= NUTTX_IRUSR;
@ -917,7 +904,7 @@ static void gen_dirlink(const char *name, uint32_t tgtoffs, bool dirempty)
/* Generate the hardlink node */
dump_nextline(g_tmpstream);
fprintf(g_tmpstream, "\n /* Offset %6lu: Hard link %s*/\n\n",
fprintf(g_tmpstream, "\n /* Offset %6lu: Hard link %s */\n\n",
(unsigned long)g_offset, name);
node.cn_mode = TGT_UINT16(DIRLINK_MODEFLAGS);