ContainerTracer  0.1
generic.h
Go to the documentation of this file.
1 
25 #ifndef _GENERIC_H
26 #define _GENERIC_H
27 
28 #define MAX_DRIVERS 10
29 
30 #include <stdlib.h>
31 #include <string.h>
32 #include <errno.h>
33 #include <linux/limits.h>
34 
35 #include <json.h>
36 
37 #include <log.h>
38 
39 enum { TRACE_REPLAY_DRIVER = 0,
41 };
42 
47  int (*runner)(void);
48  int (*get_interval)(const char *key,
49  char *buffer);
50  int (*get_total)(const char *key,
51  char *buffer);
52  void (*free)(
53  void);
54 };
55 
56 int get_generic_driver_index(const char *name);
57 int generic_driver_init(const char *name, void *object);
58 
67 static inline void generic_strip_string(char *str, char ch)
68 {
69  int i = 0, j = 0;
70  while (i < PATH_MAX && str[j] != '\0') {
71  if (str[i] == ch) {
72  i++;
73  continue;
74  }
75  str[j++] = str[i++];
76  }
77 }
78 
79 #endif
Definition: generic.h:40
static const char * key[]
Definition: docker-driver-test.c:55
void(* free)(void)
Definition: generic.h:52
int(* get_total)(const char *key, char *buffer)
Definition: generic.h:50
static void generic_strip_string(char *str, char ch)
Remove the word <ch> in string.
Definition: generic.h:67
name
Definition: setup.py:13
int generic_driver_init(const char *name, void *object)
This is a generic initialization function that performs initialization of driver corresponding to the...
Definition: generic.c:71
int(* runner)(void)
Definition: generic.h:47
This structure contains the driver&#39;s command set.
Definition: generic.h:46
int(* get_interval)(const char *key, char *buffer)
Definition: generic.h:48
int get_generic_driver_index(const char *name)
Get the index of the name based on an associated table.
Definition: generic.c:50
Definition: generic.h:39
Format of log printing.