1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

Always compile debug logging into clvmd as it's too useful to

restrict to just developers.
-d will switch it on and run the daemon in the foreground
This commit is contained in:
Patrick Caulfield 2006-11-30 13:19:42 +00:00
parent 736751930f
commit a16f48e31a
3 changed files with 21 additions and 7 deletions

View File

@ -1,6 +1,7 @@
Version 2.02.16 - Version 2.02.16 -
==================================== ====================================
Add startup timeout to RHEL4 clvmd startup script Always compile debug logging into clvmd.
Add startup timeout to RHEL4 clvmd startup script.
Add -T (startup timeout) switch to clvmd. Add -T (startup timeout) switch to clvmd.
Improve lvm_dump.sh robustness. Improve lvm_dump.sh robustness.
Update lvm2create_initrd to support gentoo. Update lvm2create_initrd to support gentoo.

View File

@ -30,6 +30,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stddef.h> #include <stddef.h>
#include <stdarg.h>
#include <signal.h> #include <signal.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
@ -85,6 +86,7 @@ struct lvm_thread_cmd {
int msglen; int msglen;
unsigned short xid; unsigned short xid;
}; };
static int debug = 0;
static pthread_t lvm_thread; static pthread_t lvm_thread;
static pthread_mutex_t lvm_thread_mutex; static pthread_mutex_t lvm_thread_mutex;
static pthread_cond_t lvm_thread_cond; static pthread_cond_t lvm_thread_cond;
@ -163,13 +165,27 @@ static void child_init_signal(int status)
} }
void debuglog(const char *fmt, ...)
{
time_t P;
va_list ap;
if (!debug)
return;
va_start(ap,fmt);
time(&P);
fprintf(stderr, "CLVMD[%x]: %.15s ", (int)pthread_self(), ctime(&P)+4 );
vfprintf(stderr, fmt, ap);
va_end(ap);
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int local_sock; int local_sock;
struct local_client *newfd; struct local_client *newfd;
struct utsname nodeinfo; struct utsname nodeinfo;
signed char opt; signed char opt;
int debug = 0;
int cmd_timeout = DEFAULT_CMD_TIMEOUT; int cmd_timeout = DEFAULT_CMD_TIMEOUT;
int start_timeout = 0; int start_timeout = 0;
sigset_t ss; sigset_t ss;

View File

@ -95,11 +95,7 @@ struct local_client {
} bits; } bits;
}; };
#ifdef DEBUG #define DEBUGLOG(fmt, args...) debuglog(fmt, ## args);
#define DEBUGLOG(fmt, args...) {time_t P; time(&P); fprintf(stderr, "CLVMD[%x]: %.15s ", (int)pthread_self(), ctime(&P)+4 ); fprintf(stderr, fmt, ## args);}
#else
#define DEBUGLOG(fmt, args...)
#endif
#ifndef max #ifndef max
#define max(a,b) ((a)>(b)?(a):(b)) #define max(a,b) ((a)>(b)?(a):(b))
@ -117,6 +113,7 @@ extern int add_client(struct local_client *new_client);
extern void clvmd_cluster_init_completed(void); extern void clvmd_cluster_init_completed(void);
extern void process_message(struct local_client *client, char *buf, int len, char *csid); extern void process_message(struct local_client *client, char *buf, int len, char *csid);
extern void debuglog(const char *fmt, ... );
int sync_lock(const char *resource, int mode, int flags, int *lockid); int sync_lock(const char *resource, int mode, int flags, int *lockid);
int sync_unlock(const char *resource, int lockid); int sync_unlock(const char *resource, int lockid);