examples/romfs: Add ldir(soft link) into check

since romfs can return the soft link with the kernel change:
commit 67ef70d460db4695b950208d861ff47d4a40bdb3
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
Date:   Mon Jul 6 00:34:32 2020 +0800

    vfs/dirread: Should return the same file type as lstat

    by extend the possible value of d_type for the special file

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2021-01-19 04:42:45 -08:00 committed by Alan Carvalho de Assis
parent b7ef4fb513
commit e4f76ac9eb

View File

@ -153,6 +153,7 @@ static const char g_subdirfilecontent[] = "File in subdirectory\n";
static struct node_s g_adir; static struct node_s g_adir;
static struct node_s g_afile; static struct node_s g_afile;
static struct node_s g_ldir;
static struct node_s g_hfile; static struct node_s g_hfile;
static struct node_s g_anotherfile; static struct node_s g_anotherfile;
@ -183,7 +184,7 @@ static void connectem(void)
g_adir.size = 0; g_adir.size = 0;
g_adir.u.child = &g_anotherfile; g_adir.u.child = &g_anotherfile;
g_afile.peer = &g_hfile; g_afile.peer = &g_ldir;
g_afile.directory = false; g_afile.directory = false;
g_afile.found = false; g_afile.found = false;
g_afile.name = "afile.txt"; g_afile.name = "afile.txt";
@ -191,6 +192,14 @@ static void connectem(void)
g_afile.size = strlen(g_afilecontent); g_afile.size = strlen(g_afilecontent);
g_afile.u.filecontent = g_afilecontent; g_afile.u.filecontent = g_afilecontent;
g_ldir.peer = &g_hfile;
g_ldir.directory = true;
g_ldir.found = false;
g_ldir.name = "ldir";
g_ldir.mode = DIRECTORY_MODE;
g_ldir.size = 0;
g_ldir.u.child = &g_subdirfile;
g_hfile.peer = NULL; g_hfile.peer = NULL;
g_hfile.directory = false; /* Actually a hard link */ g_hfile.directory = false; /* Actually a hard link */
g_hfile.found = false; g_hfile.found = false;
@ -416,7 +425,7 @@ static void readdirectories(const char *path, struct node_s *entry)
printf("Continuing directory: %s\n", path); printf("Continuing directory: %s\n", path);
} }
} }
else else if (!DIRENT_ISLINK(direntry->d_type))
{ {
printf(" FILE: %s/\n", fullpath); printf(" FILE: %s/\n", fullpath);
if (node->directory) if (node->directory)