ContainerTracer  0.1
Data Structures | Macros | Enumerations | Functions
generic.h File Reference

This header maintain the driver's mapping information. It's definition in runner/generic.c. More...

#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <linux/limits.h>
#include <json.h>
#include <log.h>
Include dependency graph for generic.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  generic_driver_op
 This structure contains the driver's command set. More...
 

Macros

#define MAX_DRIVERS   10
 

Enumerations

enum  { TRACE_REPLAY_DRIVER = 0, DOCKER_DRIVER = 1 }
 

Functions

int get_generic_driver_index (const char *name)
 Get the index of the name based on an associated table. More...
 
int generic_driver_init (const char *name, void *object)
 This is a generic initialization function that performs initialization of driver corresponding to the driver name. More...
 
static void generic_strip_string (char *str, char ch)
 Remove the word <ch> in string. More...
 

Detailed Description

This header maintain the driver's mapping information. It's definition in runner/generic.c.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Author
BlaCkinkGJ (ss5ki.nosp@m.jun@.nosp@m.gmail.nosp@m..com)
Version
0.1
Date
2020-08-05

Macro Definition Documentation

◆ MAX_DRIVERS

#define MAX_DRIVERS   10

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
TRACE_REPLAY_DRIVER 

tr-driver index

DOCKER_DRIVER 

docker-driver index

Function Documentation

◆ generic_driver_init()

int generic_driver_init ( const char *  name,
void *  object 
)

This is a generic initialization function that performs initialization of driver corresponding to the driver name.

Parameters
[in]namedriver's name.
[in]objectThe object which wants to initialize. Usually, global_config in this place.
Returns
0 for success to init, other value for fail to init.
Exceptions
-EINVALif doesn't exist the name in associated table.
Here is the call graph for this function:

◆ generic_strip_string()

static void generic_strip_string ( char *  str,
char  ch 
)
static

Remove the word <ch> in string.

Parameters
strInputted string.
chThe word which I want to remove.
Note
This function can degrade the total performance of the program due to linear searching.

◆ get_generic_driver_index()

int get_generic_driver_index ( const char *  name)

Get the index of the name based on an associated table.

Parameters
[in]nameThe name of driver.
Returns
index number which related to name
Exceptions
-EINVALif doesn't exist the name in associated table.