comparison th_ioctx.h @ 675:fb4093ad1f7b

Add MemIO ioctx functionality.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 25 Feb 2020 06:15:08 +0200
parents 3c9205d52376
children 927772fb0745
comparison
equal deleted inserted replaced
674:dfabc7eef3dd 675:fb4093ad1f7b
40 time_t atime; ///< Last access time 40 time_t atime; ///< Last access time
41 int64_t size; ///< Size in bytes 41 int64_t size; ///< Size in bytes
42 int status; ///< Status 42 int status; ///< Status
43 size_t line; ///< Line number 43 size_t line; ///< Line number
44 44
45 // Mem data
46 size_t maxSize; ///< Maximum size (0 = no limit)
47 size_t memSize; ///< Size of data
48 size_t memAlloc; ///< Amount allocated
49 size_t minAlloc; ///< Minimum allocation increase (0 = default)
50 off_t memOffset; ///< Current offset in data
51 uint8_t *memData; ///< Pointer to data
52
53 // Message functions
45 void (*error)(struct th_ioctx *ctx, const int err, const char *msg); 54 void (*error)(struct th_ioctx *ctx, const int err, const char *msg);
46 void (*msg)(struct th_ioctx *ctx, const int level, const char *msg); 55 void (*msg)(struct th_ioctx *ctx, const int level, const char *msg);
47 56
48 const struct th_ioctx_ops *fops; ///< Pointer to I/O ops struct to be used with this context 57 const struct th_ioctx_ops *fops; ///< Pointer to I/O ops struct to be used with this context
49 } th_ioctx; 58 } th_ioctx;
75 84
76 85
77 // 86 //
78 // Some basic iops 87 // Some basic iops
79 // 88 //
80 extern const th_ioctx_ops th_stdio_io_ops; 89 extern const th_ioctx_ops th_stdio_io_ops, th_mem_io_ops;
81 90
82 91
83 92
84 // 93 //
85 // I/O context management functions 94 // I/O context management functions