kexec: determine size of block device
Subsystems (2)
PATCH v3 1/1 kexec: determine size of block device
starting 'kexec -l /dev/mmcblk0p1' fails since the size of a block device can not be determined with stat
Signed-off-by Andreas Fenkart <[email protected]>
--- kexec/kexec.c | 8 ++++++++ 1 file changed, 8 insertions(+)
kexec/kexec.c +8 -0
@@ -26,6 +26,8 @@#include <stdlib.h> #include <errno.h> #include <limits.h> +#include <sys/ioctl.h> +#include <sys/mount.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/reboot.h>
@@ -555,6 +557,12 @@ static char *slurp_file_generic(const char *filename, off_t *r_size,die ("Can not seek to the begin of file %s: %s\n" , filename,strerror (errno)); buf =slurp_fd (fd, filename, size, &nread); + }else if (S_ISBLK (stats.st_mode)) { + err =ioctl (fd,BLKGETSIZE64 , &size); +if (err <0 ) +die ("Can't retrieve size of block device %s: %s\n" , + filename,strerror (errno)); + buf =slurp_fd (fd, filename, size, &nread); }else { size = stats.st_size;if (use_mmap) {
Signature · 7 lines
2.6.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Simon Horman
AppliedQuoted 4 lines · Andreas Fenkart
starting 'kexec -l
/dev/mmcblk0p1' fails since the size of a block device can not be determined with statSigned-off-by Andreas Fenkart <[email protected]>
Thanks, applied.
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec