smartmontools  SVN Rev 4814
Utility to control and monitor storage systems with "S.M.A.R.T."
Macros | Functions | Variables
utility.cpp File Reference
#include "config.h"
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include <stdlib.h>
#include <ctype.h>
#include <stdarg.h>
#include <sys/stat.h>
#include <stdexcept>
#include "svnversion.h"
#include "utility.h"
#include "atacmds.h"
#include "dev_interface.h"
#include "sg_unaligned.h"
Include dependency graph for utility.cpp:

Go to the source code of this file.

Macros

#define __STDC_FORMAT_MACROS   1
 
#define BUILD_INFO   "(local build)"
 
#define N2S_(s)   #s
 
#define N2S(s)   "(" N2S_(s) ")"
 

Functions

std::string format_version_info (const char *prog_name, bool full)
 
void FixGlibcTimeZoneBug ()
 
const char * packetdevicetype (int type)
 
void dateandtimezoneepoch (char(&buffer)[DATEANDEPOCHLEN], time_t tval)
 
void syserror (const char *message)
 
static const char * check_regex (const char *pattern)
 
int split_selective_arg (char *s, uint64_t *start, uint64_t *stop, int *mode)
 
bool nonempty (const void *data, int size)
 
const char * format_char_array (char *str, int strsize, const char *chr, int chrsize)
 
const char * format_with_thousands_sep (char *str, int strsize, uint64_t val, const char *thousands_sep)
 
const char * format_capacity (char *str, int strsize, uint64_t val, const char *decimal_point)
 
 __attribute_format_printf (1, 0) std
 
std::string strprintf (const char *fmt,...)
 
const char * uint128_hilo_to_str (char *str, int strsize, uint64_t value_hi, uint64_t value_lo)
 
static void check_endianness ()
 
int safe_vsnprintf (char *buf, int size, const char *fmt, va_list ap)
 
int safe_snprintf (char *buf, int size, const char *fmt,...)
 
static void check_snprintf ()
 
void check_config ()
 

Variables

const char * utility_cpp_cvsid
 
const char * packet_types []
 

Macro Definition Documentation

#define __STDC_FORMAT_MACROS   1

Definition at line 18 of file utility.cpp.

#define BUILD_INFO   "(local build)"

Definition at line 69 of file utility.cpp.

#define N2S (   s)    "(" N2S_(s) ")"
#define N2S_ (   s)    #s

Function Documentation

__attribute_format_printf ( ,
 
)

Definition at line 719 of file utility.cpp.

void check_config ( )

Definition at line 866 of file utility.cpp.

static void check_endianness ( )
static

Definition at line 794 of file utility.cpp.

static const char* check_regex ( const char *  pattern)
static

Definition at line 372 of file utility.cpp.

static void check_snprintf ( )
static

Definition at line 845 of file utility.cpp.

void dateandtimezoneepoch ( char(&)  buffer[DATEANDEPOCHLEN],
time_t  tval 
)

Definition at line 284 of file utility.cpp.

void FixGlibcTimeZoneBug ( )

Definition at line 181 of file utility.cpp.

const char* format_capacity ( char *  str,
int  strsize,
uint64_t  val,
const char *  decimal_point 
)

Definition at line 677 of file utility.cpp.

const char* format_char_array ( char *  str,
int  strsize,
const char *  chr,
int  chrsize 
)

Definition at line 621 of file utility.cpp.

std::string format_version_info ( const char *  prog_name,
bool  full 
)

Definition at line 73 of file utility.cpp.

const char* format_with_thousands_sep ( char *  str,
int  strsize,
uint64_t  val,
const char *  thousands_sep 
)

Definition at line 645 of file utility.cpp.

bool nonempty ( const void *  data,
int  size 
)

Definition at line 611 of file utility.cpp.

const char* packetdevicetype ( int  type)

Definition at line 271 of file utility.cpp.

int safe_snprintf ( char *  buf,
int  size,
const char *  fmt,
  ... 
)

Definition at line 836 of file utility.cpp.

int safe_vsnprintf ( char *  buf,
int  size,
const char *  fmt,
va_list  ap 
)

Definition at line 824 of file utility.cpp.

int split_selective_arg ( char *  s,
uint64_t *  start,
uint64_t *  stop,
int *  mode 
)

Definition at line 559 of file utility.cpp.

std::string strprintf ( const char *  fmt,
  ... 
)

Definition at line 728 of file utility.cpp.

void syserror ( const char *  message)

Definition at line 338 of file utility.cpp.

const char* uint128_hilo_to_str ( char *  str,
int  strsize,
uint64_t  value_hi,
uint64_t  value_lo 
)

Definition at line 785 of file utility.cpp.

Variable Documentation

const char* packet_types[]
Initial value:
= {
"Direct-access (disk)",
"Sequential-access (tape)",
"Printer",
"Processor",
"Write-once (optical disk)",
"CD/DVD",
"Scanner",
"Optical memory (optical disk)",
"Medium changer",
"Communications",
"Graphic arts pre-press (10)",
"Graphic arts pre-press (11)",
"Array controller",
"Enclosure services",
"Reduced block command (simplified disk)",
"Optical card reader/writer"
}

Definition at line 48 of file utility.cpp.

const char* utility_cpp_cvsid
Initial value:
= "$Id: utility.cpp 4804 2018-10-09 19:07:13Z chrfranke $"
#define UTILITY_H_CVSID
Definition: utility.h:16

Definition at line 45 of file utility.cpp.