Skip to content

Use a device-specialized constructor for Cdio - #22

Open
skr4n wants to merge 5 commits into
mainfrom
perms
Open

Use a device-specialized constructor for Cdio#22
skr4n wants to merge 5 commits into
mainfrom
perms

Conversation

@skr4n

@skr4n skr4n commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

There are two major types of drivers in libcdio.

  • OS
  • Images

Thus, rather than have a generic new() method with multiple (unused)
initialization options, have two methods with_device() and
with_image().

This PR introduces with_device(), which opens the Cdio object with both read and write flags.

skr4n added 5 commits July 28, 2026 17:14
Only `OsError` was used to represent MMC errors.
Introduce `MmcError`, which also covers MMC errors by including sense data.
There are two major types of drivers in Cdio.
- OS
- Images

Thus, rather than have a generic `new()` method with multiple (unused)
initialization options, have two methods `with_device()` and
`with_image()`.

This commit introduces `with_device()`.
@skr4n skr4n changed the title Replace generic new() constructor with a specialized with_device() one for the Cdio type Use a device-specialized constructor for Cdio Jul 28, 2026
Comment thread libcdio-rs/src/mmc.rs
/// Generic information describing an exception.
pub sense_key: SenseKey,

/// Additional Sense Code indicates further information related

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Additional Sense Code indicates further information related
/// Additional Sense Code (ASC) indicates further information related

Comment thread libcdio-rs/src/mmc.rs
/// to the exception reported by `sense_key`.
pub asc: u8,

/// Additional Sense Code Qualifier indicates detailed information related

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Additional Sense Code Qualifier indicates detailed information related
/// Additional Sense Code Qualifier (ASCQ) indicates detailed information related

Comment thread libcdio-rs/src/mmc.rs
/// Sense Key Specific indicates additional information about the exception.
pub sks: [u8; 3],

/// Additional Sense Bytes may contain vendor specific data that further

@rocky rocky Jul 28, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In https://www.13thmonkey.org/documentation/SCSI/x3_304_1997.pdf I see do not see "Additional Sense Bytes" mentioned, although I do see "additional sense code" mentioned. Is this the same thing?

More generally, some of these fields like asc and ascq correspond very closely to the names used in many versions of a standard (including the one we are focusing on): ASC and ASCQ. But something like ili or Incorrect length indicator I am having a hard time finding matching terms in a specification.

How do we make it clear in the comments which terms are exact and which terms are our terminology for a concept that might not be spelled out with a particular term in the specification? And for the exact terms, where would I go in a spec to understand that an ASCQ is u8 (or even just 8 bits since that's probably all the standard is going to indicate)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants