From d61f62962fd0c5c05693cb8c06bfcf7f67f601fd Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Wed, 14 Oct 2020 10:52:02 +0300 Subject: [PATCH] iio: backend: add get_description() backend op This doesn't get rid of the 'ctx->description' object; that will still be around and cache the description. The get_description() splits the creation logic of the description into a backend op. That way, we can think of splitting the creation of an IIO context into an 'alloc()' and 'init()' part where: * an IIO context is allocated first in libiio core * it's backend init() routine is called * it's backend get_description() routine is called The idea of the 'get_description()' op is to return a pointer, that libiio core will manage/free. Hence the return is 'char *' vs 'const char *'. Signed-off-by: Alexandru Ardelean --- iio-backend.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/iio-backend.h b/iio-backend.h index 4b11ab6a6..217c70276 100644 --- a/iio-backend.h +++ b/iio-backend.h @@ -70,6 +70,8 @@ struct iio_backend_ops { void (*shutdown)(struct iio_context *ctx); + char * (*get_description)(const struct iio_context *ctx); + int (*get_version)(const struct iio_context *ctx, unsigned int *major, unsigned int *minor, char git_tag[8]);