Skip to content

Commit

Permalink
iio: add iio_context_get_pdata() accessor
Browse files Browse the repository at this point in the history
This adds a iio_context_get_pdata() accessor to retrieve the private
information of an IIO context object, to better hide it from IIO backends.

Signed-off-by: Alexandru Ardelean <[email protected]>
  • Loading branch information
commodo committed Oct 15, 2020
1 parent 481437d commit 5701d04
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions context.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,11 @@ struct iio_context * iio_context_create_from_backend(
return NULL;
}

struct iio_context_pdata * iio_context_get_pdata(const struct iio_context *ctx)
{
return ctx->pdata;
}

const char * iio_context_get_xml(const struct iio_context *ctx)
{
return ctx->xml;
Expand Down
2 changes: 2 additions & 0 deletions iio-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ int iio_context_add_device(struct iio_context *ctx, struct iio_device *dev);
int iio_context_add_attr(struct iio_context *ctx,
const char *key, const char *value);

struct iio_context_pdata * iio_context_get_pdata(const struct iio_context *ctx);

#undef __api

#endif /* __IIO_PRIVATE_H__ */

0 comments on commit 5701d04

Please sign in to comment.