From: David Teigland <teigland@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] logsys in cluster3
Date: Tue, 1 Jul 2008 11:37:01 -0500 [thread overview]
Message-ID: <20080701163700.GB1259@redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0807010650250.27368@trider-g7>
On Tue, Jul 01, 2008 at 07:01:42AM +0200, Fabio M. Di Nitto wrote:
> No. You can just install the callback and be done with it. The ccs fd was
> never a real fd to poll.
OK, it's a cman callback. If the ccs "connection" isn't really a
connection and if it's not necessary then can we get rid of the illusion?
> Given that this code is going to be re-implemented N times, I suggest
> again to create a cluster/common/helpers with pre-built objects to just
> include at linking time (note that we also share and duplicate a lot of
> header files around and it was in my mind for sometime to create a
> cluster/common/includes too)
Let's get the code in place and replicated first, before trying to factor
it. And I don't think it needs to be too complicated. Assuming I can
make my simplified logsys api work (really, we're trying to solve stuff in
parallel here that should be sequential)...
/* Read cluster.conf settings and convert them into logsys values.
If no cluster.conf setting exists, the default that was used in
logsys_init() is used. */
int read_ccs_logging(int *mode, int *facility, int *priority, char *file,
int *debug)
{
*mode = MYPROG_DEFAULT_MODE;
*facility = MYPROG_DEFAULT_FACILITY;
*priority = MYPROG_DEFAULT_PRIORITY;
strcpy(file, MYPROG_DEFAULT_FILE);
/* Read settings from ccs to override the defaults above.
(with some appropriate helper functions around ccs_get, the
following can be pretty compact)
mode from
"/cluster/logging/@to_stderr"
"/cluster/logging/@to_syslog"
"/cluster/logging/@to_file"
facility from
"/cluster/logging/@syslog_facility"
priority from
"/cluster/logging/logger_subsys[@subsys=\"prog_name\"]/@syslog_level"
file from
"/cluster/logging/@filename"
debug from
"/cluster/logging/logger_subsys[@subsys=\"prog_name\"]/@debug"
*/
}
/* this function will also be called when we get a cman config-update event */
void setup_logging(int *prog_debug)
{
int mode, facility, priority;
char *file;
/* The debug setting is special, it's used by the program
and not used to configure logsys. */
read_ccs_logging(&mode, &facility, &priority, file, prog_debug);
logsys_conf(mode, facility, priority, file);
}
int main(int argc, char **argv)
{
logsys_init(MYPROG_DEFAULT_MODE, MYPROG_DEFAULT_FACILITY,
MYPROG_DEFAULT_PRIORITY, MYPROG_DEFAULT_FILE);
/* set up cman/ccs connections ... */
setup_logging(&prog_debug);
}
next prev parent reply other threads:[~2008-07-01 16:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-30 15:23 [Cluster-devel] logsys in cluster3 David Teigland
2008-06-30 16:38 ` Fabio M. Di Nitto
2008-06-30 17:31 ` David Teigland
2008-07-01 5:01 ` Fabio M. Di Nitto
2008-07-01 16:37 ` David Teigland [this message]
2008-07-01 17:21 ` David Teigland
2008-07-01 19:12 ` David Teigland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080701163700.GB1259@redhat.com \
--to=teigland@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).