|
| 1 | +#[allow(unused_imports)] |
| 2 | +use core::ptr; |
| 3 | + |
1 | 4 | use crate::off_t;
|
2 | 5 | use crate::prelude::*;
|
3 | 6 |
|
@@ -256,6 +259,70 @@ s_no_extra_traits! {
|
256 | 259 | pub __pad: [c_int; 3],
|
257 | 260 | }
|
258 | 261 |
|
| 262 | + pub union _kernel_simple_lock { |
| 263 | + pub _slock: c_long, |
| 264 | + // Should be pointer to 'lock_data_instrumented' |
| 265 | + pub _slockp: *mut c_void, |
| 266 | + } |
| 267 | + |
| 268 | + pub struct fileops_t { |
| 269 | + pub fo_rw: extern "C" fn( |
| 270 | + file: *mut file, |
| 271 | + rw: crate::uio_rw, |
| 272 | + io: *mut c_void, |
| 273 | + ext: c_long, |
| 274 | + secattr: *mut c_void, |
| 275 | + ) -> c_int, |
| 276 | + pub fo_ioctl: extern "C" fn( |
| 277 | + file: *mut file, |
| 278 | + a: c_long, |
| 279 | + b: crate::caddr_t, |
| 280 | + c: c_long, |
| 281 | + d: c_long, |
| 282 | + ) -> c_int, |
| 283 | + pub fo_select: |
| 284 | + extern "C" fn(file: *mut file, a: c_int, b: *mut c_ushort, c: extern "C" fn()) -> c_int, |
| 285 | + pub fo_close: extern "C" fn(file: *mut file) -> c_int, |
| 286 | + pub fo_fstat: extern "C" fn(file: *mut file, sstat: *mut crate::stat) -> c_int, |
| 287 | + } |
| 288 | + |
| 289 | + pub struct file { |
| 290 | + pub f_flag: c_long, |
| 291 | + pub f_count: c_int, |
| 292 | + pub f_options: c_short, |
| 293 | + pub f_type: c_short, |
| 294 | + // Should be pointer to 'vnode' |
| 295 | + pub f_data: *mut c_void, |
| 296 | + pub f_offset: c_longlong, |
| 297 | + pub f_dir_off: c_long, |
| 298 | + // Should be pointer to 'cred' |
| 299 | + pub f_cred: *mut c_void, |
| 300 | + pub f_lock: _kernel_simple_lock, |
| 301 | + pub f_offset_lock: _kernel_simple_lock, |
| 302 | + pub f_vinfo: crate::caddr_t, |
| 303 | + pub f_ops: *mut fileops_t, |
| 304 | + pub f_parentp: crate::caddr_t, |
| 305 | + pub f_fnamep: crate::caddr_t, |
| 306 | + pub f_fdata: [c_char; 160], |
| 307 | + } |
| 308 | + |
| 309 | + pub union __ld_info_file { |
| 310 | + pub _ldinfo_fd: c_int, |
| 311 | + pub _ldinfo_fp: *mut file, |
| 312 | + pub _core_offset: c_long, |
| 313 | + } |
| 314 | + |
| 315 | + pub struct ld_info { |
| 316 | + pub ldinfo_next: c_uint, |
| 317 | + pub ldinfo_flags: c_uint, |
| 318 | + pub _file: __ld_info_file, |
| 319 | + pub ldinfo_textorg: *mut c_void, |
| 320 | + pub ldinfo_textsize: c_ulong, |
| 321 | + pub ldinfo_dataorg: *mut c_void, |
| 322 | + pub ldinfo_datasize: c_ulong, |
| 323 | + pub ldinfo_filename: [c_char; 2], |
| 324 | + } |
| 325 | + |
259 | 326 | pub union __pollfd_ext_u {
|
260 | 327 | pub addr: *mut c_void,
|
261 | 328 | pub data32: u32,
|
@@ -327,6 +394,127 @@ cfg_if! {
|
327 | 394 | self.__si_flags.hash(state);
|
328 | 395 | }
|
329 | 396 | }
|
| 397 | + |
| 398 | + impl PartialEq for _kernel_simple_lock { |
| 399 | + fn eq(&self, other: &_kernel_simple_lock) -> bool { |
| 400 | + unsafe { self._slock == other._slock && self._slockp == other._slockp } |
| 401 | + } |
| 402 | + } |
| 403 | + impl Eq for _kernel_simple_lock {} |
| 404 | + impl hash::Hash for _kernel_simple_lock { |
| 405 | + fn hash<H: hash::Hasher>(&self, state: &mut H) { |
| 406 | + unsafe { |
| 407 | + self._slock.hash(state); |
| 408 | + self._slockp.hash(state); |
| 409 | + } |
| 410 | + } |
| 411 | + } |
| 412 | + |
| 413 | + impl PartialEq for fileops_t { |
| 414 | + fn eq(&self, other: &fileops_t) -> bool { |
| 415 | + ptr::fn_addr_eq(self.fo_rw, other.fo_rw) |
| 416 | + && ptr::fn_addr_eq(self.fo_ioctl, other.fo_ioctl) |
| 417 | + && ptr::fn_addr_eq(self.fo_select, other.fo_select) |
| 418 | + && ptr::fn_addr_eq(self.fo_close, other.fo_close) |
| 419 | + && ptr::fn_addr_eq(self.fo_fstat, other.fo_fstat) |
| 420 | + } |
| 421 | + } |
| 422 | + impl Eq for fileops_t {} |
| 423 | + impl hash::Hash for fileops_t { |
| 424 | + fn hash<H: hash::Hasher>(&self, state: &mut H) { |
| 425 | + self.fo_rw.hash(state); |
| 426 | + self.fo_ioctl.hash(state); |
| 427 | + self.fo_select.hash(state); |
| 428 | + self.fo_close.hash(state); |
| 429 | + self.fo_fstat.hash(state); |
| 430 | + } |
| 431 | + } |
| 432 | + |
| 433 | + impl PartialEq for file { |
| 434 | + fn eq(&self, other: &file) -> bool { |
| 435 | + self.f_flag == other.f_flag |
| 436 | + && self.f_count == other.f_count |
| 437 | + && self.f_options == other.f_options |
| 438 | + && self.f_type == other.f_type |
| 439 | + && self.f_data == other.f_data |
| 440 | + && self.f_offset == other.f_offset |
| 441 | + && self.f_dir_off == other.f_dir_off |
| 442 | + && self.f_cred == other.f_cred |
| 443 | + && self.f_vinfo == other.f_vinfo |
| 444 | + && self.f_ops == other.f_ops |
| 445 | + && self.f_parentp == other.f_parentp |
| 446 | + && self.f_fnamep == other.f_fnamep |
| 447 | + && self.f_fdata == other.f_fdata |
| 448 | + && self.f_lock == other.f_lock |
| 449 | + && self.f_offset_lock == other.f_offset_lock |
| 450 | + } |
| 451 | + } |
| 452 | + impl Eq for file {} |
| 453 | + impl hash::Hash for file { |
| 454 | + fn hash<H: hash::Hasher>(&self, state: &mut H) { |
| 455 | + self.f_flag.hash(state); |
| 456 | + self.f_count.hash(state); |
| 457 | + self.f_options.hash(state); |
| 458 | + self.f_type.hash(state); |
| 459 | + self.f_data.hash(state); |
| 460 | + self.f_offset.hash(state); |
| 461 | + self.f_dir_off.hash(state); |
| 462 | + self.f_cred.hash(state); |
| 463 | + self.f_lock.hash(state); |
| 464 | + self.f_offset_lock.hash(state); |
| 465 | + self.f_vinfo.hash(state); |
| 466 | + self.f_ops.hash(state); |
| 467 | + self.f_parentp.hash(state); |
| 468 | + self.f_fnamep.hash(state); |
| 469 | + self.f_fdata.hash(state); |
| 470 | + } |
| 471 | + } |
| 472 | + |
| 473 | + impl PartialEq for __ld_info_file { |
| 474 | + fn eq(&self, other: &__ld_info_file) -> bool { |
| 475 | + unsafe { |
| 476 | + self._ldinfo_fd == other._ldinfo_fd |
| 477 | + && self._ldinfo_fp == other._ldinfo_fp |
| 478 | + && self._core_offset == other._core_offset |
| 479 | + } |
| 480 | + } |
| 481 | + } |
| 482 | + impl Eq for __ld_info_file {} |
| 483 | + impl hash::Hash for __ld_info_file { |
| 484 | + fn hash<H: hash::Hasher>(&self, state: &mut H) { |
| 485 | + unsafe { |
| 486 | + self._ldinfo_fd.hash(state); |
| 487 | + self._ldinfo_fp.hash(state); |
| 488 | + self._core_offset.hash(state); |
| 489 | + } |
| 490 | + } |
| 491 | + } |
| 492 | + |
| 493 | + impl PartialEq for ld_info { |
| 494 | + fn eq(&self, other: &ld_info) -> bool { |
| 495 | + self.ldinfo_next == other.ldinfo_next |
| 496 | + && self.ldinfo_flags == other.ldinfo_flags |
| 497 | + && self.ldinfo_textorg == other.ldinfo_textorg |
| 498 | + && self.ldinfo_textsize == other.ldinfo_textsize |
| 499 | + && self.ldinfo_dataorg == other.ldinfo_dataorg |
| 500 | + && self.ldinfo_datasize == other.ldinfo_datasize |
| 501 | + && self.ldinfo_filename == other.ldinfo_filename |
| 502 | + && self._file == other._file |
| 503 | + } |
| 504 | + } |
| 505 | + impl Eq for ld_info {} |
| 506 | + impl hash::Hash for ld_info { |
| 507 | + fn hash<H: hash::Hasher>(&self, state: &mut H) { |
| 508 | + self.ldinfo_next.hash(state); |
| 509 | + self.ldinfo_flags.hash(state); |
| 510 | + self.ldinfo_textorg.hash(state); |
| 511 | + self.ldinfo_textsize.hash(state); |
| 512 | + self.ldinfo_dataorg.hash(state); |
| 513 | + self.ldinfo_datasize.hash(state); |
| 514 | + self.ldinfo_filename.hash(state); |
| 515 | + self._file.hash(state); |
| 516 | + } |
| 517 | + } |
330 | 518 | impl PartialEq for __pollfd_ext_u {
|
331 | 519 | fn eq(&self, other: &__pollfd_ext_u) -> bool {
|
332 | 520 | unsafe {
|
|
0 commit comments