efivar/libefiboot-export-disk_get_partition_info.patch

95 lines
3.7 KiB
Diff
Raw Normal View History

diff -ruN efivar-36.orig/src/disk.c efivar-36/src/disk.c
--- efivar-36.orig/src/disk.c 2018-06-20 15:11:14.775975508 +0200
+++ efivar-36/src/disk.c 2018-06-20 16:45:26.191953950 +0200
@@ -256,6 +256,33 @@
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)
diff -ruN efivar-36.orig/src/include/efivar/efiboot-disk.h efivar-36/src/include/efivar/efiboot-disk.h
--- efivar-36.orig/src/include/efivar/efiboot-disk.h 1970-01-01 01:00:00.000000000 +0100
+++ efivar-36/src/include/efivar/efiboot-disk.h 2018-06-20 16:47:47.111953412 +0200
@@ -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 */
diff -ruN efivar-36.orig/src/include/efivar/efiboot.h efivar-36/src/include/efivar/efiboot.h
--- efivar-36.orig/src/include/efivar/efiboot.h 2018-06-20 15:11:14.779975508 +0200
+++ efivar-36/src/include/efivar/efiboot.h 2018-06-20 16:49:20.599953055 +0200
@@ -34,5 +34,6 @@
#include <efivar/efiboot-creator.h>
#include <efivar/efiboot-loadopt.h>
+#include <efivar/efiboot-disk.h>
#endif /* EFIBOOT_H */
diff -ruN efivar-36.orig/src/libefiboot.map.in efivar-36/src/libefiboot.map.in
--- efivar-36.orig/src/libefiboot.map.in 2018-06-20 15:11:14.779975508 +0200
+++ efivar-36/src/libefiboot.map.in 2018-06-21 18:32:07.615999484 +0200
@@ -33,3 +33,7 @@
LIBEFIBOOT_1.30 {
} LIBEFIBOOT_1.29;
+
+LIBEFIBOOT_1.31 {
+ global: efi_disk_get_partition_info;
+} LIBEFIBOOT_1.30;