Skip to content

Commit a3f96c3

Browse files
vireshkjiangliu
authored andcommitted
volatile_memory: Deprecate .as_ptr() interfaces
The `.as_ptr()` interface can't be used with the `xen` feature. Mark them deprecated with a note to use the new interfaces. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
1 parent d913c99 commit a3f96c3

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515
- [[#241]](https://github.com/rust-vmm/vm-memory/pull/245) mmap_xen: Don't drop
1616
the FileOffset while in use #245
1717

18+
## [Unreleased]
19+
20+
### Deprecated
21+
22+
- [[#244]](https://github.com/rust-vmm/vm-memory/pull/241) Deprecate volatile
23+
memory's `as_ptr()` interfaces. The new interfaces to be used instead are:
24+
`ptr_guard()` and `ptr_guard_mut()`.
25+
1826
## [v0.12.0]
1927

2028
### Added

src/volatile_memory.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,10 @@ impl<'a, B: BitmapSlice> VolatileSlice<'a, B> {
355355
/// Returns a pointer to the beginning of the slice. Mutable accesses performed
356356
/// using the resulting pointer are not automatically accounted for by the dirty bitmap
357357
/// tracking functionality.
358+
#[deprecated(
359+
since = "0.12.1",
360+
note = "Use `.ptr_guard()` or `.ptr_guard_mut()` instead"
361+
)]
358362
#[cfg(not(all(feature = "xen", unix)))]
359363
pub fn as_ptr(&self) -> *mut u8 {
360364
self.addr
@@ -1028,6 +1032,10 @@ where
10281032
/// Returns a pointer to the underlying memory. Mutable accesses performed
10291033
/// using the resulting pointer are not automatically accounted for by the dirty bitmap
10301034
/// tracking functionality.
1035+
#[deprecated(
1036+
since = "0.12.1",
1037+
note = "Use `.ptr_guard()` or `.ptr_guard_mut()` instead"
1038+
)]
10311039
#[cfg(not(all(feature = "xen", unix)))]
10321040
pub fn as_ptr(&self) -> *mut u8 {
10331041
self.addr as *mut u8
@@ -1217,6 +1225,10 @@ where
12171225
/// Returns a pointer to the underlying memory. Mutable accesses performed
12181226
/// using the resulting pointer are not automatically accounted for by the dirty bitmap
12191227
/// tracking functionality.
1228+
#[deprecated(
1229+
since = "0.12.1",
1230+
note = "Use `.ptr_guard()` or `.ptr_guard_mut()` instead"
1231+
)]
12201232
#[cfg(not(all(feature = "xen", unix)))]
12211233
pub fn as_ptr(&self) -> *mut u8 {
12221234
self.addr

0 commit comments

Comments
 (0)