]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* include/grub/cryptodisk.h (grub_cryptodisk): Use grub_util_fd_t
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Mon, 23 Sep 2013 09:58:19 +0000 (11:58 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Mon, 23 Sep 2013 09:58:19 +0000 (11:58 +0200)
for cheat_fd.
* grub-core/disk/cryptodisk.c (grub_cryptodisk_open): Use grub_util_*
functions.
(grub_cryptodisk_cheat_insert): Likewise.
(grub_cryptodisk_close): Likewise.

ChangeLog
grub-core/disk/cryptodisk.c
include/grub/cryptodisk.h

index ac63eafe0505641bea6782b66f69b6f11ead42c9..54684fe510a289f4ea77fe165380106232abf756 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
index 456c608462794bac9c8b109589bec8406171a0c3..f291ea69896bd6a8ccd02072a7ca815c69f18077 100644 (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++;
index c3ee82004f8ac6ec3e0c6fa7ee339ec6eeec2da2..09e65721d1cf95f0a5b4b927da5dd691b50e031f 100644 (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;