@@ -18,7 +18,6 @@ use std::ffi::c_void;
18
18
use std:: fs:: File ;
19
19
use std:: io:: { Read , Write } ;
20
20
use std:: num:: NonZero ;
21
- use std:: os:: fd:: RawFd ;
22
21
use std:: os:: unix:: io:: { AsRawFd , FromRawFd , IntoRawFd } ;
23
22
use std:: os:: unix:: net:: UnixStream ;
24
23
use std:: ptr;
@@ -28,47 +27,10 @@ use std::time::Duration;
28
27
use serde:: { Deserialize , Serialize } ;
29
28
use serde_json:: { Deserializer , StreamDeserializer } ;
30
29
use userfaultfd:: { Error , Event , Uffd } ;
31
- use vmm_sys_util:: ioctl:: ioctl_with_mut_ref;
32
- use vmm_sys_util:: ioctl_iowr_nr;
33
30
use vmm_sys_util:: sock_ctrl_msg:: ScmSocket ;
34
31
35
32
use crate :: uffd_utils:: userfault_bitmap:: UserfaultBitmap ;
36
33
37
- // TODO: remove when UFFDIO_CONTINUE for guest_memfd is available in the crate
38
- #[ repr( C ) ]
39
- struct uffdio_continue {
40
- range : uffdio_range ,
41
- mode : u64 ,
42
- mapped : u64 ,
43
- }
44
-
45
- ioctl_iowr_nr ! ( UFFDIO_CONTINUE , 0xAA , 0x7 , uffdio_continue) ;
46
-
47
- #[ repr( C ) ]
48
- struct uffdio_range {
49
- start : u64 ,
50
- len : u64 ,
51
- }
52
-
53
- pub fn uffd_continue ( uffd : RawFd , fault_addr : u64 , len : u64 ) -> std:: io:: Result < ( ) > {
54
- let mut cont = uffdio_continue {
55
- range : uffdio_range {
56
- start : fault_addr,
57
- len,
58
- } ,
59
- mode : 0 , // Normal continuation mode
60
- mapped : 0 ,
61
- } ;
62
-
63
- let ret = unsafe { ioctl_with_mut_ref ( & uffd, UFFDIO_CONTINUE ( ) , & mut cont) } ;
64
-
65
- if ret == -1 {
66
- return Err ( std:: io:: Error :: last_os_error ( ) ) ;
67
- }
68
-
69
- Ok ( ( ) )
70
- }
71
-
72
34
// This is the same with the one used in src/vmm.
73
35
/// This describes the mapping between Firecracker base virtual address and offset in the
74
36
/// buffer or file backend for a guest memory region. It is used to tell an external
@@ -440,7 +402,9 @@ impl UffdHandler {
440
402
. unwrap ( )
441
403
. reset_addr_range ( offset, len) ;
442
404
443
- uffd_continue ( self . uffd . as_raw_fd ( ) , dst, len as u64 ) . expect ( "uffd_continue" ) ;
405
+ self . uffd
406
+ . r#continue ( dst as _ , len, true )
407
+ . expect ( "uffd_continue" ) ;
444
408
445
409
true
446
410
}
0 commit comments