Use the common size routine in hostfs so we can read disks as well.

* grub-core/kern/emu/hostdisk.c (grub_util_get_fd_sectors): Rename to ..
	(grub_util_get_fd_size): ... this. Return size in bytes.
	All users updated.
	* grub-core/kern/emu/hostfs.c (grub_hostfs_open): Use
	grub_util_get_fd_size.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-02-29 15:23:31 +01:00
parent c66d641020
commit a121c9648e
5 changed files with 24 additions and 13 deletions

View file

@ -24,6 +24,7 @@
#include <grub/mm.h>
#include <grub/dl.h>
#include <grub/util/misc.h>
#include <grub/emu/hostdisk.h>
#include <grub/i18n.h>
#include <dirent.h>
@ -132,9 +133,7 @@ grub_hostfs_open (struct grub_file *file, const char *name)
#ifdef __MINGW32__
file->size = grub_util_get_disk_size (name);
#else
fseeko (f, 0, SEEK_END);
file->size = ftello (f);
fseeko (f, 0, SEEK_SET);
file->size = grub_util_get_fd_size (fileno (f), name, NULL);
#endif
return GRUB_ERR_NONE;