rename config -> options

This commit is contained in:
luwenpeng
2024-03-08 14:51:21 +08:00
parent d0914483bb
commit 734f6a5135
32 changed files with 336 additions and 336 deletions

View File

@@ -5,7 +5,7 @@
#include "packet_io_marsio.h"
#include "packet_io_dumpfile.h"
typedef void *new_cb(void *config);
typedef void *new_cb(void *options);
typedef void free_cb(void *handle);
typedef void *stat_cb(void *handle);
typedef int init_cb(void *handle, uint16_t thread_id);
@@ -23,7 +23,7 @@ struct packet_io
send_cb *on_send;
};
struct packet_io *packet_io_new(struct packet_io_config *config)
struct packet_io *packet_io_new(struct packet_io_options *opts)
{
struct packet_io *handle = (struct packet_io *)calloc(1, sizeof(struct packet_io));
if (handle == NULL)
@@ -32,21 +32,21 @@ struct packet_io *packet_io_new(struct packet_io_config *config)
return NULL;
}
struct packet_io_marsio_confg marsio_config;
strncpy(marsio_config.app_symbol, config->app_symbol, sizeof(marsio_config.app_symbol));
strncpy(marsio_config.dev_symbol, config->dev_symbol, sizeof(marsio_config.dev_symbol));
memcpy(marsio_config.cpu_mask, config->cpu_mask, sizeof(marsio_config.cpu_mask));
marsio_config.nr_threads = config->nr_threads;
struct packet_io_marsio_opts marsio_opts;
strncpy(marsio_opts.app_symbol, opts->app_symbol, sizeof(marsio_opts.app_symbol));
strncpy(marsio_opts.dev_symbol, opts->dev_symbol, sizeof(marsio_opts.dev_symbol));
memcpy(marsio_opts.cpu_mask, opts->cpu_mask, sizeof(marsio_opts.cpu_mask));
marsio_opts.nr_threads = opts->nr_threads;
struct packet_io_dumpfile_confg dumpfile_config;
strncpy(dumpfile_config.dumpfile_dir, config->dumpfile_dir, sizeof(dumpfile_config.dumpfile_dir));
dumpfile_config.nr_threads = config->nr_threads;
struct packet_io_dumpfile_opts dumpfile_opts;
strncpy(dumpfile_opts.dumpfile_dir, opts->dumpfile_dir, sizeof(dumpfile_opts.dumpfile_dir));
dumpfile_opts.nr_threads = opts->nr_threads;
void *_config = NULL;
void *_opts = NULL;
if (config->mode == PACKET_IO_MARSIO)
if (opts->mode == PACKET_IO_MARSIO)
{
_config = &marsio_config;
_opts = &marsio_opts;
handle->on_new = (new_cb *)packet_io_marsio_new;
handle->on_free = (free_cb *)packet_io_marsio_free;
handle->on_stat = (stat_cb *)packet_io_marsio_stat;
@@ -56,7 +56,7 @@ struct packet_io *packet_io_new(struct packet_io_config *config)
}
else
{
_config = &dumpfile_config;
_opts = &dumpfile_opts;
handle->on_new = (new_cb *)packet_io_dumpfile_new;
handle->on_free = (free_cb *)packet_io_dumpfile_free;
handle->on_stat = (stat_cb *)packet_io_dumpfile_stat;
@@ -65,7 +65,7 @@ struct packet_io *packet_io_new(struct packet_io_config *config)
handle->on_send = (send_cb *)packet_io_dumpfile_send;
}
handle->handle = handle->on_new(_config);
handle->handle = handle->on_new(_opts);
if (handle->handle == NULL)
{
goto error_out;