criu/include/bfd.h
Pavel Emelyanov 5eb39aad4d bfd: Multiple buffers management (v2)
I plan to re-use the bfd engine for images buffering. Right
now this engine uses one buffer that gets reused by all
bfdopen()-s. This works for current usage (one-by-pne proc
files access), but for images we'll need more buffers.

So this patch just puts buffers in a list and organizes a
stupid R-R with refill on it.

v2:
  Check for buffer allocation errors
  Print buffer mem pointer in debug

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
2014-09-29 15:37:14 +04:00

20 lines
386 B
C

#ifndef __CR_BFD_H__
#define __CR_BFD_H__
struct bfd_buf;
struct xbuf {
char *mem; /* buffer */
char *pos; /* position we see bytes at */
unsigned int bleft; /* bytes left after b->pos */
struct bfd_buf *buf;
};
struct bfd {
int fd;
struct xbuf b;
};
#define BREADERR ((char *)-1)
int bfdopen(struct bfd *f);
void bclose(struct bfd *f);
char *breadline(struct bfd *f);
#endif