Re: [PATCH 1/2] dvb_logfunc: add a user private parameter
Em Wed, 15 Nov 2017 12:33:35 +0100 Rafaël Carré escreveu: At v4l-utils, we're using about the same submission rules as with the Linux Kernel. So, I would be expecting a patch description and, most importantly, a Signed-off-by. > --- > lib/include/libdvbv5/dvb-dev.h | 3 ++- > lib/include/libdvbv5/dvb-fe.h | 9 +++-- > lib/include/libdvbv5/dvb-log.h | 33 + > lib/libdvbv5/dvb-dev.c | 3 ++- > lib/libdvbv5/dvb-fe.c | 15 --- > lib/libdvbv5/dvb-log.c | 3 ++- > utils/dvb/dvb-fe-tool.c| 2 +- > utils/dvb/dvbv5-daemon.c | 9 + > utils/dvb/dvbv5-scan.c | 2 +- > utils/dvb/dvbv5-zap.c | 2 +- > 10 files changed, 46 insertions(+), 35 deletions(-) > > diff --git a/lib/include/libdvbv5/dvb-dev.h b/lib/include/libdvbv5/dvb-dev.h > index 55e0f065..396fcd07 100644 > --- a/lib/include/libdvbv5/dvb-dev.h > +++ b/lib/include/libdvbv5/dvb-dev.h > @@ -243,6 +243,7 @@ void dvb_dev_stop_monitor(struct dvb_device *dvb); > * @param logfuncCallback function to be called when a log event > * happens. Can either store the event into a file or > * to print it at the TUI/GUI. Can be null. > + * @param logpriv Private data for log function > * > * @details Sets the function to report log errors and to set the verbosity > * level of debug report messages. If not called, or if logfunc is > @@ -252,7 +253,7 @@ void dvb_dev_stop_monitor(struct dvb_device *dvb); > */ > void dvb_dev_set_log(struct dvb_device *dvb, >unsigned verbose, > - dvb_logfunc logfunc); > + dvb_logfunc logfunc, void *logpriv); That breaks the ABI. I guess the best here would be to create a new function (dvb_dev_set_logpriv?), and keep this function name for backward compatibility. > > /** > * @brief Opens a dvb device > diff --git a/lib/include/libdvbv5/dvb-fe.h b/lib/include/libdvbv5/dvb-fe.h > index 1d3565ec..107cb03d 100644 > --- a/lib/include/libdvbv5/dvb-fe.h > +++ b/lib/include/libdvbv5/dvb-fe.h > @@ -107,6 +107,7 @@ > * @param freq_bpf SCR/Unicable band-pass filter frequency to use, > in kHz > * @param verboseVerbosity level of the library (RW) > * @param dvb_logfuncFunction used to write log messages (RO) > + * @param logprivPrivate data for logging function (RO) > * @param default_charsetName of the charset used by the DVB standard > (RW) > * @param output_charset Name of the charset to output (system specific) > (RW) > * > @@ -140,7 +141,8 @@ struct dvb_v5_fe_parms { > > /* Function to write DVB logs */ > unsignedverbose; > - dvb_logfunc logfunc; > + dvb_logfunc logfunc; > + void*logpriv; To avoid breaking API, please put this at dvb_v5_fe_parms_priv. > > /* Charsets to be used by the conversion utilities */ > char*default_charset; > @@ -176,6 +178,7 @@ struct dvb_v5_fe_parms *dvb_fe_dummy(void); > * happens. Can either store the event into a file > * or to print it at the TUI/GUI. If NULL, the > * library will use its internal handler. > + * @param logprivPrivate data for dvb_logfunc > * @param flags Flags to be passed to open. Currently > only two > * flags are supported: O_RDONLY or O_RDWR. > * Using O_NONBLOCK may hit unexpected issues. > @@ -195,6 +198,7 @@ struct dvb_v5_fe_parms *dvb_fe_open_flags(int adapter, > int frontend, > unsigned verbose, > unsigned use_legacy_call, > dvb_logfunc logfunc, > + void *logpriv, > int flags); > > /** > @@ -231,6 +235,7 @@ struct dvb_v5_fe_parms *dvb_fe_open(int adapter, int > frontend, > * @param logfuncCallback function to be called when a log event > * happens. Can either store the event into a file > * or to print it at the TUI/GUI. > + * @param logprivPrivate data for dvb_logfunc > * > * @details This function should be called before using any other function at > * the frontend library (or the other alternatives: dvb_fe_open() or > @@ -240,7 +245,7 @@ struct dvb_v5_fe_parms *dvb_fe_open(int adapter, int > frontend, > */ > struct dvb_v5_fe_parms *dvb_fe_open2(int adapter, int frontend, > unsigned verbose, unsigned use_legacy_call, > - dvb_logfunc logfunc); > + dvb_logfunc lo
[PATCH 1/2] dvb_logfunc: add a user private parameter
--- lib/include/libdvbv5/dvb-dev.h | 3 ++- lib/include/libdvbv5/dvb-fe.h | 9 +++-- lib/include/libdvbv5/dvb-log.h | 33 + lib/libdvbv5/dvb-dev.c | 3 ++- lib/libdvbv5/dvb-fe.c | 15 --- lib/libdvbv5/dvb-log.c | 3 ++- utils/dvb/dvb-fe-tool.c| 2 +- utils/dvb/dvbv5-daemon.c | 9 + utils/dvb/dvbv5-scan.c | 2 +- utils/dvb/dvbv5-zap.c | 2 +- 10 files changed, 46 insertions(+), 35 deletions(-) diff --git a/lib/include/libdvbv5/dvb-dev.h b/lib/include/libdvbv5/dvb-dev.h index 55e0f065..396fcd07 100644 --- a/lib/include/libdvbv5/dvb-dev.h +++ b/lib/include/libdvbv5/dvb-dev.h @@ -243,6 +243,7 @@ void dvb_dev_stop_monitor(struct dvb_device *dvb); * @param logfunc Callback function to be called when a log event * happens. Can either store the event into a file or * to print it at the TUI/GUI. Can be null. + * @param logpriv Private data for log function * * @details Sets the function to report log errors and to set the verbosity * level of debug report messages. If not called, or if logfunc is @@ -252,7 +253,7 @@ void dvb_dev_stop_monitor(struct dvb_device *dvb); */ void dvb_dev_set_log(struct dvb_device *dvb, unsigned verbose, -dvb_logfunc logfunc); +dvb_logfunc logfunc, void *logpriv); /** * @brief Opens a dvb device diff --git a/lib/include/libdvbv5/dvb-fe.h b/lib/include/libdvbv5/dvb-fe.h index 1d3565ec..107cb03d 100644 --- a/lib/include/libdvbv5/dvb-fe.h +++ b/lib/include/libdvbv5/dvb-fe.h @@ -107,6 +107,7 @@ * @param freq_bpf SCR/Unicable band-pass filter frequency to use, in kHz * @param verbose Verbosity level of the library (RW) * @param dvb_logfunc Function used to write log messages (RO) + * @param logpriv Private data for logging function (RO) * @param default_charset Name of the charset used by the DVB standard (RW) * @param output_charset Name of the charset to output (system specific) (RW) * @@ -140,7 +141,8 @@ struct dvb_v5_fe_parms { /* Function to write DVB logs */ unsignedverbose; - dvb_logfunc logfunc; + dvb_logfunc logfunc; + void*logpriv; /* Charsets to be used by the conversion utilities */ char*default_charset; @@ -176,6 +178,7 @@ struct dvb_v5_fe_parms *dvb_fe_dummy(void); * happens. Can either store the event into a file * or to print it at the TUI/GUI. If NULL, the * library will use its internal handler. + * @param logpriv Private data for dvb_logfunc * @param flagsFlags to be passed to open. Currently only two * flags are supported: O_RDONLY or O_RDWR. * Using O_NONBLOCK may hit unexpected issues. @@ -195,6 +198,7 @@ struct dvb_v5_fe_parms *dvb_fe_open_flags(int adapter, int frontend, unsigned verbose, unsigned use_legacy_call, dvb_logfunc logfunc, + void *logpriv, int flags); /** @@ -231,6 +235,7 @@ struct dvb_v5_fe_parms *dvb_fe_open(int adapter, int frontend, * @param logfunc Callback function to be called when a log event * happens. Can either store the event into a file * or to print it at the TUI/GUI. + * @param logpriv Private data for dvb_logfunc * * @details This function should be called before using any other function at * the frontend library (or the other alternatives: dvb_fe_open() or @@ -240,7 +245,7 @@ struct dvb_v5_fe_parms *dvb_fe_open(int adapter, int frontend, */ struct dvb_v5_fe_parms *dvb_fe_open2(int adapter, int frontend, unsigned verbose, unsigned use_legacy_call, - dvb_logfunc logfunc); + dvb_logfunc logfunc, void *logpriv); /** * @brief Closes the frontend and frees allocated resources diff --git a/lib/include/libdvbv5/dvb-log.h b/lib/include/libdvbv5/dvb-log.h index 181a23c8..beba7aba 100644 --- a/lib/include/libdvbv5/dvb-log.h +++ b/lib/include/libdvbv5/dvb-log.h @@ -36,12 +36,12 @@ */ /** - * @typedef void (*dvb_logfunc)(int level, const char *fmt, ...) + * @typedef void (*dvb_logfunc)(void *logpriv, int level, const char *fmt, ...) * @brief typedef used by dvb_fe_open2 for the log function * @ingroup ancillary */ -typedef void (*dvb_logfunc)(