본문 바로가기
내가만드는것_만든것/오픈소스

[jcu-dparm] ATA, NVME, SCSI Identify & Command 라이브러리. Windows & Linux 지원.

by Joseph.Lee 2020. 8. 11.

언제나 그렇듯... 설명은 나중에...ㅠㅠ

#include <jcu-dparm/drive_handle.h>
#include <jcu-dparm/drive_factory.h>

using namespace jcu::dparm;

int main() {
  auto drive_factory = DriveFactory::getSystemFactory();
  int rc;

  // 디스크 목록 얻기
  std::list<DriveInfo> drive_list;
  rc = drive_factory->enumDrives(drive_list);
  printf("enum driver result = %d, size=%d\n", rc, drive_list.size());


  // 디스크 하나 열기
  auto drive_handle = drive_factory->open("\\\\.\\PhysicalDrive1"); // Windows
//  auto drive_handle = drive_factory->open("/dev/sdb"); // Linux
  if (!drive_handle->isOpen()) {
    printf("OPEN FAILED: code=%d, sys=%d\n", drive_handle->getError().code, drive_handle->getError().sys_error);
    return 1;
  }

  return 0;
}

 

https://github.com/jc-lab/jcu-dparm

 

jc-lab/jcu-dparm

Contribute to jc-lab/jcu-dparm development by creating an account on GitHub.

github.com

 

 

반응형

댓글