1 '\" te
2 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
3 .\" Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH EFI_ALLOC_AND_INIT 3EXT "November 20, 2019"
8 .SH NAME
9 efi_alloc_and_init, efi_alloc_and_read, efi_free, efi_write, efi_use_whole_disk,
10 efi_reserved_sectors \- manipulate a disk's EFI Partition Table
11 .SH SYNOPSIS
12 .nf
13 cc [ \fIflag \&.\|.\|.\fR ] \fIfile\fR\&.\|.\|. \fB-lefi\fR [ \fIlibrary \&.\|.\|.\fR ]
14 #include <sys/vtoc.h>
15 #include <sys/efi_partition.h>
16
17 \fBint\fR \fBefi_alloc_and_init\fR(\fBint\fR \fIfd\fR, \fBuint32_t\fR \fInparts\fR, \fBdk_gpt_t **\fR\fIvtoc\fR);
18 .fi
19
20 .LP
21 .nf
22 \fBint\fR \fBefi_alloc_and_read\fR(\fBint\fR \fIfd\fR, \fBdk_gpt_t **\fR\fIvtoc\fR);
23 .fi
24
25 .LP
26 .nf
27 \fBvoid\fR \fBefi_free\fR(\fBdk_gpt_t *\fR\fIvtoc\fR);
83 The \fInparts\fR argument specifies the number of desired partitions.
84 .sp
85 .LP
86 The \fIvtoc\fR argument is a \fBdk_gpt_t\fR structure that describes an EFI
87 partition table and contains at least the following members:
88 .sp
89 .in +2
90 .nf
91 uint_t efi_version; /* set to EFI_VERSION_CURRENT */
92 uint_t efi_nparts; /* no. of partitions in efi_parts */
93 uint_t efi_lbasize; /* size of block in bytes */
94 diskaddr_t efi_last_lba; /* last block on the disk */
95 diskaddr_t efi_first_u_lba; /* first block after labels */
96 diskaddr_t efi_last_u_lba; /* last block before backup labels */
97 struct dk_part efi_parts[]; /* array of partitions */
98 .fi
99 .in -2
100
101 .SS "Protective Master Boot Record"
102 When a disk receives an EFI label, a protective MBR (\fBPMBR\fR) is also
103 written containing a single partiton of type \fBEEh\fR and spanning the
104 entire disk (up to the limit of what can be represented in an MBR). By
105 default that partition is placed in slot 0 of the PMBR and not marked as
106 active. Some BIOS implementations contain bugs that require the entry to be
107 placed into a different slot or to be made active in order for the system
108 to boot successfully. The default behaviour is modified for systems with known
109 firmware bugs, refer to \fB/usr/share/hwdata/efi.fixes\fR for more
110 information.
111
112 .SH RETURN VALUES
113 Upon successful completion, \fBefi_alloc_and_init()\fR returns 0. Otherwise it
114 returns \fBVT_EIO\fR if an I/O operation to the disk fails.
115 .sp
116 .LP
117 Upon successful completion, \fBefi_alloc_and_read()\fR returns a positive
118 integer indicating the slice index associated with the open file descriptor.
119 Otherwise, it returns a negative integer to indicate one of the following:
120 .sp
121 .ne 2
122 .na
123 \fB\fBVT_EIO\fR\fR
|
1 '\" te
2 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
3 .\" Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH EFI_ALLOC_AND_INIT 3EXT "May 16, 2020"
8 .SH NAME
9 efi_alloc_and_init, efi_alloc_and_read, efi_free, efi_write, efi_use_whole_disk,
10 efi_reserved_sectors \- manipulate a disk's EFI Partition Table
11 .SH SYNOPSIS
12 .nf
13 cc [ \fIflag \&.\|.\|.\fR ] \fIfile\fR\&.\|.\|. \fB-lefi\fR [ \fIlibrary \&.\|.\|.\fR ]
14 #include <sys/vtoc.h>
15 #include <sys/efi_partition.h>
16
17 \fBint\fR \fBefi_alloc_and_init\fR(\fBint\fR \fIfd\fR, \fBuint32_t\fR \fInparts\fR, \fBdk_gpt_t **\fR\fIvtoc\fR);
18 .fi
19
20 .LP
21 .nf
22 \fBint\fR \fBefi_alloc_and_read\fR(\fBint\fR \fIfd\fR, \fBdk_gpt_t **\fR\fIvtoc\fR);
23 .fi
24
25 .LP
26 .nf
27 \fBvoid\fR \fBefi_free\fR(\fBdk_gpt_t *\fR\fIvtoc\fR);
83 The \fInparts\fR argument specifies the number of desired partitions.
84 .sp
85 .LP
86 The \fIvtoc\fR argument is a \fBdk_gpt_t\fR structure that describes an EFI
87 partition table and contains at least the following members:
88 .sp
89 .in +2
90 .nf
91 uint_t efi_version; /* set to EFI_VERSION_CURRENT */
92 uint_t efi_nparts; /* no. of partitions in efi_parts */
93 uint_t efi_lbasize; /* size of block in bytes */
94 diskaddr_t efi_last_lba; /* last block on the disk */
95 diskaddr_t efi_first_u_lba; /* first block after labels */
96 diskaddr_t efi_last_u_lba; /* last block before backup labels */
97 struct dk_part efi_parts[]; /* array of partitions */
98 .fi
99 .in -2
100
101 .SS "Protective Master Boot Record"
102 When a disk receives an EFI label, a protective MBR (\fBPMBR\fR) is also
103 written containing a single partition of type \fBEEh\fR and spanning the
104 entire disk (up to the limit of what can be represented in an MBR). By
105 default that partition is placed in slot 0 of the PMBR and not marked as
106 active. Some BIOS implementations contain bugs that require the entry to be
107 placed into a different slot or to be made active in order for the system
108 to boot successfully. The default behaviour is modified for systems with known
109 firmware bugs, refer to \fB/usr/share/hwdata/efi.fixes\fR for more
110 information.
111
112 .SH RETURN VALUES
113 Upon successful completion, \fBefi_alloc_and_init()\fR returns 0. Otherwise it
114 returns \fBVT_EIO\fR if an I/O operation to the disk fails.
115 .sp
116 .LP
117 Upon successful completion, \fBefi_alloc_and_read()\fR returns a positive
118 integer indicating the slice index associated with the open file descriptor.
119 Otherwise, it returns a negative integer to indicate one of the following:
120 .sp
121 .ne 2
122 .na
123 \fB\fBVT_EIO\fR\fR
|