Commit 462e089c authored by Mike Rapoport's avatar Mike Rapoport Committed by Pavel Emelyanov

criu: image: add img_raw_size helper

Signed-off-by: 's avatarMike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent b78565e9
#include <unistd.h> #include <unistd.h>
#include <stdarg.h> #include <stdarg.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/stat.h>
#include "crtools.h" #include "crtools.h"
#include "cr_options.h" #include "cr_options.h"
#include "imgset.h" #include "imgset.h"
...@@ -563,3 +564,14 @@ int read_img_str(struct cr_img *img, char **pstr, int size) ...@@ -563,3 +564,14 @@ int read_img_str(struct cr_img *img, char **pstr, int size)
return 0; return 0;
} }
off_t img_raw_size(struct cr_img *img)
{
struct stat stat;
if (fstat(img->_x.fd, &stat)) {
pr_perror("Failed to get image stats\n");
return -1;
}
return stat.st_size;
}
...@@ -142,6 +142,8 @@ static inline int img_raw_fd(struct cr_img *img) ...@@ -142,6 +142,8 @@ static inline int img_raw_fd(struct cr_img *img)
return img->_x.fd; return img->_x.fd;
} }
extern off_t img_raw_size(struct cr_img *img);
extern int open_image_dir(char *dir); extern int open_image_dir(char *dir);
extern void close_image_dir(void); extern void close_image_dir(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