File libefiboot-export-disk_get_partition_info.patch of Package efivar

Index: efivar-37/src/disk.c
===================================================================
--- efivar-37.orig/src/disk.c
+++ efivar-37/src/disk.c
@@ -256,6 +256,33 @@ is_partitioned(int fd)
 	return true;
 }
 
+/*
+ * efi_disk_get_partition_info()
+ *  @fd - open file descriptor to disk
+ *  @part   - partition number (1 is first partition on the disk)
+ *  @start - partition starting sector returned
+ *  @size  - partition size (in sectors) returned
+ *  @signature - partition signature returned
+ *  @mbr_type  - partition type returned
+ *  @signature_type - signature type returned
+ *
+ *  Description: Finds partition table info for given partition on given disk.
+ *               Both GPT and MSDOS partition tables are tested for.
+ *  Returns 0 on success, non-zero on failure
+ */
+int
+__attribute__((__nonnull__ (3,4,5,6,7)))
+__attribute__((__visibility__ ("default")))
+efi_disk_get_partition_info (int fd,
+                         uint32_t part,
+                         uint64_t *start, uint64_t *size,
+                         uint8_t *signature,
+                         uint8_t *mbr_type, uint8_t *signature_type)
+{
+        return get_partition_info(fd, EFIBOOT_OPTIONS_IGNORE_PMBR_ERR, part,
+                        start, size, signature, mbr_type, signature_type);
+}
+
 ssize_t HIDDEN
 make_hd_dn(uint8_t *buf, ssize_t size, int fd, int32_t partition,
            uint32_t options)
Index: efivar-37/src/include/efivar/efiboot-disk.h
===================================================================
--- /dev/null
+++ efivar-37/src/include/efivar/efiboot-disk.h
@@ -0,0 +1,32 @@
+/*
+ * libefiboot - library for the manipulation of EFI boot variables
+ * Copyright 2012-2015 Red Hat, Inc.
+ * Copyright (C) 2001 Dell Computer Corporation <Matt_Domsch@dell.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of the
+ * License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+#ifndef _EFIBOOT_BOOT_H
+#define _EFIBOOT_BOOT_H 1
+
+extern int efi_disk_get_partition_info (int fd,
+                         uint32_t part,
+                         uint64_t *start, uint64_t *size,
+                         uint8_t *signature,
+                         uint8_t *mbr_type, uint8_t *signature_type)
+	__attribute__((__nonnull__ (3,4,5,6,7)))
+	__attribute__((__visibility__ ("default")));
+
+#endif /* _EFIBOOT_BOOT_H */
Index: efivar-37/src/include/efivar/efiboot.h
===================================================================
--- efivar-37.orig/src/include/efivar/efiboot.h
+++ efivar-37/src/include/efivar/efiboot.h
@@ -34,5 +34,6 @@
 
 #include <efivar/efiboot-creator.h>
 #include <efivar/efiboot-loadopt.h>
+#include <efivar/efiboot-disk.h>
 
 #endif /* EFIBOOT_H */
Index: efivar-37/src/libefiboot.map.in
===================================================================
--- efivar-37.orig/src/libefiboot.map.in
+++ efivar-37/src/libefiboot.map.in
@@ -33,3 +33,7 @@ LIBEFIBOOT_1.29 {
 
 LIBEFIBOOT_1.30 {
 } LIBEFIBOOT_1.29;
+
+LIBEFIBOOT_1.31 {
+        global: efi_disk_get_partition_info;
+} LIBEFIBOOT_1.30;