LOG: change the target type from uint32_t to int32_t.

This is so that you won't get warnings from mixing integer types.

I have updated the input checks in log.c to check for invalid
targets.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
This commit is contained in:
Angus Salkeld 2011-04-09 22:54:14 +10:00
parent 1844a839a6
commit 58697dbcc6
2 changed files with 11 additions and 7 deletions

View File

@ -377,14 +377,14 @@ void qb_log_callsites_dump(void);
* @retval -errno on error
* @retval 0 on success
*/
int32_t qb_log_ctl(uint32_t t, enum qb_log_conf c, int32_t arg);
int32_t qb_log_ctl(int32_t t, enum qb_log_conf c, int32_t arg);
/**
* Filter control
*
* This allows you define which log messages go to which target.
*/
int32_t qb_log_filter_ctl(uint32_t value, enum qb_log_filter_conf c,
int32_t qb_log_filter_ctl(int32_t value, enum qb_log_filter_conf c,
enum qb_log_filter_type type, const char * text,
uint32_t priority);

View File

@ -392,12 +392,16 @@ static void _log_filter_apply(struct callsite_section *sect,
}
}
int32_t qb_log_filter_ctl(uint32_t t, enum qb_log_filter_conf c,
int32_t qb_log_filter_ctl(int32_t t, enum qb_log_filter_conf c,
enum qb_log_filter_type type,
const char *text, uint32_t priority)
{
struct callsite_section *sect;
int32_t rc = _log_filter_store(t, c, type, text, priority);
int32_t rc;
if (t < 0 || t >= 32) {
return -EBADFD;
}
rc = _log_filter_store(t, c, type, text, priority);
if (rc < 0) {
return rc;
}
@ -572,13 +576,13 @@ static void _log_target_disable(struct qb_log_target *t)
qb_list_del(&t->active_list);
}
int32_t qb_log_ctl(uint32_t t, enum qb_log_conf c, int32_t arg)
int32_t qb_log_ctl(int32_t t, enum qb_log_conf c, int32_t arg)
{
int32_t rc = 0;
int32_t need_reload = QB_FALSE;
if (t > 31) {
return -EINVAL;
if (t < 0 || t >= 32) {
return -EBADFD;
}
switch (c) {
case QB_LOG_CONF_ENABLED: