virtwl: Fix DMABuf support on when building for 32bit.

name/date/desc_len fields of drm_version struct are of type __kernel_size_t
and not unsigned long long.

BUG=chromium:837209
TEST=crosvm finds DRM device on kevin

Change-Id: If940b31cb730cbaa46ed781021cbe60189da9f65
Reviewed-on: https://chromium-review.googlesource.com/1064913
Commit-Ready: David Reveman <reveman@chromium.org>
Tested-by: David Reveman <reveman@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
This commit is contained in:
David Reveman 2018-05-17 17:18:27 -04:00 committed by chrome-bot
parent bb65801679
commit fe0abe4a78

View file

@ -4,12 +4,22 @@
use std::ffi::CString;
use std::fs::{File, OpenOptions};
use std::os::raw::{c_char, c_int, c_uint, c_ulonglong};
use std::os::raw::{c_char, c_int, c_uint};
#[cfg(target_pointer_width = "64")]
use std::os::raw::c_ulong;
use std::path::Path;
use std::ptr::null_mut;
use sys_util::ioctl_with_mut_ref;
// Consistent with __kernel_size_t in include/uapi/asm-generic/posix_types.h.
#[cfg(not(target_pointer_width = "64"))]
#[allow(non_camel_case_types)]
type __kernel_size_t = c_uint;
#[cfg(target_pointer_width = "64")]
#[allow(non_camel_case_types)]
type __kernel_size_t = c_ulong;
const DRM_IOCTL_BASE: c_uint = 0x64;
#[repr(C)]
@ -18,11 +28,11 @@ struct drm_version {
version_major: c_int,
version_minor: c_int,
version_patchlevel: c_int,
name_len: c_ulonglong,
name_len: __kernel_size_t,
name: *mut c_char,
date_len: c_ulonglong,
date_len: __kernel_size_t,
date: *mut c_char,
desc_len: c_ulonglong,
desc_len: __kernel_size_t,
desc: *mut c_char,
}
@ -52,7 +62,7 @@ fn get_drm_device_name(fd: &File) -> Result<String, ()> {
version_major: 0,
version_minor: 0,
version_patchlevel: 0,
name_len: name_bytes.len() as c_ulonglong,
name_len: name_bytes.len() as __kernel_size_t,
name: name_bytes.as_mut_ptr() as *mut c_char,
date_len: 0,
date: null_mut(),