From d10e55eb63c2976981258264c88b48e81e964843 Mon Sep 17 00:00:00 2001 From: ZacJW Date: Wed, 10 Dec 2025 14:32:32 +0000 Subject: [PATCH 1/3] Add repository and links entries --- Cargo.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index fda82b7..79ca4e4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,9 @@ edition = "2024" description = "Low-level unsafe bindings to libburn, a library for working with optical drives" license = "GPL-2.0-or-later" +repository = "https://forgejo.zacjw.com/zac/libburn-sys" + +links = "burn" [dependencies] libc = "0.2.177" From 8007f0df0810bd920f480ab12060bb9867c0ccbd Mon Sep 17 00:00:00 2001 From: ZacJW Date: Wed, 10 Dec 2025 14:40:02 +0000 Subject: [PATCH 2/3] Rename constants to screaming snake case --- src/lib.rs | 80 +++++++++++++++++++++++++++--------------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 44a1503..6934a89 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -218,7 +218,7 @@ pub struct burn_write_opts { } /// Packet writing. /// currently unsupported, (for DVD Incremental Streaming use TAO) -pub const burn_write_types_BURN_WRITE_PACKET: burn_write_types = 0; +pub const BURN_WRITE_TYPES_BURN_WRITE_PACKET: burn_write_types = 0; /// With CD: Track At Once recording /// 2s gaps between tracks, no fonky lead-ins /// @@ -226,7 +226,7 @@ pub const burn_write_types_BURN_WRITE_PACKET: burn_write_types = 0; /// With DVD+R and BD-R: Track of open size /// With DVD-RAM, DVD+RW, BD-RE: Random Writeable (used sequentially) /// With overwritable DVD-RW: Rigid Restricted Overwrite -pub const burn_write_types_BURN_WRITE_TAO: burn_write_types = 1; +pub const BURN_WRITE_TYPES_BURN_WRITE_TAO: burn_write_types = 1; /// With CD: Session At Once /// Block type MUST be BURN_BLOCK_SAO /// ts A70122: Currently not capable of mixing data and audio tracks. @@ -235,7 +235,7 @@ pub const burn_write_types_BURN_WRITE_TAO: burn_write_types = 1; /// Single session, single track, fixed size mandatory, (-dvd-compat) /// With other DVD or BD media: same as BURN_WRITE_TAO but may demand /// that track size is known in advance. -pub const burn_write_types_BURN_WRITE_SAO: burn_write_types = 2; +pub const BURN_WRITE_TYPES_BURN_WRITE_SAO: burn_write_types = 2; /// With CD: Raw disc at once recording. /// all subcodes must be provided by lib or user /// only raw block types are supported @@ -252,49 +252,49 @@ pub const burn_write_types_BURN_WRITE_SAO: burn_write_types = 2; /// Now understood, explained and not stemming from cdrdao. /// /// @since 0.7.4 -pub const burn_write_types_BURN_WRITE_RAW: burn_write_types = 3; +pub const BURN_WRITE_TYPES_BURN_WRITE_RAW: burn_write_types = 3; /// In replies this indicates that not any writing will work. /// As parameter for inquiries it indicates that no particular write /// mode shall is specified. /// Do not use for setting a write mode for burning. It will not work. -pub const burn_write_types_BURN_WRITE_NONE: burn_write_types = 4; +pub const BURN_WRITE_TYPES_BURN_WRITE_NONE: burn_write_types = 4; /// Possible disc writing style/modes pub type burn_write_types = ::std::os::raw::c_uint; /// sync, headers, edc/ecc provided by lib/user -pub const burn_block_types_BURN_BLOCK_RAW0: burn_block_types = 1; +pub const BURN_BLOCK_TYPES_BURN_BLOCK_RAW0: burn_block_types = 1; /// sync, headers, edc/ecc and p/q subs provided by lib/user -pub const burn_block_types_BURN_BLOCK_RAW16: burn_block_types = 2; +pub const BURN_BLOCK_TYPES_BURN_BLOCK_RAW16: burn_block_types = 2; /// sync, headers, edc/ecc and packed p-w subs provided by lib/user -pub const burn_block_types_BURN_BLOCK_RAW96P: burn_block_types = 4; +pub const BURN_BLOCK_TYPES_BURN_BLOCK_RAW96P: burn_block_types = 4; /// sync, headers, edc/ecc and raw p-w subs provided by lib/user -pub const burn_block_types_BURN_BLOCK_RAW96R: burn_block_types = 8; +pub const BURN_BLOCK_TYPES_BURN_BLOCK_RAW96R: burn_block_types = 8; /// only 2048 bytes of user data provided by lib/user -pub const burn_block_types_BURN_BLOCK_MODE1: burn_block_types = 256; +pub const BURN_BLOCK_TYPES_BURN_BLOCK_MODE1: burn_block_types = 256; /// 2336 bytes of user data provided by lib/user -pub const burn_block_types_BURN_BLOCK_MODE2R: burn_block_types = 512; +pub const BURN_BLOCK_TYPES_BURN_BLOCK_MODE2R: burn_block_types = 512; /// 2048 bytes of user data provided by lib/user /// subheader provided in write parameters /// are we ever going to support this shit? I vote no. /// (supposed to be supported on all drives...) -pub const burn_block_types_BURN_BLOCK_MODE2_PATHETIC: burn_block_types = 1024; +pub const BURN_BLOCK_TYPES_BURN_BLOCK_MODE2_PATHETIC: burn_block_types = 1024; /// 2048 bytes of data + 8 byte subheader provided by lib/user /// hey, this is also dumb -pub const burn_block_types_BURN_BLOCK_MODE2_LAME: burn_block_types = 2048; +pub const BURN_BLOCK_TYPES_BURN_BLOCK_MODE2_LAME: burn_block_types = 2048; /// 2324 bytes of data provided by lib/user /// subheader provided in write parameters /// no sir, I don't like it. -pub const burn_block_types_BURN_BLOCK_MODE2_OBSCURE: burn_block_types = 4096; +pub const BURN_BLOCK_TYPES_BURN_BLOCK_MODE2_OBSCURE: burn_block_types = 4096; /// 2332 bytes of data supplied by lib/user /// 8 bytes sub header provided in write parameters /// this is the second least suck mode2, and is mandatory for /// all drives to support. -pub const burn_block_types_BURN_BLOCK_MODE2_OK: burn_block_types = 8192; +pub const BURN_BLOCK_TYPES_BURN_BLOCK_MODE2_OK: burn_block_types = 8192; /// SAO block sizes are based on cue sheet, so use this. -pub const burn_block_types_BURN_BLOCK_SAO: burn_block_types = 16384; +pub const BURN_BLOCK_TYPES_BURN_BLOCK_SAO: burn_block_types = 16384; /// Data format to send to the drive pub type burn_block_types = ::std::os::raw::c_uint; /// The current status is not yet known -pub const burn_disc_status_BURN_DISC_UNREADY: burn_disc_status = 0; +pub const BURN_DISC_STATUS_BURN_DISC_UNREADY: burn_disc_status = 0; /// The drive holds a blank disc. It is ready for writing from scratch. /// Unused multi-session media: /// CD-R, CD-RW, DVD-R, DVD-RW, DVD+R, BD-R @@ -302,14 +302,14 @@ pub const burn_disc_status_BURN_DISC_UNREADY: burn_disc_status = 0; /// CD-RW, DVD-RW /// Overwritable media with or without valid data /// DVD-RAM, DVD+RW, formatted DVD-RW, BD-RE -pub const burn_disc_status_BURN_DISC_BLANK: burn_disc_status = 1; +pub const BURN_DISC_STATUS_BURN_DISC_BLANK: burn_disc_status = 1; /// There is no disc at all in the drive -pub const burn_disc_status_BURN_DISC_EMPTY: burn_disc_status = 2; +pub const BURN_DISC_STATUS_BURN_DISC_EMPTY: burn_disc_status = 2; /// There is an incomplete disc in the drive. It is ready for appending /// another session. /// Written but not yet closed multi-session media /// CD-R, CD-RW, DVD-R, DVD-RW, DVD+R, BD-R -pub const burn_disc_status_BURN_DISC_APPENDABLE: burn_disc_status = 3; +pub const BURN_DISC_STATUS_BURN_DISC_APPENDABLE: burn_disc_status = 3; /// There is a disc with data on it in the drive. It is usable only for /// reading. /// Written and closed multi-session media @@ -318,53 +318,53 @@ pub const burn_disc_status_BURN_DISC_APPENDABLE: burn_disc_status = 3; /// CD-ROM, DVD-ROM, BD-ROM /// Note that many DVD-ROM drives report any written media /// as Read-Only media and not by their real media types. -pub const burn_disc_status_BURN_DISC_FULL: burn_disc_status = 4; +pub const BURN_DISC_STATUS_BURN_DISC_FULL: burn_disc_status = 4; /// The drive was not grabbed when the status was inquired -pub const burn_disc_status_BURN_DISC_UNGRABBED: burn_disc_status = 5; +pub const BURN_DISC_STATUS_BURN_DISC_UNGRABBED: burn_disc_status = 5; /// The media seems to be unsuitable for reading and for writing -pub const burn_disc_status_BURN_DISC_UNSUITABLE: burn_disc_status = 6; +pub const BURN_DISC_STATUS_BURN_DISC_UNSUITABLE: burn_disc_status = 6; /// Possible status of the drive in regard to the disc in it. pub type burn_disc_status = ::std::os::raw::c_uint; /// The source is ok -pub const burn_source_status_BURN_SOURCE_OK: burn_source_status = 0; +pub const BURN_SOURCE_STATUS_BURN_SOURCE_OK: burn_source_status = 0; /// The source is at end of file -pub const burn_source_status_BURN_SOURCE_EOF: burn_source_status = 1; +pub const BURN_SOURCE_STATUS_BURN_SOURCE_EOF: burn_source_status = 1; /// The source is unusable -pub const burn_source_status_BURN_SOURCE_FAILED: burn_source_status = 2; +pub const BURN_SOURCE_STATUS_BURN_SOURCE_FAILED: burn_source_status = 2; /// Possible data source return values pub type burn_source_status = ::std::os::raw::c_uint; /// The drive is not in an operation -pub const burn_drive_status_BURN_DRIVE_IDLE: burn_drive_status = 0; +pub const BURN_DRIVE_STATUS_BURN_DRIVE_IDLE: burn_drive_status = 0; /// The library is spawning the processes to handle a pending /// operation (A read/write/etc is about to start but hasn't quite /// yet) -pub const burn_drive_status_BURN_DRIVE_SPAWNING: burn_drive_status = 1; +pub const BURN_DRIVE_STATUS_BURN_DRIVE_SPAWNING: burn_drive_status = 1; /// The drive is reading data from a disc -pub const burn_drive_status_BURN_DRIVE_READING: burn_drive_status = 2; +pub const BURN_DRIVE_STATUS_BURN_DRIVE_READING: burn_drive_status = 2; /// The drive is writing data to a disc -pub const burn_drive_status_BURN_DRIVE_WRITING: burn_drive_status = 3; +pub const BURN_DRIVE_STATUS_BURN_DRIVE_WRITING: burn_drive_status = 3; /// The drive is writing Lead-In -pub const burn_drive_status_BURN_DRIVE_WRITING_LEADIN: burn_drive_status = 4; +pub const BURN_DRIVE_STATUS_BURN_DRIVE_WRITING_LEADIN: burn_drive_status = 4; /// The drive is writing Lead-Out -pub const burn_drive_status_BURN_DRIVE_WRITING_LEADOUT: burn_drive_status = 5; +pub const BURN_DRIVE_STATUS_BURN_DRIVE_WRITING_LEADOUT: burn_drive_status = 5; /// The drive is erasing a disc -pub const burn_drive_status_BURN_DRIVE_ERASING: burn_drive_status = 6; +pub const BURN_DRIVE_STATUS_BURN_DRIVE_ERASING: burn_drive_status = 6; /// The drive is being grabbed -pub const burn_drive_status_BURN_DRIVE_GRABBING: burn_drive_status = 7; +pub const BURN_DRIVE_STATUS_BURN_DRIVE_GRABBING: burn_drive_status = 7; /// The drive gets written zeroes before the track payload data -pub const burn_drive_status_BURN_DRIVE_WRITING_PREGAP: burn_drive_status = 8; +pub const BURN_DRIVE_STATUS_BURN_DRIVE_WRITING_PREGAP: burn_drive_status = 8; /// The drive is told to close a track (TAO only) -pub const burn_drive_status_BURN_DRIVE_CLOSING_TRACK: burn_drive_status = 9; +pub const BURN_DRIVE_STATUS_BURN_DRIVE_CLOSING_TRACK: burn_drive_status = 9; /// The drive is told to close a session (TAO only) -pub const burn_drive_status_BURN_DRIVE_CLOSING_SESSION: burn_drive_status = 10; +pub const BURN_DRIVE_STATUS_BURN_DRIVE_CLOSING_SESSION: burn_drive_status = 10; /// The drive is formatting media -pub const burn_drive_status_BURN_DRIVE_FORMATTING: burn_drive_status = 11; +pub const BURN_DRIVE_STATUS_BURN_DRIVE_FORMATTING: burn_drive_status = 11; /// The drive is busy in synchronous read (if you see this then it /// has been interrupted) -pub const burn_drive_status_BURN_DRIVE_READING_SYNC: burn_drive_status = 12; +pub const BURN_DRIVE_STATUS_BURN_DRIVE_READING_SYNC: burn_drive_status = 12; /// The drive is busy in synchronous write (if you see this then it /// has been interrupted) -pub const burn_drive_status_BURN_DRIVE_WRITING_SYNC: burn_drive_status = 13; +pub const BURN_DRIVE_STATUS_BURN_DRIVE_WRITING_SYNC: burn_drive_status = 13; /// Possible busy states for a drive pub type burn_drive_status = ::std::os::raw::c_uint; /// Information about a track on a disc - this is from the q sub channel of the From 41952f7b02c6d8950a043d1c778f968f9398722c Mon Sep 17 00:00:00 2001 From: ZacJW Date: Wed, 10 Dec 2025 14:51:04 +0000 Subject: [PATCH 3/3] Fix or silence some clippy warnings --- src/lib.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 6934a89..bfedd06 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -15,6 +15,7 @@ //! installed to start using libburn-sys. #![allow(non_camel_case_types)] +#![allow(clippy::useless_transmute)] /* automatically generated by rust-bindgen 0.72.1 */ @@ -55,7 +56,7 @@ where debug_assert!(index / 8 < core::mem::size_of::()); let byte_index = index / 8; let byte = unsafe { - *(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize) + *(core::ptr::addr_of!((*this).storage) as *const u8).add(byte_index) }; Self::extract_bit(byte, index) } @@ -81,7 +82,7 @@ where debug_assert!(index / 8 < core::mem::size_of::()); let byte_index = index / 8; let byte = unsafe { - (core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize) + (core::ptr::addr_of_mut!((*this).storage) as *mut u8).add(byte_index) }; unsafe { *byte = Self::change_bit(*byte, index, val) }; } @@ -1051,6 +1052,7 @@ impl burn_drive_info { ) } } + #[expect(clippy::too_many_arguments)] #[inline] pub fn new_bitfield_1( read_dvdram: ::std::os::raw::c_uint, @@ -1384,7 +1386,9 @@ unsafe extern "C" { unsafe extern "C" { /// Allows the use of media types which are implemented in libburn but not yet /// tested. The list of those untested profiles is subject to change. - /// - Currently no media types are under test reservation - + /// + /// Currently no media types are under test reservation + /// /// If you really test such media, then please report the outcome on /// libburn-hackers@pykix.org /// If ever then this call should be done soon after burn_initialize() before @@ -1525,8 +1529,8 @@ unsafe extern "C" { /// /// @param n_drives Returns the number of drive items in drive_infos. /// - /// @return 0 while scanning is not complete - /// >0 when it is finished successfully, + /// @return 0 while scanning is not complete, + /// \>0 when it is finished successfully, /// <0 when finished but failed. pub fn burn_drive_scan( drive_infos: *mut *mut burn_drive_info, @@ -4510,6 +4514,7 @@ unsafe extern "C" { /// - the check whether CD write+block type is supported by the drive /// - the check whether the media profile supports simulated burning /// - @since 1.5.6 + /// /// The check whether a write operation exceeds the size of the medium /// as announced by the drive. This is known as \"overburn\" and may work /// for a few thousand additional blocks on CD media with write type SAO.