smartmontools  SVN Rev 4814
Utility to control and monitor storage systems with "S.M.A.R.T."
Classes | Macros | Functions
utility.h File Reference
#include <float.h>
#include <time.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <string>
#include <sys/types.h>
#include <regex.h>
Include dependency graph for utility.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  raw_buffer
 
class  stdio_file
 Wrapper class for FILE *. More...
 
class  regular_expression
 Wrapper class for POSIX regex(3) or std::regex Supports copy & assignment and is compatible with STL containers. More...
 

Macros

#define UTILITY_H_CVSID   "$Id: utility.h 4805 2018-10-09 19:34:46Z chrfranke $"
 
#define __attribute_format_printf(x, y)
 
#define snprintf   safe_snprintf
 
#define vsnprintf   safe_vsnprintf
 
#define DATEANDEPOCHLEN   64
 

Functions

std::string format_version_info (const char *prog_name, bool full=false)
 
std::string strprintf (const char *fmt,...) __attribute_format_printf(1
 
std::string std::string vstrprintf (const char *fmt, va_list ap)
 
bool str_starts_with (const char *str, const char *prefix)
 
bool str_starts_with (const std::string &str, const char *prefix)
 
int safe_snprintf (char *buf, int size, const char *fmt,...) __attribute_format_printf(3
 
int int safe_vsnprintf (char *buf, int size, const char *fmt, va_list ap)
 
void dateandtimezoneepoch (char(&buffer)[DATEANDEPOCHLEN], time_t tval)
 
void pout (const char *fmt,...) __attribute_format_printf(1
 
void void syserror (const char *message)
 
int split_selective_arg (char *s, uint64_t *start, uint64_t *stop, int *mode)
 
bool isbigendian ()
 
void check_config ()
 
const char * packetdevicetype (int type)
 
bool nonempty (const void *data, int size)
 
void FixGlibcTimeZoneBug ()
 
const char * format_char_array (char *str, int strsize, const char *chr, int chrsize)
 
template<size_t STRSIZE, size_t CHRSIZE>
const char * format_char_array (char(&str)[STRSIZE], const char(&chr)[CHRSIZE])
 
const char * format_with_thousands_sep (char *str, int strsize, uint64_t val, const char *thousands_sep=0)
 
const char * format_capacity (char *str, int strsize, uint64_t val, const char *decimal_point=0)
 
int uint128_to_str_precision_bits ()
 
const char * uint128_hilo_to_str (char *str, int strsize, uint64_t value_hi, uint64_t value_lo)
 
template<size_t SIZE>
const char * uint128_hilo_to_str (char(&str)[SIZE], uint64_t value_hi, uint64_t value_lo)
 

Macro Definition Documentation

#define __attribute_format_printf (   x,
 
)

Definition at line 34 of file utility.h.

#define DATEANDEPOCHLEN   64

Definition at line 70 of file utility.h.

#define snprintf   safe_snprintf

Definition at line 63 of file utility.h.

#define UTILITY_H_CVSID   "$Id: utility.h 4805 2018-10-09 19:34:46Z chrfranke $"

Definition at line 16 of file utility.h.

#define vsnprintf   safe_vsnprintf

Definition at line 64 of file utility.h.

Function Documentation

void check_config ( )

Definition at line 866 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 = 0 
)

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.

template<size_t STRSIZE, size_t CHRSIZE>
const char* format_char_array ( char(&)  str[STRSIZE],
const char(&)  chr[CHRSIZE] 
)
inline

Definition at line 117 of file utility.h.

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

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 = 0 
)

Definition at line 645 of file utility.cpp.

bool isbigendian ( )
inline

Definition at line 88 of file utility.h.

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.

void pout ( const char *  fmt,
  ... 
)
int safe_snprintf ( char *  buf,
int  size,
const char *  fmt,
  ... 
)
int 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.

bool str_starts_with ( const char *  str,
const char *  prefix 
)
inline

Definition at line 52 of file utility.h.

bool str_starts_with ( const std::string &  str,
const char *  prefix 
)
inline

Definition at line 55 of file utility.h.

std::string strprintf ( const char *  fmt,
  ... 
)
void 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.

template<size_t SIZE>
const char* uint128_hilo_to_str ( char(&)  str[SIZE],
uint64_t  value_hi,
uint64_t  value_lo 
)
inline

Definition at line 307 of file utility.h.

int uint128_to_str_precision_bits ( )
inline

Definition at line 291 of file utility.h.

std::string std::string vstrprintf ( const char *  fmt,
va_list  ap 
)