freebsd-src/sys
Toomas Soome c12dbfe608 loader: Implement disk_ioctl() to support DIOCGSECTORSIZE and DIOCGMEDIASIZE.
Need interface to extract information about disk abstraction,
to read disk or partition size depending on the provided argument
and adjust disk size based on information in partition table.

The disk handle from disk_open() has d_offset field to point to
partition start. So we can use this fact to return either whole disk
size or partition size. For this we only need to record partition size
we get from disk_open() anyhow.

In addition, this will also make it possible to adjust the disk media size
based on information from partition table. The problem with disk size is
about some BIOS systems reporting bogus disk size for 2+TB disks, but
since such disks are using GPT partitioning, and GPT does have information
about disk size (alternate LBA + 1), we can use this fact to record disk
size based on partition table.

This patch does exactly this: implements DIOCGSECTORSIZE and DIOCGMEDIASIZE
ioctl, and DIOCGMEDIASIZE will report either disk media size or partition size.

Adds ptable_getsize() call to read partition size in bytes from ptable pointer.
Updates disk_open() to use ptable_getsize() to update mediasize value.

Implements GPT detection function to update ptable size (used by
ptable_getsize()) according to alternate lba (which is location of backup copy
of GPT header table).

Reviewed by:	allanjude
Approved by:	allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D8594
2017-02-06 08:26:45 +00:00
..
amd64 Regen after r313284. 2017-02-05 14:19:19 +00:00
arm Define the vm_ooffset_t and vm_pindex_t types as machine-independend. 2017-02-04 12:26:38 +00:00
arm64 Define the vm_ooffset_t and vm_pindex_t types as machine-independend. 2017-02-04 12:26:38 +00:00
boot loader: Implement disk_ioctl() to support DIOCGSECTORSIZE and DIOCGMEDIASIZE. 2017-02-06 08:26:45 +00:00
bsm
cam Revert crap accidentally committed 2017-01-28 16:31:23 +00:00
cddl Ensure that the DOF string length is divisible by 2. 2017-02-05 02:47:34 +00:00
compat Update syscall.master to 4.10-rc6. Also fix comments, a typo, 2017-02-05 14:17:09 +00:00
conf [iwm] Add implementation of the notification wait api from iwlwifi. 2017-02-06 05:27:07 +00:00
contrib [ath_hal] [ar9300] link in the CAC enable/diable methods and expose it via the HAL. 2017-02-03 05:15:35 +00:00
crypto Remove pc98 support completely. 2017-01-28 02:22:15 +00:00
ddb Revert crap accidentally committed 2017-01-28 16:31:23 +00:00
dev [iwm] Use notification wait API to wait for calibration to complete. 2017-02-06 05:35:11 +00:00
fs Revert crap accidentally committed 2017-01-28 16:31:23 +00:00
gdb
geom Check that primary GPT header is valid before wiping partitioning. 2017-02-04 05:09:47 +00:00
gnu
i386 Regen after r313284. 2017-02-05 14:19:19 +00:00
isa Remove pc98 support completely. 2017-01-28 02:22:15 +00:00
kern rwlock: move lockstat handling out of inline primitives 2017-02-05 13:37:23 +00:00
kgssapi
libkern calculate_crc32c: Add SSE4.2 implementation on x86 2017-01-31 03:26:32 +00:00
mips Define the vm_ooffset_t and vm_pindex_t types as machine-independend. 2017-02-04 12:26:38 +00:00
modules [iwm] Add implementation of the notification wait api from iwlwifi. 2017-02-06 05:27:07 +00:00
net Delete duplicate break. 2017-02-04 18:25:09 +00:00
net80211 [net80211] don't update quiet time counter values every probe request. 2017-02-03 06:04:06 +00:00
netgraph mppc - Finish pluging NETGRAPH_MPPC_COMPRESSION. 2017-01-20 00:02:11 +00:00
netinet Fix VIMAGE-related bugs in TFO. The autokey callout vnet context was 2017-02-03 17:02:57 +00:00
netinet6 Garbage collect IFT_IEEE80211 (but leave the define for possible reuse) 2017-01-28 17:08:40 +00:00
netipsec Add direction argument to ipsec_setspidx_inpcb() function. 2017-01-08 12:40:07 +00:00
netnatm
netpfil Fix indentantion in pf_purge_thread(). No functional change. 2017-01-30 22:47:48 +00:00
netsmb
nfs
nfsclient
nfsserver
nlm
ofed
opencrypto
powerpc Define the vm_ooffset_t and vm_pindex_t types as machine-independend. 2017-02-04 12:26:38 +00:00
riscv Implement atomic_fcmpset_*() for RISC-V. 2017-02-05 00:32:12 +00:00
rpc
security
sparc64 Define the vm_ooffset_t and vm_pindex_t types as machine-independend. 2017-02-04 12:26:38 +00:00
sys rwlock: move lockstat handling out of inline primitives 2017-02-05 13:37:23 +00:00
teken
tests
tools Replace using of objdump with elfdump 2017-01-10 18:46:40 +00:00
ufs ffs_vnops: Simplify extattr access 2017-01-19 16:46:05 +00:00
vm Style, use tab after #define. 2017-02-04 19:16:19 +00:00
x86 Define the vm_ooffset_t and vm_pindex_t types as machine-independend. 2017-02-04 12:26:38 +00:00
xdr
xen "Buses" is the preferred plural of "bus" 2017-01-15 17:54:01 +00:00
Makefile Remove pc98 support completely. 2017-01-28 02:22:15 +00:00