ContainerTracer  0.1
Functions | Variables
generic.c File Reference

This makes runner to determine the driver in runtime. More...

#include <generic.h>
#include <driver/tr-driver.h>
#include <driver/docker-driver.h>
Include dependency graph for generic.c:

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...
 

Variables

const char * driver_name_tbl []
 
static int(* driver_init_tbl [])(void *object)
 

Detailed Description

This makes runner to determine the driver in runtime.

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
Note
reference link: https://github.com/mit-pdos/xv6-public/blob/master/syscall.c

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:

◆ 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.

Variable Documentation

◆ driver_init_tbl

int(* driver_init_tbl[])(void *object)
static
Initial value:
= {
}
Definition: generic.h:40
int docker_init(void *object)
Initialize the global configuration and per processes configuration.
Definition: docker-driver.c:253
Definition: generic.h:39
int tr_init(void *object)
Initialize the global configuration and per processes configuration.
Definition: tr-driver.c:182

Associated initialization table of each driver. This uses in generic_driver_init()

◆ driver_name_tbl

const char* driver_name_tbl[]
Initial value:
= {
[TRACE_REPLAY_DRIVER] = "trace-replay",
[DOCKER_DRIVER] = "docker",
NULL,
}
Definition: generic.h:40
Definition: generic.h:39

Associated table of each driver.