summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_gpt.c
Commit message (Collapse)AuthorAgeFilesLines
* Evolve the ctlreq interface added to geom_gpt into a genericmarcel2007-02-071-1356/+0
| | | | | | | | | | | partitioning class that supports multiple schemes. Current schemes supported are APM (Apple Partition Map) and GPT. Change all GEOM_APPLE anf GEOM_GPT options into GEOM_PART_APM and GEOM_PART_GPT (resp). The ctlreq interface supports verbs to create and destroy partitioning schemes on a disk; to add, delete and modify partitions; and to commit or undo changes made.
* Add BIO_FLUSH support to GPT class.pjd2006-11-011-0/+2
|
* Strengthen the check for a PMBR:marcel2006-08-091-18/+35
| | | | | | | | | | | | | | | | | o PMBR partitions count to the number of partitions on the disk, which means that if a PMBR entry is invalid we will not treat the MBR as a PMBR by virtue of it not describing any partitions. Previously the checks were inconsistent in that an invalid PMBR entry would be harmless when no other partitions exist (we would treat the MBR as a PMBR by virtue of it being empty), but it would be fatal when there is at least one other partition. o The partition size of a PMBR partition is one less than the media size because the GPT starts at the second sector (LBA 1) and extends to the end of the media. For backward bug-compatibility we accept a size that's exactly the media size (FreeBSD bug). Also, when the partition size can not be represented in a 32-bit integral, the partition size in the MBR is to be set to 0xFFFFFFFF. Accept this as a valid size, even if the size can be represented.
* Fix a phase-ordering bug: check the mediasize and sectorsize aftermarcel2006-08-081-20/+21
| | | | | | | | | | we obtained access. It is possible that GPT gets to taste a disk first, which means the disk has not been opened before and it will not get opened until after we checked the mediasize and sectorsize. However, since the mediasize and sectorsize are determined at open and that happens when access is optained, checking the mediasize and sectorsize before obtaining access may result in GPT rejecting the disk.
* Improve check for protective MBR. Instead of assiming that protectivesobomax2006-06-261-5/+24
| | | | | | | | | | MBR should have only one entry of type 0xEE, consider protective MBR to be one, that has at least one entry of type 0xEE covering the whole unit. This makes GEOM_GPT compatible with disks partitioned by the Apple's BootCamp. Approved in principle by: marcel MFC After: 1 month
* Fix unaligned memory accesses on Alpha and possible other platforms.marcel2006-06-041-3/+4
| | | | | | | | | | | | | | | | | By using a pointer to struct dos_partition, we implicitly tell the compiler that the pointer is 4-bytes aligned, even though we know that's not the case. The fact that we only dereference the pointer to access a byte-wide field (field dp_ptyp) is not a guarantee that the compiler will in fact use a byte-wide load. On some platforms it's more efficient to use long word or quad word loads and use bit-shifting and bit-masking to get the intended byte. On those platforms an misaligned load will be the result. The fix is to use byte-wide pointer arithmetic based on sizeof() and offsetof() to avoid invalid casts which avoids that the compiler makes invalid assumptions. Backtrace provided by: wilko@ MFC after: 1 week
* MFp4:marcel2006-04-101-20/+169
| | | | | | | | | | | | o Implement the remove verb to remove a partition entry. o Improve error reporting by first checking that the verb is valid. o Add an entry parameter to the add verb. this parameter can be both read-only as welll as read-write and specifies the entry number of the newly added partition. o Make sure that the provider is alive when passed to us. It may be withering away. o When adding a new partition entry, test for overlaps with existing partitions.
* Check for g_read_data(9) errors properly:sobomax2005-11-301-5/+5
| | | | | | | | | | o The only indication of error condition is NULL value returned by the function; o value pointed to by error argument is undefined in the case when operation completes successfully. Discussed with: phk
* o Slightly refactor the ctlreq code to maximize code sharing betweenmarcel2005-11-131-67/+127
| | | | | | | | | | | | | | verbs. Only the create verb operates on a provider. All other verbs operate on a GPT geom. Also, the GPT entry oriented verbs require a non-downgraded GPT. o Have all verbs take an optional flags parameter. The flags parameter is a string of single-letter flags. The typical use of these flags is to enable certain behaviour in support fo the gpt(8) tool. o Add dummy implementations for the destroy and recover verbs. This change causes test 2 of the GPT regression test suite to fail. The presence of a geom parameter is now required even for unknown verbs.
* Rough implementation of the create and add verbs. The verbs causemarcel2005-10-091-2/+290
| | | | | in-memory changes only and as such are only useful for prototyping and regression testing purposes.
* Complete rewrite in preparation of adding support for controlmarcel2005-09-171-154/+726
| | | | | | | | | | | | | | | | | requests. The following features have been added: 1. Extensive checking and validation of both the primary and secondary headers to protect against corrupted data and to take advantage of the redundancy to allow the GPT to be used in the face of recoverable corruption. 2. Dynamic data-structures to avoid hardcoding gratuitous table limits so as to support the creation of GPT tables of (as of yet) unspecified size. 3. Only allow kernel dumps to swap partitions to provide the necessary anti-footshooting measures. Linux swap partitions are allowed. 4. Complete dump of the GPT configuration, including labels. 5. Supports Byte Order Mark (U+FEFF) handling for big-endian, little-endian and mixed-endian partition names.
* g_read_data() can return NULL, check for it.phk2005-03-181-0/+2
| | | | Found by: Coverity (ID#258)
* o Don't limit GPT as a rank 2 provider. Allow it to be connectedmarcel2004-12-051-17/+25
| | | | | | | | | anywhere in the DAG. This includes configurations that are not allowed by the EFI specification. o Reject a GPT partition table if it's not preceeded by a PMBR. There's no need to preserve the MBR partitioning anymore as GPT is mature and with the first bullet extending the applicability of GPT, it's better to be a bit more strict.
* Tag all geom classes in the tree with a version number.phk2004-08-081-0/+1
|
* Use default method initialization on geoms.phk2004-08-081-1/+1
|
* Allow disks with a GPT to be used on big-endian machines. The GPT ismarcel2004-04-301-39/+48
| | | | | little-endian by definition and needs byte-swap operations for any multi-byte field. While here fix indentation.
* Remove the absolute count g_access_abs() function since experience hasphk2004-02-121-1/+1
| | | | | | | | | | | | shown that it is not useful. Rename the relative count g_access_rel() function to g_access(), only the name has changed. Change all g_access_rel() calls in our CVS tree to call g_access() instead. Add an #ifndef BURN_BRIDGES #define of g_access_rel() for source code compatibility.
* Use __FBSDID().obrien2003-06-111-2/+3
| | | | Approved by: phk
* Remove unused variable.phk2003-05-311-6/+1
| | | | Found by: FlexeLint
* Remove the G_CLASS_INITIALIZER, we do not need it anymore.phk2003-05-311-1/+0
|
* Use le_uuid_dec() since GPT UUID's are always in LE format.phk2003-05-311-2/+4
| | | | Tested by: Marcel
* Use g_slice_spoiled() instead of g_std_spoiled().phk2003-05-021-1/+2
| | | | Add XXX comment about minor memory leak until I can fix it.
* Back out all the stuff that didn't belong in the last commit.phk2003-05-021-7/+2
|
* Use g_slice_spoiled() rather than g_std_spoiled().phk2003-05-021-2/+7
| | | | Remember to free the buffer we got from g_read_data().
* Don't emulate a MBR by handling the MBR::type attribute. It ismarcel2003-05-011-21/+1
| | | | | not needed at all. The BSD class will attach to a GPT class without it.
* Time has run from the "run GEOM in userland" harness, and the new regressionphk2003-04-131-9/+0
| | | | | | | test is built to test GEOM as running in the kernel. This commit is basically "unifdef -D_KERNEL" to remove the mainly #include related code to support the userland-harness.
* Retire the "frontstuff" record keeping, it was no match for thephk2003-04-121-3/+0
| | | | in-band meta-data of BSD labels and a more complex solution will be needed.
* Premptively change initializations of struct g_class to use C99phk2003-03-241-3/+2
| | | | | sparse struct initializations before we extend the struct with new OAM related member functions.
* Back out M_* changes, per decision of the TRB.imp2003-02-191-1/+1
| | | | Approved by: trb
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-1/+1
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* Constify the dumpconf() function.phk2002-12-171-1/+1
|
* Get rid of g_slice_addslice() and use g_slice_config() instead.phk2002-12-161-9/+6
| | | | Tested with: i386 + src/tools/regression/geom
* Fix dumpconf so libdisk can grok its output. We weren't checkingmarcel2002-11-021-2/+6
| | | | if indent was NULL. Consequently we always emitted the XML format.
* Now that the sectorsize and mediasize are properties of the provider,phk2002-10-201-2/+2
| | | | | | | | | | | don't take the detour over the I/O path to discover them using getattr(), we can just pick them out directly. Do note though, that for now they are only valid after the first open of the underlying disk device due compatibility with the old disk_create() API. This will change in the future so they will always be valid. Sponsored by: DARPA & NAI Labs.
* Make the sectorsize a property of providers so we can include it in the XMLphk2002-10-201-0/+1
| | | | | | output. Sponsored by: DARPA & NAI Labs
* Style, whitespace and lint fixes.phk2002-09-281-44/+48
| | | | Sponsored by: DARPA & NAI Labs.
* Add the new g_slice_config() call, which can add/delete/change a slice,phk2002-09-271-0/+2
| | | | | | | | | with support for trying, doing and forcing. This will eventually replace g_slice_addslice() which gets changed from grabbing topology to requing it in this commit as well. Sponsored by: DARPA & NAI Labs.
* Remove unneeded #include <sys/disklabel.h>phk2002-09-201-1/+0
| | | | Sponsored by: DARPA & NAI Labs.
* Use 'p' as the partition specifier instead of 's'. We continue to usemarcel2002-08-241-2/+5
| | | | | | | | | | 's' for compatibility partitions (ie partitions with a BSD disklabel). Partition numbers continue to start with 1. Example /etc/fstab: # Device Mountpoint FStype Options ... /dev/da0p1 /efi msdos rw ... /dev/da0p2 / ufs rw ... /dev/da0p3 none swap sw ...
* Improve some on the naming.phk2002-06-091-2/+2
| | | | Submitted by: iedowse
* Add compile time asserts for the size of struct gpt_hdr and structmarcel2002-05-301-0/+3
| | | | gpt_ent. Use offsetof() for struct gpt_hdr to exclude padding.
* Add one copy of crc32() and crc32_tab[] in libkern, and remove it two otherphk2002-05-291-65/+0
| | | | | | | places. Comment out crc32 related definitions in zlib.h, we don't seem to have the corresponding code in our kernel.
* Add support to GEOM for GUID Partition Tables (GPTs). The supportmarcel2002-05-281-0/+314
is currently conditional on both the GEOM and GEOM_GPT options to avoid getting GPT by default and having the MBR and GPT classes clash. The correct behaviour of the MBR class would be to back-off (reject) a MBR if it's a Protective MBR (a MBR with a single partition of type 0xEE that spans the whole disk (as far as the MBR is concerned). The correct behaviour if the GPT class would be to back-off (reject) a GPT if there's a MBR that's not a Protective MBR. At this stage it's inconvenient to destroy a good MBR when working with GPTs that it's more convenient to have the MBR class back-off when it detects the GPT signature on disk and have the GPT class ignore the MBR. In sys/gpt.h UUIDs (GUIDs) for the following FreeBSD partitions have been defined: GPT_ENT_TYPE_FREEBSD FreeBSD slice with disklabel. This is the equivalent of the well-known FreeBSD MBR partition type. GPT_ENT_TYPE_FREEBSD_{SWAP|UFS|UFS2|VINUM} FreeBSD partitions in the context of disklabel. This is speculating on the idea to use the GPT to hold partitions instead if slices and removing the fixed (and low) limits we have on the number of partitions. This commit lacks a GPT image for the regression suite.
OpenPOWER on IntegriCloud