Commit c6b4d181 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Make the records static in the VSLQ_dispatch_f() api

Use the and mark __match_proto__() the typedef where applicable.
parent f2336782
......@@ -57,7 +57,6 @@
#include "vapi/vsl.h"
#include "vtim.h"
#include "vqueue.h"
#include "miniobj.h"
#include "vas.h"
#include "vre.h"
......@@ -176,8 +175,9 @@ logexp_next(struct logexp *le)
vtc_log(le->vl, 3, "tst| %s", VSB_data(le->test->str));
}
static int
logexp_dispatch(struct VSL_data *vsl, struct VSL_transaction *pt[], void *priv)
static int __match_proto__(VSLQ_dispatch_f)
logexp_dispatch(struct VSL_data *vsl, struct VSL_transaction * const pt[],
void *priv)
{
struct logexp *le;
struct VSL_transaction *t;
......@@ -275,7 +275,7 @@ logexp_thread(void *priv)
AZ(le->test);
logexp_next(le);
while (le->test) {
i = VSLQ_Dispatch(le->vslq, &logexp_dispatch, le);
i = VSLQ_Dispatch(le->vslq, logexp_dispatch, le);
if (i < 0)
vtc_log(le->vl, 0, "dispatch: %d", i);
if (i == 0 && le->test)
......
......@@ -84,6 +84,21 @@ enum VSL_grouping_e {
VSL_g_session,
};
typedef int VSLQ_dispatch_f(struct VSL_data *vsl,
struct VSL_transaction * const trans[], void *priv);
/*
* The callback function type for use with VSLQ_Dispatch.
*
* Arguments:
* vsl: The VSL_data context
* trans[]: A NULL terminated array of pointers to VSL_transaction.
* priv: The priv argument from VSL_Dispatch
*
* Return value:
* 0: OK - continue
* !=0: Makes VSLQ_Dispatch return with this return value immediatly
*/
extern const char *VSL_tags[256];
/*
* Tag to string array. Contains NULL for invalid tags.
......@@ -260,8 +275,7 @@ int VSL_PrintAll(struct VSL_data *vsl, struct VSL_cursor *c, void *fo);
* !=0: Return value from either VSL_Next or VSL_Print
*/
int VSL_PrintTransactions(struct VSL_data *vsl,
struct VSL_transaction *ptrans[], void *fo);
VSLQ_dispatch_f VSL_PrintTransactions;
/*
* Prints out each transaction in the array ptrans. For
* transactions of level > 0 it will print a header before the log
......@@ -316,8 +330,7 @@ int VSL_WriteAll(struct VSL_data *vsl, struct VSL_cursor *c, void *fo);
* !=0: Return value from either VSL_Next or VSL_Write
*/
int VSL_WriteTransactions(struct VSL_data *vsl,
struct VSL_transaction *ptrans[], void *fo);
VSLQ_dispatch_f VSL_WriteTransactions;
/*
* Write all transactions in ptrans using VSL_WriteAll
* Return values:
......@@ -347,21 +360,6 @@ void VSLQ_Delete(struct VSLQ **pvslq);
* Delete the query pointed to by pvslq, freeing up the resources
*/
typedef int VSLQ_dispatch_f(struct VSL_data *vsl,
struct VSL_transaction *trans[], void *priv);
/*
* The callback function type for use with VSLQ_Dispatch.
*
* Arguments:
* vsl: The VSL_data context
* trans[]: A NULL terminated array of pointers to VSL_transaction.
* priv: The priv argument from VSL_Dispatch
*
* Return value:
* 0: OK - continue
* !=0: Makes VSLQ_Dispatch return with this return value immediatly
*/
int VSLQ_Dispatch(struct VSLQ *vslq, VSLQ_dispatch_f *func, void *priv);
/*
* Process log and call func for each set matching the specified
......
......@@ -307,8 +307,8 @@ VSL_PrintAll(struct VSL_data *vsl, struct VSL_cursor *c, void *fo)
}
}
int
VSL_PrintTransactions(struct VSL_data *vsl, struct VSL_transaction *pt[],
int __match_proto__(VSLQ_dispatch_f)
VSL_PrintTransactions(struct VSL_data *vsl, struct VSL_transaction * const pt[],
void *fo)
{
struct VSL_transaction *t;
......@@ -425,8 +425,8 @@ VSL_WriteAll(struct VSL_data *vsl, struct VSL_cursor *c, void *fo)
}
}
int
VSL_WriteTransactions(struct VSL_data *vsl, struct VSL_transaction *pt[],
int __match_proto__(VSLQ_dispatch_f)
VSL_WriteTransactions(struct VSL_data *vsl, struct VSL_transaction * const pt[],
void *fo)
{
struct VSL_transaction *t;
......
......@@ -270,6 +270,7 @@ VSL_CursorVSM(struct VSL_data *vsl, struct VSM_data *vsm, int tail)
} else
AZ(vslc_vsm_reset(&c->c));
/* XXX: How does 'c' ever get freed ? */
return (&c->c.c);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment