Commit 618c17b6 authored by Pavel Emelyanov's avatar Pavel Emelyanov

img: Simplify the open_image() macro

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 131d4b86
...@@ -210,6 +210,9 @@ struct cr_img *open_image_at(int dfd, int type, unsigned long flags, ...) ...@@ -210,6 +210,9 @@ struct cr_img *open_image_at(int dfd, int type, unsigned long flags, ...)
va_list args; va_list args;
int ret; int ret;
if (dfd == -1)
dfd = get_service_fd(IMG_FD_OFF);
img = xmalloc(sizeof(*img)); img = xmalloc(sizeof(*img));
if (!img) if (!img)
goto errn; goto errn;
......
...@@ -138,7 +138,7 @@ extern int open_image_dir(char *dir); ...@@ -138,7 +138,7 @@ extern int open_image_dir(char *dir);
extern void close_image_dir(void); extern void close_image_dir(void);
extern struct cr_img *open_image_at(int dfd, int type, unsigned long flags, ...); extern struct cr_img *open_image_at(int dfd, int type, unsigned long flags, ...);
#define open_image(typ, flags, ...) open_image_at(get_service_fd(IMG_FD_OFF), typ, flags, ##__VA_ARGS__) #define open_image(typ, flags, ...) open_image_at(-1, typ, flags, ##__VA_ARGS__)
extern struct cr_img *open_pages_image(unsigned long flags, struct cr_img *pmi); extern struct cr_img *open_pages_image(unsigned long flags, struct cr_img *pmi);
extern struct cr_img *open_pages_image_at(int dfd, unsigned long flags, struct cr_img *pmi); extern struct cr_img *open_pages_image_at(int dfd, unsigned long flags, struct cr_img *pmi);
extern void up_page_ids_base(void); extern void up_page_ids_base(void);
......
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