mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-21 01:06:58 +00:00
Signed-off-by: Pavel Emelyanov <xemul@parallels.com> Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
34 lines
706 B
C
34 lines
706 B
C
#ifndef __CR_BFD_H__
|
|
#define __CR_BFD_H__
|
|
struct bfd_buf;
|
|
struct xbuf {
|
|
char *mem; /* buffer */
|
|
char *data; /* position we see bytes at */
|
|
unsigned int sz; /* bytes sitting after b->pos */
|
|
struct bfd_buf *buf;
|
|
};
|
|
|
|
struct bfd {
|
|
int fd;
|
|
struct xbuf b;
|
|
};
|
|
|
|
static inline bool bfd_buffered(struct bfd *b)
|
|
{
|
|
return b->b.mem != NULL;
|
|
}
|
|
|
|
static inline void bfd_setraw(struct bfd *b)
|
|
{
|
|
b->b.mem = NULL;
|
|
}
|
|
|
|
#define BREADERR ((char *)-1)
|
|
int bfdopen(struct bfd *f);
|
|
void bclose(struct bfd *f);
|
|
char *breadline(struct bfd *f);
|
|
int bwrite(struct bfd *f, const void *buf, int sz);
|
|
struct iovec;
|
|
int bwritev(struct bfd *f, const struct iovec *iov, int cnt);
|
|
int bread(struct bfd *f, void *buf, int sz);
|
|
#endif
|