mirror of
https://github.com/mbilker/vgpu_unlock-rs.git
synced 2025-06-08 05:28:21 +02:00
lib: apply profile overrides only on successful status
This commit is contained in:
parent
8bb4f47c9b
commit
3ca0999210
38
src/lib.rs
38
src/lib.rs
@ -44,7 +44,7 @@ static CONFIG: Config = {
|
||||
|
||||
process::abort();
|
||||
}
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
if e.kind() != ErrorKind::NotFound {
|
||||
eprintln!("Failed to read config: {}", e);
|
||||
@ -337,24 +337,30 @@ pub unsafe extern "C" fn ioctl(fd: RawFd, request: c_ulong, argp: *mut c_void) -
|
||||
// Set device type to vGPU capable.
|
||||
*dev_type_ptr = DEV_TYPE_VGPU_CAPABLE;
|
||||
}
|
||||
OP_READ_VGPU_CFG => {
|
||||
let config = &mut *(io_data.result as *mut VgpuConfig);
|
||||
info!("{:#?}", config);
|
||||
|
||||
if !handle_profile_override(config) {
|
||||
error!("Failed to apply profile override");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
OP_READ_START_CALL => {
|
||||
let config = &*(io_data.result as *const VgpuStart);
|
||||
info!("{:#?}", config);
|
||||
|
||||
*LAST_MDEV_UUID.lock() = Some(config.uuid);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
if io_data.status == STATUS_OK {
|
||||
match io_data.op_type {
|
||||
OP_READ_VGPU_CFG => {
|
||||
let config = &mut *(io_data.result as *mut VgpuConfig);
|
||||
info!("{:#?}", config);
|
||||
|
||||
if !handle_profile_override(config) {
|
||||
error!("Failed to apply profile override");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
OP_READ_START_CALL => {
|
||||
let config = &*(io_data.result as *const VgpuStart);
|
||||
info!("{:#?}", config);
|
||||
|
||||
*LAST_MDEV_UUID.lock() = Some(config.uuid);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
if io_data.status != STATUS_OK {
|
||||
// Things seems to work fine even if some operations that fail result in failed assertions.
|
||||
// So here we change the status value for these cases to cleanup the logs for
|
||||
|
Loading…
x
Reference in New Issue
Block a user