[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT PATCH v3 2/5] lib/vfscore: fs_getfs(): Return NULL on failed lookup



Hello Simon,

This patch seems fine. While running some test on the mount function I observed that, if we pass the invalid file system  to mount we return errno as the return value instead of -1. But since it not related to this patch we accept this patch and can fix it separately.

Reviewed-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx>

Thanks & Regards

Sharan

On 9/24/19 12:07 PM, Simon Kuenzer wrote:
Mount never failed when the filesystem name was incorrect. This was
due to the vfscore-internal function fs_getfs() that returned the last
registered filesystem instead of NULL whenever the name was invalid.

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
  lib/vfscore/mount.c | 13 +++++++------
  1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/lib/vfscore/mount.c b/lib/vfscore/mount.c
index 2629d132..9d7ace15 100644
--- a/lib/vfscore/mount.c
+++ b/lib/vfscore/mount.c
@@ -80,17 +80,18 @@ fs_getfs(const char *name)
  {
        const struct vfscore_fs_type *fs = NULL, **__fs;
+ UK_ASSERT(name != NULL);
+
        for_each_fs(__fs) {
                fs = *__fs;
-               if (fs == NULL)
+               if (!fs || !fs->vs_name)
                        continue;
- if (!strncmp(name, fs->vs_name, FSMAXNAMES))
-                       break;
+               if (strncmp(name, fs->vs_name, FSMAXNAMES) == 0)
+                       return fs;
        }
-       if (!fs || !fs->vs_name)
-               return NULL;
-       return fs;
+
+       return NULL;
  }
int device_open(const char *name __unused, int mode __unused,

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.