diff options
| author | Lexi Winter <ivy@FreeBSD.org> | 2025-12-01 03:19:41 +0000 |
|---|---|---|
| committer | Lexi Winter <ivy@FreeBSD.org> | 2025-12-01 03:19:41 +0000 |
| commit | 2e80774d0b20d167bc0a9e2b63dafbfb171c0d22 (patch) | |
| tree | 25f0138e1af8902b92dacc8cce09b267447c17db /devel/efivar/files/patch-src_disk.c | |
| parent | f85f2b2d6e5b7ed869376eb4b180c3a74a5c5da9 (diff) | |
| parent | 1a30da80670973368b399f2b01fe9c04b91a1273 (diff) | |
Merge remote-tracking branch 'freebsd/main' into lf/mainlf/main
Diffstat (limited to 'devel/efivar/files/patch-src_disk.c')
| -rw-r--r-- | devel/efivar/files/patch-src_disk.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/devel/efivar/files/patch-src_disk.c b/devel/efivar/files/patch-src_disk.c new file mode 100644 index 000000000000..796a0904ed29 --- /dev/null +++ b/devel/efivar/files/patch-src_disk.c @@ -0,0 +1,32 @@ +--- src/disk.c.orig 2024-01-31 20:08:46 UTC ++++ src/disk.c +@@ -14,6 +14,10 @@ + #include <stdio.h> + #include <stdlib.h> + #include <string.h> ++#ifdef __FreeBSD__ ++# include <sys/disk.h> ++# undef LIST_HEAD ++#endif + #include <sys/ioctl.h> + #include <sys/mount.h> + #include <sys/stat.h> +@@ -158,8 +162,18 @@ msdos_disk_get_partition_info (int fd, int write_signa + } else if (num == 0) { + /* Whole disk */ + *start = 0; ++#if defined(__linux__) + ioctl(fd, BLKGETSIZE, &disk_size); + *size = disk_size; ++#elif defined(__FreeBSD__) ++ long sector_size=0; ++ ioctl(fd, DIOCGMEDIASIZE, &disk_size); ++ ioctl(fd, DIOCGSECTORSIZE, §or_size); ++ *size = disk_size / sector_size; ++#else ++ efi_error("could not get disk size (not implemented on your OS)"); ++ return -1; ++#endif + } else if (num >= 1 && num <= 4) { + /* Primary partition */ + *start = mbr->partition[num-1].starting_lba; |
