Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do media checks on getting next block encryption status #74

Merged
merged 2 commits into from
May 18, 2022

Conversation

jmwilson
Copy link
Contributor

Only the next block encryption status query (aka "Volume Encryption" in the output) requires having media loaded, so allow stenc to run on a drive without media by opening the device in nonblocking mode, and checking for media before getting NBES.

Additionally, as reported in #71, it appears some drives may return BLANK CHECK status on unformatted media instead of GOOD status with "cannot determine" in the result. Catch this specific error and suppress the error message.

Closes #12 and #71.

@sunwire
Copy link
Contributor

sunwire commented May 16, 2022

Before we close #12 What about FreeBSD? Does it also need O_NDELAY flag?

stenc/src/scsiencrypt.cpp

Lines 113 to 115 in 8caaf85

#elif defined(OS_FREEBSD)
auto dev = std::unique_ptr<struct cam_device, decltype(&cam_close_device)>
{cam_open_device(device.c_str(), O_RDWR), &cam_close_device};

@jmwilson
Copy link
Contributor Author

No need; that code finds the generic device and opens it, which doesn't do any media check. So this makes the two versions more consistent.

@jonasstein jonasstein merged commit a7a7c47 into scsitape:master May 18, 2022
@jmwilson jmwilson deleted the cleanup branch June 6, 2022 05:33
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.

stenc should detect an empty LTO drive and return a proper exit code
3 participants