diff options
author | marcel <marcel@FreeBSD.org> | 2008-06-18 01:46:32 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2008-06-18 01:46:32 +0000 |
commit | b12551bbfa1c146748eb1514a8d44d48b1c74d92 (patch) | |
tree | 334a8b056ca7411abbcef54bba4dcee58857fd91 /sbin/geom | |
parent | 1fee86b4dc8e173a05f104332711818c58f3b894 (diff) | |
download | FreeBSD-src-b12551bbfa1c146748eb1514a8d44d48b1c74d92.zip FreeBSD-src-b12551bbfa1c146748eb1514a8d44d48b1c74d92.tar.gz |
Implement the set and unset verbs. While here, have the manpage
catch up with various changes.
Diffstat (limited to 'sbin/geom')
-rw-r--r-- | sbin/geom/class/part/geom_part.c | 35 | ||||
-rw-r--r-- | sbin/geom/class/part/gpart.8 | 60 |
2 files changed, 84 insertions, 11 deletions
diff --git a/sbin/geom/class/part/geom_part.c b/sbin/geom/class/part/geom_part.c index 87be834..19d4157 100644 --- a/sbin/geom/class/part/geom_part.c +++ b/sbin/geom/class/part/geom_part.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007 Marcel Moolenaar + * Copyright (c) 2007, 2008 Marcel Moolenaar * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -108,6 +108,13 @@ struct g_command PUBSYM(class_commands)[] = { G_OPT_SENTINEL }, "geom", NULL }, + { "set", 0, NULL, { + { 'a', "attrib", NULL, G_TYPE_STRING }, + { 'i', index_param, NULL, G_TYPE_STRING }, + { 'f', "flags", flags, G_TYPE_STRING }, + G_OPT_SENTINEL }, + "geom", NULL + }, { "show", 0, gpart_show, { { 'l', "show_label", NULL, G_TYPE_BOOL }, { 'r', "show_rawtype", NULL, G_TYPE_BOOL }, @@ -115,6 +122,13 @@ struct g_command PUBSYM(class_commands)[] = { NULL, "[-lr] [geom ...]" }, { "undo", 0, NULL, G_NULL_OPTS, "geom", NULL }, + { "unset", 0, NULL, { + { 'a', "attrib", NULL, G_TYPE_STRING }, + { 'i', index_param, NULL, G_TYPE_STRING }, + { 'f', "flags", flags, G_TYPE_STRING }, + G_OPT_SENTINEL }, + "geom", NULL + }, G_CMD_SENTINEL }; @@ -206,6 +220,19 @@ fmtsize(long double rawsz) return (buf); } +static const char * +fmtattrib(struct gprovider *pp) +{ + static char buf[64]; + const char *val; + + val = find_provcfg(pp, "attrib"); + if (val == NULL) + return (""); + snprintf(buf, sizeof(buf), " [%s] ", val); + return (buf); +} + static void gpart_show_geom(struct ggeom *gp, const char *element) { @@ -244,10 +271,10 @@ gpart_show_geom(struct ggeom *gp, const char *element) wname, "", fmtsize((sector - first) * secsz)); } - printf(" %*llu %*llu %*d %s (%s)\n", + printf(" %*llu %*llu %*d %s %s (%s)\n", wblocks, sector, wblocks, end - sector, - wname, idx, - find_provcfg(pp, element), fmtsize(pp->lg_mediasize)); + wname, idx, find_provcfg(pp, element), + fmtattrib(pp), fmtsize(pp->lg_mediasize)); first = end; } if (first <= last) { diff --git a/sbin/geom/class/part/gpart.8 b/sbin/geom/class/part/gpart.8 index fdc6740..3506334 100644 --- a/sbin/geom/class/part/gpart.8 +++ b/sbin/geom/class/part/gpart.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Jun 6, 2008 +.Dd Jun 17, 2008 .Dt GPART 8 .Os .Sh NAME @@ -106,6 +106,13 @@ utility: .Op Fl t Ar type .Op Fl f Ar flags .Ar geom +.\" ==== SET ==== +.Nm +.Cm set +.Fl a Ar attrib +.Fl i Ar index +.Op Fl f Ar flags +.Ar geom .\" ==== SHOW ==== .Nm .Cm show @@ -114,6 +121,13 @@ utility: .Nm .Cm undo .Ar geom +.\" ==== UNSET ==== +.Nm +.Cm unset +.Fl a Ar attrib +.Fl i Ar index +.Op Fl f Ar flags +.Ar geom .\" .Sh DESCRIPTION The @@ -181,6 +195,14 @@ The partition is specified by the .Fl i Ar index option. The size of the file must be smaller than the size of the partition. +.Pp +Addition options include: +.Bl -tag -width ".Fl w Ar wwwwwww" +.It Fl f Ar flags +Additional operational flags. +See the section entitled "Operational flags" below for a discussion +about its use. +.El .\" ==== COMMIT ==== .It Cm commit Commit any pending changes for geom @@ -275,6 +297,17 @@ Additional operational flags. See the section entitled "Operational flags" below for a discussion about its use. .El +.\" ==== SET ==== +.It Cm set +Set the named attribute on the partition entry. +.Pp +Addition options include: +.Bl -tag -width ".Fl w Ar wwwwwww" +.It Fl f Ar flags +Additional operational flags. +See the section entitled "Operational flags" below for a discussion +about its use. +.El .\" ==== SHOW ==== .It Cm show Show the current partition information of the specified geoms @@ -285,7 +318,19 @@ Revert any pending changes. This action is the opposite of the .Cm commit action and can be used to undo any changes that have not been committed. +.\" ==== UNSET ==== +.It Cm unset +Clear the named attribute on the partition entry. +.Pp +Addition options include: +.Bl -tag -width ".Fl w Ar wwwwwww" +.It Fl f Ar flags +Additional operational flags. +See the section entitled "Operational flags" below for a discussion +about its use. +.El .El +.\" .Sh PARTITION TYPES The .Nm @@ -312,6 +357,9 @@ This is a legacy partition type and should not be used for the APM or GPT schemes. The scheme-specific types are "!165" for MBR, "!FreeBSD" for APM, and "!516e7cb4-6ecf-11d6-8ff8-00022d09712b" for GPT. +.It freebsd-boot +A FreeBSD partition dedicated to bootstrap code. +The scheme-specific type is "!83bd6b9d-7f41-11dc-be0b-001560b84f0f" for GPT. .It freebsd-swap A FreeBSD partition dedicated to swap space. The scheme-specific types are "!FreeBSD-swap" for APM, and @@ -324,6 +372,10 @@ the scheme-specific types are "!FreeBSD-UFS" for APM, and A FreeBSD partition that contains a Vinum volume. The scheme-specific types are "!FreeBSD-Vinum" for APM, and "!516e7cb8-6ecf-11d6-8ff8-00022d09712b" for GPT. +.It freebsd-zfs +A FreeBSD partition that contains a ZFS volume. +The scheme-specific types are "!FreeBSD-ZFS" for APM, and +"!516e7cba-6ecf-11d6-8ff8-00022d09712b" for GPT. .It mbr A partition that is sub-partitioned by a master boot record (MBR). This type is known as "!024dee41-33e7-11d3-9d69-0008c781f39f" by GPT. @@ -360,11 +412,5 @@ The .Nm utility appeared in .Fx 7.0 . -.Sh BUGS -The MBR partitioning scheme cannot yet be used to create a bootable -MBR. -.Pp -Support for the PC98 or Sun partitioning schemes is not yet present. -The BSD disklabel is also not supported yet. .Sh AUTHORS .An Marcel Moolenaar Aq marcel@FreeBSD.org |