From 2cfda2bffdde328bfb98d87cb4be90d96086007d Mon Sep 17 00:00:00 2001 From: Jiuzhu Dong Date: Tue, 31 Aug 2021 15:58:16 +0800 Subject: [PATCH] binfmt: remove file_ioctl and get filename by strrchr Signed-off-by: Jiuzhu Dong --- binfmt/builtin.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/binfmt/builtin.c b/binfmt/builtin.c index d6d79c17ba..e226209410 100644 --- a/binfmt/builtin.c +++ b/binfmt/builtin.c @@ -78,6 +78,7 @@ static int builtin_loadbinary(FAR struct binary_s *binp, int nexports) { FAR const struct builtin_s *builtin; + FAR char *name; struct file file; int index; int ret; @@ -93,22 +94,13 @@ static int builtin_loadbinary(FAR struct binary_s *binp, return ret; } - /* If this file is a BINFS file system, then we can recover the name of - * the file using the FIOC_FILENAME ioctl() call. - */ - - ret = file_ioctl(&file, FIOC_FILENAME, - (unsigned long)((uintptr_t)&filename)); - if (ret < 0) + name = strrchr(filename, '/'); + if (name != NULL) { - berr("ERROR: FIOC_FILENAME ioctl failed: %d\n", ret); - file_close(&file); - return ret; + filename = name + 1; } - /* Other file systems may also support FIOC_FILENAME, so the real proof - * is that we can look up the index to this name in g_builtins[]. - */ + /* Looking up the index to this name in g_builtins[] */ index = builtin_isavail(filename); if (index < 0)