Skip to contentSkip to conversation

libcldc: transition to applog, phase 1

PATCH Applied Pete Zaitcev 2 participants 2 messages Aug 11, 2009 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libcldc: transition to applog, phase 1

This patch transitions from printf-like to syslog-like API for libcldc diagnostics. In the future, this allows to drop app_log() from chunkd (tabled didn't even grow it).

There's a small complication: one stdarg function cannot call another, so we cannot just insert some shims... Or actually, we can. The trick is to use printf into a local buffer, and then pass that down. All of that is strictly temporary. If I'm not missing something, once applications switch over, we'll just kill all of it and return to what it was, only with syslog-like functions. I didn't even adjust whitespace of ->app_log arguments as a pledge that it has to change again anyway.

Long story short, this should be safe to build in Koji without resorting to chain builds.

include/cldc.h +3 -1
index f625d5e..712e7c7 100644
@@ -79,6 +79,7 @@ struct cldc_ops {
 	void		(*event)(void *private, struct cldc_session *,
 				 struct cldc_fh *, uint32_t);
 	void		(*printf)(const char *fmt, ...);
+	void		(*errlog)(int prio, const char *fmt, ...);
 };
 
 /** a single CLD client session */
@@ -88,7 +89,8 @@ struct cldc_session {
 	bool		verbose;
 
 	const struct cldc_ops *ops;
-	void		(*act_log)(const char *fmt, ...);
+	void		(*act_log)(struct cldc_session *,
+				   int prio, const char *fmt, ...);
 	void		*private;
 
 	uint8_t		addr[64];		/* server address */
lib/cldc.c +68 -30

241 lines not on this page · raw message

Applied
#1 lore raw
Quoted 13 lines · Pete Zaitcev

This patch transitions from printf-like to syslog-like API for libcldc diagnostics. In the future, this allows to drop app_log() from chunkd (tabled didn't even grow it).

There's a small complication: one stdarg function cannot call another, so we cannot just insert some shims... Or actually, we can. The trick is to use printf into a local buffer, and then pass that down. All of that is strictly temporary. If I'm not missing something, once applications switch over, we'll just kill all of it and return to what it was, only with syslog-like functions. I didn't even adjust whitespace of ->app_log arguments as a pledge that it has to change again anyway.

Quoted 4 lines

Long story short, this should be safe to build in Koji without resorting to chain builds.

applied