Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/vfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ pub trait Vfs: Send + Sync {
Ok(())
}

fn check_reserved_lock(&self, handle: &mut Self::Handle) -> VfsResult<bool> {
Ok(false)
}

fn sync(&self, handle: &mut Self::Handle) -> VfsResult<()> {
Ok(())
}
Expand Down Expand Up @@ -298,7 +302,7 @@ fn register_inner<T: Vfs>(
xFileSize: Some(x_file_size::<T>),
xLock: Some(x_lock::<T>),
xUnlock: Some(x_unlock::<T>),
xCheckReservedLock: None,
xCheckReservedLock: Some(x_check_reserved_lock::<T>),
xFileControl: Some(x_file_control::<T>),
xSectorSize: Some(x_sector_size::<T>),
xDeviceCharacteristics: Some(x_device_characteristics::<T>),
Expand Down Expand Up @@ -551,6 +555,20 @@ unsafe extern "C" fn x_unlock<T: Vfs>(p_file: *mut ffi::sqlite3_file, raw_lock:
})
}

unsafe extern "C" fn x_check_reserved_lock<T: Vfs>(
p_file: *mut ffi::sqlite3_file,
p_out: *mut c_int,
) -> c_int {
fallible(|| {
let file = unwrap_file!(p_file, T)?;
let vfs = unwrap_vfs!(file.vfs, T)?;
unsafe {
*p_out = vfs.check_reserved_lock(file.handle.assume_init_mut())? as c_int;
}
Ok(vars::SQLITE_OK)
})
}

unsafe extern "C" fn x_file_control<T: Vfs>(
p_file: *mut ffi::sqlite3_file,
op: c_int,
Expand Down
Loading