Commit c67ca9e
committed
mmap: support for devdax and block devices
metadata.len() returns 0 when trying to mmap files such as block
devices and devdax (character devices) that are not regular files,
hence returning MappingPastEof even if the mapping would fit at the
provided file_offset.
This patch adds support for checking the size of devdax and block
devices, and returns a new error, InvalidFileType, if the mmap being
created is not for a regular file, block or devdax device, or if the
size the devices couldn't be found in sysfs.
Usecase:
Devdax and block devices can be used in cloud-hypervisor as
memory-zone. MmapRegion::build from vm-memory is called while
creating a GuestRegionMmap for the VM memory-zone.
Reviewed-by: Fam Zheng <[email protected]>
Signed-off-by: Usama Arif <[email protected]>1 parent f6ef1b6 commit c67ca9e
2 files changed
+65
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
20 | 26 | | |
21 | 27 | | |
22 | 28 | | |
| |||
106 | 112 | | |
107 | 113 | | |
108 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
109 | 165 | | |
110 | 166 | | |
111 | 167 | | |
| |||
119 | 175 | | |
120 | 176 | | |
121 | 177 | | |
122 | | - | |
123 | | - | |
124 | | - | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
125 | 181 | | |
126 | 182 | | |
| 183 | + | |
| 184 | + | |
127 | 185 | | |
128 | 186 | | |
129 | | - | |
| 187 | + | |
130 | 188 | | |
131 | 189 | | |
132 | 190 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| |||
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
| 55 | + | |
53 | 56 | | |
54 | 57 | | |
55 | 58 | | |
| |||
0 commit comments