* 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:
parent
e85a5d5ca6
commit
a47a78be88
3 changed files with 19 additions and 7 deletions
|
@ -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>
|
2013-09-23 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* include/grub/emu/misc.h: Remove leftover cygwin definitions.
|
* include/grub/emu/misc.h: Remove leftover cygwin definitions.
|
||||||
|
|
|
@ -504,9 +504,9 @@ grub_cryptodisk_open (const char *name, grub_disk_t disk)
|
||||||
#ifdef GRUB_UTIL
|
#ifdef GRUB_UTIL
|
||||||
if (dev->cheat)
|
if (dev->cheat)
|
||||||
{
|
{
|
||||||
if (dev->cheat_fd == -1)
|
if (!GRUB_UTIL_FD_IS_VALID (dev->cheat_fd))
|
||||||
dev->cheat_fd = open (dev->cheat, O_RDONLY);
|
dev->cheat_fd = grub_util_fd_open (dev->cheat, O_RDONLY);
|
||||||
if (dev->cheat_fd == -1)
|
if (!GRUB_UTIL_FD_IS_VALID (dev->cheat_fd))
|
||||||
return grub_error (GRUB_ERR_IO, N_("cannot open `%s': %s"),
|
return grub_error (GRUB_ERR_IO, N_("cannot open `%s': %s"),
|
||||||
dev->cheat, strerror (errno));
|
dev->cheat, strerror (errno));
|
||||||
}
|
}
|
||||||
|
@ -541,8 +541,8 @@ grub_cryptodisk_close (grub_disk_t disk)
|
||||||
#ifdef GRUB_UTIL
|
#ifdef GRUB_UTIL
|
||||||
if (dev->cheat)
|
if (dev->cheat)
|
||||||
{
|
{
|
||||||
close (dev->cheat_fd);
|
grub_util_fd_close (dev->cheat_fd);
|
||||||
dev->cheat_fd = -1;
|
dev->cheat_fd = GRUB_UTIL_FD_INVALID;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
grub_disk_close (dev->source_disk);
|
grub_disk_close (dev->source_disk);
|
||||||
|
@ -735,7 +735,7 @@ grub_cryptodisk_cheat_insert (grub_cryptodisk_t newdev, const char *name,
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
newdev->cheat_fd = -1;
|
newdev->cheat_fd = GRUB_UTIL_FD_INVALID;
|
||||||
newdev->source_id = source->id;
|
newdev->source_id = source->id;
|
||||||
newdev->source_dev_id = source->dev->id;
|
newdev->source_dev_id = source->dev->id;
|
||||||
newdev->id = n++;
|
newdev->id = n++;
|
||||||
|
|
|
@ -22,6 +22,9 @@
|
||||||
#include <grub/disk.h>
|
#include <grub/disk.h>
|
||||||
#include <grub/crypto.h>
|
#include <grub/crypto.h>
|
||||||
#include <grub/list.h>
|
#include <grub/list.h>
|
||||||
|
#ifdef GRUB_UTIL
|
||||||
|
#include <grub/emu/hostdisk.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
@ -85,7 +88,7 @@ struct grub_cryptodisk
|
||||||
grub_size_t keysize;
|
grub_size_t keysize;
|
||||||
#ifdef GRUB_UTIL
|
#ifdef GRUB_UTIL
|
||||||
char *cheat;
|
char *cheat;
|
||||||
int cheat_fd;
|
grub_util_fd_t cheat_fd;
|
||||||
#endif
|
#endif
|
||||||
const char *modname;
|
const char *modname;
|
||||||
int log_sector_size;
|
int log_sector_size;
|
||||||
|
|
Loading…
Reference in a new issue