-
Notifications
You must be signed in to change notification settings - Fork 240
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
only finds 26 scsi devices #479
Comments
found my keys, able to send pull requests again. #480 |
How about this:
std::vector<std::string> DtaLinux::generateDtaDriveDevRefs()
{
std::vector<std::string> devrefs;
DIR *dir = opendir("/dev");
if (dir==NULL) {
LOG(E) << "Can't read /dev ?!";
return devrefs;
}
struct dirent *dirent;
while (NULL != (dirent=readdir(dir))) {
std::string devref=std::string("/dev/")+dirent->d_name;
struct stat s;
stat(devref.c_str(), &s);
// LOG(E) << devref
// << " st_ino:" << HEXON(4) << s.st_ino
// << " st_dev:" << HEXON(4) << s.st_dev
// << " st_rdev:" << HEXON(4) << s.st_rdev
// << " st_rdev>>8:" << HEXON(4) << (s.st_rdev>>8)
// << " st_rdev&0xF:" << HEXON(4) << (s.st_rdev & 0x000F)
// ;
const unsigned long device_type=s.st_rdev >> 8;
const unsigned char device_part=s.st_rdev & 15;
typedef enum _rdev_type {
SCSI_DRIVE=8,
NVME_DRIVE=259,
} rdev_type;
if (device_part==0 &&
(device_type==rdev_type::SCSI_DRIVE ||
device_type==rdev_type::NVME_DRIVE)) {
// LOG(E) << devref << " accepted."
// ;
devrefs.push_back(devref);
}
}
closedir(dir);
std::sort(devrefs.begin(),devrefs.end());
return devrefs;
}
As you can tell from the commented-out-debug-logging-to-stderr, this is
tips code. The idea is that this is what each OS needs to be able to do,
and then enumerateDtaDriveDevRefs is just a OS-independent filtering loop
that validates our access to those devices (OK, using an OS-specific
routine openDeviceHandle there, too).
…On Thu, Sep 5, 2024 at 12:40 PM 'Keith Busch' via Drive Trust Alliance - Support ***@***.***> wrote:
found my keys, able to send pull requests again. #480
<#480>
—
Reply to this email directly, view it on GitHub
<#479 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD52TFBYJBU6MJCL7XTOKO3ZVCCQXAVCNFSM6AAAAABNM2XLZSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZSGE4TCNJQG4>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
The 259 value is not reserved for the NVMe major. Any block device can use that. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The pattern match only looks for sda - sdz, but we have more than that. Need this:
The text was updated successfully, but these errors were encountered: