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:
parent
41e9df2f3e
commit
f33dc4df3f
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
};
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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];
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -62,6 +62,7 @@ static const struct file_operations g_pipe_fops =
|
||||
NULL, /* seek */
|
||||
pipecommon_ioctl, /* ioctl */
|
||||
NULL, /* truncate */
|
||||
NULL, /* mmap */
|
||||
pipecommon_poll /* poll */
|
||||
};
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -82,6 +82,7 @@ static const struct file_operations g_usensor_fops =
|
||||
NULL, /* seek */
|
||||
usensor_ioctl, /* ioctl */
|
||||
NULL, /* truncate */
|
||||
NULL, /* mmap */
|
||||
NULL, /* poll */
|
||||
};
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
*
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -110,6 +110,7 @@ const struct mountpt_operations binfs_operations =
|
||||
NULL, /* seek */
|
||||
binfs_ioctl, /* ioctl */
|
||||
NULL, /* truncate */
|
||||
NULL, /* mmap */
|
||||
|
||||
NULL, /* sync */
|
||||
binfs_dup, /* dup */
|
||||
|
@ -185,6 +185,7 @@ const struct mountpt_operations cromfs_operations =
|
||||
NULL, /* seek */
|
||||
cromfs_ioctl, /* ioctl */
|
||||
NULL, /* truncate */
|
||||
NULL, /* mmap */
|
||||
|
||||
NULL, /* sync */
|
||||
cromfs_dup, /* dup */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -199,6 +199,7 @@ const struct mountpt_operations nfs_operations =
|
||||
NULL, /* seek */
|
||||
NULL, /* ioctl */
|
||||
nfs_truncate, /* truncate */
|
||||
NULL, /* mmap */
|
||||
|
||||
NULL, /* sync */
|
||||
nfs_dup, /* dup */
|
||||
|
@ -59,6 +59,7 @@ const struct mountpt_operations nxffs_operations =
|
||||
#else
|
||||
NULL, /* truncate */
|
||||
#endif
|
||||
NULL, /* mmap */
|
||||
|
||||
NULL, /* sync -- No buffered data */
|
||||
nxffs_dup, /* dup */
|
||||
|
@ -253,6 +253,7 @@ const struct mountpt_operations procfs_operations =
|
||||
NULL, /* seek */
|
||||
procfs_ioctl, /* ioctl */
|
||||
NULL, /* truncate */
|
||||
NULL, /* mmap */
|
||||
|
||||
NULL, /* sync */
|
||||
procfs_dup, /* dup */
|
||||
|
@ -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
|
||||
****************************************************************************/
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user