criu/include/bfd.h
Cyrill Gorcunov ae96d21a07 bfd: Use ERR_PTR and such instead of BREADERR
No need to invent new error codes here, simply
use ERR_PTR/IS_ERR_OR_NULL and such.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-10-02 14:56:39 +04:00

36 lines
695 B
C

#ifndef __CR_BFD_H__
#define __CR_BFD_H__
#include "err.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;
}
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