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
@@ -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
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+2
View File
@@ -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 */
};
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+2 -2
View File
@@ -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.
*
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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];
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+2
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -62,6 +62,7 @@ static const struct file_operations g_pipe_fops =
NULL, /* seek */
pipecommon_ioctl, /* ioctl */
NULL, /* truncate */
NULL, /* mmap */
pipecommon_poll /* poll */
};
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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 */

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