* include/grub/cryptodisk.h (grub_cryptodisk): Use grub_util_fd_t

for cheat_fd.
	* grub-core/disk/cryptodisk.c (grub_cryptodisk_open): Use grub_util_*
	functions.
	(grub_cryptodisk_cheat_insert): Likewise.
	(grub_cryptodisk_close): Likewise.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-09-23 11:58:19 +02:00
parent e85a5d5ca6
commit a47a78be88
3 changed files with 19 additions and 7 deletions

View File

@ -1,3 +1,12 @@
2013-09-23 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/cryptodisk.h (grub_cryptodisk): Use grub_util_fd_t
for cheat_fd.
* grub-core/disk/cryptodisk.c (grub_cryptodisk_open): Use grub_util_*
functions.
(grub_cryptodisk_cheat_insert): Likewise.
(grub_cryptodisk_close): Likewise.
2013-09-23 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/emu/misc.h: Remove leftover cygwin definitions.

View File

@ -504,9 +504,9 @@ grub_cryptodisk_open (const char *name, grub_disk_t disk)
#ifdef GRUB_UTIL
if (dev->cheat)
{
if (dev->cheat_fd == -1)
dev->cheat_fd = open (dev->cheat, O_RDONLY);
if (dev->cheat_fd == -1)
if (!GRUB_UTIL_FD_IS_VALID (dev->cheat_fd))
dev->cheat_fd = grub_util_fd_open (dev->cheat, O_RDONLY);
if (!GRUB_UTIL_FD_IS_VALID (dev->cheat_fd))
return grub_error (GRUB_ERR_IO, N_("cannot open `%s': %s"),
dev->cheat, strerror (errno));
}
@ -541,8 +541,8 @@ grub_cryptodisk_close (grub_disk_t disk)
#ifdef GRUB_UTIL
if (dev->cheat)
{
close (dev->cheat_fd);
dev->cheat_fd = -1;
grub_util_fd_close (dev->cheat_fd);
dev->cheat_fd = GRUB_UTIL_FD_INVALID;
}
#endif
grub_disk_close (dev->source_disk);
@ -735,7 +735,7 @@ grub_cryptodisk_cheat_insert (grub_cryptodisk_t newdev, const char *name,
return grub_errno;
}
newdev->cheat_fd = -1;
newdev->cheat_fd = GRUB_UTIL_FD_INVALID;
newdev->source_id = source->id;
newdev->source_dev_id = source->dev->id;
newdev->id = n++;

View File

@ -22,6 +22,9 @@
#include <grub/disk.h>
#include <grub/crypto.h>
#include <grub/list.h>
#ifdef GRUB_UTIL
#include <grub/emu/hostdisk.h>
#endif
typedef enum
{
@ -85,7 +88,7 @@ struct grub_cryptodisk
grub_size_t keysize;
#ifdef GRUB_UTIL
char *cheat;
int cheat_fd;
grub_util_fd_t cheat_fd;
#endif
const char *modname;
int log_sector_size;