This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit aa31648c9f0bde84c9881dfbfd70760a3fe2192a
Author: Xiang Xiao <xiaoxi...@xiaomi.com>
AuthorDate: Wed Oct 26 13:40:18 2022 +0800

    fs: Remove the unused nx_[v]ioctl to prefer file_[v]ioctl for kernel
    
    Signed-off-by: Xiang Xiao <xiaoxi...@xiaomi.com>
---
 fs/vfs/fs_ioctl.c     | 73 +++++++++++----------------------------------------
 include/nuttx/fs/fs.h | 21 ---------------
 2 files changed, 16 insertions(+), 78 deletions(-)

diff --git a/fs/vfs/fs_ioctl.c b/fs/vfs/fs_ioctl.c
index 7bb83f2675..f952733a39 100644
--- a/fs/vfs/fs_ioctl.c
+++ b/fs/vfs/fs_ioctl.c
@@ -128,28 +128,6 @@ int file_vioctl(FAR struct file *filep, int req, va_list 
ap)
   return ret;
 }
 
-/****************************************************************************
- * Name: nx_vioctl
- ****************************************************************************/
-
-static int nx_vioctl(int fd, int req, va_list ap)
-{
-  FAR struct file *filep;
-  int ret;
-
-  /* Get the file structure corresponding to the file descriptor. */
-
-  ret = fs_getfilep(fd, &filep);
-  if (ret < 0)
-    {
-      return ret;
-    }
-
-  /* Let file_vioctl() do the real work. */
-
-  return file_vioctl(filep, req, ap);
-}
-
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
@@ -186,37 +164,6 @@ int file_ioctl(FAR struct file *filep, int req, ...)
   return ret;
 }
 
-/****************************************************************************
- * Name: nx_ioctl
- *
- * Description:
- *   nx_ioctl() is similar to the standard 'ioctl' interface except that is
- *   not a cancellation point and it does not modify the errno variable.
- *
- *   nx_ioctl() is an internal NuttX interface and should not be called from
- *   applications.
- *
- * Returned Value:
- *   Returns a non-negative number on success;  A negated errno value is
- *   returned on any failure (see comments ioctl() for a list of appropriate
- *   errno values).
- *
- ****************************************************************************/
-
-int nx_ioctl(int fd, int req, ...)
-{
-  va_list ap;
-  int ret;
-
-  /* Let nx_vioctl() do the real work. */
-
-  va_start(ap, req);
-  ret = nx_vioctl(fd, req, ap);
-  va_end(ap);
-
-  return ret;
-}
-
 /****************************************************************************
  * Name: ioctl
  *
@@ -247,20 +194,32 @@ int nx_ioctl(int fd, int req, ...)
 
 int ioctl(int fd, int req, ...)
 {
+  FAR struct file *filep;
   va_list ap;
   int ret;
 
-  /* Let nx_vioctl() do the real work. */
+  /* Get the file structure corresponding to the file descriptor. */
+
+  ret = fs_getfilep(fd, &filep);
+  if (ret < 0)
+    {
+      goto err;
+    }
+
+  /* Let file_vioctl() do the real work. */
 
   va_start(ap, req);
-  ret = nx_vioctl(fd, req, ap);
+  ret = file_vioctl(filep, req, ap);
   va_end(ap);
 
   if (ret < 0)
     {
-      set_errno(-ret);
-      ret = ERROR;
+      goto err;
     }
 
   return ret;
+
+err:
+  set_errno(-ret);
+  return ERROR;
 }
diff --git a/include/nuttx/fs/fs.h b/include/nuttx/fs/fs.h
index cb55135018..a95dd2dd43 100644
--- a/include/nuttx/fs/fs.h
+++ b/include/nuttx/fs/fs.h
@@ -73,7 +73,6 @@
 #  define _NX_READ(f,b,s)      nx_read(f,b,s)
 #  define _NX_WRITE(f,b,s)     nx_write(f,b,s)
 #  define _NX_SEEK(f,o,w)      nx_seek(f,o,w)
-#  define _NX_IOCTL(f,r,a)     nx_ioctl(f,r,a)
 #  define _NX_STAT(p,s)        nx_stat(p,s,1)
 #  define _NX_GETERRNO(r)      (-(r))
 #  define _NX_SETERRNO(r)      set_errno(-(r))
@@ -84,7 +83,6 @@
 #  define _NX_READ(f,b,s)      read(f,b,s)
 #  define _NX_WRITE(f,b,s)     write(f,b,s)
 #  define _NX_SEEK(f,o,w)      lseek(f,o,w)
-#  define _NX_IOCTL(f,r,a)     ioctl(f,r,a)
 #  define _NX_STAT(p,s)        stat(p,s)
 #  define _NX_GETERRNO(r)      errno
 #  define _NX_SETERRNO(r)      ((void)(r))
@@ -1295,25 +1293,6 @@ int file_munmap(FAR void *start, size_t length);
 
 int file_ioctl(FAR struct file *filep, int req, ...);
 
-/****************************************************************************
- * Name: nx_ioctl
- *
- * Description:
- *   nx_ioctl() is similar to the standard 'ioctl' interface except that is
- *   not a cancellation point and it does not modify the errno variable.
- *
- *   nx_ioctl() is an internal NuttX interface and should not be called from
- *   applications.
- *
- * Returned Value:
- *   Returns a non-negative number on success;  A negated errno value is
- *   returned on any failure (see comments ioctl() for a list of appropriate
- *   errno values).
- *
- ****************************************************************************/
-
-int nx_ioctl(int fd, int req, ...);
-
 /****************************************************************************
  * Name: file_fcntl
  *

Reply via email to