Skip to content

Commit 3d1545e

Browse files
zengxiaoboDemesneGH
zengxiaobo
authored andcommitted
optee-utee: Add method to check if TransientObject is created with null handle
Signed-off-by: zengxiaobo <[email protected]>
1 parent a6fbe93 commit 3d1545e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

optee-utee/src/object.rs

+13
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,10 @@ impl ObjectHandle {
224224
unsafe { *(self.raw) }
225225
}
226226

227+
fn is_null(&self) -> bool {
228+
self.raw.is_null()
229+
}
230+
227231
fn from_raw(raw: *mut raw::TEE_ObjectHandle) -> ObjectHandle {
228232
Self { raw }
229233
}
@@ -517,6 +521,15 @@ impl TransientObject {
517521
Self(ObjectHandle::from_raw(ptr::null_mut()))
518522
}
519523

524+
/// Check if current object is created with null handle.
525+
///
526+
/// # See Also
527+
///
528+
/// - [Self::null_object](Self::null_object).
529+
pub fn is_null_object(&self) -> bool {
530+
self.0.is_null()
531+
}
532+
520533
/// Allocate an uninitialized [TransientObject](TransientObject), i.e. a container for attributes.
521534
///
522535
/// As allocated, the object is uninitialized.

0 commit comments

Comments
 (0)