Commit ae96d21a authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

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: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Acked-by: 's avatarAndrew Vagin <avagin@parallels.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent aeb3f547
......@@ -5,6 +5,7 @@
#include <sys/mman.h>
#include <fcntl.h>
#include <sys/uio.h>
#include <errno.h>
#include "bug.h"
#include "log.h"
......@@ -200,7 +201,7 @@ again:
/* no full line in the buffer -- refill one */
if (brefill(f) < 0)
return BREADERR;
return ERR_PTR(-EIO);
refilled = true;
......
#ifndef __CR_BFD_H__
#define __CR_BFD_H__
#include "err.h"
struct bfd_buf;
struct xbuf {
char *mem; /* buffer */
......@@ -23,7 +26,6 @@ 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);
......
......@@ -1106,19 +1106,19 @@ static int parse_timerfd(struct bfd *f, char *str, TimerfdEntry *tfy)
goto parse_err;
str = breadline(f);
if (str == NULL || str == BREADERR)
if (IS_ERR_OR_NULL(str))
goto nodata;
if (sscanf(str, "ticks: %llu", (unsigned long long *)&tfy->ticks) != 1)
goto parse_err;
str = breadline(f);
if (str == NULL || str == BREADERR)
if (IS_ERR_OR_NULL(str))
goto nodata;
if (sscanf(str, "settime flags: 0%o", &tfy->settime_flags) != 1)
goto parse_err;
str = breadline(f);
if (str == NULL || str == BREADERR)
if (IS_ERR_OR_NULL(str))
goto nodata;
if (sscanf(str, "it_value: (%llu, %llu)",
(unsigned long long *)&tfy->vsec,
......@@ -1126,7 +1126,7 @@ static int parse_timerfd(struct bfd *f, char *str, TimerfdEntry *tfy)
goto parse_err;
str = breadline(f);
if (str == NULL || str == BREADERR)
if (IS_ERR_OR_NULL(str))
goto nodata;
if (sscanf(str, "it_interval: (%llu, %llu)",
(unsigned long long *)&tfy->isec,
......@@ -1166,7 +1166,7 @@ static int parse_fdinfo_pid_s(int pid, int fd, int type,
str = breadline(&f);
if (!str)
break;
if (str == BREADERR)
if (IS_ERR(str))
goto out;
if (fdinfo_field(str, "pos") ||
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment