mirror of
https://github.com/pbatard/rufus.git
synced 2025-06-04 16:53:54 -04:00
[misc] add missing.h header
* Also clean up code
This commit is contained in:
parent
d3c9afa2fd
commit
c3f47ada06
23 changed files with 289 additions and 258 deletions
13
src/smart.c
13
src/smart.c
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Rufus: The Reliable USB Formatting Utility
|
||||
* SMART HDD vs Flash detection (using ATA over USB, S.M.A.R.T., etc.)
|
||||
* Copyright © 2013-2014 Pete Batard <pete@akeo.ie>
|
||||
* Copyright © 2013-2016 Pete Batard <pete@akeo.ie>
|
||||
*
|
||||
* Based in part on scsiata.cpp from Smartmontools: http://smartmontools.sourceforge.net
|
||||
* Copyright © 2006-12 Douglas Gilbert <dgilbert@interlog.com>
|
||||
|
@ -31,8 +31,10 @@
|
|||
#include <ctype.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "msapi_utf8.h"
|
||||
#include "rufus.h"
|
||||
#include "missing.h"
|
||||
#include "msapi_utf8.h"
|
||||
|
||||
#include "drive.h"
|
||||
#include "smart.h"
|
||||
#include "hdd_vs_ufd.h"
|
||||
|
@ -43,7 +45,7 @@ static uint8_t GetAtaDirection(uint8_t AtaCmd, uint8_t Features) {
|
|||
// Far from complete -- only the commands we *may* use.
|
||||
|
||||
// Most SMART commands require DATA_IN but there are a couple exceptions
|
||||
BOOL smart_out = (AtaCmd == ATA_SMART_CMD) &&
|
||||
BOOL smart_out = (AtaCmd == ATA_SMART_CMD) &&
|
||||
((Features == ATA_SMART_STATUS) || (Features == ATA_SMART_WRITE_LOG_SECTOR));
|
||||
|
||||
switch (AtaCmd) {
|
||||
|
@ -413,7 +415,7 @@ BOOL SmartGetVersion(HANDLE hdevice)
|
|||
* THUS, IF DATA LOSS IS INCURRED DUE TO THIS, OR ANY OTHER PART OF THIS APPLICATION,
|
||||
* NOT BEHAVING IN THE MANNER YOU EXPECTED, THE RESPONSIBILITY IS ENTIRELY ON YOU!
|
||||
*
|
||||
* What you have below, then, is our *current best guess* at differentiating UFDs
|
||||
* What you have below, then, is our *current best guess* at differentiating UFDs
|
||||
* from HDDs. But short of a crystal ball, this remains just a guess, which may be
|
||||
* way off mark. Still, you are also reminded that Rufus does produce PROMINENT
|
||||
* warnings before you format a drive, and also provides extensive info about the
|
||||
|
@ -426,7 +428,7 @@ BOOL SmartGetVersion(HANDLE hdevice)
|
|||
* - some UFDs (SanDisk Extreme) have added S.M.A.R.T. support, which also used to be
|
||||
* reserved for HDDs => can't use that either
|
||||
* - even if S.M.A.R.T. was enough, not all USB->IDE or USB->SATA bridges support ATA
|
||||
* passthrough, which is required S.M.A.R.T. data, and each manufacturer of an
|
||||
* passthrough, which is required S.M.A.R.T. data, and each manufacturer of an
|
||||
* USB<->(S)ATA bridge seem to have their own method of implementing passthrough.
|
||||
* - SSDs have also changed the deal completely, as you can get something that looks
|
||||
* like Flash but that is really an HDD.
|
||||
|
@ -436,7 +438,6 @@ BOOL SmartGetVersion(HANDLE hdevice)
|
|||
* from the above) => there is no magic API we can query that will tell us what we're
|
||||
* really looking at.
|
||||
*/
|
||||
#define GB 1073741824LL
|
||||
int IsHDD(DWORD DriveIndex, uint16_t vid, uint16_t pid, const char* strid)
|
||||
{
|
||||
int score = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue