Add sr_ prefix for datastore API functions.

This commit is contained in:
Uwe Hermann 2011-02-08 21:22:10 +01:00
parent 2bf4aca64a
commit c49111295f
4 changed files with 22 additions and 19 deletions

View File

@ -23,9 +23,9 @@
#include <glib.h>
#include <sigrok.h>
static gpointer new_chunk(struct datastore **ds);
static gpointer new_chunk(struct sr_datastore **ds);
int datastore_new(int unitsize, struct datastore **ds)
int sr_datastore_new(int unitsize, struct sr_datastore **ds)
{
if (!ds)
return SR_ERR;
@ -33,7 +33,7 @@ int datastore_new(int unitsize, struct datastore **ds)
if (unitsize <= 0)
return SR_ERR; /* TODO: Different error? */
if (!(*ds = g_malloc(sizeof(struct datastore))))
if (!(*ds = g_malloc(sizeof(struct sr_datastore))))
return SR_ERR_MALLOC;
(*ds)->ds_unitsize = unitsize;
@ -43,7 +43,7 @@ int datastore_new(int unitsize, struct datastore **ds)
return SR_OK;
}
int datastore_destroy(struct datastore *ds)
int sr_datastore_destroy(struct sr_datastore *ds)
{
GSList *chunk;
@ -58,8 +58,8 @@ int datastore_destroy(struct datastore *ds)
return SR_OK;
}
void datastore_put(struct datastore *ds, void *data, unsigned int length,
int in_unitsize, int *probelist)
void sr_datastore_put(struct sr_datastore *ds, void *data, unsigned int length,
int in_unitsize, int *probelist)
{
unsigned int stored;
int capacity, size, num_chunks, chunk_bytes_free, chunk_offset;
@ -100,7 +100,7 @@ void datastore_put(struct datastore *ds, void *data, unsigned int length,
ds->num_units += stored / ds->ds_unitsize;
}
static gpointer new_chunk(struct datastore **ds)
static gpointer new_chunk(struct sr_datastore **ds)
{
gpointer chunk;

View File

@ -142,7 +142,7 @@ int sr_session_save(char *filename)
FILE *meta;
struct sr_device *device;
struct sr_probe *probe;
struct datastore *ds;
struct sr_datastore *ds;
struct zip *zipfile;
struct zip_source *versrc, *metasrc, *logicsrc;
int bufcnt, devcnt, tmpfile, ret, error, probecnt;

View File

@ -27,10 +27,10 @@ void sr_exit(void);
/*--- datastore.c -----------------------------------------------------------*/
int datastore_new(int unitsize, struct datastore **ds);
int datastore_destroy(struct datastore *ds);
void datastore_put(struct datastore *ds, void *data, unsigned int length,
int in_unitsize, int *probelist);
int sr_datastore_new(int unitsize, struct sr_datastore **ds);
int sr_datastore_destroy(struct sr_datastore *ds);
void sr_datastore_put(struct sr_datastore *ds, void *data, unsigned int length,
int in_unitsize, int *probelist);
/*--- device.c --------------------------------------------------------------*/
@ -38,8 +38,8 @@ void sr_device_scan(void);
int sr_device_plugin_init(struct sr_device_plugin *plugin);
void sr_device_close_all(void);
GSList *sr_device_list(void);
struct sr_device *sr_device_new(struct sr_device_plugin *plugin, int plugin_index,
int num_probes);
struct sr_device *sr_device_new(struct sr_device_plugin *plugin,
int plugin_index, int num_probes);
void sr_device_clear(struct sr_device *device);
void sr_device_destroy(struct sr_device *dev);
@ -49,7 +49,8 @@ struct sr_probe *probe_find(struct sr_device *device, int probenum);
void sr_device_probe_name(struct sr_device *device, int probenum, char *name);
void sr_device_trigger_clear(struct sr_device *device);
void sr_device_trigger_set(struct sr_device *device, int probenum, char *trigger);
void sr_device_trigger_set(struct sr_device *device, int probenum,
char *trigger);
gboolean sr_device_has_hwcap(struct sr_device *device, int hwcap);
/*--- filter.c --------------------------------------------------------------*/
@ -116,7 +117,8 @@ int sr_session_start(void);
void sr_session_run(void);
void sr_session_halt(void);
void sr_session_stop(void);
void sr_session_bus(struct sr_device *device, struct sr_datafeed_packet *packet);
void sr_session_bus(struct sr_device *device,
struct sr_datafeed_packet *packet);
void make_metadata(char *filename);
int sr_session_save(char *filename);
void sr_session_source_add(int fd, int events, int timeout,
@ -135,7 +137,8 @@ struct sr_output_format **sr_output_list(void);
char *sr_samplerate_string(uint64_t samplerate);
char *sr_period_string(uint64_t frequency);
char **sr_parse_triggerstring(struct sr_device *device, const char *triggerstring);
char **sr_parse_triggerstring(struct sr_device *device,
const char *triggerstring);
uint64_t sr_parse_sizestring(const char *sizestring);
uint64_t sr_parse_timestring(const char *timestring);

View File

@ -175,7 +175,7 @@ struct analyzer {
/* Size of a chunk in units */
#define DATASTORE_CHUNKSIZE 512000
struct datastore {
struct sr_datastore {
/* Size in bytes of the number of units stored in this datastore */
int ds_unitsize;
unsigned int num_units; /* TODO: uint64_t */
@ -196,7 +196,7 @@ struct sr_device {
/* List of struct sr_probe* */
GSList *probes;
/* Data acquired by this device, if any */
struct datastore *datastore;
struct sr_datastore *datastore;
};
enum {