Commit Graph

253 Commits

Author SHA1 Message Date
Maxim Konovalov
7922d6f987 o Replace Xr to gpt(8) which is gone by gpart(8). 2008-11-05 09:27:13 +00:00
Ulf Lilleengen
9d8ce07800 - A call to close(2) might overwrite errno and thus give a wrong error message
on g_providername failure.

Suggested by:	pjd
Approved by:	pjd (mentor)
2008-09-30 11:46:14 +00:00
Ulf Lilleengen
bd5add5884 - Improve error message given on g_providername call failure.
- While there, make error messages consistent with the rest.

Approved by:	kib (mentor)
2008-09-30 07:18:49 +00:00
Ruslan Ermilov
0a4b670e07 Add missing library dependencies.
PR:		bin/127573
Submitted by:	Eygene Ryabinkin
2008-09-23 13:12:51 +00:00
Ulf Lilleengen
7a4b0bb24a - Make bsdlabel use libgeom to determine provider name, device path, the media
size and the sector size.
- Fix a bug where bsdlabel would try to read a regular file using the geom_bsd
  class.

Quick review by:	phk
Approved by:	pjd (mentor)
2008-09-18 14:04:02 +00:00
Craig Rodrigues
67361fdf2d Remove comment about "-r" flag from readlabel. "-r" is a no-op.
The is comment is left over from the old disklabel command.

Reviewed by:	phk
2008-03-23 03:01:10 +00:00
Marcel Moolenaar
d5718812ea Allow bsdlabel to operate on labels that have at most 26 partitions
by virtue of there not being any (lower-case) letters avaliable for
more partitions.
2007-12-09 22:58:49 +00:00
Remko Lodder
9b750c1c8e Remove redundant whitespace.
Noticed by:	brueffer
2007-12-08 23:41:13 +00:00
Remko Lodder
eff1c096ed Attempt to describe the ''auto'' type a bit better in the default
section (if nothing had been specified, or if the auto type had
been specified, a default layout is used).

PR:		docs/116047
Submitted by:	Ian Smith <smithi at nimnet dot asn dot au>
		Minor modifications by me.
2007-12-08 19:57:22 +00:00
Ruslan Ermilov
f9530cf087 - Fix markup.
- Somewhat improve wording.

- Change the layout of the EXAMPLES section so that descriptions
  come before example, as in most other manpages.

- Fix a bad example that edits a label using a `c' partition.
2006-12-29 16:28:38 +00:00
Maxim Konovalov
f72bbf974b o '-s' flag was killed in rev. 1.75. Clean getopt(3).
PR:		bin/104616
Submitted by:	Oliver Fromme
MFC after:	1 week
2006-10-20 13:10:27 +00:00
Ruslan Ermilov
476bfbd7c7 - Don't mention (wrong) defaults for FFS file system parameters,
replace them with references to newfs(8) which documents them.

- Remove mentions of LFS support for which was retired in 1998.

- Regenerate an example output.

PR:		docs/84913
MFC after:	3 days
2006-10-13 15:44:29 +00:00
Ruslan Ermilov
6b0db4ab37 Fix utility's short description.
PR:		docs/84467
Submitted by:	Gary W. Swearingen
MFC after:	3 days
2006-10-12 20:29:20 +00:00
Ruslan Ermilov
8266d47670 Markup fixes. 2006-09-18 11:55:10 +00:00
Ruslan Ermilov
2b46c64c9c Remove alpha left-overs. 2006-08-22 08:03:01 +00:00
Pawel Jakub Dawidek
689686bf2f Explain why the first partition should start at offset 16.
Requested by:	hrs
2006-03-08 14:17:26 +00:00
Pawel Jakub Dawidek
bd92a261fe Fix evil examples - first partition should start at offset 16.
MFC after:	3 days
2006-03-04 12:09:50 +00:00
Ruslan Ermilov
4e9e907d63 -mdoc sweep. 2005-11-18 10:36:29 +00:00
Craig Rodrigues
1c47852f8a Clarify wording for -m flag.
PR:	docs/84704
2005-09-17 15:10:39 +00:00
Ian Dowse
3b89beb171 Attempt to improve the logic for automatically sizing partitions
to take into account the new default of starting the first partition
after the boot blocks instead of at sector 0. If you used automatic
sizing when the first partition did not start at 0, you would get
an error that the automatically sized partition extended beyond the
end of the disk.

Note that there are probably still many more complex cases where
automatic sizing and placement will not work (e.g. non-contiguous
or out of order partitions).
2005-08-14 22:46:50 +00:00
Ruslan Ermilov
214144704b Scheduled mdoc(7) sweep. 2005-01-10 16:17:34 +00:00
Ralf S. Engelschall
ccdd2fce3a Fix the derivation of the GEOM name from the specified device name by
complementing the existing special case of a not existing /dev prefix
with the recognition of an already existing /dev prefix.

This implicitly solves the following two issues related to working on
GEOM devices /dev/foo/bar (which have the GEOM provider name "foo/bar")
with the expected commands like "bsdlabel /dev/foo/bar":

1. the error "Geom not found" when trying to write or edit the BSD
   label (because previously the incorrect GEOM name "bar" instead of
   "foo/bar" was derived from "/dev/foo/bar").

2. the multiple times reported "magically introduced" partition offset
   of 63 blocks and the resulting errors like "partition extends past
   end of unit" and "partition c doesn't start at 0!".

   This implicitly resulted because bsdlabel(8) determines the "MBR
   offset" via GEOM and (intentionally) silently falls back to an offset
   of 0 if it could not be queried (which is the case if the name was
   incorrectly derived).

   Usually (at least on PCs) the offset for the first slice is 63 blocks
   and bsdlabel(8) automatically subtracts them from the absolute
   offsets in the read on-disk BSD label, resulting in the display of an
   effective offset of 0. If the GEOM query fails, the assumed offset of
   0 is subtracted and an incorrect effective offset of 63 is displayed
   and tried to be worked upon.

Reviewed by: pjd
MFC after: 1 week
2005-01-07 12:19:57 +00:00
Brooks Davis
86e0bd0dc0 The disk labels generated by bsdlabel can no address more than
0xffffffff sectors.  Document this limit and avoid installing bogus
labels on disks with more sectors.

Allowing the installation of labels addressing as much of the disk as
possiable may be a useful addition in some situations, but this was easy
to implement and should reduce confusion.

PR:		bin/71408
2004-09-09 07:46:53 +00:00
Dag-Erling Smørgrav
8180729228 The multiplier prefix is actually a multiplier suffix. 2004-08-09 14:43:50 +00:00
Dag-Erling Smørgrav
4c814dfc27 Use fallthrough to simplify the multiplier logic; optimistically add
support for the T multiplier; improve the error message for unrecognized
multipliers.
2004-08-08 23:14:44 +00:00
Dag-Erling Smørgrav
266e79978a Fix some whitespace issues, and move a curly brace out of an #ifdef to
avoid confusing auto-indenting editors.
2004-08-08 23:11:43 +00:00
Ruslan Ermilov
d04b5dfe6c Assorted markup, grammar, and spelling fixes. 2004-05-17 08:35:43 +00:00
Mark Murray
4c723140a4 Remove advertising clause from University of California Regent's license,
per letter dated July 22, 1999.

Approved by: core, imp
2004-04-09 19:58:40 +00:00
Luigi Rizzo
7747c959fa Implement a '-f' flag to teach bsdlabel to work on files instead of
disk partitions.
2004-03-30 23:15:03 +00:00
John Baldwin
c8785325a6 When installing boot blocks into an Alpha BSD label, setup the location,
length, and flags fields at the end of the SRM boot sector so that SRM can
find the bootstrap code.  This fixes bsdlabel -m alpha to generate bootable
disklabels.

Reviewed by:	phk
2004-03-15 23:10:34 +00:00
Yoshihiro Takahashi
82a22cc1ed '-DPC98' is not needed. 2004-01-11 09:11:10 +00:00
Poul-Henning Kamp
427823d576 Only automatically create an 'a' partition when there is nothing
but a 'c' partition.
2003-10-18 19:32:35 +00:00
Ian Dowse
640c9cb297 Remove the hardcoded default block/frag/cpg values from bsdlabel
and the logic for setting them according to the partition size.
Instead, unspecified filesystem values are left at 0 so that newfs
will use its own defaults. It just caused confusion to have the
defaults duplicated in two different places.

Reviewed by:	phk
2003-10-05 19:40:02 +00:00
Ruslan Ermilov
743d5d518c mdoc(7): Properly mark C headers. 2003-09-10 19:24:35 +00:00
Ruslan Ermilov
fe08efe680 mdoc(7): Use the new feature of the .In macro. 2003-09-08 19:57:22 +00:00
Poul-Henning Kamp
d440887943 When we initialize a disk with a virgin label, create also an 'a'
partition which starts after the bootstrap area and fills the entire
disk.
2003-08-27 22:34:57 +00:00
Poul-Henning Kamp
9ef521ec86 Augh! Fix the sparc64 build:
If we don't have a default label location for the compiled architecture,
insist that a -m <architecture> option is specified.
2003-06-07 22:02:01 +00:00
Poul-Henning Kamp
246300f212 Sanitize setting of labeloffset and labelsector. 2003-06-07 09:09:39 +00:00
Poul-Henning Kamp
8c401bb94d Give ia64 the exact same semantics as i386 with respect to non-512
byte sector devices.
2003-06-04 05:25:04 +00:00
Marcel Moolenaar
c9192519e4 Unbreak ia64. 'nuff said. 2003-06-04 02:01:05 +00:00
Poul-Henning Kamp
b2bb9f9bfd Fix sectorsize != 512 on i386 and pc98. Add test cases for same. 2003-06-02 14:19:31 +00:00
Poul-Henning Kamp
83d771de78 Simplify the GEOM OAM api: Drop the request type, and let everything
hinge on the "verb" parameter which the class gets to interpret as
it sees fit.

Move the entire request into the kernel and move changed parameters
back when done.
2003-06-01 13:47:51 +00:00
Poul-Henning Kamp
20fc95cbdd Add pc98 arch to test set.
Remove ktrace which leaked out of test-setup.
2003-06-01 09:30:53 +00:00
David E. O'Brien
7c4d80f2d1 Protext copyright[]. 2003-05-31 15:42:56 +00:00
Ruslan Ermilov
734ac3b543 mdoc(7) fixes.
Approved by:	re (blanket)
2003-05-24 19:53:08 +00:00
Peter Wemm
59fb3d1055 Add amd64 to the MACHINE_ARCH list of systems that link bsdlabel to
disklabel.  I just got burnt again by having an old disklabel binary
kicking around.

Discussed with: phk
Approved by:    re (safe amd64 stuff)
2003-05-23 06:08:28 +00:00
Ruslan Ermilov
c1941005a3 Style fixes.
Reviewed by:	phk
Approved by:	re (scottl)
2003-05-17 19:06:45 +00:00
Ruslan Ermilov
0b00d54eed Moved libgeom.so dependencies to where they belong.
Reviewed by:	phk
Approved by:	re (scottl)
2003-05-17 19:05:17 +00:00
Poul-Henning Kamp
3ecb3802ee Add pc98 archtecture entry.
Approved by:	re/rwatson
2003-05-13 19:42:52 +00:00
Poul-Henning Kamp
8970f1a474 Before reading an ascii label, initialize with defaults so that
getasciipartspec() has a sectorisize in case it needs one.

Approved by:	re/jhb
2003-05-09 20:26:17 +00:00
Poul-Henning Kamp
54f445fb69 Sigh, this shows just how much one can be conditioned my the environment:
Just because we for the last ten years have fought for every byte
in the boot code on i386, doesn't mean that other architectures could
not actually have space to spare there.

Remore debugging message.
2003-05-09 19:07:59 +00:00
Poul-Henning Kamp
4917b55e50 Compile bsdlabel on all platforms.
Install a link to the disklabel(8) name on i386 and alpha platforms.

Leave old disklabel(8) sources intact but disconnected from the build
for now.
2003-05-05 21:28:08 +00:00
Poul-Henning Kamp
5d853216d2 Add transparent handling of mbroffset for backwards compatibility. 2003-05-04 19:27:22 +00:00
Poul-Henning Kamp
57dfbec57b More axe-work:
Hide all the historical fields of the label, unless people ask for them with -A,
set them to intelligently chosen defaults otherwise.

Distill the manual page to remove inaccuracies, misundertandings and obsolete
information.  It can probably still be done better but now at least it is
not misinforming people.
2003-05-03 09:58:20 +00:00
Poul-Henning Kamp
d2fe97c728 Some minor remodelling with a large axe. 2003-05-03 09:02:27 +00:00
Poul-Henning Kamp
5daa806da0 Use new geom.ctl based OAM instead of ioctls.
Various cleanup.
2003-05-03 08:04:24 +00:00
Poul-Henning Kamp
204ae37859 bsd_disklabel_le_dec() takes an extra argument now. 2003-05-02 22:46:44 +00:00
Poul-Henning Kamp
dfbc3f0c86 Vastly simplify architecture handling: Use properties of label as
recorded in global variables, rather than checks on the architecture.

Drop horribly code to handle MBR/PC98's embedded in the BSD label area.
If you need to have an MBR or PC98 on your disk, you should not overlap
it with a BSDLABEL, if you don't need it, this code is nothing but trouble.
2003-05-02 20:14:48 +00:00
Poul-Henning Kamp
7838fd0ebe Default the location to the compiled for architecture if no -m arg specified. 2003-05-02 20:02:11 +00:00
Poul-Henning Kamp
c80f9755bb Add three global variables which contain the location, size and a flag
for the alpha checksum, and set them depending on the specified architecture

Don't look for disklabels every 16 bytes, look the only place they should
be for the current architecture.

Always read the label from the raw disk and decode it into struct
disklabel rather than trust a cast from random addresses.

When writing to the raw disk, encode the label properly.
2003-05-02 19:58:08 +00:00
Poul-Henning Kamp
643c62af8f Pull in geom_bsd_enc.c from sys/geom to encode and decode our labels. 2003-05-02 19:54:18 +00:00
Poul-Henning Kamp
607f853af2 Remove the well-intentioned, but ill thought out check which prevents us
from dd(1)'ing the boot code off one drive and have bsdlabel write it
on another.
2003-05-02 19:14:38 +00:00
Poul-Henning Kamp
798b27f1f2 Update the test-script based on the sunlabel version, but put a for-loop
in there to run over the various architectures.
2003-05-02 19:12:20 +00:00
Poul-Henning Kamp
d7960ce5a2 Add the beginning of a regression test.
So far it checks the overwrites of the BSD label inband (ie: dd
if=/dev/ad0a of=/dev/ad2a).

This excercises the geom::slice::hotspot code.
2003-04-18 22:20:46 +00:00
Poul-Henning Kamp
2c60b6689a First scrub of s/disklabel/bsdlabel/
bsdlabel.5 deliberately exempted, its contents looks less than useful.
2003-04-18 19:44:12 +00:00
Tom Rhodes
c3da0eb49a Quick grammar fix. 2003-04-17 17:36:31 +00:00
Yaroslav Tykhiy
29f3f095a6 Don't die of SIGSEGV on a missing fstype field
in a saved disklabel file.

MFC after:	1 week
2003-04-01 14:44:53 +00:00
Sean Chittenden
5fe45f18e7 Small mdoc fix 2003-03-29 02:09:02 +00:00
Ruslan Ermilov
bc33ea1acc Teach disklabel(8) about different hardware architectures.
This is aimed at creating floppies during cross-releases.
For different endianness machines, a tool like bswapfs(8)
is necessary to make the generated floppies readable on
the target machine.  While here, fixed unaligned access
on Alphas.

Tested on:	i386, alpha
2003-03-16 00:11:49 +00:00
Ruslan Ermilov
9a9f19b166 Give this manpage a good overhaul, including the markup.
Notable changes:

- Removed the "disktype" argument from the -B only synopsis
  form.  This form doesn't touch the disk label, and doesn't
  use this argument.

- Fixed the first example in the EXAMPLES section.  Support
  for compatibility slices has been recently dropped from
  the GEOM kernels, and a bit later GEOM became standard.

- Removed the buggy notion from rev. 1.37 that disklabel(8)
  may be used to define mount points; it cannot.  Improve
  some DOS partition / FreeBSD slice wording.  Among these,
  ``dangerously-dedicated slice'' was just a nonsense.  ;-)
2003-03-15 22:00:45 +00:00
Ruslan Ermilov
9503d41cb1 Properly mark "auto" as a keyword. 2003-03-14 09:38:54 +00:00
Ruslan Ermilov
ef9ab0b32b Deal with vestiges of d_boot[01]. 2003-02-23 01:48:42 +00:00
Poul-Henning Kamp
74c041ac57 If we fail to open O_RDWR, try opening O_RDONLY, if we use ioctls
to fiddle the disk we can get away with it.

Try to use DIOCBSDBB to write boot code.
2003-01-26 21:55:43 +00:00
Poul-Henning Kamp
23e8074bd0 IA64 still needs to be able to run on MBR+BSD combination, so put disklabel
back.

Pointed out by:	peter
2003-01-26 18:33:54 +00:00
Poul-Henning Kamp
8d48318bbb Drop the silly notion that i386 has two bootstrap files now that sys/boot
creates a single file named just "boot".

Apart from the fact that the option "-s" is now gone and that "-b" should
be pointed at /boot/boot instead of /boot/boot1, this patch should be
a no-op.
2003-01-26 14:35:53 +00:00
Poul-Henning Kamp
a9595c8217 Remove #if checks for NUMBOOT==0, it's not relevant for any architecture
and if we get such an architecture, we can just avoid using the relevant
options.
2003-01-26 13:50:11 +00:00
Poul-Henning Kamp
7e3e26cdc1 Offer better advice in #error.
Remove yet a usage message about -N/-W
2003-01-26 12:39:46 +00:00
Poul-Henning Kamp
6250c8c527 Remove ia64 and powerpc #ifdefs: this is i386/pc98/alpha only code. 2003-01-26 12:22:26 +00:00
Poul-Henning Kamp
3874baafd8 Remove #ifdef __sparc64__ code. GEOM uses native SUN labels on this arch,
so no hacks are needed.
2003-01-26 11:43:50 +00:00
Poul-Henning Kamp
80baf8ced8 Fix typo in last commit.
Rearrange bits in writelabel() a bit for improved readability.
2003-01-26 11:41:37 +00:00
Poul-Henning Kamp
5a5469f26a Remember to remove -N and -W from usage. 2003-01-26 11:28:34 +00:00
Poul-Henning Kamp
89fd458f17 Don't fiddle write-protect status of disklabel, it's a discontinued feature. 2003-01-26 11:16:25 +00:00
Poul-Henning Kamp
f080d33b66 Retire the "-N" and "-W" options which implemented write-protection
for the disklabel:  This facility is OBE.

First of all, we cannot sensibly implement this in a properly stacked
environment.

Second, if we did, it would confuse the heck out of users who
wouldn't be able to "start from scratch" by dd(8)'ing /dev/zero
onto /dev/da0.

Third, the offered protection is not comprehensive: no other software
would respect it.

Fourth and finally, the disklabel is already protected against
tampering if it controls open partitions.

Uselessness of these options discussed with:	peter
2003-01-26 11:11:19 +00:00
Dag-Erling Smørgrav
b0459c58c9 Clear part_set, part_size_type and part_offset_type before parsing the
ascii label; otherwise checklabel() might report spurious errors because
of leftovers from a previous pass.

Reviewed by:	bde
MFC after:	1 week
2003-01-16 12:57:53 +00:00
Yoshihiro Takahashi
404a379e4a Rename the dos_partition structure for pc98 to pc98_partition. 2003-01-04 08:50:48 +00:00
Ruslan Ermilov
facc67676f mdoc(7) police: Deal with self-xrefs. 2002-12-24 13:41:48 +00:00
Ruslan Ermilov
8d5d039f80 Uniformly refer to a file system as "file system".
Approved by:	re
2002-12-12 17:26:04 +00:00
Greg Lehey
f2f632579f Relax partition overlap check to allow Vinum partitions to overlap
other partitiosns.  This is necessary when migrating conventional
partitions to Vinum and was broken by recent more stringent overlap
checks.  This is arguably the wrong way to do it.  A better method
would be to have the loader understand a subset of Vinum partitioning
and allow an install directly to Vinum, but until then, this is the
best we have.

Reviewed by:	jhb
Approved by:	re (rwatson)
2002-12-02 23:49:59 +00:00
Ruslan Ermilov
742ec8caad mdoc(7) police: Added missing markup bit.
Approved by:	re
2002-11-25 15:43:18 +00:00
Julian Elischer
484c780433 Everything in the disklabel is unsigned so make all the input routines
take unsigned values.
his allows one to label disk with the number of blocks > 31 bits
(though less then 32 bits)

e.g.
#        size   offset fstype [fsize bsize bps/cpg]
  c: 3125755904  0   unused    0     0        # (Cyl.    0 - 194569*)
  d: 3125755840  64  unused    0     0        # (Cyl.    0*- 194569*)
which is needd to test UFS2
2002-11-18 04:58:11 +00:00
Jens Schweikhardt
b2aa8b2a98 Document that write(2) et al can return EROFS for attempts to write the
disk label area.

PR:		43891
Submitted by:	Diomidis D. Spinellis <dds@istlab.dmst.aueb.gr>
MFC after:	3 days
2002-10-10 19:16:10 +00:00
Yoshihiro Takahashi
6d8c8fabad Fix to support pc98. 2002-10-08 12:13:19 +00:00
Poul-Henning Kamp
0cdbe32937 Don't be noisy if DIOCWLABEL fails, it's probably because we're writing
the first label to the raw disk.

Sponsored by:	DARPA & NAI Labs.
2002-10-05 21:57:05 +00:00
Poul-Henning Kamp
3bb24c35f2 Split MBR and PC98 on-disk sliceformats out from disklabel.h, step 1:
Peter had repocopied sys/disklabel.h to sys/diskpc98.h and sys/diskmbr.h.

These two new copies are still intact copies of disklabel.h and
therefore protected by #ifndef _SYS_DISKLABEL_H_ so #including them
in programs which already include <sys.disklabel.h> is currently a
no-op.

This commit adds a number of such #includes.

Once I have verified that I have fixed all the places which need fixing,
I will commit the updated versions of the three #include files.

Sponsored by:   DARPA & NAI Labs.
2002-10-01 07:24:55 +00:00
Poul-Henning Kamp
b9d05a16f4 Construct new disklabels based on the medias stated parameters in
userland, rather than expect all possible GEOMetries to know about
BSD disklabels.

Sponsored by:	DARPA & NAI Labs
2002-09-20 09:18:31 +00:00
Tom Rhodes
ce66ddb763 s/filesystem/file system/g as discussed on -developers 2002-08-21 18:11:48 +00:00
Bosko Milekic
b35e69503a Fix more breakage due to FSTYPENAMES/DKTYPENAMES split.
Also submitted by: David Wolfskill <david@catwhisker.org>
2002-08-16 16:08:36 +00:00
Philippe Charnier
e1205e80e5 The .Nm utility 2002-07-06 19:34:18 +00:00
Mark Murray
c822396536 Apply __FBSDID(); fix local variable(names) that stomp on global
definitions; fix some const strings; fix some signedness issues.
2002-07-03 16:43:11 +00:00
Ian Dowse
09dbd0701c Oops, unbreak parsing of the `type' field in getasciilabel(). I had
changed a `goto' to a `continue' in revision 1.52, but it continued
the wrong loop.

Noticed by:	bde
2002-06-05 08:11:28 +00:00