Skip to content

Commit 3c36a0c

Browse files
committed
IIOD: Remove dependency on iio-private.h
Re-introduce a few macros that were provided by iio-private.h that are called from within IIOD. Starting from now, IIOD can run fully on top of the public libiio API, without shenanigans. Signed-off-by: Paul Cercueil <[email protected]>
1 parent 346e41c commit 3c36a0c

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

iiod/ops.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include "parser.h"
1111
#include "thread-pool.h"
1212
#include "../debug.h"
13-
#include "../iio-private.h"
1413

1514
#include <errno.h>
1615
#include <limits.h>

iiod/ops.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
#ifndef __OPS_H__
1010
#define __OPS_H__
1111

12-
#include "../iio-private.h"
1312
#include "queue.h"
1413

1514
#include <endian.h>
1615
#include <errno.h>
16+
#include <iio.h>
1717
#include <stdint.h>
1818
#include <stdio.h>
1919
#include <string.h>
@@ -38,9 +38,21 @@
3838
(((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
3939
#endif
4040

41+
#define BIT(x) (1 << (x))
42+
#define BIT_MASK(bit) BIT((bit) % 32)
43+
#define BIT_WORD(bit) ((bit) / 32)
44+
#define TEST_BIT(addr, bit) (!!(*(((uint32_t *) addr) + BIT_WORD(bit)) \
45+
& BIT_MASK(bit)))
46+
4147
struct thread_pool;
4248
extern struct thread_pool *main_thread_pool;
4349

50+
enum iio_attr_type {
51+
IIO_ATTR_TYPE_DEVICE,
52+
IIO_ATTR_TYPE_DEBUG,
53+
IIO_ATTR_TYPE_BUFFER,
54+
};
55+
4456
struct parser_pdata {
4557
struct iio_context *ctx;
4658
bool stop, verbose;
@@ -69,6 +81,11 @@ struct parser_pdata {
6981

7082
extern bool server_demux; /* Defined in iiod.c */
7183

84+
static inline void *zalloc(size_t size)
85+
{
86+
return calloc(1, size);
87+
}
88+
7289
void interpreter(struct iio_context *ctx, int fd_in, int fd_out, bool verbose,
7390
bool is_socket, bool use_aio, struct thread_pool *pool,
7491
const void *xml_zstd, size_t xml_zstd_len);

iiod/usbd.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
*/
88

99
#include "../debug.h"
10-
#include "../iio-private.h"
1110
#include "ops.h"
1211
#include "thread-pool.h"
1312

0 commit comments

Comments
 (0)