From 4f0922229b36e6d3cd3c0e9335a9fe5324fb33eb Mon Sep 17 00:00:00 2001 From: LouiseX-10 Date: Tue, 21 Feb 2023 18:21:59 -0800 Subject: [PATCH 1/3] clean up comments --- src/address_space.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/address_space.rs b/src/address_space.rs index 8bbf908..b57df65 100644 --- a/src/address_space.rs +++ b/src/address_space.rs @@ -79,14 +79,14 @@ impl AddressSpace { /// Look up the DataSource and offset within that DataSource for a /// VirtualAddress / AccessType in this AddressSpace - /// + /// /// # Errors /// If this VirtualAddress does not have a valid mapping in &self, /// or if this AccessType is not permitted by the mapping pub fn get_source_for_addr( &self, addr: VirtualAddress, - access_type: FlagBuilder + access_type: FlagBuilder, ) -> Result<(&D, usize), &str> { todo!(); } @@ -96,7 +96,7 @@ impl AddressSpace { /// /// We recommend using this builder type as follows: /// ``` -/// # use reedos_address_space::FlagBuilder; +/// /// let flags = FlagBuilder::new() /// .toggle_read() /// .toggle_write(); @@ -194,7 +194,7 @@ impl FlagBuilder { /// You can think of this as `self &! other` on each field. /// /// ``` - /// # use reedos_address_space::FlagBuilder; + /// /// let read_execute = FlagBuilder::read().toggle_execute(); /// let execute = FlagBuilder::execute(); /// let new = read_execute.but_not(execute); @@ -218,4 +218,3 @@ impl FlagBuilder { } } } - From 1201a739916b27dfafa2288eb551c10e8613dd34 Mon Sep 17 00:00:00 2001 From: LouiseX-10 Date: Tue, 21 Feb 2023 18:32:59 -0800 Subject: [PATCH 2/3] distinguish remove_map_at and remove_map --- src/address_space.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/address_space.rs b/src/address_space.rs index b57df65..277af41 100644 --- a/src/address_space.rs +++ b/src/address_space.rs @@ -65,11 +65,19 @@ impl AddressSpace { todo!() } + /// Remove the mapping to `DataSource` from this `AddressSpace` + /// + /// # Errors + /// If the mapping could not be removed. + pub fn remove_mapping(&self, source: &D) -> Result<(), &str> { + todo!() + } + /// Remove the mapping to `DataSource` that starts at the given address. /// /// # Errors /// If the mapping could not be removed. - pub fn remove_mapping( + pub fn remove_mapping_at( &self, source: &D, start: VirtualAddress, From 077fa2694ffdd1a62876728fa95abb9f1d52a5c2 Mon Sep 17 00:00:00 2001 From: LouiseX-10 Date: Tue, 21 Feb 2023 18:36:55 -0800 Subject: [PATCH 3/3] add comment for remove_mapping --- src/address_space.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/address_space.rs b/src/address_space.rs index 277af41..4f8051e 100644 --- a/src/address_space.rs +++ b/src/address_space.rs @@ -66,6 +66,7 @@ impl AddressSpace { } /// Remove the mapping to `DataSource` from this `AddressSpace` + /// Figure out corresponding virtual address in body of this function /// /// # Errors /// If the mapping could not be removed.