Commit Graph

129 Commits

Author SHA1 Message Date
Marcel Moolenaar
165651a553 o Add the "PART::scheme" attribute that returns the name of the
underlying partitioning scheme.
o  Put the start and end of the partition in the XML configuration.
   The start and end are the LBAs of the first and last sector
   (resp.) of the partition. They are currently identical to the
   offset and size attributes, which describe the partition as an
   offset and size in bytes, but may not in the future. The start
   and end will be used for the logical partition boundaries and
   may include metadata. The offset and size will always represent
   the useful storage space within the partition. Typically these
   two notions are the same, but for logical partitions in an
   extended partition, the EBR is more naturally treated as being
   part of the partition.
2009-02-08 20:15:08 +00:00
Marcel Moolenaar
3d556594df Don't enforce an upper-bound to the number of sectors or heads
that that the provider has. The limits we imposed were PC BIOS
specific and not always applicable.
2009-01-06 06:47:53 +00:00
Marcel Moolenaar
6647711279 Allow boot code to be smaller than what the scheme expects.
This effectively changes the boot code size to be an upper
bound and makes the interface more flexible.
2008-12-01 00:07:17 +00:00
Marcel Moolenaar
1e2fbcfa44 Insert the null scheme at the head. This does not change any
functionality, but creates an invariant: the first element
on the list is always the null scheme.
2008-09-29 02:39:02 +00:00
Marcel Moolenaar
a455de093b Hold the root mount while we're tasting. It is possible
that a nested partition (typically the BSD disklabel)
is not done tasting while the root file system is being
mounted. While this is rare, it's still possible.
2008-09-27 19:29:52 +00:00
Rui Paulo
89ea496520 Fix build. 2008-09-05 18:11:18 +00:00
Rui Paulo
87662ab391 Keep entries sorted. 2008-09-05 18:09:49 +00:00
Rui Paulo
35fa2f1bcd Include the vendor in the partition name. 2008-09-05 16:54:07 +00:00
Rui Paulo
d7255ff42e Detect Apple HFS GPT slices. 2008-09-05 12:49:14 +00:00
Dag-Erling Smørgrav
2616144e43 Add sbuf_new_auto as a shortcut for the very common case of creating a
completely dynamic sbuf.

Obtained from:	Varnish
MFC after:	2 weeks
2008-08-09 11:14:05 +00:00
Marcel Moolenaar
f6aa3fccce Add the set and unset verbs used to set and clear attributes for
partition entries. Implement the setunset method for the MBR
scheme to control the active flag.
2008-06-18 01:13:34 +00:00
Marcel Moolenaar
5db670520f Implement the G_PART_DUMPCONF method for all 6 schemes. Also call
the method for the (indent == NULL) case (i.e. the kern.geom.conftxt
sysctl). The purpose is to extend the conftxt output with scheme-
specific fields which can be used by libdisk. In particular, have
the schemes dump the xs and xt fields, which contain the backward
compatible values for class type and partition type. This allows
libdisk to work with the legacy slicers as well as with gpart and
helps/promotes migration.
2008-04-23 20:13:05 +00:00
Marcel Moolenaar
4d32fcb42b Add the bootcode verb for installing boot code. Boot code
is supported for the MBR, GPT and PC98 schemes, where GPT
installs boot code into the PMBR.
2008-04-13 19:54:54 +00:00
Marcel Moolenaar
4ffca444a5 Redefine G_PART_SCHEME_DECLARE() from populating a private linker set
to declaring a proper module. The module event handler is part of the
gpart core and will add the scheme to an internal list on module load
and will remove the scheme from the internal list on module unload.
This makes it possible to dynamically load and unload partitioning
schemes.
2008-03-23 01:31:59 +00:00
Marcel Moolenaar
4275d83ab5 Fix a bug in the add verb, where we failed to keep the list
of partitions in index-order. This is assumed by the APM, MBR
and BSD partitioning schemes.
2007-12-09 22:26:42 +00:00
Marcel Moolenaar
04a814ef90 Internal partitions can not be deleted or modified. 2007-12-08 23:08:42 +00:00
Marcel Moolenaar
d6bbbeebd9 Skip internal partitions in the check for (user) partitions for
the destroy command. Previously a freshly created BSD disklabel
could not be destroyed because of the internal partition.
2007-12-08 22:06:17 +00:00
Marcel Moolenaar
5aaa8fefdf Add a BSD disklabel backend to g_part:
o  Disklabels can have between 8 and 20 partitions (inclusive).
o  No device special file is created for the raw partition.
o  Switch ia64 to use this backend.
o  No support for boot code yet.
2007-12-06 02:32:42 +00:00
John Baldwin
f352a0d45f First cut at support for booting a GPT labeled disk via the BIOS bootstrap
on i386 and amd64 machines.  The overall process is that /boot/pmbr lives
in the PMBR (similar to /boot/mbr for MBR disks) and is responsible for
locating and loading /boot/gptboot.  /boot/gptboot is similar to /boot/boot
except that it groks GPT rather than MBR + bsdlabel.  Unlike /boot/boot,
/boot/gptboot lives in its own dedicated GPT partition with a new
"FreeBSD boot" type.  This partition does not have a fixed size in that
/boot/pmbr will load the entire partition into the lower 640k.  However,
it is limited in that it can only be 545k.  That's still a lot better than
the current 7.5k limit for boot2 on MBR.  gptboot mostly acts just like
boot2 in that it reads /boot.config and loads up /boot/loader.  Some more
details:
- Include uuid_equal() and uuid_is_nil() in libstand.
- Add a new 'boot' command to gpt(8) which makes a GPT disk bootable using
  /boot/pmbr and /boot/gptboot.  Note that the disk must have some free
  space for the boot partition.
  - This required exposing the backend of the 'add' function as a
    gpt_add_part() function to the rest of gpt(8).  'boot' uses this to
    create a boot partition if needed.
- Don't cripple cgbase() in the UFS boot code for /boot/gptboot so that
  it can handle a filesystem > 1.5 TB.
- /boot/gptboot has a simple loader (gptldr) that doesn't do any I/O
  unlike boot1 since /boot/pmbr loads all of gptboot up front.  The
  C portion of gptboot (gptboot.c) has been repocopied from boot2.c.
  The primary changes are to parse the GPT to find a root filesystem
  and to use 64-bit disk addresses.  Currently gptboot assumes that the
  first UFS partition on the disk is the / filesystem, but this algorithm
  will likely be improved in the future.
- Teach the biosdisk driver in /boot/loader to understand GPT tables.
  GPT partitions are identified as 'disk0pX:' (e.g. disk0p2:) which is
  similar to the /dev names the kernel uses (e.g. /dev/ad0p2).
- Add a new "freebsd-boot" alias to g_part() for the new boot UUID.

MFC after:	1 month
Discussed with:	marcel (some things might still change, but am committing
			what I have so far)
2007-10-24 21:33:00 +00:00
Marcel Moolenaar
a1fedf914f Add the freebsd-zfs alias. Both APM and GPT have ZFS partition
types.
2007-10-21 20:02:57 +00:00
Marcel Moolenaar
0081f96ecd Have gpart synthesize a disk geometry if the underlying provider
don't have it. Some partitioning schemes, as well as file systems,
operate on the geometry and without it such schemes (e.g. MBR)
and file systems (e.g. FAT) can't be created. This is useful for
memory disks.
2007-06-17 22:19:19 +00:00
Marcel Moolenaar
33a558c7e9 Call sbuf_finish() before sbuf_data() and sbuf_len(). 2007-06-06 05:01:41 +00:00
Marcel Moolenaar
ce3498bd83 Fix a dereference in KASSERT. 2007-05-15 23:29:57 +00:00
Marcel Moolenaar
35fe9df032 o Implement automatic commit. It's enabled when the flags parameter
exists and contains the 'C' flag.
o  The partition label can be the empty string. It's how labels are
   cleared.
o  When an action fails, lower permissions when they were raised
   in order to allow the action. A failed action will not result
   in any uncommitted changes.
o  Allow the flags paremeter to be present but empty. It's the
   equivalent of not being present.
2007-05-15 20:14:55 +00:00
Marcel Moolenaar
5100f9e95b Write the output parameter (if present) for the add, create, delete
destroy and modify verbs.
2007-05-09 05:37:53 +00:00
Marcel Moolenaar
c8dffc524a When reverting the creation of a partitioning scheme on a provider,
the failure to probe an existing partitioning scheme means that no
previous partitioning scheme existed. Don't error. Just destroy the
geom.
2007-05-09 01:46:42 +00:00
Marcel Moolenaar
d287f59062 MFp4:
119373:	o  Remove the query verb, along with the request and response
	   parameters.
	o  Add the version and output parameters.
119390: [APM,GPT] Properly clear deleted entries.
119394:	o  Make the alias the standard and use the '!' to prefix
	   literal partition types.
	o  Treat schemes and partition types as case insensitive.
119462: [GPT] Fix a page fault caused when modifying a partition entry
	without a new partition type.
2007-05-08 20:18:17 +00:00
Marcel Moolenaar
e8e1f54462 Put the scheme (APM, GPT, etc) in the XML. 2007-04-27 05:58:10 +00:00
Marcel Moolenaar
1d3aed33e8 Evolve the ctlreq interface added to geom_gpt into a generic
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.
2007-02-07 18:55:31 +00:00