On Mon, Feb 4, 2019 at 4:20 PM Edd Barrett <e...@theunixzoo.co.uk> wrote:
> On Sun, Jan 27, 2019 at 06:54:02PM +0100, Thomas Schmitt wrote: > > I would give set_speed_mmc() a try. > > Alas, sadly this doesn't help. TBH I can live without it, although I'd > like to silence the error message unless logging is turned up. > > Which brings us to: > > > > I wonder if the errors should only be shown if an environment variable > > > is set or something? > > > > You could sort the messages of lib/driver/netbsd.c into libcdio's log > level > > spectrum, rather than using fprintf(stderr) or perror(): > > cdio_debug(), cdio_info(), cdio_warn(), cdio_error(). > > > > (I dimly remember to have had problems when trying to enable or disable > > printing of those in the demo programs. But cdio_log_level_t in > > include/cdio/logging.h gives hope that it can be done.) > > Looking at the linux driver, it seems cdio_info() would be appropriate, > but wow, the implementation of the logging functions is scary: > > ---8<--- > void cdio_info (const char format[], ...) GNUC_PRINTF(1,2); > ---8<--- > > And then: > > --->8--- > #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) > #define GNUC_PRINTF( format_idx, arg_idx ) \ > __attribute__((format (printf, format_idx, arg_idx))) > ... > #else /* !__GNUC__ */ > #define GNUC_PRINTF( format_idx, arg_idx ) > #endif /* !__GNUC__ */ > --->8--- > > So if you are not on glibc, then logging is a NOOP, by the look of it. > > I'm not really sure this logging scheme can work on OpenBSD. I wonder why > it > was implemented this way. > > It also looks like there is no way to turn up/down the verbosity of the > logging. Or am I mistaken? > The logging goes back to the earliest days of libcdio so we are talking almost 20 years ago. In fact it predates it and is from vcdimager. It also has a certain amount of globalness in the way things are set. If someone wants to rewrite this in modern C, by all means go ahead! > > -- > Best Regards > Edd Barrett > > http://www.theunixzoo.co.uk > >