Index: efivar-38/src/disk.c =================================================================== --- efivar-38.orig/src/disk.c +++ efivar-38/src/disk.c @@ -239,6 +239,34 @@ 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, (partition_signature_t *)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-38/src/include/efivar/efiboot-disk.h =================================================================== --- /dev/null +++ efivar-38/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 + * + * 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 + * . + * + */ +#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-38/src/include/efivar/efiboot.h =================================================================== --- efivar-38.orig/src/include/efivar/efiboot.h +++ efivar-38/src/include/efivar/efiboot.h @@ -20,6 +20,7 @@ #include #include +#include extern uint32_t efi_get_libefiboot_version(void) __attribute__((__visibility__("default"))); Index: efivar-38/src/libefiboot.map.in =================================================================== --- efivar-38.orig/src/libefiboot.map.in +++ efivar-38/src/libefiboot.map.in @@ -36,4 +36,5 @@ LIBEFIBOOT_1.30 { LIBEFIBOOT_1.31 { global: efi_get_libefiboot_version; + efi_disk_get_partition_info; } LIBEFIBOOT_1.30;