@@ -14,47 +14,16 @@ See the License for the specific language governing permissions and
1414limitations under the License.
1515*/
1616
17- #![ allow( dead_code, unused_variables, unused_imports) ]
18- use std:: sync:: Arc ;
19-
2017use tracing:: { Span , instrument} ;
2118
22- #[ cfg( target_os = "windows" ) ]
23- pub use super :: WindowsDirtyPageTracker as PlatformDirtyPageTracker ;
2419#[ cfg( target_os = "linux" ) ]
2520pub use super :: linux_dirty_page_tracker:: LinuxDirtyPageTracker as PlatformDirtyPageTracker ;
21+ #[ cfg( target_os = "windows" ) ]
22+ pub use super :: windows_dirty_page_tracker:: WindowsDirtyPageTracker as PlatformDirtyPageTracker ;
2623use crate :: Result ;
2724
2825/// Trait defining the interface for dirty page tracking implementations
2926pub trait DirtyPageTracking {
30- // /// Start tracking dirty pages
31- // fn start_tracking(&self) -> Result<()>;
32-
33- // /// Stop tracking dirty pages
34- // fn stop_tracking(&self) -> Result<()>;
35-
36- // /// Take a snapshot of only the dirty pages
37- // fn take_new_snapshot(&self) -> Result<()>;
38-
39- // /// Restore memory from the snapshot of dirty pages
40- // fn restore_from_snapshot(&self) -> Result<()>;
41-
42- // /// Check if tracking is currently active
43- // fn is_tracking_active(&self) -> bool;
44-
45- // /// Get the base address of the tracked region
46- // fn base_addr(&self) -> usize;
47-
48- // /// Get the size of the tracked region
49- // fn size(&self) -> usize;
50-
51- // /// Get the number of pages in the tracked region
52- // fn num_pages(&self) -> usize;
53-
54- // /// Add pages to the last snapshot
55- // /// This is used to update the snapshot with new dirty pages from hypervisor dirty page tracking
56- // fn add_pages_to_last_snapshot(&self, pages: &[usize]) -> Result<()>;
57-
5827 fn get_dirty_pages ( self ) -> Vec < usize > ;
5928}
6029
@@ -66,61 +35,13 @@ pub struct DirtyPageTracker {
6635impl DirtyPageTracker {
6736 /// Create a new dirty page tracker for the given memory region
6837 #[ instrument( skip_all, parent = Span :: current( ) , level = "Trace" ) ]
69- #[ cfg( target_os = "linux" ) ]
7038 pub fn new ( base_addr : usize , size : usize ) -> Result < Self > {
7139 let inner = PlatformDirtyPageTracker :: new ( base_addr, size) ?;
7240 Ok ( Self { inner } )
7341 }
74-
75- /// Create a new tracker with a Windows file mapping handle (Windows only)
76- #[ cfg( target_os = "windows" ) ]
77- #[ instrument( skip_all, parent = Span :: current( ) , level = "Trace" ) ]
78- pub fn new_with_handle (
79- base_addr : usize ,
80- size : usize ,
81- handle : windows:: Win32 :: Foundation :: HANDLE ,
82- ) -> Result < Arc < Self > > {
83- let inner = PlatformDirtyPageTracker :: new_with_handle ( base_addr, size, handle) ?;
84- Ok ( Arc :: new ( Self { inner } ) )
85- }
8642}
8743
8844impl DirtyPageTracking for DirtyPageTracker {
89- // fn start_tracking(&self) -> Result<()> {
90- // self.inner.start_tracking()
91- // }
92-
93- // fn stop_tracking(&self) -> Result<()> {
94- // self.inner.stop_tracking()
95- // }
96-
97- // fn take_new_snapshot(&self) -> Result<()> {
98- // self.inner.take_new_snapshot()
99- // }
100-
101- // fn restore_from_snapshot(&self) -> Result<()> {
102- // self.inner.restore_from_snapshot()
103- // }
104-
105- // fn is_tracking_active(&self) -> bool {
106- // self.inner.is_tracking_active()
107- // }
108-
109- // fn base_addr(&self) -> usize {
110- // self.inner.base_addr()
111- // }
112-
113- // fn size(&self) -> usize {
114- // self.inner.size()
115- // }
116-
117- // fn num_pages(&self) -> usize {
118- // self.inner.num_pages()
119- // }
120-
121- // fn add_pages_to_last_snapshot(&self, pages: &[usize]) -> Result<()> {
122- // self.inner.add_pages_to_last_snapshot(pages)
123- // }
12445 fn get_dirty_pages ( self ) -> Vec < usize > {
12546 self . inner . get_dirty_pages ( )
12647 }
0 commit comments