smartmontools SVN Rev 5388
Utility to control and monitor storage systems with "S.M.A.R.T."
Macros | Enumerations | Functions | Variables
smartctl.cpp File Reference
#include "config.h"
#include <errno.h>
#include <inttypes.h>
#include <stdio.h>
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdexcept>
#include <getopt.h>
#include "atacmds.h"
#include "dev_interface.h"
#include "ataprint.h"
#include "knowndrives.h"
#include "scsicmds.h"
#include "scsiprint.h"
#include "nvmeprint.h"
#include "smartctl.h"
#include "utility.h"
#include "svnversion.h"
Include dependency graph for smartctl.cpp:

Go to the source code of this file.

Macros

#define __STDC_FORMAT_MACROS   1
 

Enumerations

enum  {
  opt_identify = 1000 , opt_scan , opt_scan_open , opt_set ,
  opt_smart
}
 
enum  checksum_err_mode_t { CHECKSUM_ERR_WARN , CHECKSUM_ERR_EXIT , CHECKSUM_ERR_IGNORE }
 

Functions

static void printslogan ()
 
static void UsageSummary ()
 
static void js_initialize (int argc, char **argv, bool verbose)
 
static std::string getvalidarglist (int opt)
 
static void Usage ()
 
static void printvalidarglistmessage (int opt)
 
static void scan_devices (const smart_devtype_list &types, bool with_open, char **argv)
 
static int parse_options (int argc, char **argv, const char *&type, ata_print_options &ataopts, scsi_print_options &scsiopts, nvme_print_options &nvmeopts, bool &print_type_only)
 
 __attribute_format_printf (3, 0) static void vjpout(bool is_js_impl
 
void jout_startup_datetime (const char *prefix)
 
void failuretest (failure_type type, int returnvalue)
 
void checksumwarning (const char *string)
 
static const char * get_protocol_info (const smart_device *dev)
 
static void js_device_info (const json::ref &jref, const smart_device *dev)
 
static int main_worker (int argc, char **argv)
 
int main (int argc, char **argv)
 

Variables

const char * smartctl_cpp_cvsid
 
bool printing_is_switchable = false
 
bool printing_is_off = false
 
json jglb
 
static bool print_as_json = false
 
static json::print_options print_as_json_options
 
static bool print_as_json_output = false
 
static bool print_as_json_impl = false
 
static bool print_as_json_unimpl = false
 
static checksum_err_mode_t checksum_err_mode = CHECKSUM_ERR_WARN
 
const char * msg_severity
 
const char const char * fmt
 
const char const char va_list ap
 
bool failuretest_conservative = false
 
unsigned char failuretest_permissive = 0
 

Macro Definition Documentation

◆ __STDC_FORMAT_MACROS

#define __STDC_FORMAT_MACROS   1

Definition at line 14 of file smartctl.cpp.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
opt_identify 
opt_scan 
opt_scan_open 
opt_set 
opt_smart 

Definition at line 224 of file smartctl.cpp.

◆ checksum_err_mode_t

Enumerator
CHECKSUM_ERR_WARN 
CHECKSUM_ERR_EXIT 
CHECKSUM_ERR_IGNORE 

Definition at line 305 of file smartctl.cpp.

Function Documentation

◆ __attribute_format_printf()

__attribute_format_printf ( ,
 
)

◆ checksumwarning()

void checksumwarning ( const char *  string)

Definition at line 1472 of file smartctl.cpp.

◆ failuretest()

void failuretest ( failure_type  type,
int  returnvalue 
)

Definition at line 1449 of file smartctl.cpp.

◆ get_protocol_info()

static const char * get_protocol_info ( const smart_device dev)
static

Definition at line 1486 of file smartctl.cpp.

◆ getvalidarglist()

static std::string getvalidarglist ( int  opt)
static

Definition at line 228 of file smartctl.cpp.

◆ jout_startup_datetime()

void jout_startup_datetime ( const char *  prefix)

Definition at line 1437 of file smartctl.cpp.

◆ js_device_info()

static void js_device_info ( const json::ref jref,
const smart_device dev 
)
static

Definition at line 1500 of file smartctl.cpp.

◆ js_initialize()

static void js_initialize ( int  argc,
char **  argv,
bool  verbose 
)
static

Definition at line 71 of file smartctl.cpp.

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 1673 of file smartctl.cpp.

◆ main_worker()

static int main_worker ( int  argc,
char **  argv 
)
static

Definition at line 1564 of file smartctl.cpp.

◆ parse_options()

static int parse_options ( int  argc,
char **  argv,
const char *&  type,
ata_print_options ataopts,
scsi_print_options scsiopts,
nvme_print_options nvmeopts,
bool &  print_type_only 
)
static

Definition at line 315 of file smartctl.cpp.

◆ printslogan()

static void printslogan ( )
static

Definition at line 60 of file smartctl.cpp.

◆ printvalidarglistmessage()

static void printvalidarglistmessage ( int  opt)
static

Definition at line 287 of file smartctl.cpp.

◆ scan_devices()

void scan_devices ( const smart_devtype_list types,
bool  with_open,
char **  argv 
)
static

Definition at line 1510 of file smartctl.cpp.

◆ Usage()

static void Usage ( )
static

Definition at line 113 of file smartctl.cpp.

◆ UsageSummary()

static void UsageSummary ( )
static

Definition at line 65 of file smartctl.cpp.

Variable Documentation

◆ ap

const char const char va_list ap

Definition at line 1312 of file smartctl.cpp.

◆ checksum_err_mode

checksum_err_mode_t checksum_err_mode = CHECKSUM_ERR_WARN
static

Definition at line 309 of file smartctl.cpp.

◆ failuretest_conservative

bool failuretest_conservative = false

Definition at line 1443 of file smartctl.cpp.

◆ failuretest_permissive

unsigned char failuretest_permissive = 0

Definition at line 1444 of file smartctl.cpp.

◆ fmt

const char const char* fmt

Definition at line 1312 of file smartctl.cpp.

◆ jglb

json jglb

Definition at line 53 of file smartctl.cpp.

◆ msg_severity

const char* msg_severity

Definition at line 1311 of file smartctl.cpp.

◆ print_as_json

bool print_as_json = false
static

Definition at line 54 of file smartctl.cpp.

◆ print_as_json_impl

bool print_as_json_impl = false
static

Definition at line 57 of file smartctl.cpp.

◆ print_as_json_options

json::print_options print_as_json_options
static

Definition at line 55 of file smartctl.cpp.

◆ print_as_json_output

bool print_as_json_output = false
static

Definition at line 56 of file smartctl.cpp.

◆ print_as_json_unimpl

bool print_as_json_unimpl = false
static

Definition at line 58 of file smartctl.cpp.

◆ printing_is_off

bool printing_is_off = false

Definition at line 50 of file smartctl.cpp.

◆ printing_is_switchable

bool printing_is_switchable = false

Definition at line 49 of file smartctl.cpp.

◆ smartctl_cpp_cvsid

const char* smartctl_cpp_cvsid
Initial value:
= "$Id: smartctl.cpp 5354 2022-04-22 19:14:42Z chrfranke $"
CONFIG_H_CVSID SMARTCTL_H_CVSID
#define SMARTCTL_H_CVSID
Definition: smartctl.h:16

Definition at line 45 of file smartctl.cpp.