Skip to content

Commit

Permalink
derive missing common traits
Browse files Browse the repository at this point in the history
  • Loading branch information
gnzlbg committed Oct 27, 2018
1 parent 2716d61 commit 59a0a94
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/clock_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ pub type clock_flavor_t = ::libc::c_int;
pub type clock_attr_t = *mut ::libc::c_int;
pub type clock_res_t = ::libc::c_int;

#[derive(Copy, Clone, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct mach_timespec {
pub tv_sec: ::libc::c_uint,
pub tv_nsec: clock_res_t,
Expand Down
4 changes: 2 additions & 2 deletions src/dyld_kernel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use boolean::boolean_t;
use mach_types::{fsid_t, fsobj_id_t, uuid_t};

#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, PartialEq)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct dyld_kernel_image_info {
pub uuid: uuid_t,
pub fsobjid: fsobj_id_t,
Expand All @@ -14,7 +14,7 @@ pub struct dyld_kernel_image_info {

#[allow(non_snake_case)]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, PartialEq)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct dyld_kernel_process_info {
pub cache_image_info: dyld_kernel_image_info,
pub timestamp: u64,
Expand Down
4 changes: 2 additions & 2 deletions src/mach_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ pub type uuid_t = [::libc::c_uchar; 16];

// <sys/_types/_fsid_t.h>
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, PartialEq)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct fsid {
pub val: [i32; 2],
}
pub type fsid_t = fsid;

// <sys/_types/_fsobj_id_t.h>
#[repr(C)]
#[derive(Debug, Default, Copy, Clone, Hash, PartialOrd, PartialEq)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct fsobj_id {
pub fid_objno: u32,
pub fid_generation: u32,
Expand Down
14 changes: 7 additions & 7 deletions src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ pub const MACH_RCV_INVALID_TRAILER: mach_msg_return_t = 0x1000_400f;
pub const MACH_RCV_IN_PROGRESS_TIMED: mach_msg_return_t = 0x1000_4011;

#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct mach_msg_header_t {
pub msgh_bits: mach_msg_bits_t,
pub msgh_size: mach_msg_size_t,
Expand All @@ -142,13 +142,13 @@ pub struct mach_msg_header_t {
}

#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct mach_msg_body_t {
pub msgh_descriptor_count: mach_msg_size_t,
}

#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct mach_msg_base_t {
pub header: mach_msg_header_t,
pub body: mach_msg_body_t,
Expand All @@ -157,14 +157,14 @@ pub struct mach_msg_base_t {
pub const MACH_MSG_TRAILER_FORMAT_0: mach_msg_trailer_type_t = 0;

#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct mach_msg_trailer_t {
pub msgh_trailer_type: mach_msg_trailer_type_t,
pub msgh_trailer_size: mach_msg_trailer_size_t,
}

#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct mach_msg_port_descriptor_t {
pub name: mach_port_t,
pub pad1: mach_msg_size_t,
Expand All @@ -186,7 +186,7 @@ impl mach_msg_port_descriptor_t {
}

#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct mach_msg_ool_descriptor_t {
pub address: *mut ::libc::c_void,
#[cfg(not(target_pointer_width = "64"))]
Expand Down Expand Up @@ -218,7 +218,7 @@ impl mach_msg_ool_descriptor_t {
}

#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct mach_msg_ool_ports_descriptor_t {
pub address: *mut ::libc::c_void,
#[cfg(not(target_pointer_width = "64"))]
Expand Down
1 change: 1 addition & 0 deletions src/port.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use vm_types::natural_t;
pub type mach_port_name_t = natural_t;

#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct ipc_port;

pub type ipc_port_t = *mut ipc_port;
Expand Down
2 changes: 1 addition & 1 deletion src/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use core::mem;
use message::mach_msg_type_number_t;

#[repr(C)]
#[derive(Clone, Debug, Default)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct x86_thread_state64_t {
pub __rax: u64,
pub __rbx: u64,
Expand Down
1 change: 1 addition & 0 deletions src/task_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pub type task_info_t = *mut integer_t;
note = "requires the unstable feature to avoid undefined behavior"
)
)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct task_dyld_info {
pub all_image_info_addr: mach_vm_address_t,
pub all_image_info_size: mach_vm_size_t,
Expand Down
18 changes: 9 additions & 9 deletions src/vm_region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub const SM_SHARED_ALIASED: ::libc::c_uchar = 7;
note = "requires the unstable feature to avoid undefined behavior"
)
)]
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct vm_region_basic_info_64 {
pub protection: vm_prot_t,
pub max_protection: vm_prot_t,
Expand All @@ -84,7 +84,7 @@ impl vm_region_basic_info_64 {
}

#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct vm_region_basic_info {
pub protection: vm_prot_t,
pub max_protection: vm_prot_t,
Expand All @@ -103,7 +103,7 @@ impl vm_region_basic_info {
}

#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct vm_region_extended_info {
pub protection: vm_prot_t,
pub user_tag: ::libc::c_uint,
Expand All @@ -125,7 +125,7 @@ impl vm_region_extended_info {
}

#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct vm_region_top_info {
pub obj_id: ::libc::c_uint,
pub ref_count: ::libc::c_uint,
Expand All @@ -141,7 +141,7 @@ impl vm_region_top_info {
}

#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct vm_region_submap_info {
pub protection: vm_prot_t,
pub max_protection: vm_prot_t,
Expand Down Expand Up @@ -177,7 +177,7 @@ impl vm_region_submap_info {
note = "requires the `unstable` feature to avoid undefined behavior"
)
)]
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct vm_region_submap_info_64 {
pub protection: vm_prot_t,
pub max_protection: vm_prot_t,
Expand Down Expand Up @@ -214,7 +214,7 @@ impl vm_region_submap_info_64 {
note = "requires the `unstable` feature to avoid undefined behavior"
)
)]
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct vm_region_submap_short_info_64 {
pub protection: vm_prot_t,
pub max_protection: vm_prot_t,
Expand All @@ -238,7 +238,7 @@ impl vm_region_submap_short_info_64 {
}

#[repr(C)]
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct vm_page_info_basic {
pub disposition: ::libc::c_int,
pub ref_count: ::libc::c_int,
Expand All @@ -263,7 +263,7 @@ impl vm_page_info_basic {
note = "requires the `unstable` feature to avoid undefined behavior"
)
)]
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct mach_vm_read_entry {
pub address: mach_vm_address_t,
pub size: mach_vm_size_t,
Expand Down
2 changes: 2 additions & 0 deletions src/vm_statistics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pub const VM_FLAGS_ANYWHERE: ::libc::c_int = 0x1;
pub const VM_FLAGS_OVERWRITE: ::libc::c_int = 0x4000;

#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct vm_statistics {
pub free_count: natural_t,
pub active_count: natural_t,
Expand All @@ -69,6 +70,7 @@ pub struct vm_statistics {
note = "`pmap_statistics` was removed after MacOSX 10.3.9"
)]
#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Hash, PartialOrd, PartialEq, Eq, Ord)]
pub struct pmap_statistics {
pub resident_count: integer_t,
pub wired_count: integer_t,
Expand Down

0 comments on commit 59a0a94

Please sign in to comment.