Skip to content

Commit

Permalink
iio: backend: add get_description() backend op
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
commodo committed Oct 15, 2020
1 parent 5648215 commit d61f629
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions iio-backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

Expand Down

0 comments on commit d61f629

Please sign in to comment.