mirror of
https://gitee.com/openharmony/communication_ipc
synced 2024-11-26 17:41:17 +00:00
fix: rectify reorder
Signed-off-by: jwx1282937 <jialinbo@huawei.com>
This commit is contained in:
parent
3f54dcf3ac
commit
4b62739925
@ -20,8 +20,8 @@ extern crate ipc_rust;
|
|||||||
mod access_token;
|
mod access_token;
|
||||||
|
|
||||||
use ipc_rust::{
|
use ipc_rust::{
|
||||||
IRemoteBroker, IRemoteObj, RemoteStub, IpcResult, IpcStatusCode,
|
IRemoteBroker, IRemoteObj, RemoteStub, IpcResult,
|
||||||
RemoteObj, define_remote_object, FIRST_CALL_TRANSACTION,
|
IpcStatusCode, RemoteObj, define_remote_object, FIRST_CALL_TRANSACTION,
|
||||||
};
|
};
|
||||||
use ipc_rust::{
|
use ipc_rust::{
|
||||||
MsgParcel, BorrowedMsgParcel,
|
MsgParcel, BorrowedMsgParcel,
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
ipc_binding, RawData, IpcResult, IpcStatusCode, BorrowedMsgParcel, status_result,
|
ipc_binding, RawData, IpcResult, IpcStatusCode,
|
||||||
AsRawPtr
|
BorrowedMsgParcel, status_result, AsRawPtr
|
||||||
};
|
};
|
||||||
use crate::ipc_binding::CAshmem;
|
use crate::ipc_binding::CAshmem;
|
||||||
use std::ffi::{CString, c_char};
|
use std::ffi::{CString, c_char};
|
||||||
@ -153,7 +153,7 @@ impl Ashmem {
|
|||||||
/// Write data to ashmem
|
/// Write data to ashmem
|
||||||
pub fn write(&self, data: &[u8], offset: i32) -> bool {
|
pub fn write(&self, data: &[u8], offset: i32) -> bool {
|
||||||
let len = data.len() as i32;
|
let len = data.len() as i32;
|
||||||
if offset < 0 || offset >= len {
|
if (offset < 0) || (offset >= len) {
|
||||||
error!(LOG_LABEL, "invalid offset: {}, len: {}", offset, len);
|
error!(LOG_LABEL, "invalid offset: {}, len: {}", offset, len);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ impl Ord for RemoteObj {
|
|||||||
let greater_than = unsafe {
|
let greater_than = unsafe {
|
||||||
ipc_binding::RemoteObjectLessThan(other.0.as_ptr(), self.0.as_ptr())
|
ipc_binding::RemoteObjectLessThan(other.0.as_ptr(), self.0.as_ptr())
|
||||||
};
|
};
|
||||||
if !less_than && !greater_than {
|
if (!less_than) && (!greater_than) {
|
||||||
Ordering::Equal
|
Ordering::Equal
|
||||||
} else if less_than {
|
} else if less_than {
|
||||||
Ordering::Less
|
Ordering::Less
|
||||||
|
@ -19,8 +19,11 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use crate::ipc_binding::{CRemoteObject, CParcel};
|
use crate::ipc_binding::{CRemoteObject, CParcel};
|
||||||
use std::ffi::{c_void, CString, c_char};
|
use std::ffi::{c_void, CString, c_char};
|
||||||
use std::ops::{Deref};
|
use std::ops::Deref;
|
||||||
use hilog_rust::{info, error, hilog, HiLogLabel, LogType};
|
use hilog_rust::{
|
||||||
|
info, error, hilog, HiLogLabel,
|
||||||
|
LogType
|
||||||
|
};
|
||||||
|
|
||||||
const LOG_LABEL: HiLogLabel = HiLogLabel {
|
const LOG_LABEL: HiLogLabel = HiLogLabel {
|
||||||
log_type: LogType::LogCore,
|
log_type: LogType::LogCore,
|
||||||
|
@ -26,12 +26,12 @@ mod ashmem;
|
|||||||
// Export types of this crate
|
// Export types of this crate
|
||||||
pub use crate::errors::{IpcResult, status_result, IpcStatusCode, parse_status_code};
|
pub use crate::errors::{IpcResult, status_result, IpcStatusCode, parse_status_code};
|
||||||
pub use crate::ipc::{
|
pub use crate::ipc::{
|
||||||
IRemoteBroker, IRemoteObj, IRemoteStub, FromRemoteObj, RemoteObjRef,
|
IRemoteBroker, IRemoteObj, IRemoteStub, FromRemoteObj,
|
||||||
remote_obj::RemoteObj, remote_obj::death_recipient::DeathRecipient,
|
RemoteObjRef, remote_obj::RemoteObj, remote_obj::death_recipient::DeathRecipient,remote_stub::RemoteStub,
|
||||||
remote_stub::RemoteStub,
|
|
||||||
};
|
};
|
||||||
pub use crate::ipc_async::{
|
pub use crate::ipc_async::{
|
||||||
IpcAsyncPool, IpcAsyncRuntime, ToAsyncIpc, ToSyncIpc, BoxFuture, Ylong, Runtime,
|
IpcAsyncPool, IpcAsyncRuntime, ToAsyncIpc, ToSyncIpc,
|
||||||
|
BoxFuture, Ylong, Runtime,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub use crate::parcel::{
|
pub use crate::parcel::{
|
||||||
@ -40,17 +40,18 @@ pub use crate::parcel::{
|
|||||||
};
|
};
|
||||||
pub use crate::parcel::parcelable::{SerArray, DeArray};
|
pub use crate::parcel::parcelable::{SerArray, DeArray};
|
||||||
pub use crate::parcel::types::{
|
pub use crate::parcel::types::{
|
||||||
interface_token::InterfaceToken, file_desc::FileDesc,
|
interface_token::InterfaceToken, file_desc::FileDesc, string16::String16
|
||||||
string16::String16
|
|
||||||
};
|
};
|
||||||
pub use crate::ashmem::{
|
pub use crate::ashmem::{
|
||||||
Ashmem, PROT_NONE, PROT_READ, PROT_WRITE, PROT_EXEC,
|
Ashmem, PROT_NONE, PROT_READ, PROT_WRITE,
|
||||||
|
PROT_EXEC,
|
||||||
};
|
};
|
||||||
pub use crate::process::{
|
pub use crate::process::{
|
||||||
get_context_object, add_service, get_service, join_work_thread, stop_work_thread,
|
get_context_object, add_service, get_service, join_work_thread,
|
||||||
get_calling_uid, get_calling_token_id, get_first_token_id, get_self_token_id,
|
stop_work_thread, get_calling_uid, get_calling_token_id, get_first_token_id,
|
||||||
get_calling_pid, set_max_work_thread, is_local_calling, set_calling_identity,
|
get_self_token_id, get_calling_pid, set_max_work_thread, is_local_calling,
|
||||||
get_local_device_id, get_calling_device_id, reset_calling_identity, is_handling_transaction,
|
set_calling_identity, get_local_device_id, get_calling_device_id, reset_calling_identity,
|
||||||
|
is_handling_transaction,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub use crate::ipc_binding::{CRemoteObject, CIRemoteObject};
|
pub use crate::ipc_binding::{CRemoteObject, CIRemoteObject};
|
||||||
|
@ -263,7 +263,7 @@ impl RawData{
|
|||||||
/// The caller should ensure that the u8 slice can be
|
/// The caller should ensure that the u8 slice can be
|
||||||
/// correctly converted to other rust types
|
/// correctly converted to other rust types
|
||||||
pub fn read(&self, start: u32, len: u32) -> IpcResult<&[u8]> {
|
pub fn read(&self, start: u32, len: u32) -> IpcResult<&[u8]> {
|
||||||
if len == 0 || len > self.len || start >= self.len || (start + len) > self.len {
|
if (len == 0) || (len > self.len) || (start >= self.len) || ((start + len) > self.len) {
|
||||||
return Err(IpcStatusCode::Failed);
|
return Err(IpcStatusCode::Failed);
|
||||||
}
|
}
|
||||||
// SAFETY:
|
// SAFETY:
|
||||||
|
@ -13,7 +13,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use crate::{IpcResult, IpcStatusCode, status_result, BorrowedMsgParcel, ipc_binding, AsRawPtr};
|
use crate::{
|
||||||
|
IpcResult, IpcStatusCode, status_result, BorrowedMsgParcel,
|
||||||
|
ipc_binding, AsRawPtr
|
||||||
|
};
|
||||||
use std::mem::MaybeUninit;
|
use std::mem::MaybeUninit;
|
||||||
use std::ffi::{c_void, c_ulong};
|
use std::ffi::{c_void, c_ulong};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
@ -17,7 +17,7 @@ use super::*;
|
|||||||
|
|
||||||
impl<T: Serialize> Serialize for Box<T> {
|
impl<T: Serialize> Serialize for Box<T> {
|
||||||
fn serialize(&self, parcel: &mut BorrowedMsgParcel<'_>) -> IpcResult<()> {
|
fn serialize(&self, parcel: &mut BorrowedMsgParcel<'_>) -> IpcResult<()> {
|
||||||
Serialize::serialize(&**self, parcel)
|
Serialize::serialize(&(**self), parcel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ impl<T: Deserialize> Deserialize for Box<T> {
|
|||||||
|
|
||||||
impl<T: SerOption> SerOption for Box<T> {
|
impl<T: SerOption> SerOption for Box<T> {
|
||||||
fn ser_option(this: Option<&Self>, parcel: &mut BorrowedMsgParcel<'_>) -> IpcResult<()> {
|
fn ser_option(this: Option<&Self>, parcel: &mut BorrowedMsgParcel<'_>) -> IpcResult<()> {
|
||||||
SerOption::ser_option(this.map(|inner| &**inner), parcel)
|
SerOption::ser_option(this.map(|inner| &(**inner)), parcel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{ipc_binding, BorrowedMsgParcel, AsRawPtr, status_result, IpcResult, IpcStatusCode};
|
use crate::{
|
||||||
|
ipc_binding, BorrowedMsgParcel, AsRawPtr, status_result,
|
||||||
|
IpcResult, IpcStatusCode
|
||||||
|
};
|
||||||
|
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
|
use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
|
||||||
|
@ -14,7 +14,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{ipc_binding, BorrowedMsgParcel, IpcResult, status_result, AsRawPtr};
|
use crate::{
|
||||||
|
ipc_binding, BorrowedMsgParcel, IpcResult, status_result,
|
||||||
|
AsRawPtr
|
||||||
|
};
|
||||||
use std::mem::MaybeUninit;
|
use std::mem::MaybeUninit;
|
||||||
|
|
||||||
impl_serde_option_for_parcelable!(i8, u8, i16, u16, i32, u32, i64, u64, f32,f64);
|
impl_serde_option_for_parcelable!(i8, u8, i16, u16, i32, u32, i64, u64, f32,f64);
|
||||||
|
@ -14,7 +14,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{ipc_binding, BorrowedMsgParcel, IpcResult, IpcStatusCode, AsRawPtr, status_result};
|
use crate::{
|
||||||
|
ipc_binding, BorrowedMsgParcel, IpcResult, IpcStatusCode,
|
||||||
|
AsRawPtr, status_result
|
||||||
|
};
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
use std::ffi::{CString, c_char};
|
use std::ffi::{CString, c_char};
|
||||||
use hilog_rust::{error, hilog, HiLogLabel, LogType};
|
use hilog_rust::{error, hilog, HiLogLabel, LogType};
|
||||||
|
@ -14,7 +14,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{ipc_binding, BorrowedMsgParcel, IpcResult, IpcStatusCode, status_result, AsRawPtr};
|
use crate::{
|
||||||
|
ipc_binding, BorrowedMsgParcel, IpcResult, IpcStatusCode,
|
||||||
|
status_result, AsRawPtr
|
||||||
|
};
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
use std::mem::MaybeUninit;
|
use std::mem::MaybeUninit;
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{
|
use crate::{
|
||||||
ipc_binding, BorrowedMsgParcel, IpcResult, IpcStatusCode, status_result,
|
ipc_binding, BorrowedMsgParcel, IpcResult, IpcStatusCode,
|
||||||
AsRawPtr
|
status_result, AsRawPtr
|
||||||
};
|
};
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
use std::mem::MaybeUninit;
|
use std::mem::MaybeUninit;
|
||||||
|
@ -14,8 +14,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
ipc_binding, MsgParcel, RemoteObj, IRemoteObj, InterfaceToken, String16,
|
ipc_binding, MsgParcel, RemoteObj, IRemoteObj,
|
||||||
IpcResult, IpcStatusCode, parse_status_code,
|
InterfaceToken, String16, IpcResult, IpcStatusCode,
|
||||||
|
parse_status_code
|
||||||
};
|
};
|
||||||
use crate::parcel::{vec_to_string, allocate_vec_with_buffer};
|
use crate::parcel::{vec_to_string, allocate_vec_with_buffer};
|
||||||
use std::ffi::{CString, c_char, c_void};
|
use std::ffi::{CString, c_char, c_void};
|
||||||
|
@ -20,8 +20,8 @@ extern crate ipc_rust;
|
|||||||
mod access_token;
|
mod access_token;
|
||||||
|
|
||||||
use ipc_rust::{
|
use ipc_rust::{
|
||||||
IRemoteBroker, IRemoteObj, RemoteStub, IpcResult, IpcStatusCode,
|
IRemoteBroker, IRemoteObj, RemoteStub, IpcResult,
|
||||||
RemoteObj, define_remote_object, FIRST_CALL_TRANSACTION,
|
IpcStatusCode, RemoteObj, define_remote_object, FIRST_CALL_TRANSACTION,
|
||||||
};
|
};
|
||||||
use ipc_rust::{
|
use ipc_rust::{
|
||||||
MsgParcel, BorrowedMsgParcel, FileDesc, InterfaceToken,
|
MsgParcel, BorrowedMsgParcel, FileDesc, InterfaceToken,
|
||||||
|
Loading…
Reference in New Issue
Block a user