Commit Graph

34 Commits

Author SHA1 Message Date
Marcel Moolenaar
ada6a4d2b7 Rough implementation of the create and add verbs. The verbs cause
in-memory changes only and as such are only useful for prototyping
and regression testing purposes.
2005-10-09 17:10:35 +00:00
Marcel Moolenaar
233b044b9b Complete rewrite in preparation of adding support for control
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.
2005-09-17 07:05:17 +00:00
Poul-Henning Kamp
cb7ff8b71d g_read_data() can return NULL, check for it.
Found by:	Coverity (ID#258)
2005-03-18 07:03:56 +00:00
Marcel Moolenaar
9055ed836a o Don't limit GPT as a rank 2 provider. Allow it to be connected
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.
2004-12-05 06:02:21 +00:00
Poul-Henning Kamp
5721c9c76a Tag all geom classes in the tree with a version number. 2004-08-08 07:57:53 +00:00
Poul-Henning Kamp
650ee351b3 Use default method initialization on geoms. 2004-08-08 06:49:07 +00:00
Marcel Moolenaar
1b19d4ae61 Allow disks with a GPT to be used on big-endian machines. The GPT is
little-endian by definition and needs byte-swap operations for any
multi-byte field. While here fix indentation.
2004-04-30 05:05:39 +00:00
Poul-Henning Kamp
d2bae332d6 Remove the absolute count g_access_abs() function since experience has
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.
2004-02-12 22:42:11 +00:00
David E. O'Brien
50b1faef38 Use __FBSDID().
Approved by:	phk
2003-06-11 06:49:16 +00:00
Poul-Henning Kamp
68283a9b5a Remove unused variable.
Found by:       FlexeLint
2003-05-31 19:28:53 +00:00
Poul-Henning Kamp
f075585f67 Remove the G_CLASS_INITIALIZER, we do not need it anymore. 2003-05-31 16:59:27 +00:00
Poul-Henning Kamp
7e28a78f0e Use le_uuid_dec() since GPT UUID's are always in LE format.
Tested by:      Marcel
2003-05-31 16:48:43 +00:00
Poul-Henning Kamp
c9c29450f5 Use g_slice_spoiled() instead of g_std_spoiled().
Add XXX comment about minor memory leak until I can fix it.
2003-05-02 08:33:26 +00:00
Poul-Henning Kamp
c4da4e46b2 Back out all the stuff that didn't belong in the last commit. 2003-05-02 06:42:59 +00:00
Poul-Henning Kamp
e65ab0f83f Use g_slice_spoiled() rather than g_std_spoiled().
Remember to free the buffer we got from g_read_data().
2003-05-02 06:36:14 +00:00
Marcel Moolenaar
b52e9eb6b6 Don't emulate a MBR by handling the MBR::type attribute. It is
not needed at all. The BSD class will attach to a GPT class without
it.
2003-05-01 01:51:28 +00:00
Poul-Henning Kamp
3924ad705e Time has run from the "run GEOM in userland" harness, and the new regression
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.
2003-04-13 09:02:06 +00:00
Poul-Henning Kamp
0d3e96e39c Retire the "frontstuff" record keeping, it was no match for the
in-band meta-data of BSD labels and a more complex solution will be needed.
2003-04-12 08:41:26 +00:00
Poul-Henning Kamp
c138fec0b5 Premptively change initializations of struct g_class to use C99
sparse struct initializations before we extend the struct with
new OAM related member functions.
2003-03-24 19:30:15 +00:00
Warner Losh
a163d034fa Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
Alfred Perlstein
44956c9863 Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
2003-01-21 08:56:16 +00:00
Poul-Henning Kamp
2cc40a38a8 Constify the dumpconf() function. 2002-12-17 07:22:48 +00:00
Poul-Henning Kamp
a1d5f791fa Get rid of g_slice_addslice() and use g_slice_config() instead.
Tested with:	i386 + src/tools/regression/geom
2002-12-16 23:08:48 +00:00
Marcel Moolenaar
0df5787813 Fix dumpconf so libdisk can grok its output. We weren't checking
if indent was NULL. Consequently we always emitted the XML format.
2002-11-02 11:45:54 +00:00
Poul-Henning Kamp
3f12caa180 Now that the sectorsize and mediasize are properties of the provider,
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.
2002-10-20 20:28:24 +00:00
Poul-Henning Kamp
48444d6262 Make the sectorsize a property of providers so we can include it in the XML
output.

Sponsored by:	DARPA & NAI Labs
2002-10-20 19:18:07 +00:00
Poul-Henning Kamp
4ae677009e Style, whitespace and lint fixes.
Sponsored by:	DARPA & NAI Labs.
2002-09-28 11:57:20 +00:00
Poul-Henning Kamp
5a6baf5457 Add the new g_slice_config() call, which can add/delete/change a slice,
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.
2002-09-27 21:37:11 +00:00
Poul-Henning Kamp
af820f158f Remove unneeded #include <sys/disklabel.h>
Sponsored by:	DARPA & NAI Labs.
2002-09-20 17:00:24 +00:00
Marcel Moolenaar
c2926e2329 Use 'p' as the partition specifier instead of 's'. We continue to use
'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	...
2002-08-24 22:42:16 +00:00
Poul-Henning Kamp
503abe4540 Improve some on the naming.
Submitted by:	iedowse
2002-06-09 10:57:34 +00:00
Marcel Moolenaar
fd8706be29 Add compile time asserts for the size of struct gpt_hdr and struct
gpt_ent. Use offsetof() for struct gpt_hdr to exclude padding.
2002-05-30 06:33:07 +00:00
Poul-Henning Kamp
f4258597dc Add one copy of crc32() and crc32_tab[] in libkern, and remove it two other
places.

Comment out crc32 related definitions in zlib.h, we don't seem to have the
corresponding code in our kernel.
2002-05-29 20:24:09 +00:00
Marcel Moolenaar
bcd46c600a Add support to GEOM for GUID Partition Tables (GPTs). The support
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.
2002-05-28 09:04:48 +00:00