You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2023/01/02 14:23:26 UTC

[nuttx] branch master updated (275b2e70a4 -> f33dc4df3f)

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

acassis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


    from 275b2e70a4 syslog: fix extra line breaks in syslog when SYSLOG_COLOR_OUTPUT is enabled
     new 36528eed64 Revert "fs/vfs/fs_truncate.c: Use ioctl to truncate on non-mountpoint inode"
     new 41e9df2f3e Add ftruncate into file operation calls
     new f33dc4df3f Change FIOC_MMAP into file operation call

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 Documentation/reference/user/10_filesystem.rst     | 11 ++--
 arch/arm/src/cxd56xx/cxd56_geofence.c              |  2 +
 arch/arm/src/cxd56xx/cxd56_gnss.c                  |  2 +
 arch/arm/src/cxd56xx/cxd56_hostif.c                |  2 +
 arch/arm/src/sama5/sam_tsd.c                       |  2 +
 boards/arm/sam34/sam4l-xplained/src/sam_slcd.c     |  2 +
 .../stm32/mikroe-stm32f4/src/stm32_touchscreen.c   |  2 +
 boards/arm/stm32/stm32ldiscovery/src/stm32_lcd.c   |  2 +
 .../pic32mx/pic32mx7mmb/src/pic32_touchscreen.c    |  2 +
 .../pic32mx/sure-pic32mx/src/pic32mx_lcd1602.c     |  2 +
 crypto/cryptodev.c                                 |  4 ++
 drivers/analog/adc.c                               |  2 +
 drivers/analog/comp.c                              |  2 +
 drivers/bch/bchdev_driver.c                        |  2 +
 drivers/can/can.c                                  |  2 +
 drivers/crypto/dev_urandom.c                       |  2 +
 drivers/i2c/i2c_driver.c                           |  2 +
 drivers/input/ads7843e.c                           |  2 +
 drivers/input/ajoystick.c                          |  2 +
 drivers/input/button_upper.c                       |  2 +
 drivers/input/cypress_mbr3108.c                    |  2 +
 drivers/input/djoystick.c                          |  2 +
 drivers/input/ft5x06.c                             |  2 +
 drivers/input/keyboard_upper.c                     |  2 +
 drivers/input/max11802.c                           |  2 +
 drivers/input/mxt.c                                |  2 +
 drivers/input/spq10kbd.c                           |  2 +
 drivers/input/stmpe811_tsc.c                       |  2 +
 drivers/input/touchscreen_upper.c                  |  2 +
 drivers/input/tsc2007.c                            |  2 +
 drivers/lcd/ft80x.c                                |  2 +
 drivers/lcd/pcf8574_lcd_backpack.c                 |  2 +
 drivers/lcd/tda19988.c                             |  2 +
 drivers/leds/ws2812.c                              |  4 +-
 drivers/misc/dev_null.c                            |  2 +
 drivers/misc/dev_zero.c                            |  2 +
 drivers/misc/rpmsgdev.c                            |  2 +
 drivers/modem/alt1250/alt1250.c                    |  2 +
 drivers/modem/u-blox.c                             |  2 +
 drivers/mtd/mtd_config.c                           |  2 +
 drivers/mtd/mtd_config_fs.c                        |  2 +
 drivers/net/telnet.c                               |  4 ++
 drivers/net/tun.c                                  |  2 +
 drivers/pipes/fifo.c                               |  2 +
 drivers/pipes/pipe.c                               |  2 +
 drivers/power/battery/battery_charger.c            |  2 +
 drivers/power/battery/battery_gauge.c              |  2 +
 drivers/power/battery/battery_monitor.c            |  2 +
 drivers/rc/lirc_dev.c                              |  2 +
 drivers/sensors/aht10.c                            |  2 +
 drivers/sensors/hc_sr04.c                          |  2 +
 drivers/sensors/hdc1008.c                          |  2 +
 drivers/sensors/hts221.c                           |  2 +
 drivers/sensors/lis2dh.c                           |  2 +
 drivers/sensors/max44009.c                         |  2 +
 drivers/sensors/scd30.c                            |  2 +
 drivers/sensors/scd41.c                            |  2 +
 drivers/sensors/sensor.c                           |  2 +
 drivers/sensors/sgp30.c                            |  2 +
 drivers/sensors/sht21.c                            |  2 +
 drivers/sensors/sht3x.c                            |  2 +
 drivers/sensors/sps30.c                            |  2 +
 drivers/sensors/usensor.c                          |  2 +
 drivers/serial/pty.c                               |  2 +
 drivers/serial/serial.c                            |  2 +
 drivers/serial/uart_bth4.c                         |  2 +
 drivers/spi/spi_driver.c                           |  2 +
 drivers/spi/spi_slave_driver.c                     |  2 +
 drivers/syslog/ramlog.c                            |  2 +
 drivers/timers/rtc.c                               |  2 +
 drivers/usbdev/adb.c                               |  2 +
 drivers/usbhost/usbhost_cdcmbim.c                  |  2 +
 drivers/usbhost/usbhost_hidkbd.c                   |  2 +
 drivers/usbhost/usbhost_hidmouse.c                 |  2 +
 drivers/usbhost/usbhost_xboxcontroller.c           |  2 +
 drivers/usbmisc/fusb301.c                          |  2 +
 drivers/usbmisc/fusb303.c                          |  2 +
 drivers/usrsock/usrsock_dev.c                      |  2 +
 drivers/video/fb.c                                 | 40 ++++++++++-----
 drivers/video/video.c                              | 27 +++++++---
 drivers/wireless/cc1101.c                          |  2 +
 drivers/wireless/gs2200m.c                         |  2 +
 drivers/wireless/lpwan/sx127x/sx127x.c             |  2 +
 drivers/wireless/nrf24l01.c                        |  2 +
 fs/binfs/fs_binfs.c                                |  3 +-
 fs/cromfs/fs_cromfs.c                              |  3 +-
 fs/fat/fs_fat32.c                                  |  4 +-
 fs/hostfs/hostfs.c                                 |  3 +-
 fs/littlefs/lfs_vfs.c                              |  3 +-
 fs/mmap/README.txt                                 |  2 +-
 fs/mmap/fs_mmap.c                                  | 44 +++++++++++-----
 fs/mmap/fs_munmap.c                                |  2 +-
 fs/mqueue/mq_open.c                                |  2 +
 fs/nfs/nfs_vfsops.c                                |  3 +-
 fs/nxffs/nxffs_initialize.c                        | 11 ++--
 fs/procfs/fs_procfs.c                              |  3 +-
 fs/romfs/fs_romfs.c                                | 50 ++++++++++++------
 fs/rpmsgfs/rpmsgfs.c                               |  3 +-
 fs/smartfs/smartfs_smart.c                         |  3 +-
 fs/socket/socket.c                                 |  2 +
 fs/spiffs/src/spiffs_vfs.c                         |  3 +-
 fs/tmpfs/fs_tmpfs.c                                | 32 ++++--------
 fs/unionfs/fs_unionfs.c                            |  3 +-
 fs/userfs/fs_userfs.c                              |  3 +-
 fs/vfs/fs_epoll.c                                  |  2 +
 fs/vfs/fs_eventfd.c                                |  2 +
 fs/vfs/fs_signalfd.c                               |  2 +
 fs/vfs/fs_truncate.c                               | 18 ++-----
 graphics/nxterm/nxterm_driver.c                    |  4 ++
 include/nuttx/fs/fs.h                              |  6 ++-
 include/nuttx/fs/ioctl.h                           | 34 +++++--------
 .../nuttx/mm/map.h                                 | 59 ++++++++++++----------
 112 files changed, 395 insertions(+), 160 deletions(-)
 copy arch/arm/src/max326xx/max32620_30/max32620_30_clockconfig.h => include/nuttx/mm/map.h (61%)


[nuttx] 01/03: Revert "fs/vfs/fs_truncate.c: Use ioctl to truncate on non-mountpoint inode"

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 36528eed64d598e31cc4b65d80b61813e3b13539
Author: Jukka Laitinen <ju...@ssrc.tii.ae>
AuthorDate: Mon Jan 2 16:32:30 2023 +0400

    Revert "fs/vfs/fs_truncate.c: Use ioctl to truncate on non-mountpoint inode"
    
    This reverts commit dbc163f1b0b78543bb93e6e35142ec2061db85d6.
---
 fs/vfs/fs_truncate.c     | 15 +--------------
 include/nuttx/fs/ioctl.h |  3 ---
 2 files changed, 1 insertion(+), 17 deletions(-)

diff --git a/fs/vfs/fs_truncate.c b/fs/vfs/fs_truncate.c
index e67339a54b..4ecd06c13d 100644
--- a/fs/vfs/fs_truncate.c
+++ b/fs/vfs/fs_truncate.c
@@ -31,7 +31,6 @@
 #include <debug.h>
 
 #include <nuttx/fs/fs.h>
-#include <nuttx/fs/ioctl.h>
 
 #include "inode/inode.h"
 
@@ -69,19 +68,7 @@ int file_truncate(FAR struct file *filep, off_t length)
    */
 
   inode = filep->f_inode;
-  if (inode == NULL)
-    {
-      return -EINVAL;
-    }
-
-  /* If inode is not mountpoint try ioctl first */
-
-  if (!INODE_IS_MOUNTPT(inode))
-    {
-      return file_ioctl(filep, FIOC_TRUNCATE, length);
-    }
-
-  if (inode->u.i_mops == NULL)
+  if (inode == NULL || !INODE_IS_MOUNTPT(inode) || inode->u.i_mops == NULL)
     {
       fwarn("WARNING:  Not a (regular) file on a mounted file system.\n");
       return -EINVAL;
diff --git a/include/nuttx/fs/ioctl.h b/include/nuttx/fs/ioctl.h
index a249122c63..f356002eff 100644
--- a/include/nuttx/fs/ioctl.h
+++ b/include/nuttx/fs/ioctl.h
@@ -187,9 +187,6 @@
                                            *      configuration
                                            * OUT: None
                                            */
-#define FIOC_TRUNCATE   _FIOC(0x0010)     /* IN:  Length of the file after truncate
-                                           * OUT: None
-                                           */
 
 /* NuttX file system ioctl definitions **************************************/
 


[nuttx] 03/03: Change FIOC_MMAP into file operation call

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit f33dc4df3fcbf5bcb1f5a5b4d4d982f611fd92a9
Author: Jukka Laitinen <ju...@ssrc.tii.ae>
AuthorDate: Mon Jan 2 17:02:51 2023 +0400

    Change FIOC_MMAP into file operation call
    
    - Add mmap into file_operations and remove it from ioctl definitions.
    - Add mm_map structure definitions to support future unmapping
    - Modify all drivers to initialize the operations struct accordingly
    
    Signed-off-by: Jukka Laitinen <ju...@ssrc.tii.ae>
---
 Documentation/reference/user/10_filesystem.rst     | 11 ++--
 arch/arm/src/cxd56xx/cxd56_geofence.c              |  1 +
 arch/arm/src/cxd56xx/cxd56_gnss.c                  |  1 +
 arch/arm/src/cxd56xx/cxd56_hostif.c                |  1 +
 arch/arm/src/sama5/sam_tsd.c                       |  1 +
 boards/arm/sam34/sam4l-xplained/src/sam_slcd.c     |  1 +
 .../stm32/mikroe-stm32f4/src/stm32_touchscreen.c   |  1 +
 boards/arm/stm32/stm32ldiscovery/src/stm32_lcd.c   |  1 +
 .../pic32mx/pic32mx7mmb/src/pic32_touchscreen.c    |  1 +
 .../pic32mx/sure-pic32mx/src/pic32mx_lcd1602.c     |  1 +
 crypto/cryptodev.c                                 |  2 +
 drivers/analog/adc.c                               |  1 +
 drivers/analog/comp.c                              |  1 +
 drivers/bch/bchdev_driver.c                        |  1 +
 drivers/can/can.c                                  |  1 +
 drivers/crypto/dev_urandom.c                       |  1 +
 drivers/i2c/i2c_driver.c                           |  1 +
 drivers/input/ads7843e.c                           |  1 +
 drivers/input/ajoystick.c                          |  1 +
 drivers/input/button_upper.c                       |  1 +
 drivers/input/cypress_mbr3108.c                    |  1 +
 drivers/input/djoystick.c                          |  1 +
 drivers/input/ft5x06.c                             |  1 +
 drivers/input/keyboard_upper.c                     |  1 +
 drivers/input/max11802.c                           |  1 +
 drivers/input/mxt.c                                |  1 +
 drivers/input/spq10kbd.c                           |  1 +
 drivers/input/stmpe811_tsc.c                       |  1 +
 drivers/input/touchscreen_upper.c                  |  1 +
 drivers/input/tsc2007.c                            |  1 +
 drivers/lcd/ft80x.c                                |  1 +
 drivers/lcd/pcf8574_lcd_backpack.c                 |  1 +
 drivers/lcd/tda19988.c                             |  1 +
 drivers/leds/ws2812.c                              |  4 +-
 drivers/misc/dev_null.c                            |  1 +
 drivers/misc/dev_zero.c                            |  1 +
 drivers/misc/rpmsgdev.c                            |  1 +
 drivers/modem/alt1250/alt1250.c                    |  1 +
 drivers/modem/u-blox.c                             |  1 +
 drivers/mtd/mtd_config.c                           |  1 +
 drivers/mtd/mtd_config_fs.c                        |  1 +
 drivers/net/telnet.c                               |  2 +
 drivers/net/tun.c                                  |  1 +
 drivers/pipes/fifo.c                               |  1 +
 drivers/pipes/pipe.c                               |  1 +
 drivers/power/battery/battery_charger.c            |  1 +
 drivers/power/battery/battery_gauge.c              |  1 +
 drivers/power/battery/battery_monitor.c            |  1 +
 drivers/rc/lirc_dev.c                              |  1 +
 drivers/sensors/aht10.c                            |  1 +
 drivers/sensors/hc_sr04.c                          |  1 +
 drivers/sensors/hdc1008.c                          |  1 +
 drivers/sensors/hts221.c                           |  1 +
 drivers/sensors/lis2dh.c                           |  1 +
 drivers/sensors/max44009.c                         |  1 +
 drivers/sensors/scd30.c                            |  1 +
 drivers/sensors/scd41.c                            |  1 +
 drivers/sensors/sensor.c                           |  1 +
 drivers/sensors/sgp30.c                            |  1 +
 drivers/sensors/sht21.c                            |  1 +
 drivers/sensors/sht3x.c                            |  1 +
 drivers/sensors/sps30.c                            |  1 +
 drivers/sensors/usensor.c                          |  1 +
 drivers/serial/pty.c                               |  1 +
 drivers/serial/serial.c                            |  1 +
 drivers/serial/uart_bth4.c                         |  1 +
 drivers/spi/spi_driver.c                           |  1 +
 drivers/spi/spi_slave_driver.c                     |  1 +
 drivers/syslog/ramlog.c                            |  1 +
 drivers/timers/rtc.c                               |  1 +
 drivers/usbdev/adb.c                               |  1 +
 drivers/usbhost/usbhost_cdcmbim.c                  |  1 +
 drivers/usbhost/usbhost_hidkbd.c                   |  1 +
 drivers/usbhost/usbhost_hidmouse.c                 |  1 +
 drivers/usbhost/usbhost_xboxcontroller.c           |  1 +
 drivers/usbmisc/fusb301.c                          |  1 +
 drivers/usbmisc/fusb303.c                          |  1 +
 drivers/usrsock/usrsock_dev.c                      |  1 +
 drivers/video/fb.c                                 | 39 ++++++++----
 drivers/video/video.c                              | 26 +++++---
 drivers/wireless/cc1101.c                          |  1 +
 drivers/wireless/gs2200m.c                         |  1 +
 drivers/wireless/lpwan/sx127x/sx127x.c             |  1 +
 drivers/wireless/nrf24l01.c                        |  1 +
 fs/binfs/fs_binfs.c                                |  1 +
 fs/cromfs/fs_cromfs.c                              |  1 +
 fs/fat/fs_fat32.c                                  |  1 +
 fs/hostfs/hostfs.c                                 |  1 +
 fs/littlefs/lfs_vfs.c                              |  1 +
 fs/mmap/README.txt                                 |  2 +-
 fs/mmap/fs_mmap.c                                  | 44 +++++++++----
 fs/mmap/fs_munmap.c                                |  2 +-
 fs/mqueue/mq_open.c                                |  1 +
 fs/nfs/nfs_vfsops.c                                |  1 +
 fs/nxffs/nxffs_initialize.c                        |  1 +
 fs/procfs/fs_procfs.c                              |  1 +
 fs/romfs/fs_romfs.c                                | 49 ++++++++++-----
 fs/rpmsgfs/rpmsgfs.c                               |  1 +
 fs/smartfs/smartfs_smart.c                         |  1 +
 fs/socket/socket.c                                 |  1 +
 fs/spiffs/src/spiffs_vfs.c                         |  1 +
 fs/tmpfs/fs_tmpfs.c                                | 30 +++------
 fs/unionfs/fs_unionfs.c                            |  1 +
 fs/userfs/fs_userfs.c                              |  1 +
 fs/vfs/fs_epoll.c                                  |  1 +
 fs/vfs/fs_eventfd.c                                |  1 +
 fs/vfs/fs_signalfd.c                               |  1 +
 graphics/nxterm/nxterm_driver.c                    |  2 +
 include/nuttx/fs/fs.h                              |  3 +
 include/nuttx/fs/ioctl.h                           | 31 ++++-----
 include/nuttx/mm/map.h                             | 73 ++++++++++++++++++++++
 111 files changed, 320 insertions(+), 96 deletions(-)

diff --git a/Documentation/reference/user/10_filesystem.rst b/Documentation/reference/user/10_filesystem.rst
index acbf64b0b5..d567797dc6 100644
--- a/Documentation/reference/user/10_filesystem.rst
+++ b/Documentation/reference/user/10_filesystem.rst
@@ -458,12 +458,11 @@ are two conditions where ``mmap()`` can be supported:
 1. ``mmap()`` can be used to support *eXecute In Place* (XIP) on random
    access media under the following very restrictive conditions:
 
-   a. The file-system supports the ``FIOC_MMAP`` ioctl command. Any file
-      system that maps files contiguously on the media should support
-      this ``ioctl`` command. By comparison, most file system scatter
-      files over the media in non-contiguous sectors. As of this
-      writing, ROMFS is the only file system that meets this
-      requirement.
+   a. Any file system that maps files contiguously on the media
+      should implement the mmap file operation. By comparison, most
+      file system scatter files over the media in non-contiguous
+      sectors. As of this writing, ROMFS is the only file system
+      that meets this requirement.
 
    b. The underlying block driver supports the ``BIOC_XIPBASE``
       ``ioctl`` command that maps the underlying media to a randomly
diff --git a/arch/arm/src/cxd56xx/cxd56_geofence.c b/arch/arm/src/cxd56xx/cxd56_geofence.c
index 0dc32b65cd..ad040534f0 100644
--- a/arch/arm/src/cxd56xx/cxd56_geofence.c
+++ b/arch/arm/src/cxd56xx/cxd56_geofence.c
@@ -107,6 +107,7 @@ static const struct file_operations g_geofencefops =
   NULL,                 /* seek */
   cxd56_geofence_ioctl, /* ioctl */
   NULL,                 /* truncate */
+  NULL,                 /* mmap */
   cxd56_geofence_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL                /* unlink */
diff --git a/arch/arm/src/cxd56xx/cxd56_gnss.c b/arch/arm/src/cxd56xx/cxd56_gnss.c
index 04270f1477..9f9683a35c 100644
--- a/arch/arm/src/cxd56xx/cxd56_gnss.c
+++ b/arch/arm/src/cxd56xx/cxd56_gnss.c
@@ -318,6 +318,7 @@ static const struct file_operations g_gnssfops =
   NULL,             /* seek */
   cxd56_gnss_ioctl, /* ioctl */
   NULL,             /* truncate */
+  NULL,             /* mmap */
   cxd56_gnss_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL            /* unlink */
diff --git a/arch/arm/src/cxd56xx/cxd56_hostif.c b/arch/arm/src/cxd56xx/cxd56_hostif.c
index 905c1baf68..790506052c 100644
--- a/arch/arm/src/cxd56xx/cxd56_hostif.c
+++ b/arch/arm/src/cxd56xx/cxd56_hostif.c
@@ -146,6 +146,7 @@ static const struct file_operations g_hif_fops =
   hif_seek,    /* seek */
   hif_ioctl,   /* ioctl */
   NULL,        /* truncate */
+  NULL,        /* mmap */
   hif_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , hif_unlink /* unlink */
diff --git a/arch/arm/src/sama5/sam_tsd.c b/arch/arm/src/sama5/sam_tsd.c
index 3e2adab4db..888d4a34e6 100644
--- a/arch/arm/src/sama5/sam_tsd.c
+++ b/arch/arm/src/sama5/sam_tsd.c
@@ -250,6 +250,7 @@ static const struct file_operations g_tsdops =
   NULL,            /* seek */
   sam_tsd_ioctl,   /* ioctl */
   NULL,            /* truncate */
+  NULL,            /* mmap */
   sam_tsd_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL           /* unlink */
diff --git a/boards/arm/sam34/sam4l-xplained/src/sam_slcd.c b/boards/arm/sam34/sam4l-xplained/src/sam_slcd.c
index c612ab8c54..0002e3ca6f 100644
--- a/boards/arm/sam34/sam4l-xplained/src/sam_slcd.c
+++ b/boards/arm/sam34/sam4l-xplained/src/sam_slcd.c
@@ -297,6 +297,7 @@ static const struct file_operations g_slcdops =
   NULL,          /* seek */
   slcd_ioctl,    /* ioctl */
   NULL,          /* truncate */
+  NULL,          /* mmap */
   slcd_poll      /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
diff --git a/boards/arm/stm32/mikroe-stm32f4/src/stm32_touchscreen.c b/boards/arm/stm32/mikroe-stm32f4/src/stm32_touchscreen.c
index 0a9b57e28d..b22be31a6e 100644
--- a/boards/arm/stm32/mikroe-stm32f4/src/stm32_touchscreen.c
+++ b/boards/arm/stm32/mikroe-stm32f4/src/stm32_touchscreen.c
@@ -269,6 +269,7 @@ static const struct file_operations tc_fops =
   NULL,       /* seek */
   tc_ioctl,   /* ioctl */
   NULL,       /* truncate */
+  NULL,       /* mmap */
   tc_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL      /* unlink */
diff --git a/boards/arm/stm32/stm32ldiscovery/src/stm32_lcd.c b/boards/arm/stm32/stm32ldiscovery/src/stm32_lcd.c
index 5778631ff0..e8c8bf90fe 100644
--- a/boards/arm/stm32/stm32ldiscovery/src/stm32_lcd.c
+++ b/boards/arm/stm32/stm32ldiscovery/src/stm32_lcd.c
@@ -347,6 +347,7 @@ static const struct file_operations g_slcdops =
   NULL,          /* seek */
   slcd_ioctl,    /* ioctl */
   NULL,          /* truncate */
+  NULL,          /* mmap */
   slcd_poll      /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
diff --git a/boards/mips/pic32mx/pic32mx7mmb/src/pic32_touchscreen.c b/boards/mips/pic32mx/pic32mx7mmb/src/pic32_touchscreen.c
index 9ae2554986..04786a968a 100644
--- a/boards/mips/pic32mx/pic32mx7mmb/src/pic32_touchscreen.c
+++ b/boards/mips/pic32mx/pic32mx7mmb/src/pic32_touchscreen.c
@@ -250,6 +250,7 @@ static const struct file_operations tc_fops =
   NULL,       /* seek */
   tc_ioctl,   /* ioctl */
   NULL,       /* truncate */
+  NULL,       /* mmap */
   tc_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL      /* unlink */
diff --git a/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_lcd1602.c b/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_lcd1602.c
index 50cb3f99e9..9fe29b59ba 100644
--- a/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_lcd1602.c
+++ b/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_lcd1602.c
@@ -182,6 +182,7 @@ static const struct file_operations g_lcdops =
   NULL,          /* seek */
   lcd_ioctl,     /* ioctl */
   NULL,          /* truncate */
+  NULL,          /* mmap */
   lcd_poll       /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
diff --git a/crypto/cryptodev.c b/crypto/cryptodev.c
index 44eb9410e8..749e2c0120 100644
--- a/crypto/cryptodev.c
+++ b/crypto/cryptodev.c
@@ -126,6 +126,7 @@ static const struct file_operations g_cryptofops =
   NULL,                /* seek   */
   cryptof_ioctl,       /* ioctl  */
   NULL,                /* truncate */
+  NULL,                /* mmap */
   cryptof_poll         /* poll   */
 };
 
@@ -138,6 +139,7 @@ static const struct file_operations g_cryptoops =
   NULL,                /* seek   */
   cryptoioctl,         /* ioctl  */
   NULL,                /* truncate */
+  NULL,                /* mmap */
   NULL                 /* poll   */
 };
 
diff --git a/drivers/analog/adc.c b/drivers/analog/adc.c
index 099e7b4d17..f8df2343a6 100644
--- a/drivers/analog/adc.c
+++ b/drivers/analog/adc.c
@@ -73,6 +73,7 @@ static const struct file_operations g_adc_fops =
   NULL,         /* seek */
   adc_ioctl,    /* ioctl */
   NULL,         /* truncate */
+  NULL,         /* mmap */
   adc_poll      /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL        /* unlink */
diff --git a/drivers/analog/comp.c b/drivers/analog/comp.c
index 1fb32f18de..0fc956d6c0 100644
--- a/drivers/analog/comp.c
+++ b/drivers/analog/comp.c
@@ -66,6 +66,7 @@ static const struct file_operations comp_fops =
   NULL,                         /* seek */
   comp_ioctl,                   /* ioctl */
   NULL,                         /* truncate */
+  NULL,                         /* mmap */
   comp_poll                     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL                        /* unlink */
diff --git a/drivers/bch/bchdev_driver.c b/drivers/bch/bchdev_driver.c
index 83fc4250d3..9069d93596 100644
--- a/drivers/bch/bchdev_driver.c
+++ b/drivers/bch/bchdev_driver.c
@@ -79,6 +79,7 @@ const struct file_operations bch_fops =
   bch_seek,    /* seek */
   bch_ioctl,   /* ioctl */
   NULL,        /* truncate */
+  NULL,        /* mmap */
   bch_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , bch_unlink /* unlink */
diff --git a/drivers/can/can.c b/drivers/can/can.c
index b19cb36f26..78a72255ff 100644
--- a/drivers/can/can.c
+++ b/drivers/can/can.c
@@ -136,6 +136,7 @@ static const struct file_operations g_canops =
   NULL,      /* seek */
   can_ioctl, /* ioctl */
   NULL,      /* truncate */
+  NULL,      /* mmap */
   can_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL     /* unlink */
diff --git a/drivers/crypto/dev_urandom.c b/drivers/crypto/dev_urandom.c
index 8796f7445b..5496ab60d9 100644
--- a/drivers/crypto/dev_urandom.c
+++ b/drivers/crypto/dev_urandom.c
@@ -101,6 +101,7 @@ static const struct file_operations g_urand_fops =
   NULL,                         /* seek */
   NULL,                         /* ioctl */
   NULL,                         /* truncate */
+  NULL,                         /* mmap */
   devurand_poll                 /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL                        /* unlink */
diff --git a/drivers/i2c/i2c_driver.c b/drivers/i2c/i2c_driver.c
index b7836b7327..57fedcb2a6 100644
--- a/drivers/i2c/i2c_driver.c
+++ b/drivers/i2c/i2c_driver.c
@@ -100,6 +100,7 @@ static const struct file_operations i2cdrvr_fops =
   NULL,            /* seek */
   i2cdrvr_ioctl,   /* ioctl */
   NULL,            /* truncate */
+  NULL,            /* mmap */
   NULL             /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , i2cdrvr_unlink /* unlink */
diff --git a/drivers/input/ads7843e.c b/drivers/input/ads7843e.c
index 19126b3b6b..f7602f2b42 100644
--- a/drivers/input/ads7843e.c
+++ b/drivers/input/ads7843e.c
@@ -123,6 +123,7 @@ static const struct file_operations ads7843e_fops =
   NULL,             /* seek */
   ads7843e_ioctl,   /* ioctl */
   NULL,             /* truncate */
+  NULL,             /* mmap */
   ads7843e_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL            /* unlink */
diff --git a/drivers/input/ajoystick.c b/drivers/input/ajoystick.c
index 072d90615e..e9acb48266 100644
--- a/drivers/input/ajoystick.c
+++ b/drivers/input/ajoystick.c
@@ -136,6 +136,7 @@ static const struct file_operations ajoy_fops =
   NULL,       /* seek */
   ajoy_ioctl, /* ioctl */
   NULL,       /* truncate */
+  NULL,       /* mmap */
   ajoy_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL      /* unlink */
diff --git a/drivers/input/button_upper.c b/drivers/input/button_upper.c
index 16b578bbf9..007a9ffc30 100644
--- a/drivers/input/button_upper.c
+++ b/drivers/input/button_upper.c
@@ -134,6 +134,7 @@ static const struct file_operations btn_fops =
   NULL,      /* seek */
   btn_ioctl, /* ioctl */
   NULL,      /* truncate */
+  NULL,      /* mmap */
   btn_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL     /* unlink */
diff --git a/drivers/input/cypress_mbr3108.c b/drivers/input/cypress_mbr3108.c
index 39189b9329..107bd814b3 100644
--- a/drivers/input/cypress_mbr3108.c
+++ b/drivers/input/cypress_mbr3108.c
@@ -225,6 +225,7 @@ static const struct file_operations g_mbr3108_fileops =
   NULL,           /* seek */
   NULL,           /* ioctl */
   NULL,           /* truncate */
+  NULL,           /* mmap */
   mbr3108_poll    /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL          /* unlink */
diff --git a/drivers/input/djoystick.c b/drivers/input/djoystick.c
index 13365fd7a5..06a8d82890 100644
--- a/drivers/input/djoystick.c
+++ b/drivers/input/djoystick.c
@@ -136,6 +136,7 @@ static const struct file_operations djoy_fops =
   NULL,       /* seek */
   djoy_ioctl, /* ioctl */
   NULL,       /* truncate */
+  NULL,       /* mmap */
   djoy_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL      /* unlink */
diff --git a/drivers/input/ft5x06.c b/drivers/input/ft5x06.c
index 8898f8e5d4..59f94b9a7a 100644
--- a/drivers/input/ft5x06.c
+++ b/drivers/input/ft5x06.c
@@ -177,6 +177,7 @@ static const struct file_operations ft5x06_fops =
   NULL,           /* seek */
   ft5x06_ioctl,   /* ioctl */
   NULL,           /* truncate */
+  NULL,           /* mmap */
   ft5x06_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL          /* unlink */
diff --git a/drivers/input/keyboard_upper.c b/drivers/input/keyboard_upper.c
index c874a3a04f..4ab770288d 100644
--- a/drivers/input/keyboard_upper.c
+++ b/drivers/input/keyboard_upper.c
@@ -89,6 +89,7 @@ static const struct file_operations g_keyboard_fops =
   NULL,           /* seek */
   NULL,           /* ioctl */
   NULL,           /* truncate */
+  NULL,           /* mmap */
   keyboard_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL          /* unlink */
diff --git a/drivers/input/max11802.c b/drivers/input/max11802.c
index b0d69eb390..0713c61d56 100644
--- a/drivers/input/max11802.c
+++ b/drivers/input/max11802.c
@@ -116,6 +116,7 @@ static const struct file_operations max11802_fops =
   NULL,             /* seek */
   max11802_ioctl,   /* ioctl */
   NULL,             /* truncate */
+  NULL,             /* mmap */
   max11802_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL            /* unlink */
diff --git a/drivers/input/mxt.c b/drivers/input/mxt.c
index 5050bcda50..50426a9646 100644
--- a/drivers/input/mxt.c
+++ b/drivers/input/mxt.c
@@ -281,6 +281,7 @@ static const struct file_operations mxt_fops =
   NULL,        /* seek */
   mxt_ioctl,   /* ioctl */
   NULL,        /* truncate */
+  NULL,        /* mmap */
   mxt_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL       /* unlink */
diff --git a/drivers/input/spq10kbd.c b/drivers/input/spq10kbd.c
index 91597439cd..427925f4d9 100644
--- a/drivers/input/spq10kbd.c
+++ b/drivers/input/spq10kbd.c
@@ -256,6 +256,7 @@ static const struct file_operations g_hidkbd_fops =
   NULL,                      /* seek */
   NULL,                      /* ioctl */
   NULL,                      /* truncate */
+  NULL,                      /* mmap */
   spq10kbd_poll              /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL                     /* unlink */
diff --git a/drivers/input/stmpe811_tsc.c b/drivers/input/stmpe811_tsc.c
index 6e82fed382..efc73437d2 100644
--- a/drivers/input/stmpe811_tsc.c
+++ b/drivers/input/stmpe811_tsc.c
@@ -125,6 +125,7 @@ static const struct file_operations g_stmpe811fops =
   NULL,             /* seek */
   stmpe811_ioctl,   /* ioctl */
   NULL,             /* truncate */
+  NULL,             /* mmap */
   stmpe811_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL            /* unlink */
diff --git a/drivers/input/touchscreen_upper.c b/drivers/input/touchscreen_upper.c
index 48dc7038a6..0f3a6c6c83 100644
--- a/drivers/input/touchscreen_upper.c
+++ b/drivers/input/touchscreen_upper.c
@@ -91,6 +91,7 @@ static const struct file_operations g_touch_fops =
   NULL,           /* seek */
   touch_ioctl,    /* ioctl */
   NULL,           /* truncate */
+  NULL,           /* mmap */
   touch_poll      /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL          /* unlink */
diff --git a/drivers/input/tsc2007.c b/drivers/input/tsc2007.c
index 5a1afd55af..5932578c07 100644
--- a/drivers/input/tsc2007.c
+++ b/drivers/input/tsc2007.c
@@ -210,6 +210,7 @@ static const struct file_operations tsc2007_fops =
   NULL,            /* seek */
   tsc2007_ioctl,   /* ioctl */
   NULL,            /* truncate */
+  NULL,            /* mmap */
   tsc2007_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL           /* unlink */
diff --git a/drivers/lcd/ft80x.c b/drivers/lcd/ft80x.c
index 6950b39c7f..c75aaeea4b 100644
--- a/drivers/lcd/ft80x.c
+++ b/drivers/lcd/ft80x.c
@@ -135,6 +135,7 @@ static const struct file_operations g_ft80x_fops =
   NULL,          /* seek */
   ft80x_ioctl,   /* ioctl */
   NULL,          /* truncate */
+  NULL,          /* mmap */
   NULL           /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , ft80x_unlink /* unlink */
diff --git a/drivers/lcd/pcf8574_lcd_backpack.c b/drivers/lcd/pcf8574_lcd_backpack.c
index a27179386a..0a0ec4dbf2 100644
--- a/drivers/lcd/pcf8574_lcd_backpack.c
+++ b/drivers/lcd/pcf8574_lcd_backpack.c
@@ -118,6 +118,7 @@ static const struct file_operations g_pcf8574_lcd_fops =
   pcf8574_lcd_seek,             /* seek */
   pcf8574_lcd_ioctl,            /* ioctl */
   NULL,                         /* truncate */
+  NULL,                         /* mmap */
   pcf8574_lcd_poll              /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , pcf8574_lcd_unlink          /* unlink */
diff --git a/drivers/lcd/tda19988.c b/drivers/lcd/tda19988.c
index f8e0b06eb6..16a0001089 100644
--- a/drivers/lcd/tda19988.c
+++ b/drivers/lcd/tda19988.c
@@ -171,6 +171,7 @@ static const struct file_operations tda19988_fops =
   tda19988_seek,     /* seek */
   tda19988_ioctl,    /* ioctl */
   NULL,              /* truncate */
+  NULL,              /* mmap */
   tda19988_poll      /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , tda19988_unlink  /* unlink */
diff --git a/drivers/leds/ws2812.c b/drivers/leds/ws2812.c
index b239ba5659..235df171f1 100644
--- a/drivers/leds/ws2812.c
+++ b/drivers/leds/ws2812.c
@@ -182,8 +182,8 @@ static const struct file_operations g_ws2812fops =
 /****************************************************************************
  * #### TODO ####
  *
- * Consider supporting mmap by returning memory buffer using...
- *       file_ioctl(filep, FIOC_MMAP, (unsigned long)((uintptr_t)&addr));
+ * Consider supporting mmap by returning memory buffer using file_operations'
+ *   mmap
  * Code using this would be non-portable across architectures as the format
  * of the buffer can be different.
  *
diff --git a/drivers/misc/dev_null.c b/drivers/misc/dev_null.c
index 5b84c8a436..8067011275 100644
--- a/drivers/misc/dev_null.c
+++ b/drivers/misc/dev_null.c
@@ -58,6 +58,7 @@ static const struct file_operations devnull_fops =
   NULL,          /* seek */
   NULL,          /* ioctl */
   NULL,          /* truncate */
+  NULL,          /* mmap */
   devnull_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
diff --git a/drivers/misc/dev_zero.c b/drivers/misc/dev_zero.c
index b02ba21559..998aaa394f 100644
--- a/drivers/misc/dev_zero.c
+++ b/drivers/misc/dev_zero.c
@@ -58,6 +58,7 @@ static const struct file_operations devzero_fops =
   NULL,          /* seek */
   NULL,          /* ioctl */
   NULL,          /* truncate */
+  NULL,          /* mmap */
   devzero_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
diff --git a/drivers/misc/rpmsgdev.c b/drivers/misc/rpmsgdev.c
index 96eb593411..3be631336f 100644
--- a/drivers/misc/rpmsgdev.c
+++ b/drivers/misc/rpmsgdev.c
@@ -166,6 +166,7 @@ const struct file_operations g_rpmsgdev_ops =
   rpmsgdev_seek,          /* seek */
   rpmsgdev_ioctl,         /* ioctl */
   NULL,                   /* truncate */
+  NULL,                   /* mmap */
   rpmsgdev_poll           /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL                  /* unlink */
diff --git a/drivers/modem/alt1250/alt1250.c b/drivers/modem/alt1250/alt1250.c
index 6978432a53..7e76bd199f 100644
--- a/drivers/modem/alt1250/alt1250.c
+++ b/drivers/modem/alt1250/alt1250.c
@@ -78,6 +78,7 @@ static const struct file_operations g_alt1250fops =
   NULL,          /* seek */
   alt1250_ioctl, /* ioctl */
   NULL,          /* truncate */
+  NULL,          /* mmap */
   alt1250_poll,  /* poll */
 };
 static uint8_t g_recvbuff[ALTCOM_RX_PKT_SIZE_MAX];
diff --git a/drivers/modem/u-blox.c b/drivers/modem/u-blox.c
index fbd3d38ad3..86cb243909 100644
--- a/drivers/modem/u-blox.c
+++ b/drivers/modem/u-blox.c
@@ -115,6 +115,7 @@ static const struct file_operations ubxmdm_fops =
   NULL,         /* seek */
   ubxmdm_ioctl, /* ioctl */
   NULL,         /* truncate */
+  NULL,         /* mmap */
   ubxmdm_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL        /* unlink */
diff --git a/drivers/mtd/mtd_config.c b/drivers/mtd/mtd_config.c
index 4e74433a59..e2f0f76536 100644
--- a/drivers/mtd/mtd_config.c
+++ b/drivers/mtd/mtd_config.c
@@ -120,6 +120,7 @@ static const struct file_operations mtdconfig_fops =
   NULL,            /* seek */
   mtdconfig_ioctl, /* ioctl */
   NULL,            /* truncate */
+  NULL,            /* mmap */
   mtdconfig_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL            /* unlink */
diff --git a/drivers/mtd/mtd_config_fs.c b/drivers/mtd/mtd_config_fs.c
index cb6153e248..254a8ccbe9 100644
--- a/drivers/mtd/mtd_config_fs.c
+++ b/drivers/mtd/mtd_config_fs.c
@@ -142,6 +142,7 @@ static const struct file_operations g_mtdnvs_fops =
   NULL,            /* Seek */
   mtdconfig_ioctl, /* Ioctl */
   NULL,            /* Truncate */
+  NULL,            /* Mmap */
   mtdconfig_poll   /* Poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL           /* Unlink */
diff --git a/drivers/net/telnet.c b/drivers/net/telnet.c
index 2b922a08d6..fabbe81514 100644
--- a/drivers/net/telnet.c
+++ b/drivers/net/telnet.c
@@ -191,6 +191,7 @@ static const struct file_operations g_telnet_fops =
   NULL,          /* seek */
   telnet_ioctl,  /* ioctl */
   NULL,          /* truncate */
+  NULL,          /* mmap */
   telnet_poll    /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
@@ -206,6 +207,7 @@ static const struct file_operations g_factory_fops =
   NULL,          /* seek */
   factory_ioctl, /* ioctl */
   NULL,          /* truncate */
+  NULL,          /* mmap */
   NULL           /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index cab2d1f325..43d43ade79 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -220,6 +220,7 @@ static const struct file_operations g_tun_file_ops =
   NULL,         /* seek */
   tun_ioctl,    /* ioctl */
   NULL,         /* truncate */
+  NULL,         /* mmap */
   tun_poll      /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL        /* unlink */
diff --git a/drivers/pipes/fifo.c b/drivers/pipes/fifo.c
index 7ad5c4358c..283f1614ff 100644
--- a/drivers/pipes/fifo.c
+++ b/drivers/pipes/fifo.c
@@ -48,6 +48,7 @@ static const struct file_operations g_fifo_fops =
   NULL,                /* seek */
   pipecommon_ioctl,    /* ioctl */
   NULL,                /* truncate */
+  NULL,                /* mmap */
   pipecommon_poll      /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , pipecommon_unlink  /* unlink */
diff --git a/drivers/pipes/pipe.c b/drivers/pipes/pipe.c
index 67050f9176..5bc8716d5b 100644
--- a/drivers/pipes/pipe.c
+++ b/drivers/pipes/pipe.c
@@ -62,6 +62,7 @@ static const struct file_operations g_pipe_fops =
   NULL,                /* seek */
   pipecommon_ioctl,    /* ioctl */
   NULL,                /* truncate */
+  NULL,                /* mmap */
   pipecommon_poll      /* poll */
 };
 
diff --git a/drivers/power/battery/battery_charger.c b/drivers/power/battery/battery_charger.c
index edfc8c4c29..0316a5d47e 100644
--- a/drivers/power/battery/battery_charger.c
+++ b/drivers/power/battery/battery_charger.c
@@ -92,6 +92,7 @@ static const struct file_operations g_batteryops =
   NULL,                /* seek */
   bat_charger_ioctl,   /* ioctl */
   NULL,                /* truncate */
+  NULL,                /* mmap */
   bat_charger_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL               /* unlink */
diff --git a/drivers/power/battery/battery_gauge.c b/drivers/power/battery/battery_gauge.c
index 37b01cb9c4..0b24303e27 100644
--- a/drivers/power/battery/battery_gauge.c
+++ b/drivers/power/battery/battery_gauge.c
@@ -94,6 +94,7 @@ static const struct file_operations g_batteryops =
   NULL,             /* seek */
   bat_gauge_ioctl,  /* ioctl */
   NULL,             /* truncate */
+  NULL,             /* mmap */
   bat_gauge_poll    /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL            /* unlink */
diff --git a/drivers/power/battery/battery_monitor.c b/drivers/power/battery/battery_monitor.c
index 77e1980868..4f1c2ff5d5 100644
--- a/drivers/power/battery/battery_monitor.c
+++ b/drivers/power/battery/battery_monitor.c
@@ -93,6 +93,7 @@ static const struct file_operations g_batteryops =
   NULL,                /* seek */
   bat_monitor_ioctl,   /* ioctl */
   NULL,                /* truncate */
+  NULL,                /* mmap */
   bat_monitor_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL               /* unlink */
diff --git a/drivers/rc/lirc_dev.c b/drivers/rc/lirc_dev.c
index d4911fae41..57a0d5e6b2 100644
--- a/drivers/rc/lirc_dev.c
+++ b/drivers/rc/lirc_dev.c
@@ -104,6 +104,7 @@ static const struct file_operations g_lirc_fops =
   NULL,        /* seek */
   lirc_ioctl,  /* ioctl */
   NULL,        /* truncate */
+  NULL,        /* mmap */
   lirc_poll    /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL       /* unlink */
diff --git a/drivers/sensors/aht10.c b/drivers/sensors/aht10.c
index 529ce0140e..514e0c96eb 100644
--- a/drivers/sensors/aht10.c
+++ b/drivers/sensors/aht10.c
@@ -117,6 +117,7 @@ static const struct file_operations g_aht10fops =
   NULL,           /* seek */
   aht10_ioctl,    /* ioctl */
   NULL,           /* truncate */
+  NULL,           /* mmap */
   NULL            /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , aht10_unlink /* unlink */
diff --git a/drivers/sensors/hc_sr04.c b/drivers/sensors/hc_sr04.c
index f4cfd37726..2b956b9140 100644
--- a/drivers/sensors/hc_sr04.c
+++ b/drivers/sensors/hc_sr04.c
@@ -91,6 +91,7 @@ static const struct file_operations g_hcsr04ops =
   NULL,          /* seek */
   hcsr04_ioctl,  /* ioctl */
   NULL,          /* truncate */
+  NULL,          /* mmap */
   hcsr04_poll    /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
diff --git a/drivers/sensors/hdc1008.c b/drivers/sensors/hdc1008.c
index 612011ebb2..44f83ed33b 100644
--- a/drivers/sensors/hdc1008.c
+++ b/drivers/sensors/hdc1008.c
@@ -162,6 +162,7 @@ static const struct file_operations g_hdc1008fops =
   NULL,             /* seek */
   hdc1008_ioctl,    /* ioctl */
   NULL,             /* truncate */
+  NULL,             /* mmap */
   NULL              /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , hdc1008_unlink  /* unlink */
diff --git a/drivers/sensors/hts221.c b/drivers/sensors/hts221.c
index 9e02fbe00f..18b6ee31b1 100644
--- a/drivers/sensors/hts221.c
+++ b/drivers/sensors/hts221.c
@@ -158,6 +158,7 @@ static const struct file_operations g_humidityops =
   NULL,          /* seek */
   hts221_ioctl,  /* ioctl */
   NULL,          /* truncate */
+  NULL,          /* mmap */
   hts221_poll    /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
diff --git a/drivers/sensors/lis2dh.c b/drivers/sensors/lis2dh.c
index efdd81e535..445f9b9f42 100644
--- a/drivers/sensors/lis2dh.c
+++ b/drivers/sensors/lis2dh.c
@@ -155,6 +155,7 @@ static const struct file_operations g_lis2dhops =
   NULL,          /* seek */
   lis2dh_ioctl,  /* ioctl */
   NULL,          /* truncate */
+  NULL,          /* mmap */
   lis2dh_poll    /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
diff --git a/drivers/sensors/max44009.c b/drivers/sensors/max44009.c
index 45a6fb6bae..840c4bdcb8 100644
--- a/drivers/sensors/max44009.c
+++ b/drivers/sensors/max44009.c
@@ -113,6 +113,7 @@ static const struct file_operations g_alsops =
   NULL,            /* seek */
   max44009_ioctl,  /* ioctl */
   NULL,            /* truncate */
+  NULL,            /* mmap */
   max44009_poll    /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL           /* unlink */
diff --git a/drivers/sensors/scd30.c b/drivers/sensors/scd30.c
index 063a346b35..54317a85f0 100644
--- a/drivers/sensors/scd30.c
+++ b/drivers/sensors/scd30.c
@@ -183,6 +183,7 @@ static const struct file_operations g_scd30fops =
   NULL,           /* seek */
   scd30_ioctl,    /* ioctl */
   NULL,           /* truncate */
+  NULL,           /* mmap */
   NULL            /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , scd30_unlink /* unlink */
diff --git a/drivers/sensors/scd41.c b/drivers/sensors/scd41.c
index 272f37f5af..74288c4f5b 100644
--- a/drivers/sensors/scd41.c
+++ b/drivers/sensors/scd41.c
@@ -191,6 +191,7 @@ static const struct file_operations g_scd41fops =
   NULL,           /* seek */
   scd41_ioctl,    /* ioctl */
   NULL,           /* truncate */
+  NULL,           /* mmap */
   NULL            /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , scd41_unlink /* unlink */
diff --git a/drivers/sensors/sensor.c b/drivers/sensors/sensor.c
index 4a93b4f11a..417554f063 100644
--- a/drivers/sensors/sensor.c
+++ b/drivers/sensors/sensor.c
@@ -168,6 +168,7 @@ static const struct file_operations g_sensor_fops =
   NULL,           /* seek  */
   sensor_ioctl,   /* ioctl */
   NULL,           /* truncate */
+  NULL,           /* mmap */
   sensor_poll     /* poll  */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL          /* unlink */
diff --git a/drivers/sensors/sgp30.c b/drivers/sensors/sgp30.c
index 493a0af4d7..e9ad20336e 100644
--- a/drivers/sensors/sgp30.c
+++ b/drivers/sensors/sgp30.c
@@ -160,6 +160,7 @@ static const struct file_operations g_sgp30fops =
   NULL,           /* seek */
   sgp30_ioctl,    /* ioctl */
   NULL,           /* truncate */
+  NULL,           /* mmap */
   NULL            /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , sgp30_unlink /* unlink */
diff --git a/drivers/sensors/sht21.c b/drivers/sensors/sht21.c
index a23b58ebfc..e314663813 100644
--- a/drivers/sensors/sht21.c
+++ b/drivers/sensors/sht21.c
@@ -132,6 +132,7 @@ static const struct file_operations g_sht21fops =
   NULL,           /* seek */
   sht21_ioctl,    /* ioctl */
   NULL,           /* truncate */
+  NULL,           /* mmap */
   NULL            /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , sht21_unlink /* unlink */
diff --git a/drivers/sensors/sht3x.c b/drivers/sensors/sht3x.c
index 11dd183480..ffcb146ce2 100644
--- a/drivers/sensors/sht3x.c
+++ b/drivers/sensors/sht3x.c
@@ -171,6 +171,7 @@ static const struct file_operations g_sht3xfops =
   NULL,           /* seek */
   sht3x_ioctl,    /* ioctl */
   NULL,           /* truncate */
+  NULL,           /* mmap */
   NULL            /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , sht3x_unlink  /* unlink */
diff --git a/drivers/sensors/sps30.c b/drivers/sensors/sps30.c
index ad176cbe11..37f7f010c0 100644
--- a/drivers/sensors/sps30.c
+++ b/drivers/sensors/sps30.c
@@ -176,6 +176,7 @@ static const struct file_operations g_sps30fops =
   NULL,           /* seek */
   sps30_ioctl,    /* ioctl */
   NULL,           /* truncate */
+  NULL,           /* mmap */
   NULL            /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , sps30_unlink /* unlink */
diff --git a/drivers/sensors/usensor.c b/drivers/sensors/usensor.c
index 08fd9f791f..e0d1dda2a5 100644
--- a/drivers/sensors/usensor.c
+++ b/drivers/sensors/usensor.c
@@ -82,6 +82,7 @@ static const struct file_operations g_usensor_fops =
   NULL,          /* seek  */
   usensor_ioctl, /* ioctl */
   NULL,          /* truncate */
+  NULL,          /* mmap */
   NULL,          /* poll  */
 };
 
diff --git a/drivers/serial/pty.c b/drivers/serial/pty.c
index 39a182cdd7..c06cb6fd26 100644
--- a/drivers/serial/pty.c
+++ b/drivers/serial/pty.c
@@ -128,6 +128,7 @@ static const struct file_operations g_pty_fops =
   NULL,          /* seek */
   pty_ioctl,     /* ioctl */
   NULL,          /* truncate */
+  NULL,          /* mmap */
   pty_poll       /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , pty_unlink   /* unlink */
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index ed7299b8aa..48c8dc069a 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -127,6 +127,7 @@ static const struct file_operations g_serialops =
   NULL,       /* seek */
   uart_ioctl, /* ioctl */
   NULL,       /* truncate */
+  NULL,       /* mmap */
   uart_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL      /* unlink */
diff --git a/drivers/serial/uart_bth4.c b/drivers/serial/uart_bth4.c
index e01a27331f..08421df006 100644
--- a/drivers/serial/uart_bth4.c
+++ b/drivers/serial/uart_bth4.c
@@ -91,6 +91,7 @@ static const struct file_operations g_uart_bth4_ops =
   NULL,             /* seek */
   uart_bth4_ioctl,  /* ioctl */
   NULL,             /* truncate */
+  NULL,             /* mmap */
   uart_bth4_poll    /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL            /* unlink */
diff --git a/drivers/spi/spi_driver.c b/drivers/spi/spi_driver.c
index ae3a09726d..583344d72d 100644
--- a/drivers/spi/spi_driver.c
+++ b/drivers/spi/spi_driver.c
@@ -100,6 +100,7 @@ static const struct file_operations spidrvr_fops =
   NULL,            /* seek */
   spidrvr_ioctl,   /* ioctl */
   NULL,            /* truncate */
+  NULL,            /* mmap */
   NULL             /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , spidrvr_unlink /* unlink */
diff --git a/drivers/spi/spi_slave_driver.c b/drivers/spi/spi_slave_driver.c
index 54b4f5ac20..c2eaff7672 100644
--- a/drivers/spi/spi_slave_driver.c
+++ b/drivers/spi/spi_slave_driver.c
@@ -128,6 +128,7 @@ static const struct file_operations g_spislavefops =
   NULL,                         /* seek */
   NULL,                         /* ioctl */
   NULL,                         /* truncate */
+  NULL,                         /* mmap */
   NULL                          /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , spi_slave_unlink            /* unlink */
diff --git a/drivers/syslog/ramlog.c b/drivers/syslog/ramlog.c
index a47c734742..5019cf231f 100644
--- a/drivers/syslog/ramlog.c
+++ b/drivers/syslog/ramlog.c
@@ -115,6 +115,7 @@ static const struct file_operations g_ramlogfops =
   NULL,              /* seek */
   ramlog_file_ioctl, /* ioctl */
   NULL,              /* truncate */
+  NULL,              /* mmap */
   ramlog_file_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL             /* unlink */
diff --git a/drivers/timers/rtc.c b/drivers/timers/rtc.c
index c0055c12f0..b77405bd1a 100644
--- a/drivers/timers/rtc.c
+++ b/drivers/timers/rtc.c
@@ -130,6 +130,7 @@ static const struct file_operations rtc_fops =
   NULL,          /* seek */
   rtc_ioctl,     /* ioctl */
   NULL,          /* truncate */
+  NULL,          /* mmap */
   NULL           /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , rtc_unlink   /* unlink */
diff --git a/drivers/usbdev/adb.c b/drivers/usbdev/adb.c
index 3fdf8f082b..42ec3d5a2e 100755
--- a/drivers/usbdev/adb.c
+++ b/drivers/usbdev/adb.c
@@ -255,6 +255,7 @@ static const struct file_operations g_adb_fops =
   NULL,           /* seek */
   NULL,           /* ioctl */
   NULL,           /* truncate */
+  NULL,           /* mmap */
   adb_char_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL          /* unlink */
diff --git a/drivers/usbhost/usbhost_cdcmbim.c b/drivers/usbhost/usbhost_cdcmbim.c
index c4f7540edb..fb63be6588 100644
--- a/drivers/usbhost/usbhost_cdcmbim.c
+++ b/drivers/usbhost/usbhost_cdcmbim.c
@@ -348,6 +348,7 @@ static const struct file_operations cdcwdm_fops =
   NULL,          /* seek */
   NULL,          /* ioctl */
   NULL,          /* truncate */
+  NULL,          /* mmap */
   cdcwdm_poll    /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
diff --git a/drivers/usbhost/usbhost_hidkbd.c b/drivers/usbhost/usbhost_hidkbd.c
index be1f8e3ce5..53690b986b 100644
--- a/drivers/usbhost/usbhost_hidkbd.c
+++ b/drivers/usbhost/usbhost_hidkbd.c
@@ -342,6 +342,7 @@ static const struct file_operations g_hidkbd_fops =
   NULL,                     /* seek */
   NULL,                     /* ioctl */
   NULL,                     /* truncate */
+  NULL,                     /* mmap */
   usbhost_poll              /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL                    /* unlink */
diff --git a/drivers/usbhost/usbhost_hidmouse.c b/drivers/usbhost/usbhost_hidmouse.c
index c44574fc21..a7b430e846 100644
--- a/drivers/usbhost/usbhost_hidmouse.c
+++ b/drivers/usbhost/usbhost_hidmouse.c
@@ -392,6 +392,7 @@ static const struct file_operations g_hidmouse_fops =
   NULL,                    /* seek */
   NULL,                    /* ioctl */
   NULL,                    /* truncate */
+  NULL,                    /* mmap */
   usbhost_poll             /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL                   /* unlink */
diff --git a/drivers/usbhost/usbhost_xboxcontroller.c b/drivers/usbhost/usbhost_xboxcontroller.c
index 0531f38f39..0a467f58fd 100644
--- a/drivers/usbhost/usbhost_xboxcontroller.c
+++ b/drivers/usbhost/usbhost_xboxcontroller.c
@@ -297,6 +297,7 @@ static const struct file_operations g_xboxcontroller_fops =
   NULL,                     /* seek */
   usbhost_ioctl,            /* ioctl */
   NULL,                     /* truncate */
+  NULL,                     /* mmap */
   usbhost_poll              /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL                    /* unlink */
diff --git a/drivers/usbmisc/fusb301.c b/drivers/usbmisc/fusb301.c
index 565a9ae8d6..a64d77d3d6 100644
--- a/drivers/usbmisc/fusb301.c
+++ b/drivers/usbmisc/fusb301.c
@@ -95,6 +95,7 @@ static const struct file_operations g_fusb301ops =
   NULL,          /* seek */
   fusb301_ioctl, /* ioctl */
   NULL,          /* truncate */
+  NULL,          /* mmap */
   fusb301_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
diff --git a/drivers/usbmisc/fusb303.c b/drivers/usbmisc/fusb303.c
index 19bb9ae710..d64b5055c3 100644
--- a/drivers/usbmisc/fusb303.c
+++ b/drivers/usbmisc/fusb303.c
@@ -129,6 +129,7 @@ static const struct file_operations g_fusb303ops =
   NULL,          /* seek */
   fusb303_ioctl, /* ioctl */
   NULL,          /* truncate */
+  NULL,          /* mmap */
   fusb303_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
diff --git a/drivers/usrsock/usrsock_dev.c b/drivers/usrsock/usrsock_dev.c
index 30d46b58cc..9bf410a24c 100644
--- a/drivers/usrsock/usrsock_dev.c
+++ b/drivers/usrsock/usrsock_dev.c
@@ -104,6 +104,7 @@ static const struct file_operations g_usrsockdevops =
   usrsockdev_seek,    /* seek */
   NULL,               /* ioctl */
   NULL,               /* truncate */
+  NULL,               /* mmap */
   usrsockdev_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL              /* unlink */
diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index b401599432..6edc13dc17 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -39,6 +39,7 @@
 #include <nuttx/fs/fs.h>
 #include <nuttx/fs/ioctl.h>
 #include <nuttx/video/fb.h>
+#include <nuttx/mm/map.h>
 
 /****************************************************************************
  * Private Types
@@ -70,6 +71,8 @@ static ssize_t fb_write(FAR struct file *filep, FAR const char *buffer,
                         size_t buflen);
 static off_t   fb_seek(FAR struct file *filep, off_t offset, int whence);
 static int     fb_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
+static int     fb_mmap(FAR struct file *filep,
+                       FAR struct mm_map_entry_s *map);
 static int     fb_poll(FAR struct file *filep, FAR struct pollfd *fds,
                        bool setup);
 
@@ -86,6 +89,7 @@ static const struct file_operations fb_fops =
   fb_seek,       /* seek */
   fb_ioctl,      /* ioctl */
   NULL,          /* truncate */
+  fb_mmap,       /* mmap */
   fb_poll        /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
@@ -282,18 +286,6 @@ static int fb_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
 
   switch (cmd)
     {
-      case FIOC_MMAP:  /* Get color plane info */
-        {
-          FAR void **ppv = (FAR void **)((uintptr_t)arg);
-
-          /* Return the address corresponding to the start of frame buffer. */
-
-          DEBUGASSERT(ppv != NULL);
-          *ppv = fb->fbmem;
-          ret = OK;
-        }
-        break;
-
       case FBIOGET_VIDEOINFO:  /* Get color plane info */
         {
           FAR struct fb_videoinfo_s *vinfo =
@@ -683,6 +675,29 @@ static int fb_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
   return ret;
 }
 
+static int fb_mmap(FAR struct file *filep, FAR struct mm_map_entry_s *map)
+{
+  FAR struct inode *inode;
+  FAR struct fb_chardev_s *fb;
+  int ret = -EINVAL;
+
+  /* Get the framebuffer instance */
+
+  DEBUGASSERT(filep != NULL && filep->f_inode != NULL);
+  inode = filep->f_inode;
+  fb    = (FAR struct fb_chardev_s *)inode->i_private;
+
+  /* Return the address corresponding to the start of frame buffer. */
+
+  if (map->offset + map->length <= fb->fblen)
+    {
+      map->vaddr = (FAR char *)fb->fbmem + map->offset;
+      ret = OK;
+    }
+
+  return ret;
+}
+
 /****************************************************************************
  * Name: fb_poll
  *
diff --git a/drivers/video/video.c b/drivers/video/video.c
index 94f894aa10..f6d07e9998 100644
--- a/drivers/video/video.c
+++ b/drivers/video/video.c
@@ -38,6 +38,7 @@
 
 #include <nuttx/video/imgsensor.h>
 #include <nuttx/video/imgdata.h>
+#include <nuttx/mm/map.h>
 
 #include "video_framebuff.h"
 
@@ -197,6 +198,8 @@ static ssize_t video_read(FAR struct file *filep,
 static ssize_t video_write(FAR struct file *filep,
                            FAR const char *buffer, size_t buflen);
 static int video_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
+static int video_mmap(FAR struct file *filep,
+                      FAR struct mm_map_entry_s *map);
 
 /* Common function */
 
@@ -285,6 +288,7 @@ static const struct file_operations g_video_fops =
   NULL,                     /* seek */
   video_ioctl,              /* ioctl */
   NULL,                     /* truncate */
+  video_mmap,               /* mmap */
   NULL                      /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL                    /* unlink */
@@ -3185,13 +3189,6 @@ static int video_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
                 (FAR struct v4s_ext_controls_scene *)arg);
         break;
 
-      case FIOC_MMAP:
-        DEBUGASSERT((FAR void **)(uintptr_t)arg != NULL);
-        *(FAR void **)((uintptr_t)arg) = priv->video_inf.bufheap;
-        ret = OK;
-
-        break;
-
       default:
         verr("Unrecognized cmd: %d\n", cmd);
         ret = - ENOTTY;
@@ -3201,6 +3198,21 @@ static int video_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
   return ret;
 }
 
+static int video_mmap(FAR struct file *filep, FAR struct mm_map_entry_s *map)
+{
+  FAR struct inode *inode = filep->f_inode;
+  FAR video_mng_t  *priv  = (FAR video_mng_t *)inode->i_private;
+  int ret = -EINVAL;
+
+  if (map)
+    {
+      map->vaddr = priv->video_inf.bufheap + map->offset;
+      ret = OK;
+    }
+
+  return ret;
+}
+
 static FAR void *video_register(FAR const char *devpath)
 {
   FAR video_mng_t *priv;
diff --git a/drivers/wireless/cc1101.c b/drivers/wireless/cc1101.c
index 9b0633c77c..496f9b4dd1 100644
--- a/drivers/wireless/cc1101.c
+++ b/drivers/wireless/cc1101.c
@@ -306,6 +306,7 @@ static const struct file_operations g_cc1101ops =
   NULL,              /* seek */
   NULL,              /* ioctl */
   NULL,              /* truncate */
+  NULL,              /* mmap */
   cc1101_file_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL             /* unlink */
diff --git a/drivers/wireless/gs2200m.c b/drivers/wireless/gs2200m.c
index 25c3400e73..8c1dc3647d 100644
--- a/drivers/wireless/gs2200m.c
+++ b/drivers/wireless/gs2200m.c
@@ -232,6 +232,7 @@ static const struct file_operations g_gs2200m_fops =
   NULL,          /* seek */
   gs2200m_ioctl, /* ioctl */
   NULL,          /* truncate */
+  NULL,          /* mmap */
   gs2200m_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
diff --git a/drivers/wireless/lpwan/sx127x/sx127x.c b/drivers/wireless/lpwan/sx127x/sx127x.c
index 8f00f4e486..8c2f898c47 100644
--- a/drivers/wireless/lpwan/sx127x/sx127x.c
+++ b/drivers/wireless/lpwan/sx127x/sx127x.c
@@ -452,6 +452,7 @@ static const struct file_operations sx127x_fops =
   NULL,           /* seek */
   sx127x_ioctl,   /* ioctl */
   NULL,           /* truncate */
+  NULL,           /* mmap */
   sx127x_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL          /* unlink */
diff --git a/drivers/wireless/nrf24l01.c b/drivers/wireless/nrf24l01.c
index 383ca7e658..44973dae65 100644
--- a/drivers/wireless/nrf24l01.c
+++ b/drivers/wireless/nrf24l01.c
@@ -240,6 +240,7 @@ static const struct file_operations nrf24l01_fops =
   NULL,             /* seek */
   nrf24l01_ioctl,   /* ioctl */
   NULL,             /* truncate */
+  NULL,             /* mmap */
   nrf24l01_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL            /* unlink */
diff --git a/fs/binfs/fs_binfs.c b/fs/binfs/fs_binfs.c
index abb8647c86..758d8c31f7 100644
--- a/fs/binfs/fs_binfs.c
+++ b/fs/binfs/fs_binfs.c
@@ -110,6 +110,7 @@ const struct mountpt_operations binfs_operations =
   NULL,              /* seek */
   binfs_ioctl,       /* ioctl */
   NULL,              /* truncate */
+  NULL,              /* mmap */
 
   NULL,              /* sync */
   binfs_dup,         /* dup */
diff --git a/fs/cromfs/fs_cromfs.c b/fs/cromfs/fs_cromfs.c
index 84f8184d69..c80584871b 100644
--- a/fs/cromfs/fs_cromfs.c
+++ b/fs/cromfs/fs_cromfs.c
@@ -185,6 +185,7 @@ const struct mountpt_operations cromfs_operations =
   NULL,              /* seek */
   cromfs_ioctl,      /* ioctl */
   NULL,              /* truncate */
+  NULL,              /* mmap */
 
   NULL,              /* sync */
   cromfs_dup,        /* dup */
diff --git a/fs/fat/fs_fat32.c b/fs/fat/fs_fat32.c
index aef7d5856b..5086868e18 100644
--- a/fs/fat/fs_fat32.c
+++ b/fs/fat/fs_fat32.c
@@ -116,6 +116,7 @@ const struct mountpt_operations fat_operations =
   fat_seek,          /* seek */
   fat_ioctl,         /* ioctl */
   fat_truncate,      /* truncate */
+  NULL,              /* mmap */
   fat_sync,          /* sync */
   fat_dup,           /* dup */
   fat_fstat,         /* fstat */
diff --git a/fs/hostfs/hostfs.c b/fs/hostfs/hostfs.c
index de380b2f35..1bb795fe54 100644
--- a/fs/hostfs/hostfs.c
+++ b/fs/hostfs/hostfs.c
@@ -143,6 +143,7 @@ const struct mountpt_operations hostfs_operations =
   hostfs_seek,          /* seek */
   hostfs_ioctl,         /* ioctl */
   hostfs_ftruncate,     /* ftruncate */
+  NULL,                 /* mmap */
 
   hostfs_sync,          /* sync */
   hostfs_dup,           /* dup */
diff --git a/fs/littlefs/lfs_vfs.c b/fs/littlefs/lfs_vfs.c
index 9022c0c76c..22b55e5048 100644
--- a/fs/littlefs/lfs_vfs.c
+++ b/fs/littlefs/lfs_vfs.c
@@ -141,6 +141,7 @@ const struct mountpt_operations littlefs_operations =
   littlefs_seek,          /* seek */
   littlefs_ioctl,         /* ioctl */
   littlefs_truncate,      /* truncate */
+  NULL,                   /* mmap */
 
   littlefs_sync,          /* sync */
   littlefs_dup,           /* dup */
diff --git a/fs/mmap/README.txt b/fs/mmap/README.txt
index 4f6ba6c317..59cecd0569 100644
--- a/fs/mmap/README.txt
+++ b/fs/mmap/README.txt
@@ -14,7 +14,7 @@ conditions where mmap() can be supported:
 1. mmap can be used to support eXecute In Place (XIP) on random access media
    under the following very restrictive conditions:
 
-   a. The filesystem supports the FIOC_MMAP ioctl command.  Any file
+   a. The filesystem implements the mmap file operation.  Any file
       system that maps files contiguously on the media should support
       this ioctl. (vs. file system that scatter files over the media
       in non-contiguous sectors).  As of this writing, ROMFS is the
diff --git a/fs/mmap/fs_mmap.c b/fs/mmap/fs_mmap.c
index c99da4c2c0..5717ed1cd9 100644
--- a/fs/mmap/fs_mmap.c
+++ b/fs/mmap/fs_mmap.c
@@ -23,6 +23,7 @@
  ****************************************************************************/
 
 #include <nuttx/config.h>
+#include <nuttx/mm/map.h>
 
 #include <sys/types.h>
 #include <sys/mman.h>
@@ -49,7 +50,6 @@ static int file_mmap_(FAR struct file *filep, FAR void *start,
                       size_t length, int prot, int flags,
                       off_t offset, bool kernel, FAR void **mapped)
 {
-  FAR void *addr;
   int ret;
 
   /* Since only a tiny subset of mmap() functionality, we have to verify many
@@ -135,14 +135,33 @@ static int file_mmap_(FAR struct file *filep, FAR void *start,
 #endif
     }
 
-  /* Perform the ioctl to get the base address of the file in 'mapped'
-   * in memory. (casting to uintptr_t first eliminates complaints on some
-   * architectures where the sizeof long is different from the size of
-   * a pointer).
+  /* Call driver's mmap to get the base address of the file in 'mapped'
+   * in memory.
    */
 
-  ret = file_ioctl(filep, FIOC_MMAP, (unsigned long)((uintptr_t)&addr));
-  if (ret < 0)
+  if (filep->f_inode && filep->f_inode->u.i_ops->mmap != NULL)
+    {
+      /* Pass the information about the mapping in mm_map_entry_s structure.
+       * The driver may alter the structure, and if it supports unmap, it
+       * will also add it to the kernel maintained list of mappings.
+       */
+
+      struct mm_map_entry_s map =
+        {
+         NULL, /* sq_entry_t */
+         start, length, offset,
+         prot, flags,
+         NULL, /* priv */
+         NULL  /* munmap */
+        };
+
+      ret = filep->f_inode->u.i_ops->mmap(filep, &map);
+      if (ret == OK)
+        {
+          *mapped = (void *)map.vaddr;
+        }
+    }
+  else
     {
       /* Not directly mappable, probably because the underlying media does
        * not support random access.
@@ -155,15 +174,14 @@ static int file_mmap_(FAR struct file *filep, FAR void *start,
 
       return rammap(filep, length, offset, kernel, mapped);
 #else
-      ferr("ERROR: file_ioctl(FIOC_MMAP) failed: %d\n", ret);
-      return ret;
+      ferr("ERROR: mmap not supported \n");
+      return -ENOSYS;
 #endif
     }
 
-  /* Return the offset address */
+  /* Return */
 
-  *mapped = (FAR void *)(((FAR uint8_t *)addr) + offset);
-  return OK;
+  return ret;
 }
 
 /****************************************************************************
@@ -197,7 +215,7 @@ int file_mmap(FAR struct file *filep, FAR void *start, size_t length,
  *   1. mmap() is the API that is used to support direct access to random
  *     access media under the following very restrictive conditions:
  *
- *     a. The filesystem supports the FIOC_MMAP ioctl command.  Any file
+ *     a. The filesystem implements the mmap file operation.  Any file
  *        system that maps files contiguously on the media should support
  *        this ioctl. (vs. file system that scatter files over the media
  *        in non-contiguous sectors).  As of this writing, ROMFS is the
diff --git a/fs/mmap/fs_munmap.c b/fs/mmap/fs_munmap.c
index 2bcef5de3a..7b8e57d492 100644
--- a/fs/mmap/fs_munmap.c
+++ b/fs/mmap/fs_munmap.c
@@ -196,7 +196,7 @@ int file_munmap(FAR void *start, size_t length)
  *   1. mmap() is the API that is used to support direct access to random
  *     access media under the following very restrictive conditions:
  *
- *     a. The filesystem supports the FIOC_MMAP ioctl command.  Any file
+ *     a. The filesystem impelements the mmap file operation.  Any file
  *        system that maps files contiguously on the media should support
  *        this ioctl. (vs. file system that scatter files over the media
  *        in non-contiguous sectors).  As of this writing, ROMFS is the
diff --git a/fs/mqueue/mq_open.c b/fs/mqueue/mq_open.c
index 74c78e82f3..d6c9647bcf 100644
--- a/fs/mqueue/mq_open.c
+++ b/fs/mqueue/mq_open.c
@@ -61,6 +61,7 @@ static const struct file_operations g_nxmq_fileops =
   NULL,             /* seek */
   NULL,             /* ioctl */
   NULL,             /* truncate */
+  NULL,             /* mmap */
   nxmq_file_poll    /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL            /* unlink */
diff --git a/fs/nfs/nfs_vfsops.c b/fs/nfs/nfs_vfsops.c
index e75aac5d41..7eae707be2 100644
--- a/fs/nfs/nfs_vfsops.c
+++ b/fs/nfs/nfs_vfsops.c
@@ -199,6 +199,7 @@ const struct mountpt_operations nfs_operations =
   NULL,                         /* seek */
   NULL,                         /* ioctl */
   nfs_truncate,                 /* truncate */
+  NULL,                         /* mmap */
 
   NULL,                         /* sync */
   nfs_dup,                      /* dup */
diff --git a/fs/nxffs/nxffs_initialize.c b/fs/nxffs/nxffs_initialize.c
index 01964038f8..9b7e124a54 100644
--- a/fs/nxffs/nxffs_initialize.c
+++ b/fs/nxffs/nxffs_initialize.c
@@ -59,6 +59,7 @@ const struct mountpt_operations nxffs_operations =
 #else
   NULL,              /* truncate */
 #endif
+  NULL,              /* mmap */
 
   NULL,              /* sync -- No buffered data */
   nxffs_dup,         /* dup */
diff --git a/fs/procfs/fs_procfs.c b/fs/procfs/fs_procfs.c
index ee5276d00c..7b446cc12e 100644
--- a/fs/procfs/fs_procfs.c
+++ b/fs/procfs/fs_procfs.c
@@ -253,6 +253,7 @@ const struct mountpt_operations procfs_operations =
   NULL,              /* seek */
   procfs_ioctl,      /* ioctl */
   NULL,              /* truncate */
+  NULL,              /* mmap */
 
   NULL,              /* sync */
   procfs_dup,        /* dup */
diff --git a/fs/romfs/fs_romfs.c b/fs/romfs/fs_romfs.c
index 91fceacf8d..6d45fc48f6 100644
--- a/fs/romfs/fs_romfs.c
+++ b/fs/romfs/fs_romfs.c
@@ -73,6 +73,8 @@ static ssize_t romfs_read(FAR struct file *filep, FAR char *buffer,
 static off_t   romfs_seek(FAR struct file *filep, off_t offset, int whence);
 static int     romfs_ioctl(FAR struct file *filep, int cmd,
                            unsigned long arg);
+static int     romfs_mmap(FAR struct file *filep,
+                          FAR struct mm_map_entry_s *map);
 
 static int     romfs_dup(FAR const struct file *oldp,
                          FAR struct file *newp);
@@ -120,12 +122,12 @@ const struct mountpt_operations romfs_operations =
   romfs_seek,      /* seek */
   romfs_ioctl,     /* ioctl */
   NULL,            /* truncate */
+  romfs_mmap,      /* mmap */
 
   NULL,            /* sync */
   romfs_dup,       /* dup */
   romfs_fstat,     /* fstat */
   NULL,            /* fchstat */
-  NULL,            /* truncate */
 
   romfs_opendir,   /* opendir */
   romfs_closedir,  /* closedir */
@@ -578,9 +580,7 @@ errout_with_lock:
 
 static int romfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
 {
-  FAR struct romfs_mountpt_s *rm;
   FAR struct romfs_file_s    *rf;
-  FAR void                  **ppv = (FAR void**)arg;
 
   finfo("cmd: %d arg: %08lx\n", cmd, arg);
 
@@ -591,22 +591,10 @@ static int romfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
   /* Recover our private data from the struct file instance */
 
   rf = filep->f_priv;
-  rm = filep->f_inode->i_private;
-
-  DEBUGASSERT(rm != NULL);
 
   /* Only one ioctl command is supported */
 
-  if (cmd == FIOC_MMAP && rm->rm_xipbase && ppv)
-    {
-      /* Return the address on the media corresponding to the start of
-       * the file.
-       */
-
-      *ppv = rm->rm_xipbase + rf->rf_startoffset;
-      return OK;
-    }
-  else if (cmd == FIOC_FILEPATH)
+  if (cmd == FIOC_FILEPATH)
     {
       FAR char *ptr = (FAR char *)((uintptr_t)arg);
       inode_getpath(filep->f_inode, ptr);
@@ -618,6 +606,35 @@ static int romfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
   return -ENOTTY;
 }
 
+static int romfs_mmap(FAR struct file *filep, FAR struct mm_map_entry_s *map)
+{
+  FAR struct romfs_mountpt_s *rm;
+  FAR struct romfs_file_s *rf;
+  int ret = -EINVAL;
+
+  /* Sanity checks */
+
+  DEBUGASSERT(filep->f_priv != NULL && filep->f_inode != NULL);
+
+  /* Recover our private data from the struct file instance */
+
+  rf = filep->f_priv;
+  rm = filep->f_inode->i_private;
+
+  /* Return the address on the media corresponding to the start of
+   * the file.
+   */
+
+  if (map && rm && rm->rm_xipbase && rf &&
+      map->offset + map->length <= rf->rf_size)
+    {
+      map->vaddr = rm->rm_xipbase + rf->rf_startoffset + map->offset;
+      ret = OK;
+    }
+
+  return ret;
+}
+
 /****************************************************************************
  * Name: romfs_dup
  ****************************************************************************/
diff --git a/fs/rpmsgfs/rpmsgfs.c b/fs/rpmsgfs/rpmsgfs.c
index c35984098f..b56f5662bd 100644
--- a/fs/rpmsgfs/rpmsgfs.c
+++ b/fs/rpmsgfs/rpmsgfs.c
@@ -162,6 +162,7 @@ const struct mountpt_operations rpmsgfs_operations =
   rpmsgfs_seek,          /* seek */
   rpmsgfs_ioctl,         /* ioctl */
   rpmsgfs_ftruncate,     /* ftruncate */
+  NULL,                  /* mmap */
 
   rpmsgfs_sync,          /* sync */
   rpmsgfs_dup,           /* dup */
diff --git a/fs/smartfs/smartfs_smart.c b/fs/smartfs/smartfs_smart.c
index f5735cea05..93486cedf7 100644
--- a/fs/smartfs/smartfs_smart.c
+++ b/fs/smartfs/smartfs_smart.c
@@ -141,6 +141,7 @@ const struct mountpt_operations smartfs_operations =
   smartfs_seek,          /* seek */
   smartfs_ioctl,         /* ioctl */
   smartfs_truncate,      /* truncate */
+  NULL,                  /* mmap */
 
   smartfs_sync,          /* sync */
   smartfs_dup,           /* dup */
diff --git a/fs/socket/socket.c b/fs/socket/socket.c
index f18bc48963..30c5716b76 100644
--- a/fs/socket/socket.c
+++ b/fs/socket/socket.c
@@ -65,6 +65,7 @@ static const struct file_operations g_sock_fileops =
   NULL,             /* seek */
   sock_file_ioctl,  /* ioctl */
   NULL,             /* truncate */
+  NULL,             /* mmap */
   sock_file_poll    /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL            /* unlink */
diff --git a/fs/spiffs/src/spiffs_vfs.c b/fs/spiffs/src/spiffs_vfs.c
index 011f1e53db..b3c9b77fbd 100644
--- a/fs/spiffs/src/spiffs_vfs.c
+++ b/fs/spiffs/src/spiffs_vfs.c
@@ -142,6 +142,7 @@ const struct mountpt_operations spiffs_operations =
   spiffs_seek,       /* seek */
   spiffs_ioctl,      /* ioctl */
   spiffs_truncate,   /* truncate */
+  NULL,              /* mmap */
 
   spiffs_sync,       /* sync */
   spiffs_dup,        /* dup */
diff --git a/fs/tmpfs/fs_tmpfs.c b/fs/tmpfs/fs_tmpfs.c
index 4c92eb04a8..7db062e62a 100644
--- a/fs/tmpfs/fs_tmpfs.c
+++ b/fs/tmpfs/fs_tmpfs.c
@@ -134,11 +134,12 @@ static ssize_t tmpfs_read(FAR struct file *filep, FAR char *buffer,
 static ssize_t tmpfs_write(FAR struct file *filep, FAR const char *buffer,
               size_t buflen);
 static off_t tmpfs_seek(FAR struct file *filep, off_t offset, int whence);
-static int  tmpfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
 static int  tmpfs_sync(FAR struct file *filep);
 static int  tmpfs_dup(FAR const struct file *oldp, FAR struct file *newp);
 static int  tmpfs_fstat(FAR const struct file *filep, FAR struct stat *buf);
 static int  tmpfs_truncate(FAR struct file *filep, off_t length);
+static int  tmpfs_mmap(FAR struct file *filep,
+                       FAR struct mm_map_entry_s *map);
 
 static int  tmpfs_opendir(FAR struct inode *mountpt, FAR const char *relpath,
               FAR struct fs_dirent_s **dir);
@@ -176,8 +177,9 @@ const struct mountpt_operations tmpfs_operations =
   tmpfs_read,       /* read */
   tmpfs_write,      /* write */
   tmpfs_seek,       /* seek */
-  tmpfs_ioctl,      /* ioctl */
+  NULL,             /* ioctl */
   tmpfs_truncate,   /* truncate */
+  tmpfs_mmap,       /* mmap */
 
   tmpfs_sync,       /* sync */
   tmpfs_dup,        /* dup */
@@ -1640,16 +1642,11 @@ static off_t tmpfs_seek(FAR struct file *filep, off_t offset, int whence)
   return position;
 }
 
-/****************************************************************************
- * Name: tmpfs_ioctl
- ****************************************************************************/
-
-static int tmpfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
+static int tmpfs_mmap(FAR struct file *filep, FAR struct mm_map_entry_s *map)
 {
   FAR struct tmpfs_file_s *tfo;
-  FAR void **ppv = (FAR void**)arg;
+  int ret = -EINVAL;
 
-  finfo("filep: %p cmd: %d arg: %08lx\n", filep, cmd, arg);
   DEBUGASSERT(filep->f_priv != NULL && filep->f_inode != NULL);
 
   /* Recover our private data from the struct file instance */
@@ -1658,20 +1655,13 @@ static int tmpfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
 
   DEBUGASSERT(tfo != NULL);
 
-  /* Only one ioctl command is supported */
-
-  if (cmd == FIOC_MMAP && ppv != NULL)
+  if (map && map->offset + map->length <= tfo->tfo_size)
     {
-      /* Return the address on the media corresponding to the start of
-       * the file.
-       */
-
-      *ppv = (FAR void *)tfo->tfo_data;
-      return OK;
+      map->vaddr = tfo->tfo_data + map->offset;
+      ret = OK;
     }
 
-  ferr("ERROR: Invalid cmd: %d\n", cmd);
-  return -ENOTTY;
+  return ret;
 }
 
 /****************************************************************************
diff --git a/fs/unionfs/fs_unionfs.c b/fs/unionfs/fs_unionfs.c
index 50b2f5ad26..6aa10c83f2 100644
--- a/fs/unionfs/fs_unionfs.c
+++ b/fs/unionfs/fs_unionfs.c
@@ -223,6 +223,7 @@ const struct mountpt_operations unionfs_operations =
   unionfs_seek,        /* seek */
   unionfs_ioctl,       /* ioctl */
   unionfs_truncate,    /* truncate */
+  NULL,                /* mmap */
 
   unionfs_sync,        /* sync */
   unionfs_dup,         /* dup */
diff --git a/fs/userfs/fs_userfs.c b/fs/userfs/fs_userfs.c
index 303a8571af..fad5276b98 100644
--- a/fs/userfs/fs_userfs.c
+++ b/fs/userfs/fs_userfs.c
@@ -161,6 +161,7 @@ const struct mountpt_operations userfs_operations =
   userfs_seek,       /* seek */
   userfs_ioctl,      /* ioctl */
   userfs_truncate,   /* truncate */
+  NULL,              /* mmap */
 
   userfs_sync,       /* sync */
   userfs_dup,        /* dup */
diff --git a/fs/vfs/fs_epoll.c b/fs/vfs/fs_epoll.c
index c642333b20..18450c2798 100644
--- a/fs/vfs/fs_epoll.c
+++ b/fs/vfs/fs_epoll.c
@@ -105,6 +105,7 @@ static const struct file_operations g_epoll_ops =
   NULL,             /* seek */
   NULL,             /* ioctl */
   NULL,             /* truncate */
+  NULL,             /* mmap */
   epoll_do_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL            /* unlink */
diff --git a/fs/vfs/fs_eventfd.c b/fs/vfs/fs_eventfd.c
index 78610a5de7..4b2769d900 100644
--- a/fs/vfs/fs_eventfd.c
+++ b/fs/vfs/fs_eventfd.c
@@ -101,6 +101,7 @@ static const struct file_operations g_eventfd_fops =
   NULL,             /* seek */
   NULL,             /* ioctl */
   NULL,             /* truncate */
+  NULL,             /* mmap */
 #ifdef CONFIG_EVENT_FD_POLL
   eventfd_do_poll   /* poll */
 #else
diff --git a/fs/vfs/fs_signalfd.c b/fs/vfs/fs_signalfd.c
index 6ffa8b1671..8c26ba8481 100644
--- a/fs/vfs/fs_signalfd.c
+++ b/fs/vfs/fs_signalfd.c
@@ -80,6 +80,7 @@ static const struct file_operations g_signalfd_fileops =
   NULL,                 /* seek */
   NULL,                 /* ioctl */
   NULL,                 /* truncate */
+  NULL,                 /* mmap */
   signalfd_file_poll    /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL                /* unlink */
diff --git a/graphics/nxterm/nxterm_driver.c b/graphics/nxterm/nxterm_driver.c
index 594dc97519..7fd79f7bc2 100644
--- a/graphics/nxterm/nxterm_driver.c
+++ b/graphics/nxterm/nxterm_driver.c
@@ -67,6 +67,7 @@ const struct file_operations g_nxterm_drvrops =
   NULL,           /* seek */
   nxterm_ioctl,   /* ioctl */
   NULL,           /* truncate */
+  NULL,           /* mmap */
   nxterm_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , nxterm_unlink /* unlink */
@@ -84,6 +85,7 @@ const struct file_operations g_nxterm_drvrops =
   NULL,           /* seek */
   nxterm_ioctl,   /* ioctl */
   NULL,           /* truncate */
+  NULL,           /* mmap */
   NULL            /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , nxterm_unlink /* unlink */
diff --git a/include/nuttx/fs/fs.h b/include/nuttx/fs/fs.h
index cf011428f6..21e31adf03 100644
--- a/include/nuttx/fs/fs.h
+++ b/include/nuttx/fs/fs.h
@@ -37,6 +37,7 @@
 
 #include <nuttx/mutex.h>
 #include <nuttx/semaphore.h>
+#include <nuttx/mm/map.h>
 
 /****************************************************************************
  * Pre-processor Definitions
@@ -213,6 +214,7 @@ struct file_operations
   off_t   (*seek)(FAR struct file *filep, off_t offset, int whence);
   int     (*ioctl)(FAR struct file *filep, int cmd, unsigned long arg);
   int     (*truncate)(FAR struct file *filep, off_t length);
+  int     (*mmap)(FAR struct file *filep, FAR struct mm_map_entry_s *map);
 
   /* The two structures need not be common after this point */
 
@@ -300,6 +302,7 @@ struct mountpt_operations
   off_t   (*seek)(FAR struct file *filep, off_t offset, int whence);
   int     (*ioctl)(FAR struct file *filep, int cmd, unsigned long arg);
   int     (*truncate)(FAR struct file *filep, off_t length);
+  int     (*mmap)(FAR struct file *filep, FAR struct mm_map_entry_s *map);
 
   /* The two structures need not be common after this point. The following
    * are extended methods needed to deal with the unique needs of mounted
diff --git a/include/nuttx/fs/ioctl.h b/include/nuttx/fs/ioctl.h
index f356002eff..a231e85f82 100644
--- a/include/nuttx/fs/ioctl.h
+++ b/include/nuttx/fs/ioctl.h
@@ -134,55 +134,50 @@
 #define _FIOCVALID(c)   (_IOC_TYPE(c)==_FIOCBASE)
 #define _FIOC(nr)       _IOC(_FIOCBASE,nr)
 
-#define FIOC_MMAP       _FIOC(0x0001)     /* IN:  Location to return address (void **)
-                                           * OUT: If media is directly accessible,
-                                           *      return (void*) base address
-                                           *      of file
-                                           */
-#define FIOC_REFORMAT   _FIOC(0x0002)     /* IN:  None
+#define FIOC_REFORMAT   _FIOC(0x0001)     /* IN:  None
                                            * OUT: None
                                            */
-#define FIOC_OPTIMIZE   _FIOC(0x0003)     /* IN:  The number of bytes to recover
+#define FIOC_OPTIMIZE   _FIOC(0x0002)     /* IN:  The number of bytes to recover
                                            *      (ignored on most file systems)
                                            * OUT: None
                                            */
-#define FIOC_FILEPATH   _FIOC(0x0004)     /* IN:  FAR char *(length >= PATH_MAX)
+#define FIOC_FILEPATH   _FIOC(0x0003)     /* IN:  FAR char *(length >= PATH_MAX)
                                            * OUT: The full file path
                                            */
-#define FIOC_INTEGRITY  _FIOC(0x0005)     /* Run a consistency check on the
+#define FIOC_INTEGRITY  _FIOC(0x0004)     /* Run a consistency check on the
                                            *      file system media.
                                            * IN:  None
                                            * OUT: None
                                            */
-#define FIOC_DUMP       _FIOC(0x0006)     /* Dump logical content of media.
+#define FIOC_DUMP       _FIOC(0x0005)     /* Dump logical content of media.
                                            * IN:  None
                                            * OUT: None
                                            */
-#define FIONREAD        _FIOC(0x0007)     /* IN:  Location to return value (int *)
+#define FIONREAD        _FIOC(0x0006)     /* IN:  Location to return value (int *)
                                            * OUT: Bytes readable from this fd
                                            */
-#define FIONWRITE       _FIOC(0x0008)     /* IN:  Location to return value (int *)
+#define FIONWRITE       _FIOC(0x0007)     /* IN:  Location to return value (int *)
                                            * OUT: Number bytes in send queue
                                            */
-#define FIONSPACE       _FIOC(0x0009)     /* IN:  Location to return value (int *)
+#define FIONSPACE       _FIOC(0x0008)     /* IN:  Location to return value (int *)
                                            * OUT: Free space in send queue.
                                            */
-#define FIONUSERFS      _FIOC(0x000a)     /* IN:  Pointer to struct usefs_config_s
+#define FIONUSERFS      _FIOC(0x0009)     /* IN:  Pointer to struct usefs_config_s
                                            *      holding userfs configuration.
                                            * OUT: Instance number is returned on
                                            *      success.
                                            */
-#define FIONBIO         _FIOC(0x000b)     /* IN:  Boolean option takes an
+#define FIONBIO         _FIOC(0x000a)     /* IN:  Boolean option takes an
                                            *      int value.
                                            * OUT: Origin option.
                                            */
-#define FIOCLEX         _FIOC(0x000c)     /* IN:  None
+#define FIOCLEX         _FIOC(0x000b)     /* IN:  None
                                            * OUT: None
                                            */
-#define FIONCLEX        _FIOC(0x000d)     /* IN:  None
+#define FIONCLEX        _FIOC(0x000c)     /* IN:  None
                                            * OUT: None
                                            */
-#define FIOC_NOTIFY     _FIOC(0x000e)     /* IN:  Pointer to struct automount_notify_s
+#define FIOC_NOTIFY     _FIOC(0x000d)     /* IN:  Pointer to struct automount_notify_s
                                            *      holding automount notification
                                            *      configuration
                                            * OUT: None
diff --git a/include/nuttx/mm/map.h b/include/nuttx/mm/map.h
new file mode 100644
index 0000000000..cf1d38f047
--- /dev/null
+++ b/include/nuttx/mm/map.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+ * include/nuttx/mm/map.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __INCLUDE_NUTTX_MM_MAP_H
+#define __INCLUDE_NUTTX_MM_MAP_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/queue.h>
+#include <nuttx/mutex.h>
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+/* A memory mapping list item */
+
+struct mm_map_entry_s
+{
+  FAR struct mm_map_entry *flink;  /* this is used as sq_entry_t */
+  FAR const void *vaddr;
+  size_t length;
+  off_t offset;
+  int prot;
+  int flags;
+  FAR void *priv;
+
+  /* Drivers which register mappings may also
+   * implement the unmap function to undo anything done in mmap.
+   * Nb. Implementation must NOT use "this_task()->group" since
+   * this is not valid during process exit. The argument "group" will be
+   * NULL in this case.
+   */
+
+  int (*munmap)(FAR struct task_group_s *group,
+                FAR struct mm_map_entry_s *map,
+                FAR void *start,
+                size_t length);
+};
+
+/* A structure for the task group */
+
+struct mm_map_s
+{
+  sq_queue_t mm_map_sq;
+  mutex_t mm_map_mutex;
+};
+
+/****************************************************************************
+ * Public Function Prototypes
+ ****************************************************************************/
+
+#endif /* __INCLUDE_NUTTX_MM_MM_MAP_H */


[nuttx] 02/03: Add ftruncate into file operation calls

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 41e9df2f3e7c6d4c5010400dbe8222aebbf1f3da
Author: Jukka Laitinen <ju...@ssrc.tii.ae>
AuthorDate: Thu Dec 22 14:51:59 2022 +0400

    Add ftruncate into file operation calls
    
    - Add truncate into file_operations
    - Move truncate to be common for mountpt_operations and file_operations
    - Modify all drivers to initialize the operations struct accordingly
    
    Signed-off-by: Jukka Laitinen <ju...@ssrc.tii.ae>
---
 arch/arm/src/cxd56xx/cxd56_geofence.c                   |  1 +
 arch/arm/src/cxd56xx/cxd56_gnss.c                       |  1 +
 arch/arm/src/cxd56xx/cxd56_hostif.c                     |  1 +
 arch/arm/src/sama5/sam_tsd.c                            |  1 +
 boards/arm/sam34/sam4l-xplained/src/sam_slcd.c          |  1 +
 boards/arm/stm32/mikroe-stm32f4/src/stm32_touchscreen.c |  1 +
 boards/arm/stm32/stm32ldiscovery/src/stm32_lcd.c        |  1 +
 boards/mips/pic32mx/pic32mx7mmb/src/pic32_touchscreen.c |  1 +
 boards/mips/pic32mx/sure-pic32mx/src/pic32mx_lcd1602.c  |  1 +
 crypto/cryptodev.c                                      |  2 ++
 drivers/analog/adc.c                                    |  1 +
 drivers/analog/comp.c                                   |  1 +
 drivers/bch/bchdev_driver.c                             |  1 +
 drivers/can/can.c                                       |  1 +
 drivers/crypto/dev_urandom.c                            |  1 +
 drivers/i2c/i2c_driver.c                                |  1 +
 drivers/input/ads7843e.c                                |  1 +
 drivers/input/ajoystick.c                               |  1 +
 drivers/input/button_upper.c                            |  1 +
 drivers/input/cypress_mbr3108.c                         |  1 +
 drivers/input/djoystick.c                               |  1 +
 drivers/input/ft5x06.c                                  |  1 +
 drivers/input/keyboard_upper.c                          |  1 +
 drivers/input/max11802.c                                |  1 +
 drivers/input/mxt.c                                     |  1 +
 drivers/input/spq10kbd.c                                |  1 +
 drivers/input/stmpe811_tsc.c                            |  1 +
 drivers/input/touchscreen_upper.c                       |  1 +
 drivers/input/tsc2007.c                                 |  1 +
 drivers/lcd/ft80x.c                                     |  1 +
 drivers/lcd/pcf8574_lcd_backpack.c                      |  1 +
 drivers/lcd/tda19988.c                                  |  1 +
 drivers/misc/dev_null.c                                 |  1 +
 drivers/misc/dev_zero.c                                 |  1 +
 drivers/misc/rpmsgdev.c                                 |  1 +
 drivers/modem/alt1250/alt1250.c                         |  1 +
 drivers/modem/u-blox.c                                  |  1 +
 drivers/mtd/mtd_config.c                                |  1 +
 drivers/mtd/mtd_config_fs.c                             |  1 +
 drivers/net/telnet.c                                    |  2 ++
 drivers/net/tun.c                                       |  1 +
 drivers/pipes/fifo.c                                    |  1 +
 drivers/pipes/pipe.c                                    |  1 +
 drivers/power/battery/battery_charger.c                 |  1 +
 drivers/power/battery/battery_gauge.c                   |  1 +
 drivers/power/battery/battery_monitor.c                 |  1 +
 drivers/rc/lirc_dev.c                                   |  1 +
 drivers/sensors/aht10.c                                 |  1 +
 drivers/sensors/hc_sr04.c                               |  1 +
 drivers/sensors/hdc1008.c                               |  1 +
 drivers/sensors/hts221.c                                |  1 +
 drivers/sensors/lis2dh.c                                |  1 +
 drivers/sensors/max44009.c                              |  1 +
 drivers/sensors/scd30.c                                 |  1 +
 drivers/sensors/scd41.c                                 |  1 +
 drivers/sensors/sensor.c                                |  1 +
 drivers/sensors/sgp30.c                                 |  1 +
 drivers/sensors/sht21.c                                 |  1 +
 drivers/sensors/sht3x.c                                 |  1 +
 drivers/sensors/sps30.c                                 |  1 +
 drivers/sensors/usensor.c                               |  1 +
 drivers/serial/pty.c                                    |  1 +
 drivers/serial/serial.c                                 |  1 +
 drivers/serial/uart_bth4.c                              |  1 +
 drivers/spi/spi_driver.c                                |  1 +
 drivers/spi/spi_slave_driver.c                          |  1 +
 drivers/syslog/ramlog.c                                 |  1 +
 drivers/timers/rtc.c                                    |  1 +
 drivers/usbdev/adb.c                                    |  1 +
 drivers/usbhost/usbhost_cdcmbim.c                       |  1 +
 drivers/usbhost/usbhost_hidkbd.c                        |  1 +
 drivers/usbhost/usbhost_hidmouse.c                      |  1 +
 drivers/usbhost/usbhost_xboxcontroller.c                |  1 +
 drivers/usbmisc/fusb301.c                               |  1 +
 drivers/usbmisc/fusb303.c                               |  1 +
 drivers/usrsock/usrsock_dev.c                           |  1 +
 drivers/video/fb.c                                      |  1 +
 drivers/video/video.c                                   |  1 +
 drivers/wireless/cc1101.c                               |  1 +
 drivers/wireless/gs2200m.c                              |  1 +
 drivers/wireless/lpwan/sx127x/sx127x.c                  |  1 +
 drivers/wireless/nrf24l01.c                             |  1 +
 fs/binfs/fs_binfs.c                                     |  2 +-
 fs/cromfs/fs_cromfs.c                                   |  2 +-
 fs/fat/fs_fat32.c                                       |  3 +--
 fs/hostfs/hostfs.c                                      |  2 +-
 fs/littlefs/lfs_vfs.c                                   |  2 +-
 fs/mqueue/mq_open.c                                     |  1 +
 fs/nfs/nfs_vfsops.c                                     |  2 +-
 fs/nxffs/nxffs_initialize.c                             | 10 +++++-----
 fs/procfs/fs_procfs.c                                   |  2 +-
 fs/romfs/fs_romfs.c                                     |  1 +
 fs/rpmsgfs/rpmsgfs.c                                    |  2 +-
 fs/smartfs/smartfs_smart.c                              |  2 +-
 fs/socket/socket.c                                      |  1 +
 fs/spiffs/src/spiffs_vfs.c                              |  2 +-
 fs/tmpfs/fs_tmpfs.c                                     |  2 +-
 fs/unionfs/fs_unionfs.c                                 |  2 +-
 fs/userfs/fs_userfs.c                                   |  2 +-
 fs/vfs/fs_epoll.c                                       |  1 +
 fs/vfs/fs_eventfd.c                                     |  1 +
 fs/vfs/fs_signalfd.c                                    |  1 +
 fs/vfs/fs_truncate.c                                    | 15 ++++++++++-----
 graphics/nxterm/nxterm_driver.c                         |  2 ++
 include/nuttx/fs/fs.h                                   |  3 ++-
 105 files changed, 122 insertions(+), 25 deletions(-)

diff --git a/arch/arm/src/cxd56xx/cxd56_geofence.c b/arch/arm/src/cxd56xx/cxd56_geofence.c
index f5b5bb7592..0dc32b65cd 100644
--- a/arch/arm/src/cxd56xx/cxd56_geofence.c
+++ b/arch/arm/src/cxd56xx/cxd56_geofence.c
@@ -106,6 +106,7 @@ static const struct file_operations g_geofencefops =
   NULL,                 /* write */
   NULL,                 /* seek */
   cxd56_geofence_ioctl, /* ioctl */
+  NULL,                 /* truncate */
   cxd56_geofence_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL                /* unlink */
diff --git a/arch/arm/src/cxd56xx/cxd56_gnss.c b/arch/arm/src/cxd56xx/cxd56_gnss.c
index 826da673aa..04270f1477 100644
--- a/arch/arm/src/cxd56xx/cxd56_gnss.c
+++ b/arch/arm/src/cxd56xx/cxd56_gnss.c
@@ -317,6 +317,7 @@ static const struct file_operations g_gnssfops =
   cxd56_gnss_write, /* write */
   NULL,             /* seek */
   cxd56_gnss_ioctl, /* ioctl */
+  NULL,             /* truncate */
   cxd56_gnss_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL            /* unlink */
diff --git a/arch/arm/src/cxd56xx/cxd56_hostif.c b/arch/arm/src/cxd56xx/cxd56_hostif.c
index ec217d03bd..905c1baf68 100644
--- a/arch/arm/src/cxd56xx/cxd56_hostif.c
+++ b/arch/arm/src/cxd56xx/cxd56_hostif.c
@@ -145,6 +145,7 @@ static const struct file_operations g_hif_fops =
   hif_write,   /* write */
   hif_seek,    /* seek */
   hif_ioctl,   /* ioctl */
+  NULL,        /* truncate */
   hif_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , hif_unlink /* unlink */
diff --git a/arch/arm/src/sama5/sam_tsd.c b/arch/arm/src/sama5/sam_tsd.c
index 4c6e925f5b..3e2adab4db 100644
--- a/arch/arm/src/sama5/sam_tsd.c
+++ b/arch/arm/src/sama5/sam_tsd.c
@@ -249,6 +249,7 @@ static const struct file_operations g_tsdops =
   NULL,            /* write */
   NULL,            /* seek */
   sam_tsd_ioctl,   /* ioctl */
+  NULL,            /* truncate */
   sam_tsd_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL           /* unlink */
diff --git a/boards/arm/sam34/sam4l-xplained/src/sam_slcd.c b/boards/arm/sam34/sam4l-xplained/src/sam_slcd.c
index 3dd6553b9b..c612ab8c54 100644
--- a/boards/arm/sam34/sam4l-xplained/src/sam_slcd.c
+++ b/boards/arm/sam34/sam4l-xplained/src/sam_slcd.c
@@ -296,6 +296,7 @@ static const struct file_operations g_slcdops =
   slcd_write,    /* write */
   NULL,          /* seek */
   slcd_ioctl,    /* ioctl */
+  NULL,          /* truncate */
   slcd_poll      /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
diff --git a/boards/arm/stm32/mikroe-stm32f4/src/stm32_touchscreen.c b/boards/arm/stm32/mikroe-stm32f4/src/stm32_touchscreen.c
index 5e3725e7ed..0a9b57e28d 100644
--- a/boards/arm/stm32/mikroe-stm32f4/src/stm32_touchscreen.c
+++ b/boards/arm/stm32/mikroe-stm32f4/src/stm32_touchscreen.c
@@ -268,6 +268,7 @@ static const struct file_operations tc_fops =
   NULL,       /* write */
   NULL,       /* seek */
   tc_ioctl,   /* ioctl */
+  NULL,       /* truncate */
   tc_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL      /* unlink */
diff --git a/boards/arm/stm32/stm32ldiscovery/src/stm32_lcd.c b/boards/arm/stm32/stm32ldiscovery/src/stm32_lcd.c
index d4859819c2..5778631ff0 100644
--- a/boards/arm/stm32/stm32ldiscovery/src/stm32_lcd.c
+++ b/boards/arm/stm32/stm32ldiscovery/src/stm32_lcd.c
@@ -346,6 +346,7 @@ static const struct file_operations g_slcdops =
   slcd_write,    /* write */
   NULL,          /* seek */
   slcd_ioctl,    /* ioctl */
+  NULL,          /* truncate */
   slcd_poll      /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
diff --git a/boards/mips/pic32mx/pic32mx7mmb/src/pic32_touchscreen.c b/boards/mips/pic32mx/pic32mx7mmb/src/pic32_touchscreen.c
index 7684c58e57..9ae2554986 100644
--- a/boards/mips/pic32mx/pic32mx7mmb/src/pic32_touchscreen.c
+++ b/boards/mips/pic32mx/pic32mx7mmb/src/pic32_touchscreen.c
@@ -249,6 +249,7 @@ static const struct file_operations tc_fops =
   NULL,       /* write */
   NULL,       /* seek */
   tc_ioctl,   /* ioctl */
+  NULL,       /* truncate */
   tc_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL      /* unlink */
diff --git a/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_lcd1602.c b/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_lcd1602.c
index 1baf1a8cf0..50cb3f99e9 100644
--- a/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_lcd1602.c
+++ b/boards/mips/pic32mx/sure-pic32mx/src/pic32mx_lcd1602.c
@@ -181,6 +181,7 @@ static const struct file_operations g_lcdops =
   lcd_write,     /* write */
   NULL,          /* seek */
   lcd_ioctl,     /* ioctl */
+  NULL,          /* truncate */
   lcd_poll       /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
diff --git a/crypto/cryptodev.c b/crypto/cryptodev.c
index b524804b2f..44eb9410e8 100644
--- a/crypto/cryptodev.c
+++ b/crypto/cryptodev.c
@@ -125,6 +125,7 @@ static const struct file_operations g_cryptofops =
   cryptof_write,       /* write  */
   NULL,                /* seek   */
   cryptof_ioctl,       /* ioctl  */
+  NULL,                /* truncate */
   cryptof_poll         /* poll   */
 };
 
@@ -136,6 +137,7 @@ static const struct file_operations g_cryptoops =
   NULL,                /* write  */
   NULL,                /* seek   */
   cryptoioctl,         /* ioctl  */
+  NULL,                /* truncate */
   NULL                 /* poll   */
 };
 
diff --git a/drivers/analog/adc.c b/drivers/analog/adc.c
index 0d9cc43bd5..099e7b4d17 100644
--- a/drivers/analog/adc.c
+++ b/drivers/analog/adc.c
@@ -72,6 +72,7 @@ static const struct file_operations g_adc_fops =
   NULL,         /* write */
   NULL,         /* seek */
   adc_ioctl,    /* ioctl */
+  NULL,         /* truncate */
   adc_poll      /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL        /* unlink */
diff --git a/drivers/analog/comp.c b/drivers/analog/comp.c
index 3bec754743..1fb32f18de 100644
--- a/drivers/analog/comp.c
+++ b/drivers/analog/comp.c
@@ -65,6 +65,7 @@ static const struct file_operations comp_fops =
   NULL,                         /* write */
   NULL,                         /* seek */
   comp_ioctl,                   /* ioctl */
+  NULL,                         /* truncate */
   comp_poll                     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL                        /* unlink */
diff --git a/drivers/bch/bchdev_driver.c b/drivers/bch/bchdev_driver.c
index d807822cce..83fc4250d3 100644
--- a/drivers/bch/bchdev_driver.c
+++ b/drivers/bch/bchdev_driver.c
@@ -78,6 +78,7 @@ const struct file_operations bch_fops =
   bch_write,   /* write */
   bch_seek,    /* seek */
   bch_ioctl,   /* ioctl */
+  NULL,        /* truncate */
   bch_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , bch_unlink /* unlink */
diff --git a/drivers/can/can.c b/drivers/can/can.c
index 69ca540382..b19cb36f26 100644
--- a/drivers/can/can.c
+++ b/drivers/can/can.c
@@ -135,6 +135,7 @@ static const struct file_operations g_canops =
   can_write, /* write */
   NULL,      /* seek */
   can_ioctl, /* ioctl */
+  NULL,      /* truncate */
   can_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL     /* unlink */
diff --git a/drivers/crypto/dev_urandom.c b/drivers/crypto/dev_urandom.c
index 0137fdfaf3..8796f7445b 100644
--- a/drivers/crypto/dev_urandom.c
+++ b/drivers/crypto/dev_urandom.c
@@ -100,6 +100,7 @@ static const struct file_operations g_urand_fops =
   devurand_write,               /* write */
   NULL,                         /* seek */
   NULL,                         /* ioctl */
+  NULL,                         /* truncate */
   devurand_poll                 /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL                        /* unlink */
diff --git a/drivers/i2c/i2c_driver.c b/drivers/i2c/i2c_driver.c
index 5a7c4c9f3b..b7836b7327 100644
--- a/drivers/i2c/i2c_driver.c
+++ b/drivers/i2c/i2c_driver.c
@@ -99,6 +99,7 @@ static const struct file_operations i2cdrvr_fops =
   i2cdrvr_write,   /* write */
   NULL,            /* seek */
   i2cdrvr_ioctl,   /* ioctl */
+  NULL,            /* truncate */
   NULL             /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , i2cdrvr_unlink /* unlink */
diff --git a/drivers/input/ads7843e.c b/drivers/input/ads7843e.c
index 8cf4e9ff16..19126b3b6b 100644
--- a/drivers/input/ads7843e.c
+++ b/drivers/input/ads7843e.c
@@ -122,6 +122,7 @@ static const struct file_operations ads7843e_fops =
   NULL,             /* write */
   NULL,             /* seek */
   ads7843e_ioctl,   /* ioctl */
+  NULL,             /* truncate */
   ads7843e_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL            /* unlink */
diff --git a/drivers/input/ajoystick.c b/drivers/input/ajoystick.c
index ef81fd8674..072d90615e 100644
--- a/drivers/input/ajoystick.c
+++ b/drivers/input/ajoystick.c
@@ -135,6 +135,7 @@ static const struct file_operations ajoy_fops =
   NULL,       /* write */
   NULL,       /* seek */
   ajoy_ioctl, /* ioctl */
+  NULL,       /* truncate */
   ajoy_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL      /* unlink */
diff --git a/drivers/input/button_upper.c b/drivers/input/button_upper.c
index 10117aa2d4..16b578bbf9 100644
--- a/drivers/input/button_upper.c
+++ b/drivers/input/button_upper.c
@@ -133,6 +133,7 @@ static const struct file_operations btn_fops =
   btn_write, /* write */
   NULL,      /* seek */
   btn_ioctl, /* ioctl */
+  NULL,      /* truncate */
   btn_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL     /* unlink */
diff --git a/drivers/input/cypress_mbr3108.c b/drivers/input/cypress_mbr3108.c
index 2fe4b6b584..39189b9329 100644
--- a/drivers/input/cypress_mbr3108.c
+++ b/drivers/input/cypress_mbr3108.c
@@ -224,6 +224,7 @@ static const struct file_operations g_mbr3108_fileops =
   mbr3108_write,  /* write */
   NULL,           /* seek */
   NULL,           /* ioctl */
+  NULL,           /* truncate */
   mbr3108_poll    /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL          /* unlink */
diff --git a/drivers/input/djoystick.c b/drivers/input/djoystick.c
index d2ba83a841..13365fd7a5 100644
--- a/drivers/input/djoystick.c
+++ b/drivers/input/djoystick.c
@@ -135,6 +135,7 @@ static const struct file_operations djoy_fops =
   NULL,       /* write */
   NULL,       /* seek */
   djoy_ioctl, /* ioctl */
+  NULL,       /* truncate */
   djoy_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL      /* unlink */
diff --git a/drivers/input/ft5x06.c b/drivers/input/ft5x06.c
index 478b362d04..8898f8e5d4 100644
--- a/drivers/input/ft5x06.c
+++ b/drivers/input/ft5x06.c
@@ -176,6 +176,7 @@ static const struct file_operations ft5x06_fops =
   NULL,           /* write */
   NULL,           /* seek */
   ft5x06_ioctl,   /* ioctl */
+  NULL,           /* truncate */
   ft5x06_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL          /* unlink */
diff --git a/drivers/input/keyboard_upper.c b/drivers/input/keyboard_upper.c
index 6ed9758ff1..c874a3a04f 100644
--- a/drivers/input/keyboard_upper.c
+++ b/drivers/input/keyboard_upper.c
@@ -88,6 +88,7 @@ static const struct file_operations g_keyboard_fops =
   keyboard_write, /* write */
   NULL,           /* seek */
   NULL,           /* ioctl */
+  NULL,           /* truncate */
   keyboard_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL          /* unlink */
diff --git a/drivers/input/max11802.c b/drivers/input/max11802.c
index 517cc3d58e..b0d69eb390 100644
--- a/drivers/input/max11802.c
+++ b/drivers/input/max11802.c
@@ -115,6 +115,7 @@ static const struct file_operations max11802_fops =
   NULL,             /* write */
   NULL,             /* seek */
   max11802_ioctl,   /* ioctl */
+  NULL,             /* truncate */
   max11802_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL            /* unlink */
diff --git a/drivers/input/mxt.c b/drivers/input/mxt.c
index 4daf8da771..5050bcda50 100644
--- a/drivers/input/mxt.c
+++ b/drivers/input/mxt.c
@@ -280,6 +280,7 @@ static const struct file_operations mxt_fops =
   NULL,        /* write */
   NULL,        /* seek */
   mxt_ioctl,   /* ioctl */
+  NULL,        /* truncate */
   mxt_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL       /* unlink */
diff --git a/drivers/input/spq10kbd.c b/drivers/input/spq10kbd.c
index 6a9cab82ba..91597439cd 100644
--- a/drivers/input/spq10kbd.c
+++ b/drivers/input/spq10kbd.c
@@ -255,6 +255,7 @@ static const struct file_operations g_hidkbd_fops =
   spq10kbd_write,            /* write */
   NULL,                      /* seek */
   NULL,                      /* ioctl */
+  NULL,                      /* truncate */
   spq10kbd_poll              /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL                     /* unlink */
diff --git a/drivers/input/stmpe811_tsc.c b/drivers/input/stmpe811_tsc.c
index 89851b6070..6e82fed382 100644
--- a/drivers/input/stmpe811_tsc.c
+++ b/drivers/input/stmpe811_tsc.c
@@ -124,6 +124,7 @@ static const struct file_operations g_stmpe811fops =
   NULL,             /* write */
   NULL,             /* seek */
   stmpe811_ioctl,   /* ioctl */
+  NULL,             /* truncate */
   stmpe811_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL            /* unlink */
diff --git a/drivers/input/touchscreen_upper.c b/drivers/input/touchscreen_upper.c
index a1239452e3..48dc7038a6 100644
--- a/drivers/input/touchscreen_upper.c
+++ b/drivers/input/touchscreen_upper.c
@@ -90,6 +90,7 @@ static const struct file_operations g_touch_fops =
   touch_write,    /* write */
   NULL,           /* seek */
   touch_ioctl,    /* ioctl */
+  NULL,           /* truncate */
   touch_poll      /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL          /* unlink */
diff --git a/drivers/input/tsc2007.c b/drivers/input/tsc2007.c
index 2b799b0c07..5a1afd55af 100644
--- a/drivers/input/tsc2007.c
+++ b/drivers/input/tsc2007.c
@@ -209,6 +209,7 @@ static const struct file_operations tsc2007_fops =
   NULL,            /* write */
   NULL,            /* seek */
   tsc2007_ioctl,   /* ioctl */
+  NULL,            /* truncate */
   tsc2007_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL           /* unlink */
diff --git a/drivers/lcd/ft80x.c b/drivers/lcd/ft80x.c
index 9880b52494..6950b39c7f 100644
--- a/drivers/lcd/ft80x.c
+++ b/drivers/lcd/ft80x.c
@@ -134,6 +134,7 @@ static const struct file_operations g_ft80x_fops =
   ft80x_write,   /* write */
   NULL,          /* seek */
   ft80x_ioctl,   /* ioctl */
+  NULL,          /* truncate */
   NULL           /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , ft80x_unlink /* unlink */
diff --git a/drivers/lcd/pcf8574_lcd_backpack.c b/drivers/lcd/pcf8574_lcd_backpack.c
index 07dd614baf..a27179386a 100644
--- a/drivers/lcd/pcf8574_lcd_backpack.c
+++ b/drivers/lcd/pcf8574_lcd_backpack.c
@@ -117,6 +117,7 @@ static const struct file_operations g_pcf8574_lcd_fops =
   pcf8574_lcd_write,            /* write */
   pcf8574_lcd_seek,             /* seek */
   pcf8574_lcd_ioctl,            /* ioctl */
+  NULL,                         /* truncate */
   pcf8574_lcd_poll              /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , pcf8574_lcd_unlink          /* unlink */
diff --git a/drivers/lcd/tda19988.c b/drivers/lcd/tda19988.c
index f07c662a09..f8e0b06eb6 100644
--- a/drivers/lcd/tda19988.c
+++ b/drivers/lcd/tda19988.c
@@ -170,6 +170,7 @@ static const struct file_operations tda19988_fops =
   tda19988_write,    /* write */
   tda19988_seek,     /* seek */
   tda19988_ioctl,    /* ioctl */
+  NULL,              /* truncate */
   tda19988_poll      /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , tda19988_unlink  /* unlink */
diff --git a/drivers/misc/dev_null.c b/drivers/misc/dev_null.c
index da6fc34863..5b84c8a436 100644
--- a/drivers/misc/dev_null.c
+++ b/drivers/misc/dev_null.c
@@ -57,6 +57,7 @@ static const struct file_operations devnull_fops =
   devnull_write, /* write */
   NULL,          /* seek */
   NULL,          /* ioctl */
+  NULL,          /* truncate */
   devnull_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
diff --git a/drivers/misc/dev_zero.c b/drivers/misc/dev_zero.c
index 097e79d1c5..b02ba21559 100644
--- a/drivers/misc/dev_zero.c
+++ b/drivers/misc/dev_zero.c
@@ -57,6 +57,7 @@ static const struct file_operations devzero_fops =
   devzero_write, /* write */
   NULL,          /* seek */
   NULL,          /* ioctl */
+  NULL,          /* truncate */
   devzero_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
diff --git a/drivers/misc/rpmsgdev.c b/drivers/misc/rpmsgdev.c
index 9df1ba0c86..96eb593411 100644
--- a/drivers/misc/rpmsgdev.c
+++ b/drivers/misc/rpmsgdev.c
@@ -165,6 +165,7 @@ const struct file_operations g_rpmsgdev_ops =
   rpmsgdev_write,         /* write */
   rpmsgdev_seek,          /* seek */
   rpmsgdev_ioctl,         /* ioctl */
+  NULL,                   /* truncate */
   rpmsgdev_poll           /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL                  /* unlink */
diff --git a/drivers/modem/alt1250/alt1250.c b/drivers/modem/alt1250/alt1250.c
index 0c0654d6f7..6978432a53 100644
--- a/drivers/modem/alt1250/alt1250.c
+++ b/drivers/modem/alt1250/alt1250.c
@@ -77,6 +77,7 @@ static const struct file_operations g_alt1250fops =
   NULL,          /* write */
   NULL,          /* seek */
   alt1250_ioctl, /* ioctl */
+  NULL,          /* truncate */
   alt1250_poll,  /* poll */
 };
 static uint8_t g_recvbuff[ALTCOM_RX_PKT_SIZE_MAX];
diff --git a/drivers/modem/u-blox.c b/drivers/modem/u-blox.c
index b858a4a072..fbd3d38ad3 100644
--- a/drivers/modem/u-blox.c
+++ b/drivers/modem/u-blox.c
@@ -114,6 +114,7 @@ static const struct file_operations ubxmdm_fops =
   ubxmdm_write, /* write */
   NULL,         /* seek */
   ubxmdm_ioctl, /* ioctl */
+  NULL,         /* truncate */
   ubxmdm_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL        /* unlink */
diff --git a/drivers/mtd/mtd_config.c b/drivers/mtd/mtd_config.c
index f63521f705..4e74433a59 100644
--- a/drivers/mtd/mtd_config.c
+++ b/drivers/mtd/mtd_config.c
@@ -119,6 +119,7 @@ static const struct file_operations mtdconfig_fops =
   NULL,            /* write */
   NULL,            /* seek */
   mtdconfig_ioctl, /* ioctl */
+  NULL,            /* truncate */
   mtdconfig_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL            /* unlink */
diff --git a/drivers/mtd/mtd_config_fs.c b/drivers/mtd/mtd_config_fs.c
index ccfeb250a5..cb6153e248 100644
--- a/drivers/mtd/mtd_config_fs.c
+++ b/drivers/mtd/mtd_config_fs.c
@@ -141,6 +141,7 @@ static const struct file_operations g_mtdnvs_fops =
   NULL,            /* Write */
   NULL,            /* Seek */
   mtdconfig_ioctl, /* Ioctl */
+  NULL,            /* Truncate */
   mtdconfig_poll   /* Poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL           /* Unlink */
diff --git a/drivers/net/telnet.c b/drivers/net/telnet.c
index a8bf663730..2b922a08d6 100644
--- a/drivers/net/telnet.c
+++ b/drivers/net/telnet.c
@@ -190,6 +190,7 @@ static const struct file_operations g_telnet_fops =
   telnet_write,  /* write */
   NULL,          /* seek */
   telnet_ioctl,  /* ioctl */
+  NULL,          /* truncate */
   telnet_poll    /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
@@ -204,6 +205,7 @@ static const struct file_operations g_factory_fops =
   factory_write, /* write */
   NULL,          /* seek */
   factory_ioctl, /* ioctl */
+  NULL,          /* truncate */
   NULL           /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 751efeaf2d..cab2d1f325 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -219,6 +219,7 @@ static const struct file_operations g_tun_file_ops =
   tun_write,    /* write */
   NULL,         /* seek */
   tun_ioctl,    /* ioctl */
+  NULL,         /* truncate */
   tun_poll      /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL        /* unlink */
diff --git a/drivers/pipes/fifo.c b/drivers/pipes/fifo.c
index 61010d3a1e..7ad5c4358c 100644
--- a/drivers/pipes/fifo.c
+++ b/drivers/pipes/fifo.c
@@ -47,6 +47,7 @@ static const struct file_operations g_fifo_fops =
   pipecommon_write,    /* write */
   NULL,                /* seek */
   pipecommon_ioctl,    /* ioctl */
+  NULL,                /* truncate */
   pipecommon_poll      /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , pipecommon_unlink  /* unlink */
diff --git a/drivers/pipes/pipe.c b/drivers/pipes/pipe.c
index 999a55a7f3..67050f9176 100644
--- a/drivers/pipes/pipe.c
+++ b/drivers/pipes/pipe.c
@@ -61,6 +61,7 @@ static const struct file_operations g_pipe_fops =
   pipecommon_write,    /* write */
   NULL,                /* seek */
   pipecommon_ioctl,    /* ioctl */
+  NULL,                /* truncate */
   pipecommon_poll      /* poll */
 };
 
diff --git a/drivers/power/battery/battery_charger.c b/drivers/power/battery/battery_charger.c
index c7d2e37398..edfc8c4c29 100644
--- a/drivers/power/battery/battery_charger.c
+++ b/drivers/power/battery/battery_charger.c
@@ -91,6 +91,7 @@ static const struct file_operations g_batteryops =
   bat_charger_write,   /* write */
   NULL,                /* seek */
   bat_charger_ioctl,   /* ioctl */
+  NULL,                /* truncate */
   bat_charger_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL               /* unlink */
diff --git a/drivers/power/battery/battery_gauge.c b/drivers/power/battery/battery_gauge.c
index ae09ed49fc..37b01cb9c4 100644
--- a/drivers/power/battery/battery_gauge.c
+++ b/drivers/power/battery/battery_gauge.c
@@ -93,6 +93,7 @@ static const struct file_operations g_batteryops =
   bat_gauge_write,  /* write */
   NULL,             /* seek */
   bat_gauge_ioctl,  /* ioctl */
+  NULL,             /* truncate */
   bat_gauge_poll    /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL            /* unlink */
diff --git a/drivers/power/battery/battery_monitor.c b/drivers/power/battery/battery_monitor.c
index 8d3499d436..77e1980868 100644
--- a/drivers/power/battery/battery_monitor.c
+++ b/drivers/power/battery/battery_monitor.c
@@ -92,6 +92,7 @@ static const struct file_operations g_batteryops =
   bat_monitor_write,   /* write */
   NULL,                /* seek */
   bat_monitor_ioctl,   /* ioctl */
+  NULL,                /* truncate */
   bat_monitor_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL               /* unlink */
diff --git a/drivers/rc/lirc_dev.c b/drivers/rc/lirc_dev.c
index 38cd34e1e6..d4911fae41 100644
--- a/drivers/rc/lirc_dev.c
+++ b/drivers/rc/lirc_dev.c
@@ -103,6 +103,7 @@ static const struct file_operations g_lirc_fops =
   lirc_write,  /* write */
   NULL,        /* seek */
   lirc_ioctl,  /* ioctl */
+  NULL,        /* truncate */
   lirc_poll    /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL       /* unlink */
diff --git a/drivers/sensors/aht10.c b/drivers/sensors/aht10.c
index 8b79b3deac..529ce0140e 100644
--- a/drivers/sensors/aht10.c
+++ b/drivers/sensors/aht10.c
@@ -116,6 +116,7 @@ static const struct file_operations g_aht10fops =
   aht10_write,    /* write */
   NULL,           /* seek */
   aht10_ioctl,    /* ioctl */
+  NULL,           /* truncate */
   NULL            /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , aht10_unlink /* unlink */
diff --git a/drivers/sensors/hc_sr04.c b/drivers/sensors/hc_sr04.c
index 5f637bf4b6..f4cfd37726 100644
--- a/drivers/sensors/hc_sr04.c
+++ b/drivers/sensors/hc_sr04.c
@@ -90,6 +90,7 @@ static const struct file_operations g_hcsr04ops =
   hcsr04_write,  /* write */
   NULL,          /* seek */
   hcsr04_ioctl,  /* ioctl */
+  NULL,          /* truncate */
   hcsr04_poll    /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
diff --git a/drivers/sensors/hdc1008.c b/drivers/sensors/hdc1008.c
index b6a78277dc..612011ebb2 100644
--- a/drivers/sensors/hdc1008.c
+++ b/drivers/sensors/hdc1008.c
@@ -161,6 +161,7 @@ static const struct file_operations g_hdc1008fops =
   hdc1008_write,    /* write */
   NULL,             /* seek */
   hdc1008_ioctl,    /* ioctl */
+  NULL,             /* truncate */
   NULL              /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , hdc1008_unlink  /* unlink */
diff --git a/drivers/sensors/hts221.c b/drivers/sensors/hts221.c
index 71f0c16634..9e02fbe00f 100644
--- a/drivers/sensors/hts221.c
+++ b/drivers/sensors/hts221.c
@@ -157,6 +157,7 @@ static const struct file_operations g_humidityops =
   hts221_write,  /* write */
   NULL,          /* seek */
   hts221_ioctl,  /* ioctl */
+  NULL,          /* truncate */
   hts221_poll    /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
diff --git a/drivers/sensors/lis2dh.c b/drivers/sensors/lis2dh.c
index 7869480aba..efdd81e535 100644
--- a/drivers/sensors/lis2dh.c
+++ b/drivers/sensors/lis2dh.c
@@ -154,6 +154,7 @@ static const struct file_operations g_lis2dhops =
   lis2dh_write,  /* write */
   NULL,          /* seek */
   lis2dh_ioctl,  /* ioctl */
+  NULL,          /* truncate */
   lis2dh_poll    /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
diff --git a/drivers/sensors/max44009.c b/drivers/sensors/max44009.c
index fcbe397b9d..45a6fb6bae 100644
--- a/drivers/sensors/max44009.c
+++ b/drivers/sensors/max44009.c
@@ -112,6 +112,7 @@ static const struct file_operations g_alsops =
   max44009_write,  /* write */
   NULL,            /* seek */
   max44009_ioctl,  /* ioctl */
+  NULL,            /* truncate */
   max44009_poll    /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL           /* unlink */
diff --git a/drivers/sensors/scd30.c b/drivers/sensors/scd30.c
index febb52e66e..063a346b35 100644
--- a/drivers/sensors/scd30.c
+++ b/drivers/sensors/scd30.c
@@ -182,6 +182,7 @@ static const struct file_operations g_scd30fops =
   scd30_write,    /* write */
   NULL,           /* seek */
   scd30_ioctl,    /* ioctl */
+  NULL,           /* truncate */
   NULL            /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , scd30_unlink /* unlink */
diff --git a/drivers/sensors/scd41.c b/drivers/sensors/scd41.c
index 015b8f319b..272f37f5af 100644
--- a/drivers/sensors/scd41.c
+++ b/drivers/sensors/scd41.c
@@ -190,6 +190,7 @@ static const struct file_operations g_scd41fops =
   scd41_write,    /* write */
   NULL,           /* seek */
   scd41_ioctl,    /* ioctl */
+  NULL,           /* truncate */
   NULL            /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , scd41_unlink /* unlink */
diff --git a/drivers/sensors/sensor.c b/drivers/sensors/sensor.c
index 0ca7184839..4a93b4f11a 100644
--- a/drivers/sensors/sensor.c
+++ b/drivers/sensors/sensor.c
@@ -167,6 +167,7 @@ static const struct file_operations g_sensor_fops =
   sensor_write,   /* write */
   NULL,           /* seek  */
   sensor_ioctl,   /* ioctl */
+  NULL,           /* truncate */
   sensor_poll     /* poll  */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL          /* unlink */
diff --git a/drivers/sensors/sgp30.c b/drivers/sensors/sgp30.c
index b013d8228f..493a0af4d7 100644
--- a/drivers/sensors/sgp30.c
+++ b/drivers/sensors/sgp30.c
@@ -159,6 +159,7 @@ static const struct file_operations g_sgp30fops =
   sgp30_write,    /* write */
   NULL,           /* seek */
   sgp30_ioctl,    /* ioctl */
+  NULL,           /* truncate */
   NULL            /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , sgp30_unlink /* unlink */
diff --git a/drivers/sensors/sht21.c b/drivers/sensors/sht21.c
index de59fc2a52..a23b58ebfc 100644
--- a/drivers/sensors/sht21.c
+++ b/drivers/sensors/sht21.c
@@ -131,6 +131,7 @@ static const struct file_operations g_sht21fops =
   sht21_write,    /* write */
   NULL,           /* seek */
   sht21_ioctl,    /* ioctl */
+  NULL,           /* truncate */
   NULL            /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , sht21_unlink /* unlink */
diff --git a/drivers/sensors/sht3x.c b/drivers/sensors/sht3x.c
index 15d781490f..11dd183480 100644
--- a/drivers/sensors/sht3x.c
+++ b/drivers/sensors/sht3x.c
@@ -170,6 +170,7 @@ static const struct file_operations g_sht3xfops =
   sht3x_write,    /* write */
   NULL,           /* seek */
   sht3x_ioctl,    /* ioctl */
+  NULL,           /* truncate */
   NULL            /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , sht3x_unlink  /* unlink */
diff --git a/drivers/sensors/sps30.c b/drivers/sensors/sps30.c
index ed7e47a3f1..ad176cbe11 100644
--- a/drivers/sensors/sps30.c
+++ b/drivers/sensors/sps30.c
@@ -175,6 +175,7 @@ static const struct file_operations g_sps30fops =
   sps30_write,    /* write */
   NULL,           /* seek */
   sps30_ioctl,    /* ioctl */
+  NULL,           /* truncate */
   NULL            /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , sps30_unlink /* unlink */
diff --git a/drivers/sensors/usensor.c b/drivers/sensors/usensor.c
index 3974abd31f..08fd9f791f 100644
--- a/drivers/sensors/usensor.c
+++ b/drivers/sensors/usensor.c
@@ -81,6 +81,7 @@ static const struct file_operations g_usensor_fops =
   usensor_write, /* write */
   NULL,          /* seek  */
   usensor_ioctl, /* ioctl */
+  NULL,          /* truncate */
   NULL,          /* poll  */
 };
 
diff --git a/drivers/serial/pty.c b/drivers/serial/pty.c
index a9181ecdb7..39a182cdd7 100644
--- a/drivers/serial/pty.c
+++ b/drivers/serial/pty.c
@@ -127,6 +127,7 @@ static const struct file_operations g_pty_fops =
   pty_write,     /* write */
   NULL,          /* seek */
   pty_ioctl,     /* ioctl */
+  NULL,          /* truncate */
   pty_poll       /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , pty_unlink   /* unlink */
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index 37e9e0aca7..ed7299b8aa 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -126,6 +126,7 @@ static const struct file_operations g_serialops =
   uart_write, /* write */
   NULL,       /* seek */
   uart_ioctl, /* ioctl */
+  NULL,       /* truncate */
   uart_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL      /* unlink */
diff --git a/drivers/serial/uart_bth4.c b/drivers/serial/uart_bth4.c
index 8978bd5312..e01a27331f 100644
--- a/drivers/serial/uart_bth4.c
+++ b/drivers/serial/uart_bth4.c
@@ -90,6 +90,7 @@ static const struct file_operations g_uart_bth4_ops =
   uart_bth4_write,  /* write */
   NULL,             /* seek */
   uart_bth4_ioctl,  /* ioctl */
+  NULL,             /* truncate */
   uart_bth4_poll    /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL            /* unlink */
diff --git a/drivers/spi/spi_driver.c b/drivers/spi/spi_driver.c
index 767eaec314..ae3a09726d 100644
--- a/drivers/spi/spi_driver.c
+++ b/drivers/spi/spi_driver.c
@@ -99,6 +99,7 @@ static const struct file_operations spidrvr_fops =
   spidrvr_write,   /* write */
   NULL,            /* seek */
   spidrvr_ioctl,   /* ioctl */
+  NULL,            /* truncate */
   NULL             /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , spidrvr_unlink /* unlink */
diff --git a/drivers/spi/spi_slave_driver.c b/drivers/spi/spi_slave_driver.c
index 61f0e6c0e9..54b4f5ac20 100644
--- a/drivers/spi/spi_slave_driver.c
+++ b/drivers/spi/spi_slave_driver.c
@@ -127,6 +127,7 @@ static const struct file_operations g_spislavefops =
   spi_slave_write,              /* write */
   NULL,                         /* seek */
   NULL,                         /* ioctl */
+  NULL,                         /* truncate */
   NULL                          /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , spi_slave_unlink            /* unlink */
diff --git a/drivers/syslog/ramlog.c b/drivers/syslog/ramlog.c
index dfc3e7dad0..a47c734742 100644
--- a/drivers/syslog/ramlog.c
+++ b/drivers/syslog/ramlog.c
@@ -114,6 +114,7 @@ static const struct file_operations g_ramlogfops =
   ramlog_file_write, /* write */
   NULL,              /* seek */
   ramlog_file_ioctl, /* ioctl */
+  NULL,              /* truncate */
   ramlog_file_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL             /* unlink */
diff --git a/drivers/timers/rtc.c b/drivers/timers/rtc.c
index 04507b917b..c0055c12f0 100644
--- a/drivers/timers/rtc.c
+++ b/drivers/timers/rtc.c
@@ -129,6 +129,7 @@ static const struct file_operations rtc_fops =
   rtc_write,     /* write */
   NULL,          /* seek */
   rtc_ioctl,     /* ioctl */
+  NULL,          /* truncate */
   NULL           /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , rtc_unlink   /* unlink */
diff --git a/drivers/usbdev/adb.c b/drivers/usbdev/adb.c
index 888e4bd4d1..3fdf8f082b 100755
--- a/drivers/usbdev/adb.c
+++ b/drivers/usbdev/adb.c
@@ -254,6 +254,7 @@ static const struct file_operations g_adb_fops =
   adb_char_write, /* write */
   NULL,           /* seek */
   NULL,           /* ioctl */
+  NULL,           /* truncate */
   adb_char_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL          /* unlink */
diff --git a/drivers/usbhost/usbhost_cdcmbim.c b/drivers/usbhost/usbhost_cdcmbim.c
index a59ecce323..c4f7540edb 100644
--- a/drivers/usbhost/usbhost_cdcmbim.c
+++ b/drivers/usbhost/usbhost_cdcmbim.c
@@ -347,6 +347,7 @@ static const struct file_operations cdcwdm_fops =
   cdcwdm_write,  /* write */
   NULL,          /* seek */
   NULL,          /* ioctl */
+  NULL,          /* truncate */
   cdcwdm_poll    /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
diff --git a/drivers/usbhost/usbhost_hidkbd.c b/drivers/usbhost/usbhost_hidkbd.c
index 9d91aa9eaa..be1f8e3ce5 100644
--- a/drivers/usbhost/usbhost_hidkbd.c
+++ b/drivers/usbhost/usbhost_hidkbd.c
@@ -341,6 +341,7 @@ static const struct file_operations g_hidkbd_fops =
   usbhost_write,            /* write */
   NULL,                     /* seek */
   NULL,                     /* ioctl */
+  NULL,                     /* truncate */
   usbhost_poll              /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL                    /* unlink */
diff --git a/drivers/usbhost/usbhost_hidmouse.c b/drivers/usbhost/usbhost_hidmouse.c
index 770f061401..c44574fc21 100644
--- a/drivers/usbhost/usbhost_hidmouse.c
+++ b/drivers/usbhost/usbhost_hidmouse.c
@@ -391,6 +391,7 @@ static const struct file_operations g_hidmouse_fops =
   usbhost_write,           /* write */
   NULL,                    /* seek */
   NULL,                    /* ioctl */
+  NULL,                    /* truncate */
   usbhost_poll             /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL                   /* unlink */
diff --git a/drivers/usbhost/usbhost_xboxcontroller.c b/drivers/usbhost/usbhost_xboxcontroller.c
index cc8c0b3fef..0531f38f39 100644
--- a/drivers/usbhost/usbhost_xboxcontroller.c
+++ b/drivers/usbhost/usbhost_xboxcontroller.c
@@ -296,6 +296,7 @@ static const struct file_operations g_xboxcontroller_fops =
   usbhost_write,            /* write */
   NULL,                     /* seek */
   usbhost_ioctl,            /* ioctl */
+  NULL,                     /* truncate */
   usbhost_poll              /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL                    /* unlink */
diff --git a/drivers/usbmisc/fusb301.c b/drivers/usbmisc/fusb301.c
index 48b86e76d9..565a9ae8d6 100644
--- a/drivers/usbmisc/fusb301.c
+++ b/drivers/usbmisc/fusb301.c
@@ -94,6 +94,7 @@ static const struct file_operations g_fusb301ops =
   fusb301_write, /* write */
   NULL,          /* seek */
   fusb301_ioctl, /* ioctl */
+  NULL,          /* truncate */
   fusb301_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
diff --git a/drivers/usbmisc/fusb303.c b/drivers/usbmisc/fusb303.c
index 9d94840c76..19bb9ae710 100644
--- a/drivers/usbmisc/fusb303.c
+++ b/drivers/usbmisc/fusb303.c
@@ -128,6 +128,7 @@ static const struct file_operations g_fusb303ops =
   fusb303_write, /* write */
   NULL,          /* seek */
   fusb303_ioctl, /* ioctl */
+  NULL,          /* truncate */
   fusb303_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
diff --git a/drivers/usrsock/usrsock_dev.c b/drivers/usrsock/usrsock_dev.c
index 34a8ad3cca..30d46b58cc 100644
--- a/drivers/usrsock/usrsock_dev.c
+++ b/drivers/usrsock/usrsock_dev.c
@@ -103,6 +103,7 @@ static const struct file_operations g_usrsockdevops =
   usrsockdev_write,   /* write */
   usrsockdev_seek,    /* seek */
   NULL,               /* ioctl */
+  NULL,               /* truncate */
   usrsockdev_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL              /* unlink */
diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index bc7fd7b5bc..b401599432 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -85,6 +85,7 @@ static const struct file_operations fb_fops =
   fb_write,      /* write */
   fb_seek,       /* seek */
   fb_ioctl,      /* ioctl */
+  NULL,          /* truncate */
   fb_poll        /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
diff --git a/drivers/video/video.c b/drivers/video/video.c
index 110012e4e4..94f894aa10 100644
--- a/drivers/video/video.c
+++ b/drivers/video/video.c
@@ -284,6 +284,7 @@ static const struct file_operations g_video_fops =
   video_write,              /* write */
   NULL,                     /* seek */
   video_ioctl,              /* ioctl */
+  NULL,                     /* truncate */
   NULL                      /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL                    /* unlink */
diff --git a/drivers/wireless/cc1101.c b/drivers/wireless/cc1101.c
index 4787c35d1a..9b0633c77c 100644
--- a/drivers/wireless/cc1101.c
+++ b/drivers/wireless/cc1101.c
@@ -305,6 +305,7 @@ static const struct file_operations g_cc1101ops =
   cc1101_file_write, /* write */
   NULL,              /* seek */
   NULL,              /* ioctl */
+  NULL,              /* truncate */
   cc1101_file_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL             /* unlink */
diff --git a/drivers/wireless/gs2200m.c b/drivers/wireless/gs2200m.c
index d16183bb0b..25c3400e73 100644
--- a/drivers/wireless/gs2200m.c
+++ b/drivers/wireless/gs2200m.c
@@ -231,6 +231,7 @@ static const struct file_operations g_gs2200m_fops =
   gs2200m_write, /* write */
   NULL,          /* seek */
   gs2200m_ioctl, /* ioctl */
+  NULL,          /* truncate */
   gs2200m_poll   /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL         /* unlink */
diff --git a/drivers/wireless/lpwan/sx127x/sx127x.c b/drivers/wireless/lpwan/sx127x/sx127x.c
index 3388e2ce9f..8f00f4e486 100644
--- a/drivers/wireless/lpwan/sx127x/sx127x.c
+++ b/drivers/wireless/lpwan/sx127x/sx127x.c
@@ -451,6 +451,7 @@ static const struct file_operations sx127x_fops =
   sx127x_write,   /* write */
   NULL,           /* seek */
   sx127x_ioctl,   /* ioctl */
+  NULL,           /* truncate */
   sx127x_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL          /* unlink */
diff --git a/drivers/wireless/nrf24l01.c b/drivers/wireless/nrf24l01.c
index 9779532d1c..383ca7e658 100644
--- a/drivers/wireless/nrf24l01.c
+++ b/drivers/wireless/nrf24l01.c
@@ -239,6 +239,7 @@ static const struct file_operations nrf24l01_fops =
   nrf24l01_write,   /* write */
   NULL,             /* seek */
   nrf24l01_ioctl,   /* ioctl */
+  NULL,             /* truncate */
   nrf24l01_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL            /* unlink */
diff --git a/fs/binfs/fs_binfs.c b/fs/binfs/fs_binfs.c
index c10d9ff3dd..abb8647c86 100644
--- a/fs/binfs/fs_binfs.c
+++ b/fs/binfs/fs_binfs.c
@@ -109,12 +109,12 @@ const struct mountpt_operations binfs_operations =
   NULL,              /* write */
   NULL,              /* seek */
   binfs_ioctl,       /* ioctl */
+  NULL,              /* truncate */
 
   NULL,              /* sync */
   binfs_dup,         /* dup */
   binfs_fstat,       /* fstat */
   NULL,              /* fchstat */
-  NULL,              /* truncate */
 
   binfs_opendir,     /* opendir */
   binfs_closedir,    /* closedir */
diff --git a/fs/cromfs/fs_cromfs.c b/fs/cromfs/fs_cromfs.c
index 3f08a6d482..84f8184d69 100644
--- a/fs/cromfs/fs_cromfs.c
+++ b/fs/cromfs/fs_cromfs.c
@@ -184,12 +184,12 @@ const struct mountpt_operations cromfs_operations =
   NULL,              /* write */
   NULL,              /* seek */
   cromfs_ioctl,      /* ioctl */
+  NULL,              /* truncate */
 
   NULL,              /* sync */
   cromfs_dup,        /* dup */
   cromfs_fstat,      /* fstat */
   NULL,              /* fchstat */
-  NULL,              /* truncate */
 
   cromfs_opendir,    /* opendir */
   cromfs_closedir,   /* closedir */
diff --git a/fs/fat/fs_fat32.c b/fs/fat/fs_fat32.c
index c0163af64a..aef7d5856b 100644
--- a/fs/fat/fs_fat32.c
+++ b/fs/fat/fs_fat32.c
@@ -115,12 +115,11 @@ const struct mountpt_operations fat_operations =
   fat_write,         /* write */
   fat_seek,          /* seek */
   fat_ioctl,         /* ioctl */
-
+  fat_truncate,      /* truncate */
   fat_sync,          /* sync */
   fat_dup,           /* dup */
   fat_fstat,         /* fstat */
   NULL,              /* fchstat */
-  fat_truncate,      /* truncate */
 
   fat_opendir,       /* opendir */
   fat_closedir,      /* closedir */
diff --git a/fs/hostfs/hostfs.c b/fs/hostfs/hostfs.c
index b6e50ddb4e..de380b2f35 100644
--- a/fs/hostfs/hostfs.c
+++ b/fs/hostfs/hostfs.c
@@ -142,12 +142,12 @@ const struct mountpt_operations hostfs_operations =
   hostfs_write,         /* write */
   hostfs_seek,          /* seek */
   hostfs_ioctl,         /* ioctl */
+  hostfs_ftruncate,     /* ftruncate */
 
   hostfs_sync,          /* sync */
   hostfs_dup,           /* dup */
   hostfs_fstat,         /* fstat */
   hostfs_fchstat,       /* fchstat */
-  hostfs_ftruncate,     /* ftruncate */
 
   hostfs_opendir,       /* opendir */
   hostfs_closedir,      /* closedir */
diff --git a/fs/littlefs/lfs_vfs.c b/fs/littlefs/lfs_vfs.c
index 49bf16cf62..9022c0c76c 100644
--- a/fs/littlefs/lfs_vfs.c
+++ b/fs/littlefs/lfs_vfs.c
@@ -140,12 +140,12 @@ const struct mountpt_operations littlefs_operations =
   littlefs_write,         /* write */
   littlefs_seek,          /* seek */
   littlefs_ioctl,         /* ioctl */
+  littlefs_truncate,      /* truncate */
 
   littlefs_sync,          /* sync */
   littlefs_dup,           /* dup */
   littlefs_fstat,         /* fstat */
   NULL,                   /* fchstat */
-  littlefs_truncate,      /* truncate */
 
   littlefs_opendir,       /* opendir */
   littlefs_closedir,      /* closedir */
diff --git a/fs/mqueue/mq_open.c b/fs/mqueue/mq_open.c
index 6158e23e1c..74c78e82f3 100644
--- a/fs/mqueue/mq_open.c
+++ b/fs/mqueue/mq_open.c
@@ -60,6 +60,7 @@ static const struct file_operations g_nxmq_fileops =
   NULL,             /* write */
   NULL,             /* seek */
   NULL,             /* ioctl */
+  NULL,             /* truncate */
   nxmq_file_poll    /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL            /* unlink */
diff --git a/fs/nfs/nfs_vfsops.c b/fs/nfs/nfs_vfsops.c
index 73f2b5fa86..e75aac5d41 100644
--- a/fs/nfs/nfs_vfsops.c
+++ b/fs/nfs/nfs_vfsops.c
@@ -198,12 +198,12 @@ const struct mountpt_operations nfs_operations =
   nfs_write,                    /* write */
   NULL,                         /* seek */
   NULL,                         /* ioctl */
+  nfs_truncate,                 /* truncate */
 
   NULL,                         /* sync */
   nfs_dup,                      /* dup */
   nfs_fstat,                    /* fstat */
   nfs_fchstat,                  /* fchstat */
-  nfs_truncate,                 /* truncate */
 
   nfs_opendir,                  /* opendir */
   nfs_closedir,                 /* closedir */
diff --git a/fs/nxffs/nxffs_initialize.c b/fs/nxffs/nxffs_initialize.c
index c594bd8385..01964038f8 100644
--- a/fs/nxffs/nxffs_initialize.c
+++ b/fs/nxffs/nxffs_initialize.c
@@ -54,17 +54,17 @@ const struct mountpt_operations nxffs_operations =
   nxffs_write,       /* write */
   NULL,              /* seek -- Use f_pos in struct file */
   nxffs_ioctl,       /* ioctl */
-
-  NULL,              /* sync -- No buffered data */
-  nxffs_dup,         /* dup */
-  nxffs_fstat,       /* fstat */
-  NULL,              /* fchstat */
 #ifdef __NO_TRUNCATE_SUPPORT__
   nxffs_truncate,    /* truncate */
 #else
   NULL,              /* truncate */
 #endif
 
+  NULL,              /* sync -- No buffered data */
+  nxffs_dup,         /* dup */
+  nxffs_fstat,       /* fstat */
+  NULL,              /* fchstat */
+
   nxffs_opendir,     /* opendir */
   nxffs_closedir,    /* closedir */
   nxffs_readdir,     /* readdir */
diff --git a/fs/procfs/fs_procfs.c b/fs/procfs/fs_procfs.c
index 76be822222..ee5276d00c 100644
--- a/fs/procfs/fs_procfs.c
+++ b/fs/procfs/fs_procfs.c
@@ -252,12 +252,12 @@ const struct mountpt_operations procfs_operations =
   procfs_write,      /* write */
   NULL,              /* seek */
   procfs_ioctl,      /* ioctl */
+  NULL,              /* truncate */
 
   NULL,              /* sync */
   procfs_dup,        /* dup */
   procfs_fstat,      /* fstat */
   NULL,              /* fchstat */
-  NULL,              /* truncate */
 
   procfs_opendir,    /* opendir */
   procfs_closedir,   /* closedir */
diff --git a/fs/romfs/fs_romfs.c b/fs/romfs/fs_romfs.c
index ad439a91e1..91fceacf8d 100644
--- a/fs/romfs/fs_romfs.c
+++ b/fs/romfs/fs_romfs.c
@@ -119,6 +119,7 @@ const struct mountpt_operations romfs_operations =
   NULL,            /* write */
   romfs_seek,      /* seek */
   romfs_ioctl,     /* ioctl */
+  NULL,            /* truncate */
 
   NULL,            /* sync */
   romfs_dup,       /* dup */
diff --git a/fs/rpmsgfs/rpmsgfs.c b/fs/rpmsgfs/rpmsgfs.c
index 50a71a9af1..c35984098f 100644
--- a/fs/rpmsgfs/rpmsgfs.c
+++ b/fs/rpmsgfs/rpmsgfs.c
@@ -161,12 +161,12 @@ const struct mountpt_operations rpmsgfs_operations =
   rpmsgfs_write,         /* write */
   rpmsgfs_seek,          /* seek */
   rpmsgfs_ioctl,         /* ioctl */
+  rpmsgfs_ftruncate,     /* ftruncate */
 
   rpmsgfs_sync,          /* sync */
   rpmsgfs_dup,           /* dup */
   rpmsgfs_fstat,         /* fstat */
   rpmsgfs_fchstat,       /* fchstat */
-  rpmsgfs_ftruncate,     /* ftruncate */
 
   rpmsgfs_opendir,       /* opendir */
   rpmsgfs_closedir,      /* closedir */
diff --git a/fs/smartfs/smartfs_smart.c b/fs/smartfs/smartfs_smart.c
index a9b22c761f..f5735cea05 100644
--- a/fs/smartfs/smartfs_smart.c
+++ b/fs/smartfs/smartfs_smart.c
@@ -140,12 +140,12 @@ const struct mountpt_operations smartfs_operations =
   smartfs_write,         /* write */
   smartfs_seek,          /* seek */
   smartfs_ioctl,         /* ioctl */
+  smartfs_truncate,      /* truncate */
 
   smartfs_sync,          /* sync */
   smartfs_dup,           /* dup */
   smartfs_fstat,         /* fstat */
   NULL,                  /* fchstat */
-  smartfs_truncate,      /* truncate */
 
   smartfs_opendir,       /* opendir */
   smartfs_closedir,      /* closedir */
diff --git a/fs/socket/socket.c b/fs/socket/socket.c
index 37e66fc7ce..f18bc48963 100644
--- a/fs/socket/socket.c
+++ b/fs/socket/socket.c
@@ -64,6 +64,7 @@ static const struct file_operations g_sock_fileops =
   sock_file_write,  /* write */
   NULL,             /* seek */
   sock_file_ioctl,  /* ioctl */
+  NULL,             /* truncate */
   sock_file_poll    /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL            /* unlink */
diff --git a/fs/spiffs/src/spiffs_vfs.c b/fs/spiffs/src/spiffs_vfs.c
index 369d557a4c..011f1e53db 100644
--- a/fs/spiffs/src/spiffs_vfs.c
+++ b/fs/spiffs/src/spiffs_vfs.c
@@ -141,12 +141,12 @@ const struct mountpt_operations spiffs_operations =
   spiffs_write,      /* write */
   spiffs_seek,       /* seek */
   spiffs_ioctl,      /* ioctl */
+  spiffs_truncate,   /* truncate */
 
   spiffs_sync,       /* sync */
   spiffs_dup,        /* dup */
   spiffs_fstat,      /* fstat */
   NULL,              /* fchstat */
-  spiffs_truncate,   /* truncate */
 
   spiffs_opendir,    /* opendir */
   spiffs_closedir,   /* closedir */
diff --git a/fs/tmpfs/fs_tmpfs.c b/fs/tmpfs/fs_tmpfs.c
index dc17b5121c..4c92eb04a8 100644
--- a/fs/tmpfs/fs_tmpfs.c
+++ b/fs/tmpfs/fs_tmpfs.c
@@ -177,12 +177,12 @@ const struct mountpt_operations tmpfs_operations =
   tmpfs_write,      /* write */
   tmpfs_seek,       /* seek */
   tmpfs_ioctl,      /* ioctl */
+  tmpfs_truncate,   /* truncate */
 
   tmpfs_sync,       /* sync */
   tmpfs_dup,        /* dup */
   tmpfs_fstat,      /* fstat */
   NULL,             /* fchstat */
-  tmpfs_truncate,   /* truncate */
 
   tmpfs_opendir,    /* opendir */
   tmpfs_closedir,   /* closedir */
diff --git a/fs/unionfs/fs_unionfs.c b/fs/unionfs/fs_unionfs.c
index 3b0b23d4d9..50b2f5ad26 100644
--- a/fs/unionfs/fs_unionfs.c
+++ b/fs/unionfs/fs_unionfs.c
@@ -222,12 +222,12 @@ const struct mountpt_operations unionfs_operations =
   unionfs_write,       /* write */
   unionfs_seek,        /* seek */
   unionfs_ioctl,       /* ioctl */
+  unionfs_truncate,    /* truncate */
 
   unionfs_sync,        /* sync */
   unionfs_dup,         /* dup */
   unionfs_fstat,       /* fstat */
   unionfs_fchstat,     /* fchstat */
-  unionfs_truncate,    /* truncate */
 
   unionfs_opendir,     /* opendir */
   unionfs_closedir,    /* closedir */
diff --git a/fs/userfs/fs_userfs.c b/fs/userfs/fs_userfs.c
index 8dff18f5d4..303a8571af 100644
--- a/fs/userfs/fs_userfs.c
+++ b/fs/userfs/fs_userfs.c
@@ -160,12 +160,12 @@ const struct mountpt_operations userfs_operations =
   userfs_write,      /* write */
   userfs_seek,       /* seek */
   userfs_ioctl,      /* ioctl */
+  userfs_truncate,   /* truncate */
 
   userfs_sync,       /* sync */
   userfs_dup,        /* dup */
   userfs_fstat,      /* fstat */
   userfs_fchstat,    /* fchstat */
-  userfs_truncate,   /* truncate */
 
   userfs_opendir,    /* opendir */
   userfs_closedir,   /* closedir */
diff --git a/fs/vfs/fs_epoll.c b/fs/vfs/fs_epoll.c
index 3214207b73..c642333b20 100644
--- a/fs/vfs/fs_epoll.c
+++ b/fs/vfs/fs_epoll.c
@@ -104,6 +104,7 @@ static const struct file_operations g_epoll_ops =
   NULL,             /* write */
   NULL,             /* seek */
   NULL,             /* ioctl */
+  NULL,             /* truncate */
   epoll_do_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL            /* unlink */
diff --git a/fs/vfs/fs_eventfd.c b/fs/vfs/fs_eventfd.c
index 30321d20bc..78610a5de7 100644
--- a/fs/vfs/fs_eventfd.c
+++ b/fs/vfs/fs_eventfd.c
@@ -100,6 +100,7 @@ static const struct file_operations g_eventfd_fops =
   eventfd_do_write, /* write */
   NULL,             /* seek */
   NULL,             /* ioctl */
+  NULL,             /* truncate */
 #ifdef CONFIG_EVENT_FD_POLL
   eventfd_do_poll   /* poll */
 #else
diff --git a/fs/vfs/fs_signalfd.c b/fs/vfs/fs_signalfd.c
index f8f5741b7a..6ffa8b1671 100644
--- a/fs/vfs/fs_signalfd.c
+++ b/fs/vfs/fs_signalfd.c
@@ -79,6 +79,7 @@ static const struct file_operations g_signalfd_fileops =
   NULL,                 /* write */
   NULL,                 /* seek */
   NULL,                 /* ioctl */
+  NULL,                 /* truncate */
   signalfd_file_poll    /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , NULL                /* unlink */
diff --git a/fs/vfs/fs_truncate.c b/fs/vfs/fs_truncate.c
index 4ecd06c13d..c4c0297640 100644
--- a/fs/vfs/fs_truncate.c
+++ b/fs/vfs/fs_truncate.c
@@ -68,9 +68,14 @@ int file_truncate(FAR struct file *filep, off_t length)
    */
 
   inode = filep->f_inode;
-  if (inode == NULL || !INODE_IS_MOUNTPT(inode) || inode->u.i_mops == NULL)
+  if (inode == NULL)
     {
-      fwarn("WARNING:  Not a (regular) file on a mounted file system.\n");
+      return -EINVAL;
+    }
+
+  if (inode->u.i_ops == NULL)
+    {
+      fwarn("WARNING:  Not a file\n");
       return -EINVAL;
     }
 
@@ -78,7 +83,7 @@ int file_truncate(FAR struct file *filep, off_t length)
    * possible not the only indicator -- sufficient, but not necessary")
    */
 
-  if (inode->u.i_mops->write == NULL)
+  if (inode->u.i_ops->write == NULL)
     {
       fwarn("WARNING: File system is read-only\n");
       return -EROFS;
@@ -88,7 +93,7 @@ int file_truncate(FAR struct file *filep, off_t length)
    * a write-able file system.
    */
 
-  if (inode->u.i_mops->truncate == NULL)
+  if (inode->u.i_ops->truncate == NULL)
     {
       fwarn("WARNING: File system does not support the truncate() method\n");
       return -ENOSYS;
@@ -96,7 +101,7 @@ int file_truncate(FAR struct file *filep, off_t length)
 
   /* Yes, then tell the file system to truncate this file */
 
-  return inode->u.i_mops->truncate(filep, length);
+  return inode->u.i_ops->truncate(filep, length);
 }
 
 /****************************************************************************
diff --git a/graphics/nxterm/nxterm_driver.c b/graphics/nxterm/nxterm_driver.c
index ddc4545039..594dc97519 100644
--- a/graphics/nxterm/nxterm_driver.c
+++ b/graphics/nxterm/nxterm_driver.c
@@ -66,6 +66,7 @@ const struct file_operations g_nxterm_drvrops =
   nxterm_write,   /* write */
   NULL,           /* seek */
   nxterm_ioctl,   /* ioctl */
+  NULL,           /* truncate */
   nxterm_poll     /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , nxterm_unlink /* unlink */
@@ -82,6 +83,7 @@ const struct file_operations g_nxterm_drvrops =
   nxterm_write,   /* write */
   NULL,           /* seek */
   nxterm_ioctl,   /* ioctl */
+  NULL,           /* truncate */
   NULL            /* poll */
 #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
   , nxterm_unlink /* unlink */
diff --git a/include/nuttx/fs/fs.h b/include/nuttx/fs/fs.h
index 951ad825ac..cf011428f6 100644
--- a/include/nuttx/fs/fs.h
+++ b/include/nuttx/fs/fs.h
@@ -212,6 +212,7 @@ struct file_operations
                    size_t buflen);
   off_t   (*seek)(FAR struct file *filep, off_t offset, int whence);
   int     (*ioctl)(FAR struct file *filep, int cmd, unsigned long arg);
+  int     (*truncate)(FAR struct file *filep, off_t length);
 
   /* The two structures need not be common after this point */
 
@@ -298,6 +299,7 @@ struct mountpt_operations
             size_t buflen);
   off_t   (*seek)(FAR struct file *filep, off_t offset, int whence);
   int     (*ioctl)(FAR struct file *filep, int cmd, unsigned long arg);
+  int     (*truncate)(FAR struct file *filep, off_t length);
 
   /* The two structures need not be common after this point. The following
    * are extended methods needed to deal with the unique needs of mounted
@@ -311,7 +313,6 @@ struct mountpt_operations
   int     (*fstat)(FAR const struct file *filep, FAR struct stat *buf);
   int     (*fchstat)(FAR const struct file *filep,
                      FAR const struct stat *buf, int flags);
-  int     (*truncate)(FAR struct file *filep, off_t length);
 
   /* Directory operations */