Use libc for off_t and timeval

This commit is contained in:
ZacJW 2025-11-15 18:49:13 +00:00
parent d17cd9cbbd
commit 330bfd1523
3 changed files with 46 additions and 50 deletions

9
Cargo.lock generated
View file

@ -5,3 +5,12 @@ version = 4
[[package]]
name = "libburn-sys"
version = "0.1.0"
dependencies = [
"libc",
]
[[package]]
name = "libc"
version = "0.2.177"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976"

View file

@ -4,3 +4,4 @@ version = "0.1.0"
edition = "2024"
[dependencies]
libc = "0.2.177"

View file

@ -1,19 +1,21 @@
//! Low-level Rust bindings for libburn.
//!
//!
//! You can find out more about the libburnia project, of which libburn is a part, by visiting
//! <https://dev.lovelyhq.com/libburnia/web/wiki>
//!
//!
//! This version of libburn-sys is based on libburn 1.5.6
//!
//!
//! ## Requirements
//!
//!
//! Currently, libburn-sys does not support statically linking libburn into your application, and may never do.
//! Instead, **you must have libburn 1.5.6 or greater installed** on your system so libburn-sys can dynamically
//! link to it.
//!
//!
//! Bindings for libburn are pregenerated for libburn-sys, so you shouldn't need bindgen's dependencies
//! installed to start using libburn-sys.
#![allow(non_camel_case_types)]
/* automatically generated by rust-bindgen 0.72.1 */
#[repr(C)]
@ -183,23 +185,7 @@ pub const BURN_HEADER_VERSION_MINOR: u32 = 5;
pub const BURN_HEADER_VERSION_MICRO: u32 = 6;
pub const BURN_MSGS_MESSAGE_LEN: u32 = 4096;
pub const LIBDAX_AUDIOXTR_STRLEN: u32 = 4096;
pub type __off_t = ::std::os::raw::c_long;
pub type __time_t = ::std::os::raw::c_long;
pub type __suseconds_t = ::std::os::raw::c_long;
pub type off_t = __off_t;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct timeval {
pub tv_sec: __time_t,
pub tv_usec: __suseconds_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of timeval"][::std::mem::size_of::<timeval>() - 16usize];
["Alignment of timeval"][::std::mem::align_of::<timeval>() - 8usize];
["Offset of field: timeval::tv_sec"][::std::mem::offset_of!(timeval, tv_sec) - 0usize];
["Offset of field: timeval::tv_usec"][::std::mem::offset_of!(timeval, tv_usec) - 8usize];
};
/// References a physical drive in the system
#[repr(C)]
#[derive(Debug, Copy, Clone)]
@ -551,7 +537,7 @@ pub struct burn_source {
/// Get the size of the source's data. Return 0 means unpredictable
/// size. If application provided (*get_size) might return 0, then
/// the application MUST provide a fully functional (*set_size).
pub get_size: ::std::option::Option<unsafe extern "C" fn(arg1: *mut burn_source) -> off_t>,
pub get_size: ::std::option::Option<unsafe extern "C" fn(arg1: *mut burn_source) -> libc::off_t>,
/// Program the reply of (*get_size) to a fixed value. It is advised
/// to implement this by a attribute off_t fixed_size; in *data .
/// The read() function does not have to take into respect this fake
@ -564,7 +550,7 @@ pub struct burn_source {
/// enforce fixed track sizes by burn_track_set_size() and possibly
/// even padding might be left out.
pub set_size: ::std::option::Option<
unsafe extern "C" fn(source: *mut burn_source, size: off_t) -> ::std::os::raw::c_int,
unsafe extern "C" fn(source: *mut burn_source, size: libc::off_t) -> ::std::os::raw::c_int,
>,
/// Clean up the source specific data. This function will be called
/// once by burn_source_free() when the last referer disposes the
@ -1156,7 +1142,7 @@ pub struct burn_progress {
/// The free space in the drive buffer (might be slightly outdated)
pub buffer_available: ::std::os::raw::c_uint,
/// The number of bytes sent to the drive buffer
pub buffered_bytes: off_t,
pub buffered_bytes: libc::off_t,
/// The minimum number of bytes stored in buffer during write.
/// (Caution: Before surely one buffer size of bytes was processed,
/// this value is 0xffffffff.)
@ -2261,7 +2247,7 @@ unsafe extern "C" {
/// @return number of most probably available free bytes
///
/// @since 0.3.4
pub fn burn_disc_available_space(d: *mut burn_drive, o: *mut burn_write_opts) -> off_t;
pub fn burn_disc_available_space(d: *mut burn_drive, o: *mut burn_write_opts) -> libc::off_t;
}
unsafe extern "C" {
/// Tells the MMC Profile identifier of the loaded media. The drive must be
@ -2503,7 +2489,7 @@ unsafe extern "C" {
/// bit16= enable POW on blank BD-R
///
/// @since 0.3.0
pub fn burn_disc_format(drive: *mut burn_drive, size: off_t, flag: ::std::os::raw::c_int);
pub fn burn_disc_format(drive: *mut burn_drive, size: libc::off_t, flag: ::std::os::raw::c_int);
}
unsafe extern "C" {
/// Inquire the formatting status, the associated sizes and the number of
@ -2535,7 +2521,7 @@ unsafe extern "C" {
pub fn burn_disc_get_formats(
drive: *mut burn_drive,
status: *mut ::std::os::raw::c_int,
size: *mut off_t,
size: *mut libc::off_t,
bl_sas: *mut ::std::os::raw::c_uint,
num_formats: *mut ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
@ -2565,7 +2551,7 @@ unsafe extern "C" {
drive: *mut burn_drive,
index: ::std::os::raw::c_int,
type_: *mut ::std::os::raw::c_int,
size: *mut off_t,
size: *mut libc::off_t,
tdp: *mut ::std::os::raw::c_uint,
) -> ::std::os::raw::c_int;
}
@ -3690,7 +3676,7 @@ unsafe extern "C" {
/// @return 0=failure 1=success
///
/// @since 0.3.4
pub fn burn_track_set_default_size(t: *mut burn_track, size: off_t) -> ::std::os::raw::c_int;
pub fn burn_track_set_default_size(t: *mut burn_track, size: libc::off_t) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
/// Free a burn_source (decrease its refcount and maybe free it)
@ -3802,7 +3788,7 @@ unsafe extern "C" {
pub fn burn_fd_source_new(
datafd: ::std::os::raw::c_int,
subfd: ::std::os::raw::c_int,
size: off_t,
size: libc::off_t,
) -> *mut burn_source;
}
unsafe extern "C" {
@ -3854,8 +3840,8 @@ unsafe extern "C" {
pub fn burn_offst_source_new(
inp: *mut burn_source,
prev: *mut burn_source,
start: off_t,
size: off_t,
start: libc::off_t,
size: libc::off_t,
flag: ::std::os::raw::c_int,
) -> *mut burn_source;
}
@ -4062,7 +4048,7 @@ unsafe extern "C" {
/// @return <=0 indicates failure , >0 success
///
/// @since 0.3.6
pub fn burn_track_set_size(t: *mut burn_track, size: off_t) -> ::std::os::raw::c_int;
pub fn burn_track_set_size(t: *mut burn_track, size: libc::off_t) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
/// Tells how many sectors a track will have on disc, or already has on
@ -4083,8 +4069,8 @@ unsafe extern "C" {
/// @since 0.2.6
pub fn burn_track_get_counters(
t: *mut burn_track,
read_bytes: *mut off_t,
written_bytes: *mut off_t,
read_bytes: *mut libc::off_t,
written_bytes: *mut libc::off_t,
) -> ::std::os::raw::c_int;
}
unsafe extern "C" {
@ -4173,9 +4159,9 @@ unsafe extern "C" {
pub fn burn_nominal_slowdown(
kb_per_second: ::std::os::raw::c_int,
max_corr: ::std::os::raw::c_int,
prev_time: *mut timeval,
prev_time: *mut libc::timeval,
us_corr: *mut ::std::os::raw::c_int,
b_since_prev: off_t,
b_since_prev: libc::off_t,
flag: ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}
@ -4500,7 +4486,7 @@ unsafe extern "C" {
/// @param value The address in bytes (-1 = start at default address)
///
/// @since 0.3.0
pub fn burn_write_opts_set_start_byte(opts: *mut burn_write_opts, value: off_t);
pub fn burn_write_opts_set_start_byte(opts: *mut burn_write_opts, value: libc::off_t);
}
unsafe extern "C" {
/// Caution: still immature and likely to change. Problems arose with
@ -4912,11 +4898,11 @@ pub struct burn_multi_caps {
pub start_adr: ::std::os::raw::c_int,
/// The alignment for start addresses.
/// ( start_address % start_alignment ) must be 0.
pub start_alignment: off_t,
pub start_alignment: libc::off_t,
/// The lowest permissible start address.
pub start_range_low: off_t,
pub start_range_low: libc::off_t,
/// The highest addressable start address.
pub start_range_high: off_t,
pub start_range_high: libc::off_t,
/// Potential availability of write modes
/// 4= needs no size prediction, not to be chosen automatically
/// 3= needs size prediction, not to be chosen automatically
@ -5397,9 +5383,9 @@ unsafe extern "C" {
/// @since 0.4.0
pub fn burn_random_access_write(
d: *mut burn_drive,
byte_address: off_t,
byte_address: libc::off_t,
data: *mut ::std::os::raw::c_char,
data_count: off_t,
data_count: libc::off_t,
flag: ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}
@ -5482,10 +5468,10 @@ unsafe extern "C" {
/// @since 0.4.0
pub fn burn_read_data(
d: *mut burn_drive,
byte_address: off_t,
byte_address: libc::off_t,
data: *mut ::std::os::raw::c_char,
data_size: off_t,
data_count: *mut off_t,
data_size: libc::off_t,
data_count: *mut libc::off_t,
flag: ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}
@ -5544,8 +5530,8 @@ unsafe extern "C" {
d: *mut burn_drive,
sector_no: ::std::os::raw::c_int,
data: *mut ::std::os::raw::c_char,
data_size: off_t,
data_count: *mut off_t,
data_size: libc::off_t,
data_count: *mut libc::off_t,
flag: ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}
@ -5773,7 +5759,7 @@ unsafe extern "C" {
/// @since 0.2.4
pub fn libdax_audioxtr_get_size(
o: *mut libdax_audioxtr,
size: *mut off_t,
size: *mut libc::off_t,
flag: ::std::os::raw::c_int,
) -> ::std::os::raw::c_int;
}