Skip to content

Commit

Permalink
libefi: remove efi_auto_sense()
Browse files Browse the repository at this point in the history
It's present (but undocumented) in the illumos gate and used exclusively
by rmformat(1) (which I recommend as a nice blast from the past),
and also the math assumes 512B sectors and is therefore wrong

Reviewed-by: Matthew Ahrens <[email protected]>
Reviewed-by: John Kennedy <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#12191
  • Loading branch information
nabijaczleweli authored and tonyhutter committed Nov 12, 2021
1 parent 73fcaed commit 998b27c
Show file tree
Hide file tree
Showing 3 changed files with 3,100 additions and 1,923 deletions.
1 change: 0 additions & 1 deletion include/sys/efi_partition.h
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ extern int efi_rescan(int);
extern void efi_free(struct dk_gpt *);
extern int efi_type(int);
extern void efi_err_check(struct dk_gpt *);
extern int efi_auto_sense(int fd, struct dk_gpt **);
extern int efi_use_whole_disk(int fd);
#endif

Expand Down
54 changes: 0 additions & 54 deletions lib/libefi/rdwr_efi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1692,57 +1692,3 @@ efi_err_check(struct dk_gpt *vtoc)
"no reserved partition found\n");
}
}

/*
* We need to get information necessary to construct a *new* efi
* label type
*/
int
efi_auto_sense(int fd, struct dk_gpt **vtoc)
{

int i;

/*
* Now build the default partition table
*/
if (efi_alloc_and_init(fd, EFI_NUMPAR, vtoc) != 0) {
if (efi_debug) {
(void) fprintf(stderr, "efi_alloc_and_init failed.\n");
}
return (-1);
}

for (i = 0; i < MIN((*vtoc)->efi_nparts, V_NUMPAR); i++) {
(*vtoc)->efi_parts[i].p_tag = default_vtoc_map[i].p_tag;
(*vtoc)->efi_parts[i].p_flag = default_vtoc_map[i].p_flag;
(*vtoc)->efi_parts[i].p_start = 0;
(*vtoc)->efi_parts[i].p_size = 0;
}
/*
* Make constants first
* and variable partitions later
*/

/* root partition - s0 128 MB */
(*vtoc)->efi_parts[0].p_start = 34;
(*vtoc)->efi_parts[0].p_size = 262144;

/* partition - s1 128 MB */
(*vtoc)->efi_parts[1].p_start = 262178;
(*vtoc)->efi_parts[1].p_size = 262144;

/* partition -s2 is NOT the Backup disk */
(*vtoc)->efi_parts[2].p_tag = V_UNASSIGNED;

/* partition -s6 /usr partition - HOG */
(*vtoc)->efi_parts[6].p_start = 524322;
(*vtoc)->efi_parts[6].p_size = (*vtoc)->efi_last_u_lba - 524322
- (1024 * 16);

/* efi reserved partition - s9 16K */
(*vtoc)->efi_parts[8].p_start = (*vtoc)->efi_last_u_lba - (1024 * 16);
(*vtoc)->efi_parts[8].p_size = (1024 * 16);
(*vtoc)->efi_parts[8].p_tag = V_RESERVED;
return (0);
}
Loading

0 comments on commit 998b27c

Please sign in to comment.