Commit d39b33a3 authored by Milan Broz's avatar Milan Broz

Avoid class C++ keyword in library header.

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@197 36d66b0a-2a48-0410-832c-cd162a569da5
parent 71c0c1f2
2010-04-12 Milan Broz <mbroz@redhat.com>
* Fix package config to use proper package version.
* Avoid class C++ keyword in library header.
2010-04-06 Milan Broz <mbroz@redhat.com>
* Prefer some device paths in status display.
......
......@@ -37,24 +37,24 @@ int crypt_init_by_name(struct crypt_device **cd, const char *name);
*
* @cd - crypt device handle (can be NULL to set default log function)
* @usrptr - provided identification in callback
* @class - log type below (debug messages can uses other levels)
* @level - log level below (debug messages can uses other levels)
* @msg - log message
*/
#define CRYPT_LOG_NORMAL 0
#define CRYPT_LOG_ERROR 1
#define CRYPT_LOG_DEBUG -1 /* always on stdout */
void crypt_set_log_callback(struct crypt_device *cd,
void (*log)(int class, const char *msg, void *usrptr),
void (*log)(int level, const char *msg, void *usrptr),
void *usrptr);
/**
* Log message through log function.
*
* @cd - crypt device handle
* @class - log type
* @level - log level
* @msg - log message
*/
void crypt_log(struct crypt_device *cd, int class, const char *msg);
void crypt_log(struct crypt_device *cd, int level, const char *msg);
/**
* Set confirmation callback (yes/no)
......@@ -518,7 +518,7 @@ void crypt_set_debug_level(int level);
struct interface_callbacks {
int (*yesDialog)(char *msg);
void (*log)(int class, char *msg);
void (*log)(int level, char *msg);
};
#define CRYPT_FLAG_VERIFY (1 << 0)
......
......@@ -30,7 +30,7 @@ struct crypt_device {
char *plain_uuid;
/* callbacks definitions */
void (*log)(int class, const char *msg, void *usrptr);
void (*log)(int level, const char *msg, void *usrptr);
void *log_usrptr;
int (*confirm)(const char *msg, void *usrptr);
void *confirm_usrptr;
......@@ -39,7 +39,7 @@ struct crypt_device {
};
/* Log helper */
static void (*_default_log)(int class, const char *msg, void *usrptr) = NULL;
static void (*_default_log)(int level, const char *msg, void *usrptr) = NULL;
static int _debug_level = 0;
void crypt_set_debug_level(int level)
......@@ -52,15 +52,15 @@ int crypt_get_debug_level()
return _debug_level;
}
void crypt_log(struct crypt_device *cd, int class, const char *msg)
void crypt_log(struct crypt_device *cd, int level, const char *msg)
{
if (cd && cd->log)
cd->log(class, msg, cd->log_usrptr);
cd->log(level, msg, cd->log_usrptr);
else if (_default_log)
_default_log(class, msg, NULL);
_default_log(level, msg, NULL);
}
void logger(struct crypt_device *cd, int class, const char *file,
void logger(struct crypt_device *cd, int level, const char *file,
int line, const char *format, ...)
{
va_list argp;
......@@ -69,8 +69,8 @@ void logger(struct crypt_device *cd, int class, const char *file,
va_start(argp, format);
if (vasprintf(&target, format, argp) > 0) {
if (class >= 0) {
crypt_log(cd, class, target);
if (level >= 0) {
crypt_log(cd, level, target);
#ifdef CRYPT_DEBUG
} else if (_debug_level)
printf("# %s:%d %s\n", file ?: "?", line, target);
......@@ -419,10 +419,10 @@ static int open_from_hdr_and_mk(struct crypt_device *cd,
return r;
}
static void log_wrapper(int class, const char *msg, void *usrptr)
static void log_wrapper(int level, const char *msg, void *usrptr)
{
void (*xlog)(int class, char *msg) = usrptr;
xlog(class, (char *)msg);
void (*xlog)(int level, char *msg) = usrptr;
xlog(level, (char *)msg);
}
static int yesDialog_wrapper(const char *msg, void *usrptr)
......@@ -556,7 +556,7 @@ static int _crypt_init(struct crypt_device **cd,
}
void crypt_set_log_callback(struct crypt_device *cd,
void (*log)(int class, const char *msg, void *usrptr),
void (*log)(int level, const char *msg, void *usrptr),
void *usrptr)
{
if (!cd)
......
......@@ -90,7 +90,7 @@ static struct action_type {
{ NULL, NULL, 0, 0, 0, NULL, NULL }
};
static void clogger(struct crypt_device *cd, int class, const char *file,
static void clogger(struct crypt_device *cd, int level, const char *file,
int line, const char *format, ...)
{
va_list argp;
......@@ -99,8 +99,8 @@ static void clogger(struct crypt_device *cd, int class, const char *file,
va_start(argp, format);
if (vasprintf(&target, format, argp) > 0) {
if (class >= 0) {
crypt_log(cd, class, target);
if (level >= 0) {
crypt_log(cd, level, target);
#ifdef CRYPT_DEBUG
} else if (opt_debug)
printf("# %s:%d %s\n", file ?: "?", line, target);
......@@ -137,8 +137,8 @@ static int yesDialog(char *msg)
return r;
}
static void cmdLineLog(int class, char *msg) {
switch(class) {
static void cmdLineLog(int level, char *msg) {
switch(level) {
case CRYPT_LOG_NORMAL:
fputs(msg, stdout);
......@@ -157,9 +157,9 @@ static struct interface_callbacks cmd_icb = {
.log = cmdLineLog,
};
static void _log(int class, const char *msg, void *usrptr)
static void _log(int level, const char *msg, void *usrptr)
{
cmdLineLog(class, (char *)msg);
cmdLineLog(level, (char *)msg);
}
static int _yesDialog(const char *msg, void *usrptr)
......
......@@ -109,15 +109,15 @@ static int yesDialog(char *msg)
return 1;
}
static void cmdLineLog(int class, char *msg)
static void cmdLineLog(int level, char *msg)
{
strncat(global_log, msg, sizeof(global_log));
global_lines++;
}
static void new_log(int class, const char *msg, void *usrptr)
static void new_log(int level, const char *msg, void *usrptr)
{
cmdLineLog(class, (char*)msg);
cmdLineLog(level, (char*)msg);
}
......
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