- libefiboot-export-disk_get_partition_info.patch: (bsc#870211, bsc#945705) - Update to 31 (fate#322108) OBS-URL: https://build.opensuse.org/request/show/476829 OBS-URL: https://build.opensuse.org/package/show/Base:System/efivar?expand=0&rev=26
129 lines
4.2 KiB
Diff
129 lines
4.2 KiB
Diff
From 29d7125f38f508587f1b56dae985bf7e62015a72 Mon Sep 17 00:00:00 2001
|
|
From: Raymund Will <rw@suse.com>
|
|
Date: Fri, 3 Mar 2017 18:36:30 +0100
|
|
Subject: [PATCH] libefiboot: export disk_get_partition_info()
|
|
References: bsc#870211, bsc#945705
|
|
|
|
This is necessary to extend to functionality of 'efibootmgr --delete'
|
|
beyond a mere '--bootnum'-usage.
|
|
|
|
Signed-off-by: Raymund Will <rw@suse.com>
|
|
---
|
|
Make.version | 2 +-
|
|
src/disk.c | 27 +++++++++++++++++++++++++++
|
|
src/include/efivar/efiboot-disk.h | 32 ++++++++++++++++++++++++++++++++
|
|
src/include/efivar/efiboot.h | 1 +
|
|
src/libefiboot.map.in | 4 ++++
|
|
6 files changed, 67 insertions(+), 2 deletions(-)
|
|
create mode 100644 src/include/efivar/efiboot-disk.h
|
|
|
|
diff --git a/Make.version b/Make.version
|
|
index b32878b..5460dcb 100644
|
|
--- a/Make.version
|
|
+++ b/Make.version
|
|
@@ -1 +1 @@
|
|
-VERSION = 30
|
|
+VERSION = 31
|
|
diff --git a/src/disk.c b/src/disk.c
|
|
index 91d636d..df8066b 100644
|
|
--- a/src/disk.c
|
|
+++ b/src/disk.c
|
|
@@ -247,6 +247,33 @@ get_partition_info(int fd, uint32_t options,
|
|
return rc;
|
|
}
|
|
|
|
+/*
|
|
+ * 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
|
|
__attribute__((__visibility__ ("hidden")))
|
|
_make_hd_dn(uint8_t *buf, ssize_t size, int fd, uint32_t partition,
|
|
diff --git a/src/include/efivar/efiboot-disk.h b/src/include/efivar/efiboot-disk.h
|
|
new file mode 100644
|
|
index 0000000..50ae862
|
|
--- /dev/null
|
|
+++ b/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 */
|
|
diff --git a/src/include/efivar/efiboot.h b/src/include/efivar/efiboot.h
|
|
index 9a4b450..a2512b0 100644
|
|
--- a/src/include/efivar/efiboot.h
|
|
+++ b/src/include/efivar/efiboot.h
|
|
@@ -34,5 +34,6 @@
|
|
|
|
#include <efiboot-creator.h>
|
|
#include <efiboot-loadopt.h>
|
|
+#include <efiboot-disk.h>
|
|
|
|
#endif /* EFIBOOT_H */
|
|
diff --git a/src/libefiboot.map.in b/src/libefiboot.map.in
|
|
index cb19d65..15970d9 100644
|
|
--- a/src/libefiboot.map.in
|
|
+++ b/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;
|
|
--
|
|
2.6.6
|
|
|