Hi Kazutomo-san,

On Fri, Mar 19, 2010 at 06:00:26PM +0900, NAKAHIRA Kazutomo wrote:
> Hi, all
> 
> I fixed sfex_daemon logging issue that listed below.
> 
> 1. sfex_daemon does not output logs
> The cl_log library has not been initialized in the sfex_daemon.c
> and cl_log() functions does not output logs.
> ("cl_log_set_*" functions does not called.)
> 
> 2. SFEX_LOG_* macros were changed to the cl_log function.
> To unify the log output function to the same format as other daemons.
> 
> 3. The log-level of "lock acquired" message was changed
>    from error to info.
> 
> And other trivial fixes(unify log sentence format, add new logs)
> included in the attached patch.
> 
> Please see attached and comment me if there are any suggestions.

Applied. Thanks for the patch.

Dejan

> Best regards,
> NAKAHIRA Kazutomo

> # HG changeset patch
> # User NAKAHIRA Kazutomo <[email protected]>
> # Date 1268984520 -32400
> # Node ID 9a9f5ef72afbc30851206b1665ebee26964e30a4
> # Parent  a10b01a6c5a778589937e9b25dd14265628e5082
> SFEX daemon: Fix logging
> 
> diff -r a10b01a6c5a7 -r 9a9f5ef72afb tools/sfex.h
> --- a/tools/sfex.h    Thu Mar 18 20:30:10 2010 +0100
> +++ b/tools/sfex.h    Fri Mar 19 16:42:00 2010 +0900
> @@ -173,11 +173,4 @@
>  extern char *nodename;
>  extern unsigned long sector_size;
>  
> -#define SFEX_LOG_ERR(args...) cl_log(LOG_ERR, args)
> -#define SFEX_LOG_INFO(args...) cl_log(LOG_INFO, args)
> -#if 0
> -#define SFEX_LOG_ERR(args...) do {fprintf(stderr, args);} while (0)
> -#define SFEX_LOG_INFO(args...) do {fprintf(stderr, args);} while (0)
> -#endif
> -
>  #endif /* SFEX_H */
> diff -r a10b01a6c5a7 -r 9a9f5ef72afb tools/sfex_daemon.c
> --- a/tools/sfex_daemon.c     Thu Mar 18 20:30:10 2010 +0100
> +++ b/tools/sfex_daemon.c     Fri Mar 19 16:42:00 2010 +0900
> @@ -1,3 +1,4 @@
> +#include <config.h>
>  #include <stdio.h>
>  #include <unistd.h>
>  #include <string.h>
> @@ -14,6 +15,10 @@
>  #include "sfex.h"
>  #include "sfex_lib.h"
>  
> +#if HAVE_GLUE_CONFIG_H
> +#include <glue_config.h> /* for HA_LOG_FACILITY */
> +#endif
> +
>  static int sysrq_fd;
>  static int lock_index = 1;        /* default 1st lock */
>  static time_t collision_timeout = 1; /* default 1 sec */
> @@ -37,25 +42,25 @@
>  static int lock_index_check(void)
>  {
>       if (read_controldata(&cdata) == -1) {
> -             SFEX_LOG_ERR("%s\n", "read_controldata failed in 
> lock_index_check");
> +             cl_log(LOG_ERR, "%s\n", "read_controldata failed in 
> lock_index_check");
>               return -1;
>       }
>  #ifdef SFEX_DEBUG
> -     SFEX_LOG_INFO("version: %d\n", cdata.version);
> -     SFEX_LOG_INFO("revision: %d\n", cdata.revision);
> -     SFEX_LOG_INFO("blocksize: %d\n", cdata.blocksize);
> -     SFEX_LOG_INFO("numlocks: %d\n", cdata.numlocks);
> +     cl_log(LOG_INFO, "version: %d\n", cdata.version);
> +     cl_log(LOG_INFO, "revision: %d\n", cdata.revision);
> +     cl_log(LOG_INFO, "blocksize: %d\n", cdata.blocksize);
> +     cl_log(LOG_INFO, "numlocks: %d\n", cdata.numlocks);
>  #endif
>  
>       if (lock_index > cdata.numlocks) {
> -             SFEX_LOG_ERR("%s: ERROR: index %d is too large. %d locks are 
> stored.\n",
> -                             progname, lock_index, cdata.numlocks);
> +             cl_log(LOG_ERR, "index %d is too large. %d locks are stored.\n",
> +                             lock_index, cdata.numlocks);
>               return -1;
>               /*exit(EXIT_FAILURE);*/
>       }
>  
>       if (cdata.blocksize != sector_size) {
> -             SFEX_LOG_ERR("%s: ERROR: sector_size is not the same as the 
> blocksize.\n", progname);
> +             cl_log(LOG_ERR, "sector_size is not the same as the 
> blocksize.\n");
>               return -1;
>       }
>       return 0;
> @@ -64,7 +69,7 @@
>  static void acquire_lock(void)
>  {
>       if (read_lockdata(&cdata, &ldata, lock_index) == -1) {
> -             SFEX_LOG_ERR("%s\n", "read_lockdata failed in acquire_lock");
> +             cl_log(LOG_ERR, "read_lockdata failed in acquire_lock\n");
>               exit(EXIT_FAILURE);
>       }
>  
> @@ -74,7 +79,7 @@
>                       t = sleep(t);
>               read_lockdata(&cdata, &ldata_new, lock_index);
>               if (ldata.count != ldata_new.count) {
> -                     SFEX_LOG_ERR("%s", "can\'t acquire lock: the lock's 
> already hold by some other node.\n");
> +                     cl_log(LOG_ERR, "can\'t acquire lock: the lock's 
> already hold by some other node.\n");
>                       exit(2);
>               }
>       }
> @@ -84,7 +89,7 @@
>       ldata.count = SFEX_NEXT_COUNT(ldata.count);
>       strncpy((char*)(ldata.nodename), nodename, sizeof(ldata.nodename));
>       if (write_lockdata(&cdata, &ldata, lock_index) == -1) {
> -             SFEX_LOG_ERR("%s", "write_lockdata failed\n");
> +             cl_log(LOG_ERR, "write_lockdata failed\n");
>               exit(EXIT_FAILURE);
>       }
>  
> @@ -100,10 +105,10 @@
>               while (t > 0)
>                       t = sleep(t);
>               if (read_lockdata(&cdata, &ldata_new, lock_index) == -1) {
> -                     SFEX_LOG_ERR("%s", "read_lockdata failed\n");
> +                     cl_log(LOG_ERR, "read_lockdata failed in collision 
> detection\n");
>               }
>               if (strncmp((char*)(ldata.nodename), (const 
> char*)(ldata_new.nodename), sizeof(ldata.nodename))) {
> -                     SFEX_LOG_ERR("%s", "can\'t acquire lock: collision 
> detected in the air.\n");
> +                     cl_log(LOG_ERR, "can\'t acquire lock: collision 
> detected in the air.\n");
>                       exit(2);
>               }
>       }
> @@ -113,15 +118,16 @@
>          the collision_timeout seconds to detect the collision. */
>       ldata.count = SFEX_NEXT_COUNT(ldata.count);
>       if (write_lockdata(&cdata, &ldata, lock_index) == -1) {
> -             SFEX_LOG_ERR("%s\n", "write_lockdata failed");
> +             cl_log(LOG_ERR, "write_lockdata failed in extension of lock\n");
>               exit(EXIT_FAILURE);
>       }
> -     SFEX_LOG_ERR("%s", "lock acquired\n");
> +     cl_log(LOG_INFO, "lock acquired\n");
>  }
>  
>  static void error_todo (void)
>  {
>       if (fork() == 0) {
> +             cl_log(LOG_INFO, "Execute \"crm_resource -F -r %s -H %s\" 
> command\n", rsc_id, nodename);
>               execl("/usr/sbin/crm_resource", "crm_resource", "-F", "-r", 
> rsc_id, "-H", nodename, NULL);
>       } else {
>               exit(EXIT_FAILURE);
> @@ -135,9 +141,11 @@
>  #else
>       /*execl("/usr/sbin/crm_resource", "crm_resource", "-F", "-r", rsc_id, 
> "-H", nodename, NULL); */
>       int ret;
> +
> +     cl_log(LOG_INFO, "Force reboot node %s\n", nodename);
>       ret = write(sysrq_fd, "b\n", 2);
>       if (ret == -1) {
> -             SFEX_LOG_ERR("%s\n", strerror(errno));
> +             cl_log(LOG_ERR, "%s\n", strerror(errno));
>       }
>       close(sysrq_fd);
>       exit(EXIT_FAILURE);
> @@ -148,6 +156,7 @@
>  {
>       /* read lock data */
>       if (read_lockdata(&cdata, &ldata, lock_index) == -1) {
> +             cl_log(LOG_ERR, "read_lockdata failed in update_lock\n");
>               error_todo();
>               exit(EXIT_FAILURE);
>       }
> @@ -155,7 +164,7 @@
>       /* check current lock status */
>       /* if own node is not locking, lock update is failed */
>       if (ldata.status != SFEX_STATUS_LOCK || strncmp((const 
> char*)(ldata.nodename), nodename, sizeof(ldata.nodename))) {
> -             SFEX_LOG_ERR("can't update lock.\n");
> +             cl_log(LOG_ERR, "can't update lock.\n");
>               failure_todo();
>               exit(EXIT_FAILURE); 
>       }
> @@ -163,6 +172,7 @@
>       /* lock update */
>       ldata.count = SFEX_NEXT_COUNT(ldata.count);
>       if (write_lockdata(&cdata, &ldata, lock_index) == -1) {
> +             cl_log(LOG_ERR, "write_lockdata failed in update_lock\n");
>               error_todo();
>               exit(EXIT_FAILURE);
>       }
> @@ -174,29 +184,32 @@
>          
>       /* read lock data */
>       if (read_lockdata(&cdata, &ldata, lock_index) == -1) {
> +             cl_log(LOG_ERR, "read_lockdata failed in release_lock\n");
>               exit(EXIT_FAILURE);
>       }
>  
>       /* check current lock status */
>       /* if own node is not locking, we judge that lock has been released 
> already */
>       if (ldata.status != SFEX_STATUS_LOCK || strncmp((const 
> char*)(ldata.nodename), nodename, sizeof(ldata.nodename))) {
> -             SFEX_LOG_ERR("lock was already released.\n");
> -             exit(1);
> +             cl_log(LOG_ERR, "lock was already released.\n");
> +             exit(EXIT_FAILURE);
>       }
>  
>       /* lock release */
>       ldata.status = SFEX_STATUS_UNLOCK;
>       if (write_lockdata(&cdata, &ldata, lock_index) == -1) {
>           /*FIXME: We are going to self-stop */
> +             cl_log(LOG_ERR, "write_lockdata failed in release_lock\n");
>               exit(EXIT_FAILURE);
>       }
> -     SFEX_LOG_INFO("lock released\n");
> +     cl_log(LOG_INFO, "lock released\n");
>  }
>  
>  static void quit_handler(int signo, siginfo_t *info, void *context)
>  {
> -     SFEX_LOG_INFO("quit_handler\n");
> +     cl_log(LOG_INFO, "quit_handler called. now releasing lock\n");
>       release_lock();
> +     cl_log(LOG_INFO, "Shutdown sfex_daemon with EXIT_SUCCESS\n");
>       exit(EXIT_SUCCESS);
>  }
>  
> @@ -208,10 +221,9 @@
>       progname = get_progname(argv[0]);
>       nodename = get_nodename();
>  
> -
> -#if 0
> -     openlog("SFex Daemon", LOG_PID|LOG_CONS|LOG_NDELAY, LOG_USER);
> -#endif
> +     cl_log_set_entity(progname);
> +     cl_log_set_facility(HA_LOG_FACILITY);
> +     cl_inherit_logging_environment(0);
>  
>       /* read command line option */
>       opterr = 0;
> @@ -222,14 +234,14 @@
>               switch (c) {
>                       case 'h':           /* help*/
>                               usage(stdout);
> -                             exit(0);
> +                             exit(EXIT_SUCCESS);
>                       case 'i':           /* -i <index> */
>                               {
>                                       unsigned long l = strtoul(optarg, NULL, 
> 10);
>                                       if (l < SFEX_MIN_NUMLOCKS || l > 
> SFEX_MAX_NUMLOCKS) {
> -                                             SFEX_LOG_ERR(
> -                                                             "%s: ERROR: 
> index %s is out of range or invalid. it must be integer value between %lu and 
> %lu.\n",
> -                                                             progname, 
> optarg,
> +                                             cl_log(LOG_ERR, 
> +                                                             "index %s is 
> out of range or invalid. it must be integer value between %lu and %lu.\n",
> +                                                             optarg,
>                                                               (unsigned 
> long)SFEX_MIN_NUMLOCKS,
>                                                               (unsigned 
> long)SFEX_MAX_NUMLOCKS);
>                                               exit(4);
> @@ -241,9 +253,9 @@
>                               {
>                                       unsigned long l = strtoul(optarg, NULL, 
> 10);
>                                       if (l < 1 || l > INT_MAX) {
> -                                             SFEX_LOG_ERR(
> -                                                             "%s: ERROR: 
> collision_timeout %s is out of range or invalid. it must be integer value 
> between %lu and %lu.\n",
> -                                                             progname, 
> optarg,
> +                                             cl_log(LOG_ERR, 
> +                                                             
> "collision_timeout %s is out of range or invalid. it must be integer value 
> between %lu and %lu.\n",
> +                                                             optarg,
>                                                               (unsigned 
> long)1,
>                                                               (unsigned 
> long)INT_MAX);
>                                               exit(4);
> @@ -255,9 +267,9 @@
>                               {
>                                       unsigned long l = strtoul(optarg, NULL, 
> 10);
>                                       if (l < 1 || l > INT_MAX) {
> -                                             SFEX_LOG_ERR(
> -                                                             "%s: ERROR: 
> monitor_interval %s is out of range or invalid. it must be integer value 
> between %lu and %lu.\n",
> -                                                             progname, 
> optarg,
> +                                             cl_log(LOG_ERR, 
> +                                                             
> "monitor_interval %s is out of range or invalid. it must be integer value 
> between %lu and %lu.\n",
> +                                                             optarg,
>                                                               (unsigned 
> long)1,
>                                                               (unsigned 
> long)INT_MAX);
>                                               exit(4);
> @@ -269,9 +281,9 @@
>                               {
>                                       unsigned long l = strtoul(optarg, NULL, 
> 10);
>                                       if (l < 1 || l > INT_MAX) {
> -                                             SFEX_LOG_ERR(
> -                                                             "%s: ERROR: 
> lock_timeout %s is out of range or invalid. it must be integer value between 
> %lu and %lu.\n",
> -                                                             progname, 
> optarg,
> +                                             cl_log(LOG_ERR, 
> +                                                             "lock_timeout 
> %s is out of range or invalid. it must be integer value between %lu and 
> %lu.\n",
> +                                                             optarg,
>                                                               (unsigned 
> long)1,
>                                                               (unsigned 
> long)INT_MAX);
>                                               exit(4);
> @@ -283,8 +295,8 @@
>                               {
>                                       free(nodename);
>                                       if (strlen(optarg) > SFEX_MAX_NODENAME) 
> {
> -                                             SFEX_LOG_ERR("%s: ERROR: 
> nodename %s is too long. must be less than %d byte.\n",
> -                                                             progname, 
> optarg,
> +                                             cl_log(LOG_ERR, "nodename %s is 
> too long. must be less than %d byte.\n",
> +                                                             optarg,
>                                                               (unsigned 
> int)SFEX_MAX_NODENAME);
>                                               exit(EXIT_FAILURE);
>                                       }
> @@ -303,11 +315,11 @@
>       }
>       /* check parameter except the option */
>       if (optind >= argc) {
> -             SFEX_LOG_ERR("%s: ERROR: no device specified.\n", progname);
> +             cl_log(LOG_ERR, "no device specified.\n");
>               usage(stderr);
>               exit(EXIT_FAILURE);
>       } else if (optind + 1 < argc) {
> -             SFEX_LOG_ERR("%s: ERROR: too many arguments.\n", progname);
> +             cl_log(LOG_ERR, "too many arguments.\n");
>               usage(stderr);
>               exit(EXIT_FAILURE);
>       }
> @@ -317,7 +329,7 @@
>  #if !SFEX_TESTING
>       sysrq_fd = open("/proc/sysrq-trigger", O_WRONLY);
>       if (sysrq_fd == -1) {
> -             SFEX_LOG_ERR("failed to open /proc/sysrq-trigger due to %s\n", 
> strerror(errno));
> +             cl_log(LOG_ERR, "failed to open /proc/sysrq-trigger due to 
> %s\n", strerror(errno));
>               exit(EXIT_FAILURE);
>       }
>  #endif
> @@ -334,12 +346,12 @@
>               sig_act.sa_sigaction = quit_handler;
>               ret = sigaction(SIGTERM, &sig_act, NULL);
>               if (ret == -1) {
> -                     SFEX_LOG_ERR("sigaction failed\n");
> +                     cl_log(LOG_ERR, "sigaction failed\n");
>                       exit(EXIT_FAILURE);
>               }
>       }
>  
> -     SFEX_LOG_INFO("Starting SFeX Daemon...\n");
> +     cl_log(LOG_INFO, "Starting SFeX Daemon...\n");
>       
>       /* acquire lock first.*/
>       acquire_lock();
> @@ -352,7 +364,7 @@
>  
>       cl_make_realtime(-1, -1, 128, 128);
>       
> -     SFEX_LOG_INFO("SFeX Daemon started.\n");
> +     cl_log(LOG_INFO, "SFeX Daemon started.\n");
>       while (1) {
>               sleep (monitor_interval);
>               update_lock();
> diff -r a10b01a6c5a7 -r 9a9f5ef72afb tools/sfex_lib.c
> --- a/tools/sfex_lib.c        Thu Mar 18 20:30:10 2010 +0100
> +++ b/tools/sfex_lib.c        Fri Mar 19 16:42:00 2010 +0900
> @@ -57,8 +57,8 @@
>      if (dev_fd == -1) {
>        if (errno == EINTR || errno == EAGAIN)
>       continue;
> -      SFEX_LOG_ERR ("%s: ERROR: can't open device %s: %s\n",
> -                 progname, device, strerror (errno));
> +      cl_log(LOG_ERR, "can't open device %s: %s\n",
> +                 device, strerror (errno));
>        exit (3);
>      }
>      break;
> @@ -67,14 +67,14 @@
>  
>    ioctl(dev_fd, BLKSSZGET, &sector_size);
>    if (sector_size == 0) {
> -       SFEX_LOG_ERR("Get sector size failed: %s\n", strerror(errno));
> +       cl_log(LOG_ERR, "Get sector size failed: %s\n", strerror(errno));
>         exit(EXIT_FAILURE);
>    }
>  
>    if (posix_memalign
>        ((void **) (&locked_mem), SFEX_ODIRECT_ALIGNMENT,
>         sector_size) != 0) {
> -    SFEX_LOG_ERR ("Failed to allocate aligned memory\n");
> +    cl_log(LOG_ERR, "Failed to allocate aligned memory\n");
>      exit (3);
>    }
>    memset (locked_mem, 0, sector_size);
> @@ -115,18 +115,18 @@
>    char *n;
>  
>    if (uname (&u)) {
> -    SFEX_LOG_ERR ("%s: ERROR: %s\n", progname, strerror (errno));
> +    cl_log(LOG_ERR, "%s\n", strerror (errno));
>      exit (3);
>    }
>    if (strlen (u.nodename) > SFEX_MAX_NODENAME) {
> -    SFEX_LOG_ERR
> -      ("%s: ERROR: nodename %s is too long. must be less than %lu byte.\n",
> -       progname, u.nodename, (unsigned long)SFEX_MAX_NODENAME);
> +    cl_log(LOG_ERR,
> +      "nodename %s is too long. must be less than %lu byte.\n",
> +       u.nodename, (unsigned long)SFEX_MAX_NODENAME);
>      exit (3);
>    }
>    n = strdup (&u.nodename[0]);
>    if (!n) {
> -    SFEX_LOG_ERR ("%s: ERROR: %s\n", progname, strerror (errno));
> +    cl_log(LOG_ERR, "%s\n", strerror (errno));
>      exit (3);
>    }
>    return n;
> @@ -197,7 +197,7 @@
>  
>    fd = dev_fd;
>    if (lseek (fd, 0, SEEK_SET) == -1) {
> -    SFEX_LOG_ERR ("%s: ERROR: can't seek file pointer: %s\n", progname,
> +    cl_log(LOG_ERR, "can't seek file pointer: %s\n",
>                 strerror (errno));
>      exit (3);
>    }
> @@ -208,8 +208,8 @@
>         if (s == -1) {
>                 if (errno == EINTR || errno == EAGAIN)
>                         continue;
> -               SFEX_LOG_ERR ("%s: ERROR: can't write meta-data: %s\n",
> -                               progname, strerror (errno));
> +               cl_log(LOG_ERR, "can't write meta-data: %s\n",
> +                             strerror (errno));
>                 exit (3);
>         }
>         else
> @@ -257,7 +257,7 @@
>  
>    /* seek a file pointer to given position */
>    if (lseek (fd, cdata->blocksize * index, SEEK_SET) == -1) {
> -    SFEX_LOG_ERR ("%s: ERROR: can't seek file pointer: %s\n", progname,
> +    cl_log(LOG_ERR, "can't seek file pointer: %s\n",
>                 strerror (errno));
>      return -1;
>    }
> @@ -268,14 +268,13 @@
>      if (s == -1) {
>        if (errno == EINTR || errno == EAGAIN)
>       continue;
> -      SFEX_LOG_ERR ("%s: ERROR: can't write meta-data: %s\n",
> -                 progname, strerror (errno));
> +      cl_log(LOG_ERR, "can't write meta-data: %s\n",
> +                 strerror (errno));
>        return -1;
>      }
>      else if (s != cdata->blocksize) {
>        /* if writing atomically failed, this process is error */
> -      SFEX_LOG_ERR ("%s: ERROR: can't write meta-data atomically.\n",
> -                 progname);
> +      cl_log(LOG_ERR, "can't write meta-data atomically.\n");
>        return -1;
>      }
>      break;
> @@ -301,7 +300,7 @@
>    block = (sfex_controldata_ondisk *) (locked_mem);
>  
>    if (lseek (dev_fd, 0, SEEK_SET) == -1) {
> -    SFEX_LOG_ERR ("%s: ERROR: can't seek file pointer: %s\n", progname,
> +    cl_log(LOG_ERR, "can't seek file pointer: %s\n",
>                 strerror (errno));
>      return -1;
>    }
> @@ -312,9 +311,9 @@
>         if (s == -1) {
>                 if (errno == EINTR || errno == EAGAIN)
>                         continue;
> -               SFEX_LOG_ERR
> -                       ("%s: ERROR: can't read controldata meta-data: %s\n",
> -                        progname, strerror (errno));
> +               cl_log(LOG_ERR,
> +                       "can't read controldata meta-data: %s\n",
> +                        strerror (errno));
>                 return -1;
>         }
>         else
> @@ -331,21 +330,21 @@
>     */
>    memcpy (cdata->magic, block->magic, 4);
>    if (memcmp (cdata->magic, SFEX_MAGIC, sizeof (cdata->magic))) {
> -    SFEX_LOG_ERR ("%s: ERROR: magic number mismatched. %c%c%c%c <-> %s\n", 
> progname, block->magic[0], block->magic[1], block->magic[2], block->magic[3], 
> SFEX_MAGIC);
> +    cl_log(LOG_ERR, "magic number mismatched. %c%c%c%c <-> %s\n", 
> block->magic[0], block->magic[1], block->magic[2], block->magic[3], 
> SFEX_MAGIC);
>      return -1;
>    }
>    if (block->version[sizeof (block->version)-1]
>        || block->revision[sizeof (block->revision)-1]
>        || block->blocksize[sizeof (block->blocksize)-1]
>        || block->numlocks[sizeof (block->numlocks)-1]) {
> -    SFEX_LOG_ERR ("%s: ERROR: control data format error.\n", progname);
> +    cl_log(LOG_ERR, "control data format error.\n");
>      return -1;
>    }
>    cdata->version = atoi ((char *) (block->version));
>    if (cdata->version != SFEX_VERSION) {
> -    SFEX_LOG_ERR
> -      ("%s: ERROR: version number mismatched. program is %d, data is %d.\n",
> -       progname, SFEX_VERSION, cdata->version);
> +    cl_log(LOG_ERR,
> +      "version number mismatched. program is %d, data is %d.\n",
> +       SFEX_VERSION, cdata->version);
>      return -1;
>    }
>    cdata->revision = atoi ((char *) (block->revision));
> @@ -383,7 +382,7 @@
>  
>    /* seek a file pointer to given position */
>    if (lseek (fd, cdata->blocksize * index, SEEK_SET) == -1) {
> -    SFEX_LOG_ERR ("%s: ERROR: can't seek file pointer: %s\n", progname,
> +    cl_log(LOG_ERR, "can't seek file pointer: %s\n",
>                 strerror (errno));
>      return -1;
>    }
> @@ -394,13 +393,12 @@
>      if (s == -1) {
>        if (errno == EINTR || errno == EAGAIN)
>       continue;
> -      SFEX_LOG_ERR ("%s: ERROR: can't read lockdata meta-data: %s\n",
> -                 progname, strerror (errno));
> +      cl_log(LOG_ERR, "can't read lockdata meta-data: %s\n",
> +                 strerror (errno));
>        return -1;
>      }
>      else if (s != cdata->blocksize) {
> -      SFEX_LOG_ERR ("%s: ERROR: can't read meta-data atomically.\n",
> -                 progname);
> +      cl_log(LOG_ERR, "can't read meta-data atomically.\n");
>        return -1;
>      }
>      break;
> @@ -415,22 +413,22 @@
>     * values in the write_lockdata() function.
>     */
>    if (block->count[sizeof(block->count)-1] || 
> block->nodename[sizeof(block->nodename)-1]) {
> -    SFEX_LOG_ERR ("%s: ERROR: lock data format error.\n", progname);
> +    cl_log(LOG_ERR, "lock data format error.\n");
>      return -1;
>    }
>    ldata->status = block->status;
>    if (ldata->status != SFEX_STATUS_UNLOCK
>        && ldata->status != SFEX_STATUS_LOCK) {
> -    SFEX_LOG_ERR ("%s: ERROR: lock data format error.\n", progname);
> +    cl_log(LOG_ERR, "lock data format error.\n");
>      return -1;
>    }
>    ldata->count = atoi ((char *) (block->count));
>    strncpy ((char *) (ldata->nodename), (const char *) (block->nodename), 
> sizeof(block->nodename));
>  
>  #ifdef SFEX_DEBUG
> -  SFEX_LOG_INFO ("status: %c\n", ldata->status);
> -  SFEX_LOG_INFO ("count: %d\n", ldata->count);
> -  SFEX_LOG_INFO ("nodename: %s\n", ldata->nodename);
> +  cl_log(LOG_INFO, "status: %c\n", ldata->status);
> +  cl_log(LOG_INFO, "count: %d\n", ldata->count);
> +  cl_log(LOG_INFO, "nodename: %s\n", ldata->nodename);
>  #endif
>    return 0;
>  }

> _______________________________________________________
> Linux-HA-Dev: [email protected]
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/

_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to