mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-24 02:29:23 +00:00
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>
20 lines
386 B
C
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
|