[DSM-devel] dsme code cleanup, comments before merging?

Lars Wirzenius liw at liw.iki.fi
Thu Aug 24 12:35:56 EEST 2006


I've mostly done the remaining small cleanups now. One small thing
remaining is the STI log method, on which I comment below. I'll comment
on the bigger issues later today.

pe, 2006-08-18 kello 16:12 +0300, Ismo.Laitinen at nokia.com kirjoitti:
> >> * Changed everything to use dsme_log, instead of the DLOG_* macros.
> >>   Having two logging methods in the same program isn't practical and
> >>   can hopefully be avoided. Removed all use of DSME_LOG_ENABLED.
> 
> Regarding the logging.c. STI logging method is quite N770 specific
> (or OMAP at least) and it relies on hardcoded channel number. Should
> we do something for it?

The problem, as I see it, and it's not a big one, is that if we want
dsme to be generic, then STI being specific to the N770 is a bit of a
conflict. There's two ways to deal with this: we can live with it, or we
can change things so that users of the the generic dsme code can add
their own logging methods.

Just living with it would mean that when someone else wants to use dsme
with their embedded hardware, and needs a logging method specific to
their device, we need to add support for that in the code.

Making it possible to add logging methods would be a friendlier option,
and it should be easy. As a first draft, we add the following function
to the logging API:

typedef void dsme_log_printer(int prio, const char *fmt, va_list ap);
int dsme_log_add_custom_method(dsme_log_printer printer);

This function adds a new log method, which basically means a function to
format and print out a log message. It returns an integer that can be
passed to dsme_log_open as the 'method' argument:

method = dsme_log_add_custom_method(log_to_sti);
dsme_log_open(method, LOG_WARNING, 1, "DSME", 0, 0,
"/var/log/dsme.log");

Because this is so simple, both in API and implementation, I think that
would be the way to go. If there are no objections, I'll change the code
this way.

-- 
Comedy evolution: survival of the wittiest



More information about the DSM-devel mailing list