vfs/stat: Make the flag defintion more confirm POSIX standard

specified here:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2020-07-05 23:30:43 +08:00
committed by Abdelatif Guettouche
parent 1a523e5519
commit 91ed14c631
7 changed files with 130 additions and 78 deletions
+11 -2
View File
@@ -1248,11 +1248,20 @@ static int romfs_stat_common(uint8_t type, uint32_t size,
buf->st_mode = S_IFDIR | S_IROTH | S_IXOTH | S_IRGRP | S_IXGRP |
S_IRUSR | S_IXUSR;
}
else if (IS_FILE(type))
else if (IS_FILE(type) || IS_SOFTLINK(type))
{
if (IS_FILE(type))
{
buf->st_mode = S_IFREG;
}
else
{
buf->st_mode = S_IFLNK;
}
/* It's a read-only file name */
buf->st_mode = S_IFREG | S_IROTH | S_IRGRP | S_IRUSR;
buf->st_mode |= S_IROTH | S_IRGRP | S_IRUSR;
if (IS_EXECUTABLE(type))
{
/* It's a read-execute file name */
+5
View File
@@ -100,6 +100,11 @@
#define IS_HARDLINK(rfn) IS_MODE(rfn,RFNEXT_HARDLINK)
#define IS_DIRECTORY(rfn) IS_MODE(rfn,RFNEXT_DIRECTORY)
#define IS_FILE(rfn) IS_MODE(rfn,RFNEXT_FILE)
#define IS_SOFTLINK(rfn) IS_MODE(rfn,RFNEXT_SOFTLINK)
#define IS_BLOCKDEV(rfn) IS_MODE(rfn,RFNEXT_BLOCKDEV)
#define IS_CHARDEV(rfn) IS_MODE(rfn,RFNEXT_CHARDEV)
#define IS_SOCKET(rfn) IS_MODE(rfn,RFNEXT_SOCKET)
#define IS_FIFO(rfn) IS_MODE(rfn,RFNEXT_FIFO)
#define IS_EXECUTABLE(rfn) (((rfn) & RFNEXT_EXEC) != 0)
/* RFNEXT_SOFTLINK, RFNEXT_BLOCKDEV, RFNEXT_CHARDEV, RFNEXT_SOCKET, and