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 <jukkax@ssrc.tii.ae>
This commit is contained in:
Jukka Laitinen 2023-01-02 17:02:51 +04:00 committed by Alan Carvalho de Assis
parent 41e9df2f3e
commit f33dc4df3f
111 changed files with 320 additions and 96 deletions

View File

@ -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 1. ``mmap()`` can be used to support *eXecute In Place* (XIP) on random
access media under the following very restrictive conditions: access media under the following very restrictive conditions:
a. The file-system supports the ``FIOC_MMAP`` ioctl command. Any file a. Any file system that maps files contiguously on the media
system that maps files contiguously on the media should support should implement the mmap file operation. By comparison, most
this ``ioctl`` command. By comparison, most file system scatter file system scatter files over the media in non-contiguous
files over the media in non-contiguous sectors. As of this sectors. As of this writing, ROMFS is the only file system
writing, ROMFS is the only file system that meets this that meets this requirement.
requirement.
b. The underlying block driver supports the ``BIOC_XIPBASE`` b. The underlying block driver supports the ``BIOC_XIPBASE``
``ioctl`` command that maps the underlying media to a randomly ``ioctl`` command that maps the underlying media to a randomly

View File

@ -107,6 +107,7 @@ static const struct file_operations g_geofencefops =
NULL, /* seek */ NULL, /* seek */
cxd56_geofence_ioctl, /* ioctl */ cxd56_geofence_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
cxd56_geofence_poll /* poll */ cxd56_geofence_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -318,6 +318,7 @@ static const struct file_operations g_gnssfops =
NULL, /* seek */ NULL, /* seek */
cxd56_gnss_ioctl, /* ioctl */ cxd56_gnss_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
cxd56_gnss_poll /* poll */ cxd56_gnss_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -146,6 +146,7 @@ static const struct file_operations g_hif_fops =
hif_seek, /* seek */ hif_seek, /* seek */
hif_ioctl, /* ioctl */ hif_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
hif_poll /* poll */ hif_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, hif_unlink /* unlink */ , hif_unlink /* unlink */

View File

@ -250,6 +250,7 @@ static const struct file_operations g_tsdops =
NULL, /* seek */ NULL, /* seek */
sam_tsd_ioctl, /* ioctl */ sam_tsd_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
sam_tsd_poll /* poll */ sam_tsd_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -297,6 +297,7 @@ static const struct file_operations g_slcdops =
NULL, /* seek */ NULL, /* seek */
slcd_ioctl, /* ioctl */ slcd_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
slcd_poll /* poll */ slcd_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -269,6 +269,7 @@ static const struct file_operations tc_fops =
NULL, /* seek */ NULL, /* seek */
tc_ioctl, /* ioctl */ tc_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
tc_poll /* poll */ tc_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -347,6 +347,7 @@ static const struct file_operations g_slcdops =
NULL, /* seek */ NULL, /* seek */
slcd_ioctl, /* ioctl */ slcd_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
slcd_poll /* poll */ slcd_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -250,6 +250,7 @@ static const struct file_operations tc_fops =
NULL, /* seek */ NULL, /* seek */
tc_ioctl, /* ioctl */ tc_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
tc_poll /* poll */ tc_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -182,6 +182,7 @@ static const struct file_operations g_lcdops =
NULL, /* seek */ NULL, /* seek */
lcd_ioctl, /* ioctl */ lcd_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
lcd_poll /* poll */ lcd_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -126,6 +126,7 @@ static const struct file_operations g_cryptofops =
NULL, /* seek */ NULL, /* seek */
cryptof_ioctl, /* ioctl */ cryptof_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
cryptof_poll /* poll */ cryptof_poll /* poll */
}; };
@ -138,6 +139,7 @@ static const struct file_operations g_cryptoops =
NULL, /* seek */ NULL, /* seek */
cryptoioctl, /* ioctl */ cryptoioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
NULL /* poll */ NULL /* poll */
}; };

View File

@ -73,6 +73,7 @@ static const struct file_operations g_adc_fops =
NULL, /* seek */ NULL, /* seek */
adc_ioctl, /* ioctl */ adc_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
adc_poll /* poll */ adc_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -66,6 +66,7 @@ static const struct file_operations comp_fops =
NULL, /* seek */ NULL, /* seek */
comp_ioctl, /* ioctl */ comp_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
comp_poll /* poll */ comp_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -79,6 +79,7 @@ const struct file_operations bch_fops =
bch_seek, /* seek */ bch_seek, /* seek */
bch_ioctl, /* ioctl */ bch_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
bch_poll /* poll */ bch_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, bch_unlink /* unlink */ , bch_unlink /* unlink */

View File

@ -136,6 +136,7 @@ static const struct file_operations g_canops =
NULL, /* seek */ NULL, /* seek */
can_ioctl, /* ioctl */ can_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
can_poll /* poll */ can_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -101,6 +101,7 @@ static const struct file_operations g_urand_fops =
NULL, /* seek */ NULL, /* seek */
NULL, /* ioctl */ NULL, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
devurand_poll /* poll */ devurand_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -100,6 +100,7 @@ static const struct file_operations i2cdrvr_fops =
NULL, /* seek */ NULL, /* seek */
i2cdrvr_ioctl, /* ioctl */ i2cdrvr_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
NULL /* poll */ NULL /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, i2cdrvr_unlink /* unlink */ , i2cdrvr_unlink /* unlink */

View File

@ -123,6 +123,7 @@ static const struct file_operations ads7843e_fops =
NULL, /* seek */ NULL, /* seek */
ads7843e_ioctl, /* ioctl */ ads7843e_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
ads7843e_poll /* poll */ ads7843e_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -136,6 +136,7 @@ static const struct file_operations ajoy_fops =
NULL, /* seek */ NULL, /* seek */
ajoy_ioctl, /* ioctl */ ajoy_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
ajoy_poll /* poll */ ajoy_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -134,6 +134,7 @@ static const struct file_operations btn_fops =
NULL, /* seek */ NULL, /* seek */
btn_ioctl, /* ioctl */ btn_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
btn_poll /* poll */ btn_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -225,6 +225,7 @@ static const struct file_operations g_mbr3108_fileops =
NULL, /* seek */ NULL, /* seek */
NULL, /* ioctl */ NULL, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
mbr3108_poll /* poll */ mbr3108_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -136,6 +136,7 @@ static const struct file_operations djoy_fops =
NULL, /* seek */ NULL, /* seek */
djoy_ioctl, /* ioctl */ djoy_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
djoy_poll /* poll */ djoy_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -177,6 +177,7 @@ static const struct file_operations ft5x06_fops =
NULL, /* seek */ NULL, /* seek */
ft5x06_ioctl, /* ioctl */ ft5x06_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
ft5x06_poll /* poll */ ft5x06_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -89,6 +89,7 @@ static const struct file_operations g_keyboard_fops =
NULL, /* seek */ NULL, /* seek */
NULL, /* ioctl */ NULL, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
keyboard_poll /* poll */ keyboard_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -116,6 +116,7 @@ static const struct file_operations max11802_fops =
NULL, /* seek */ NULL, /* seek */
max11802_ioctl, /* ioctl */ max11802_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
max11802_poll /* poll */ max11802_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -281,6 +281,7 @@ static const struct file_operations mxt_fops =
NULL, /* seek */ NULL, /* seek */
mxt_ioctl, /* ioctl */ mxt_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
mxt_poll /* poll */ mxt_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -256,6 +256,7 @@ static const struct file_operations g_hidkbd_fops =
NULL, /* seek */ NULL, /* seek */
NULL, /* ioctl */ NULL, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
spq10kbd_poll /* poll */ spq10kbd_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -125,6 +125,7 @@ static const struct file_operations g_stmpe811fops =
NULL, /* seek */ NULL, /* seek */
stmpe811_ioctl, /* ioctl */ stmpe811_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
stmpe811_poll /* poll */ stmpe811_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -91,6 +91,7 @@ static const struct file_operations g_touch_fops =
NULL, /* seek */ NULL, /* seek */
touch_ioctl, /* ioctl */ touch_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
touch_poll /* poll */ touch_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -210,6 +210,7 @@ static const struct file_operations tsc2007_fops =
NULL, /* seek */ NULL, /* seek */
tsc2007_ioctl, /* ioctl */ tsc2007_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
tsc2007_poll /* poll */ tsc2007_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -135,6 +135,7 @@ static const struct file_operations g_ft80x_fops =
NULL, /* seek */ NULL, /* seek */
ft80x_ioctl, /* ioctl */ ft80x_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
NULL /* poll */ NULL /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, ft80x_unlink /* unlink */ , ft80x_unlink /* unlink */

View File

@ -118,6 +118,7 @@ static const struct file_operations g_pcf8574_lcd_fops =
pcf8574_lcd_seek, /* seek */ pcf8574_lcd_seek, /* seek */
pcf8574_lcd_ioctl, /* ioctl */ pcf8574_lcd_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
pcf8574_lcd_poll /* poll */ pcf8574_lcd_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, pcf8574_lcd_unlink /* unlink */ , pcf8574_lcd_unlink /* unlink */

View File

@ -171,6 +171,7 @@ static const struct file_operations tda19988_fops =
tda19988_seek, /* seek */ tda19988_seek, /* seek */
tda19988_ioctl, /* ioctl */ tda19988_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
tda19988_poll /* poll */ tda19988_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, tda19988_unlink /* unlink */ , tda19988_unlink /* unlink */

View File

@ -182,8 +182,8 @@ static const struct file_operations g_ws2812fops =
/**************************************************************************** /****************************************************************************
* #### TODO #### * #### TODO ####
* *
* Consider supporting mmap by returning memory buffer using... * Consider supporting mmap by returning memory buffer using file_operations'
* file_ioctl(filep, FIOC_MMAP, (unsigned long)((uintptr_t)&addr)); * mmap
* Code using this would be non-portable across architectures as the format * Code using this would be non-portable across architectures as the format
* of the buffer can be different. * of the buffer can be different.
* *

View File

@ -58,6 +58,7 @@ static const struct file_operations devnull_fops =
NULL, /* seek */ NULL, /* seek */
NULL, /* ioctl */ NULL, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
devnull_poll /* poll */ devnull_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -58,6 +58,7 @@ static const struct file_operations devzero_fops =
NULL, /* seek */ NULL, /* seek */
NULL, /* ioctl */ NULL, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
devzero_poll /* poll */ devzero_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -166,6 +166,7 @@ const struct file_operations g_rpmsgdev_ops =
rpmsgdev_seek, /* seek */ rpmsgdev_seek, /* seek */
rpmsgdev_ioctl, /* ioctl */ rpmsgdev_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
rpmsgdev_poll /* poll */ rpmsgdev_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -78,6 +78,7 @@ static const struct file_operations g_alt1250fops =
NULL, /* seek */ NULL, /* seek */
alt1250_ioctl, /* ioctl */ alt1250_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
alt1250_poll, /* poll */ alt1250_poll, /* poll */
}; };
static uint8_t g_recvbuff[ALTCOM_RX_PKT_SIZE_MAX]; static uint8_t g_recvbuff[ALTCOM_RX_PKT_SIZE_MAX];

View File

@ -115,6 +115,7 @@ static const struct file_operations ubxmdm_fops =
NULL, /* seek */ NULL, /* seek */
ubxmdm_ioctl, /* ioctl */ ubxmdm_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
ubxmdm_poll /* poll */ ubxmdm_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -120,6 +120,7 @@ static const struct file_operations mtdconfig_fops =
NULL, /* seek */ NULL, /* seek */
mtdconfig_ioctl, /* ioctl */ mtdconfig_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
mtdconfig_poll /* poll */ mtdconfig_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -142,6 +142,7 @@ static const struct file_operations g_mtdnvs_fops =
NULL, /* Seek */ NULL, /* Seek */
mtdconfig_ioctl, /* Ioctl */ mtdconfig_ioctl, /* Ioctl */
NULL, /* Truncate */ NULL, /* Truncate */
NULL, /* Mmap */
mtdconfig_poll /* Poll */ mtdconfig_poll /* Poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* Unlink */ , NULL /* Unlink */

View File

@ -191,6 +191,7 @@ static const struct file_operations g_telnet_fops =
NULL, /* seek */ NULL, /* seek */
telnet_ioctl, /* ioctl */ telnet_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
telnet_poll /* poll */ telnet_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */
@ -206,6 +207,7 @@ static const struct file_operations g_factory_fops =
NULL, /* seek */ NULL, /* seek */
factory_ioctl, /* ioctl */ factory_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
NULL /* poll */ NULL /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -220,6 +220,7 @@ static const struct file_operations g_tun_file_ops =
NULL, /* seek */ NULL, /* seek */
tun_ioctl, /* ioctl */ tun_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
tun_poll /* poll */ tun_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -48,6 +48,7 @@ static const struct file_operations g_fifo_fops =
NULL, /* seek */ NULL, /* seek */
pipecommon_ioctl, /* ioctl */ pipecommon_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
pipecommon_poll /* poll */ pipecommon_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, pipecommon_unlink /* unlink */ , pipecommon_unlink /* unlink */

View File

@ -62,6 +62,7 @@ static const struct file_operations g_pipe_fops =
NULL, /* seek */ NULL, /* seek */
pipecommon_ioctl, /* ioctl */ pipecommon_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
pipecommon_poll /* poll */ pipecommon_poll /* poll */
}; };

View File

@ -92,6 +92,7 @@ static const struct file_operations g_batteryops =
NULL, /* seek */ NULL, /* seek */
bat_charger_ioctl, /* ioctl */ bat_charger_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
bat_charger_poll /* poll */ bat_charger_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -94,6 +94,7 @@ static const struct file_operations g_batteryops =
NULL, /* seek */ NULL, /* seek */
bat_gauge_ioctl, /* ioctl */ bat_gauge_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
bat_gauge_poll /* poll */ bat_gauge_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -93,6 +93,7 @@ static const struct file_operations g_batteryops =
NULL, /* seek */ NULL, /* seek */
bat_monitor_ioctl, /* ioctl */ bat_monitor_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
bat_monitor_poll /* poll */ bat_monitor_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -104,6 +104,7 @@ static const struct file_operations g_lirc_fops =
NULL, /* seek */ NULL, /* seek */
lirc_ioctl, /* ioctl */ lirc_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
lirc_poll /* poll */ lirc_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -117,6 +117,7 @@ static const struct file_operations g_aht10fops =
NULL, /* seek */ NULL, /* seek */
aht10_ioctl, /* ioctl */ aht10_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
NULL /* poll */ NULL /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, aht10_unlink /* unlink */ , aht10_unlink /* unlink */

View File

@ -91,6 +91,7 @@ static const struct file_operations g_hcsr04ops =
NULL, /* seek */ NULL, /* seek */
hcsr04_ioctl, /* ioctl */ hcsr04_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
hcsr04_poll /* poll */ hcsr04_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -162,6 +162,7 @@ static const struct file_operations g_hdc1008fops =
NULL, /* seek */ NULL, /* seek */
hdc1008_ioctl, /* ioctl */ hdc1008_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
NULL /* poll */ NULL /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, hdc1008_unlink /* unlink */ , hdc1008_unlink /* unlink */

View File

@ -158,6 +158,7 @@ static const struct file_operations g_humidityops =
NULL, /* seek */ NULL, /* seek */
hts221_ioctl, /* ioctl */ hts221_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
hts221_poll /* poll */ hts221_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -155,6 +155,7 @@ static const struct file_operations g_lis2dhops =
NULL, /* seek */ NULL, /* seek */
lis2dh_ioctl, /* ioctl */ lis2dh_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
lis2dh_poll /* poll */ lis2dh_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -113,6 +113,7 @@ static const struct file_operations g_alsops =
NULL, /* seek */ NULL, /* seek */
max44009_ioctl, /* ioctl */ max44009_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
max44009_poll /* poll */ max44009_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -183,6 +183,7 @@ static const struct file_operations g_scd30fops =
NULL, /* seek */ NULL, /* seek */
scd30_ioctl, /* ioctl */ scd30_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
NULL /* poll */ NULL /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, scd30_unlink /* unlink */ , scd30_unlink /* unlink */

View File

@ -191,6 +191,7 @@ static const struct file_operations g_scd41fops =
NULL, /* seek */ NULL, /* seek */
scd41_ioctl, /* ioctl */ scd41_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
NULL /* poll */ NULL /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, scd41_unlink /* unlink */ , scd41_unlink /* unlink */

View File

@ -168,6 +168,7 @@ static const struct file_operations g_sensor_fops =
NULL, /* seek */ NULL, /* seek */
sensor_ioctl, /* ioctl */ sensor_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
sensor_poll /* poll */ sensor_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -160,6 +160,7 @@ static const struct file_operations g_sgp30fops =
NULL, /* seek */ NULL, /* seek */
sgp30_ioctl, /* ioctl */ sgp30_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
NULL /* poll */ NULL /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, sgp30_unlink /* unlink */ , sgp30_unlink /* unlink */

View File

@ -132,6 +132,7 @@ static const struct file_operations g_sht21fops =
NULL, /* seek */ NULL, /* seek */
sht21_ioctl, /* ioctl */ sht21_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
NULL /* poll */ NULL /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, sht21_unlink /* unlink */ , sht21_unlink /* unlink */

View File

@ -171,6 +171,7 @@ static const struct file_operations g_sht3xfops =
NULL, /* seek */ NULL, /* seek */
sht3x_ioctl, /* ioctl */ sht3x_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
NULL /* poll */ NULL /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, sht3x_unlink /* unlink */ , sht3x_unlink /* unlink */

View File

@ -176,6 +176,7 @@ static const struct file_operations g_sps30fops =
NULL, /* seek */ NULL, /* seek */
sps30_ioctl, /* ioctl */ sps30_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
NULL /* poll */ NULL /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, sps30_unlink /* unlink */ , sps30_unlink /* unlink */

View File

@ -82,6 +82,7 @@ static const struct file_operations g_usensor_fops =
NULL, /* seek */ NULL, /* seek */
usensor_ioctl, /* ioctl */ usensor_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
NULL, /* poll */ NULL, /* poll */
}; };

View File

@ -128,6 +128,7 @@ static const struct file_operations g_pty_fops =
NULL, /* seek */ NULL, /* seek */
pty_ioctl, /* ioctl */ pty_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
pty_poll /* poll */ pty_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, pty_unlink /* unlink */ , pty_unlink /* unlink */

View File

@ -127,6 +127,7 @@ static const struct file_operations g_serialops =
NULL, /* seek */ NULL, /* seek */
uart_ioctl, /* ioctl */ uart_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
uart_poll /* poll */ uart_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -91,6 +91,7 @@ static const struct file_operations g_uart_bth4_ops =
NULL, /* seek */ NULL, /* seek */
uart_bth4_ioctl, /* ioctl */ uart_bth4_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
uart_bth4_poll /* poll */ uart_bth4_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -100,6 +100,7 @@ static const struct file_operations spidrvr_fops =
NULL, /* seek */ NULL, /* seek */
spidrvr_ioctl, /* ioctl */ spidrvr_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
NULL /* poll */ NULL /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, spidrvr_unlink /* unlink */ , spidrvr_unlink /* unlink */

View File

@ -128,6 +128,7 @@ static const struct file_operations g_spislavefops =
NULL, /* seek */ NULL, /* seek */
NULL, /* ioctl */ NULL, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
NULL /* poll */ NULL /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, spi_slave_unlink /* unlink */ , spi_slave_unlink /* unlink */

View File

@ -115,6 +115,7 @@ static const struct file_operations g_ramlogfops =
NULL, /* seek */ NULL, /* seek */
ramlog_file_ioctl, /* ioctl */ ramlog_file_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
ramlog_file_poll /* poll */ ramlog_file_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -130,6 +130,7 @@ static const struct file_operations rtc_fops =
NULL, /* seek */ NULL, /* seek */
rtc_ioctl, /* ioctl */ rtc_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
NULL /* poll */ NULL /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, rtc_unlink /* unlink */ , rtc_unlink /* unlink */

View File

@ -255,6 +255,7 @@ static const struct file_operations g_adb_fops =
NULL, /* seek */ NULL, /* seek */
NULL, /* ioctl */ NULL, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
adb_char_poll /* poll */ adb_char_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -348,6 +348,7 @@ static const struct file_operations cdcwdm_fops =
NULL, /* seek */ NULL, /* seek */
NULL, /* ioctl */ NULL, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
cdcwdm_poll /* poll */ cdcwdm_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -342,6 +342,7 @@ static const struct file_operations g_hidkbd_fops =
NULL, /* seek */ NULL, /* seek */
NULL, /* ioctl */ NULL, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
usbhost_poll /* poll */ usbhost_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -392,6 +392,7 @@ static const struct file_operations g_hidmouse_fops =
NULL, /* seek */ NULL, /* seek */
NULL, /* ioctl */ NULL, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
usbhost_poll /* poll */ usbhost_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -297,6 +297,7 @@ static const struct file_operations g_xboxcontroller_fops =
NULL, /* seek */ NULL, /* seek */
usbhost_ioctl, /* ioctl */ usbhost_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
usbhost_poll /* poll */ usbhost_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -95,6 +95,7 @@ static const struct file_operations g_fusb301ops =
NULL, /* seek */ NULL, /* seek */
fusb301_ioctl, /* ioctl */ fusb301_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
fusb301_poll /* poll */ fusb301_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -129,6 +129,7 @@ static const struct file_operations g_fusb303ops =
NULL, /* seek */ NULL, /* seek */
fusb303_ioctl, /* ioctl */ fusb303_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
fusb303_poll /* poll */ fusb303_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -104,6 +104,7 @@ static const struct file_operations g_usrsockdevops =
usrsockdev_seek, /* seek */ usrsockdev_seek, /* seek */
NULL, /* ioctl */ NULL, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
usrsockdev_poll /* poll */ usrsockdev_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -39,6 +39,7 @@
#include <nuttx/fs/fs.h> #include <nuttx/fs/fs.h>
#include <nuttx/fs/ioctl.h> #include <nuttx/fs/ioctl.h>
#include <nuttx/video/fb.h> #include <nuttx/video/fb.h>
#include <nuttx/mm/map.h>
/**************************************************************************** /****************************************************************************
* Private Types * Private Types
@ -70,6 +71,8 @@ static ssize_t fb_write(FAR struct file *filep, FAR const char *buffer,
size_t buflen); size_t buflen);
static off_t fb_seek(FAR struct file *filep, off_t offset, int whence); 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_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, static int fb_poll(FAR struct file *filep, FAR struct pollfd *fds,
bool setup); bool setup);
@ -86,6 +89,7 @@ static const struct file_operations fb_fops =
fb_seek, /* seek */ fb_seek, /* seek */
fb_ioctl, /* ioctl */ fb_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
fb_mmap, /* mmap */
fb_poll /* poll */ fb_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */
@ -282,18 +286,6 @@ static int fb_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
switch (cmd) 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 */ case FBIOGET_VIDEOINFO: /* Get color plane info */
{ {
FAR struct fb_videoinfo_s *vinfo = 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; 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 * Name: fb_poll
* *

View File

@ -38,6 +38,7 @@
#include <nuttx/video/imgsensor.h> #include <nuttx/video/imgsensor.h>
#include <nuttx/video/imgdata.h> #include <nuttx/video/imgdata.h>
#include <nuttx/mm/map.h>
#include "video_framebuff.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, static ssize_t video_write(FAR struct file *filep,
FAR const char *buffer, size_t buflen); FAR const char *buffer, size_t buflen);
static int video_ioctl(FAR struct file *filep, int cmd, unsigned long arg); 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 */ /* Common function */
@ -285,6 +288,7 @@ static const struct file_operations g_video_fops =
NULL, /* seek */ NULL, /* seek */
video_ioctl, /* ioctl */ video_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
video_mmap, /* mmap */
NULL /* poll */ NULL /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , 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); (FAR struct v4s_ext_controls_scene *)arg);
break; break;
case FIOC_MMAP:
DEBUGASSERT((FAR void **)(uintptr_t)arg != NULL);
*(FAR void **)((uintptr_t)arg) = priv->video_inf.bufheap;
ret = OK;
break;
default: default:
verr("Unrecognized cmd: %d\n", cmd); verr("Unrecognized cmd: %d\n", cmd);
ret = - ENOTTY; ret = - ENOTTY;
@ -3201,6 +3198,21 @@ static int video_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
return ret; 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) static FAR void *video_register(FAR const char *devpath)
{ {
FAR video_mng_t *priv; FAR video_mng_t *priv;

View File

@ -306,6 +306,7 @@ static const struct file_operations g_cc1101ops =
NULL, /* seek */ NULL, /* seek */
NULL, /* ioctl */ NULL, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
cc1101_file_poll /* poll */ cc1101_file_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -232,6 +232,7 @@ static const struct file_operations g_gs2200m_fops =
NULL, /* seek */ NULL, /* seek */
gs2200m_ioctl, /* ioctl */ gs2200m_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
gs2200m_poll /* poll */ gs2200m_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -452,6 +452,7 @@ static const struct file_operations sx127x_fops =
NULL, /* seek */ NULL, /* seek */
sx127x_ioctl, /* ioctl */ sx127x_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
sx127x_poll /* poll */ sx127x_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -240,6 +240,7 @@ static const struct file_operations nrf24l01_fops =
NULL, /* seek */ NULL, /* seek */
nrf24l01_ioctl, /* ioctl */ nrf24l01_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
nrf24l01_poll /* poll */ nrf24l01_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -110,6 +110,7 @@ const struct mountpt_operations binfs_operations =
NULL, /* seek */ NULL, /* seek */
binfs_ioctl, /* ioctl */ binfs_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
NULL, /* sync */ NULL, /* sync */
binfs_dup, /* dup */ binfs_dup, /* dup */

View File

@ -185,6 +185,7 @@ const struct mountpt_operations cromfs_operations =
NULL, /* seek */ NULL, /* seek */
cromfs_ioctl, /* ioctl */ cromfs_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
NULL, /* sync */ NULL, /* sync */
cromfs_dup, /* dup */ cromfs_dup, /* dup */

View File

@ -116,6 +116,7 @@ const struct mountpt_operations fat_operations =
fat_seek, /* seek */ fat_seek, /* seek */
fat_ioctl, /* ioctl */ fat_ioctl, /* ioctl */
fat_truncate, /* truncate */ fat_truncate, /* truncate */
NULL, /* mmap */
fat_sync, /* sync */ fat_sync, /* sync */
fat_dup, /* dup */ fat_dup, /* dup */
fat_fstat, /* fstat */ fat_fstat, /* fstat */

View File

@ -143,6 +143,7 @@ const struct mountpt_operations hostfs_operations =
hostfs_seek, /* seek */ hostfs_seek, /* seek */
hostfs_ioctl, /* ioctl */ hostfs_ioctl, /* ioctl */
hostfs_ftruncate, /* ftruncate */ hostfs_ftruncate, /* ftruncate */
NULL, /* mmap */
hostfs_sync, /* sync */ hostfs_sync, /* sync */
hostfs_dup, /* dup */ hostfs_dup, /* dup */

View File

@ -141,6 +141,7 @@ const struct mountpt_operations littlefs_operations =
littlefs_seek, /* seek */ littlefs_seek, /* seek */
littlefs_ioctl, /* ioctl */ littlefs_ioctl, /* ioctl */
littlefs_truncate, /* truncate */ littlefs_truncate, /* truncate */
NULL, /* mmap */
littlefs_sync, /* sync */ littlefs_sync, /* sync */
littlefs_dup, /* dup */ littlefs_dup, /* dup */

View File

@ -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 1. mmap can be used to support eXecute In Place (XIP) on random access media
under the following very restrictive conditions: 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 system that maps files contiguously on the media should support
this ioctl. (vs. file system that scatter files over the media this ioctl. (vs. file system that scatter files over the media
in non-contiguous sectors). As of this writing, ROMFS is the in non-contiguous sectors). As of this writing, ROMFS is the

View File

@ -23,6 +23,7 @@
****************************************************************************/ ****************************************************************************/
#include <nuttx/config.h> #include <nuttx/config.h>
#include <nuttx/mm/map.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/mman.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, size_t length, int prot, int flags,
off_t offset, bool kernel, FAR void **mapped) off_t offset, bool kernel, FAR void **mapped)
{ {
FAR void *addr;
int ret; int ret;
/* Since only a tiny subset of mmap() functionality, we have to verify many /* 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 #endif
} }
/* Perform the ioctl to get the base address of the file in 'mapped' /* Call driver's mmap to get the base address of the file in 'mapped'
* in memory. (casting to uintptr_t first eliminates complaints on some * in memory.
* architectures where the sizeof long is different from the size of
* a pointer).
*/ */
ret = file_ioctl(filep, FIOC_MMAP, (unsigned long)((uintptr_t)&addr)); if (filep->f_inode && filep->f_inode->u.i_ops->mmap != NULL)
if (ret < 0) {
/* 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 directly mappable, probably because the underlying media does
* not support random access. * 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); return rammap(filep, length, offset, kernel, mapped);
#else #else
ferr("ERROR: file_ioctl(FIOC_MMAP) failed: %d\n", ret); ferr("ERROR: mmap not supported \n");
return ret; return -ENOSYS;
#endif #endif
} }
/* Return the offset address */ /* Return */
*mapped = (FAR void *)(((FAR uint8_t *)addr) + offset); return ret;
return OK;
} }
/**************************************************************************** /****************************************************************************
@ -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 * 1. mmap() is the API that is used to support direct access to random
* access media under the following very restrictive conditions: * 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 * system that maps files contiguously on the media should support
* this ioctl. (vs. file system that scatter files over the media * this ioctl. (vs. file system that scatter files over the media
* in non-contiguous sectors). As of this writing, ROMFS is the * in non-contiguous sectors). As of this writing, ROMFS is the

View File

@ -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 * 1. mmap() is the API that is used to support direct access to random
* access media under the following very restrictive conditions: * 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 * system that maps files contiguously on the media should support
* this ioctl. (vs. file system that scatter files over the media * this ioctl. (vs. file system that scatter files over the media
* in non-contiguous sectors). As of this writing, ROMFS is the * in non-contiguous sectors). As of this writing, ROMFS is the

View File

@ -61,6 +61,7 @@ static const struct file_operations g_nxmq_fileops =
NULL, /* seek */ NULL, /* seek */
NULL, /* ioctl */ NULL, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
nxmq_file_poll /* poll */ nxmq_file_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

View File

@ -199,6 +199,7 @@ const struct mountpt_operations nfs_operations =
NULL, /* seek */ NULL, /* seek */
NULL, /* ioctl */ NULL, /* ioctl */
nfs_truncate, /* truncate */ nfs_truncate, /* truncate */
NULL, /* mmap */
NULL, /* sync */ NULL, /* sync */
nfs_dup, /* dup */ nfs_dup, /* dup */

View File

@ -59,6 +59,7 @@ const struct mountpt_operations nxffs_operations =
#else #else
NULL, /* truncate */ NULL, /* truncate */
#endif #endif
NULL, /* mmap */
NULL, /* sync -- No buffered data */ NULL, /* sync -- No buffered data */
nxffs_dup, /* dup */ nxffs_dup, /* dup */

View File

@ -253,6 +253,7 @@ const struct mountpt_operations procfs_operations =
NULL, /* seek */ NULL, /* seek */
procfs_ioctl, /* ioctl */ procfs_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
NULL, /* sync */ NULL, /* sync */
procfs_dup, /* dup */ procfs_dup, /* dup */

View File

@ -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 off_t romfs_seek(FAR struct file *filep, off_t offset, int whence);
static int romfs_ioctl(FAR struct file *filep, int cmd, static int romfs_ioctl(FAR struct file *filep, int cmd,
unsigned long arg); 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, static int romfs_dup(FAR const struct file *oldp,
FAR struct file *newp); FAR struct file *newp);
@ -120,12 +122,12 @@ const struct mountpt_operations romfs_operations =
romfs_seek, /* seek */ romfs_seek, /* seek */
romfs_ioctl, /* ioctl */ romfs_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
romfs_mmap, /* mmap */
NULL, /* sync */ NULL, /* sync */
romfs_dup, /* dup */ romfs_dup, /* dup */
romfs_fstat, /* fstat */ romfs_fstat, /* fstat */
NULL, /* fchstat */ NULL, /* fchstat */
NULL, /* truncate */
romfs_opendir, /* opendir */ romfs_opendir, /* opendir */
romfs_closedir, /* closedir */ romfs_closedir, /* closedir */
@ -578,9 +580,7 @@ errout_with_lock:
static int romfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg) 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 struct romfs_file_s *rf;
FAR void **ppv = (FAR void**)arg;
finfo("cmd: %d arg: %08lx\n", cmd, 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 */ /* Recover our private data from the struct file instance */
rf = filep->f_priv; rf = filep->f_priv;
rm = filep->f_inode->i_private;
DEBUGASSERT(rm != NULL);
/* Only one ioctl command is supported */ /* Only one ioctl command is supported */
if (cmd == FIOC_MMAP && rm->rm_xipbase && ppv) if (cmd == FIOC_FILEPATH)
{
/* 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)
{ {
FAR char *ptr = (FAR char *)((uintptr_t)arg); FAR char *ptr = (FAR char *)((uintptr_t)arg);
inode_getpath(filep->f_inode, ptr); 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; 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 * Name: romfs_dup
****************************************************************************/ ****************************************************************************/

View File

@ -162,6 +162,7 @@ const struct mountpt_operations rpmsgfs_operations =
rpmsgfs_seek, /* seek */ rpmsgfs_seek, /* seek */
rpmsgfs_ioctl, /* ioctl */ rpmsgfs_ioctl, /* ioctl */
rpmsgfs_ftruncate, /* ftruncate */ rpmsgfs_ftruncate, /* ftruncate */
NULL, /* mmap */
rpmsgfs_sync, /* sync */ rpmsgfs_sync, /* sync */
rpmsgfs_dup, /* dup */ rpmsgfs_dup, /* dup */

View File

@ -141,6 +141,7 @@ const struct mountpt_operations smartfs_operations =
smartfs_seek, /* seek */ smartfs_seek, /* seek */
smartfs_ioctl, /* ioctl */ smartfs_ioctl, /* ioctl */
smartfs_truncate, /* truncate */ smartfs_truncate, /* truncate */
NULL, /* mmap */
smartfs_sync, /* sync */ smartfs_sync, /* sync */
smartfs_dup, /* dup */ smartfs_dup, /* dup */

View File

@ -65,6 +65,7 @@ static const struct file_operations g_sock_fileops =
NULL, /* seek */ NULL, /* seek */
sock_file_ioctl, /* ioctl */ sock_file_ioctl, /* ioctl */
NULL, /* truncate */ NULL, /* truncate */
NULL, /* mmap */
sock_file_poll /* poll */ sock_file_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */ , NULL /* unlink */

Some files were not shown because too many files have changed in this diff Show More