Commit Graph

158 Commits

Author SHA1 Message Date
Edward Tomasz Napierala
b8c19fd719 It's 2015, and some people are still trying to use fdisk and then
go asking what debug flags to set for GEOM to make it work.  Advice
them to use gpart(8) instead.

Something similar should probably done with disklabel,
but I need to rewrite the disklabel examples first.

Reviewed by:	wblock@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3315
2015-09-02 14:08:43 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Baptiste Daroussin
13eb765f2d Convert sbin/ to LIBADD
Reduce overlinking
2014-11-25 11:23:12 +00:00
Simon J. Gerraty
ee7b0571c2 Merge head from 7/28 2014-08-19 06:50:54 +00:00
Marcel Moolenaar
e7d939bda2 Remove ia64.
This includes:
o   All directories named *ia64*
o   All files named *ia64*
o   All ia64-specific code guarded by __ia64__
o   All ia64-specific makefile logic
o   Mention of ia64 in comments and documentation

This excludes:
o   Everything under contrib/
o   Everything under crypto/
o   sys/xen/interface
o   sys/sys/elf_common.h

Discussed at: BSDcan
2014-07-07 00:27:09 +00:00
Simon J. Gerraty
fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty
76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty
3b8f084595 Merge head 2014-04-28 07:50:45 +00:00
Juli Mallett
c69a7a718d Fix fdisk(8) to create 2TB partitions on disks larger than 2TB, rather than
only being able to create 1TB partitions:
o) Use an unsigned 32-bit quantity to store the number of disk sectors.
o) Detect overflow of said 32-bit quantity and clamp to 2^32.
o) Rather than returning the disk sector count from get_params, return 0 on
   success, since its return value is only ever compared to -1 to detect
   failure.  This would cause returning 2^32 sectors to be interpreted as an
   error.

Reviewed by:	bde ("good for a quick fix")
2013-11-27 17:59:13 +00:00
Simon J. Gerraty
3caf0790a8 Merge head@256284 2013-10-13 02:35:19 +00:00
Sergey Kandaurov
05d98029e9 Sweep man pages replacing ad -> ada.
Approved by:	re (blackend)
MFC after:	1 week
X-MFC note:	stable/9 only
2013-10-01 18:41:53 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Dmitry Morozovsky
f933af5dbf VMware environment is frequent nowadays. Add VMFS id.
MFC after:	2 weeks
2012-04-16 17:30:19 +00:00
Andrey V. Elsukov
39e9a28fdf Fix multi-line comment formatting.
Pointed by:	jh
MFC after:	1 week
2011-11-07 07:50:35 +00:00
Andrey V. Elsukov
fd1ca22afb Improve error reporting when MBR can not be written.
Remove obsolete code which uses DIOCSMBR ioctl.
When writing MBR first check that GEOM_MBR is available, if it is not
available, then try write MBR directly to provider. If both are failed,
then recommend to use gpart(8).

MFC after:	2 week
2011-11-07 06:24:35 +00:00
Andrey V. Elsukov
1b100fd31b Initialize "acc" value inside the loop to reset failed attempts.
PR:		misc/162262
MFC after:	3 days
2011-11-06 21:12:52 +00:00
Andrey V. Elsukov
9a5e36b804 Add reference to gpart(8).
MFC after:	3 days
2011-11-06 20:38:27 +00:00
Ed Schouten
1efe3c6b58 Add missing static keywords for global variables to tools in sbin/.
These tools declare global variables without using the static keyword,
even though their use is limited to a single C-file, or without placing
an extern declaration of them in the proper header file.
2011-11-04 13:36:02 +00:00
John-Mark Gurney
21fa393279 remove trailing whitespace...
MFC after:	1 week
2011-10-29 17:30:57 +00:00
John-Mark Gurney
469a1218c0 error if /boot/mbr is empty... This can happen on a system like arm
that doesn't have a /boot/mbr, and you touch it to get past the previous
error message...

MFC after:	1 week
2011-10-29 17:28:59 +00:00
Andrey V. Elsukov
6bfcd9c37b The decimal() function was changed in r217808 to take the
maximum value instead of number of bits. But for case when
limitation is not needed it erroneously skips conversion to
number and always returns zero. So, don't skip conversion
for case when limitation is not needed.

PR:		bin/159765
Approved by:	re (kib)
2011-08-19 12:48:06 +00:00
Ryan Stone
f9373bbdac The MBR uses a 32-bit unsigned integer to store the size of a slice, but
fdisk(1) internally uses a signed int.  Should a user attempt to specify
a slice containing more than 2^31 - 1 sectors, an error will be reported
on systems with sizeof(long) == 4 and the slice size will be silently
truncated on systems with sizeof(long) > 4.

Instead use an unsigned long to store the slice size in fdisk(1).  This
allows the user to specify a slice size up to the maximum permitted by
the MBR on-disk format and does not have any problems with silent
truncation should the use specify an slice size larger than 2^32 on systems
with sizeof(long) > 4.

Submitted by:	Mark Johnston (markjdb AT gmail DOT com)
MFC after:	2 weeks
2011-07-17 21:08:16 +00:00
Maxim Sobolev
4be78ce327 Supply maximum value as an argument to the decimal() function
instead of supplying number of bits.

Submitted by:	bde
2011-01-25 04:35:07 +00:00
Maxim Sobolev
f70a8a9cf5 o Cylinder numbers are 10 bits in the MBR;
o Sector numbers are only 6 bits in the MBR;

o bde'cize name of the local variable.

Submitted by:	bde
2011-01-24 07:16:20 +00:00
Maxim Sobolev
68df7abe8a Warn user when value entered is greated than the amount supported
by the MBR for the given parameter and set that parameter to the
maximum value instead of just truncating the most significant part
silently.

Could happen for example if the capacity of the device is more
than 2TB, so that the number of sectors is greater than 2Mib.

MFC after:	1 month
2011-01-22 05:21:20 +00:00
Brian Somers
6a5ffa0630 Add support for identifying a journaled root filesystem.
Fix support for identifying the given /dev/vinum/root example.

MFC after:	3 weeks
2010-09-16 08:16:53 +00:00
Brian Somers
1dc7e010ec Handle geli-encrypted root disk devices.
MFC after:	2 weeks
2010-09-06 04:15:49 +00:00
Ulf Lilleengen
ea32a6995b - Back out the previous change in order to maintain compatibility. 2009-06-17 06:41:10 +00:00
Ulf Lilleengen
1d695e8ed4 - The maximum number of heads is 255, not 256.
Pointed out by:		marcel
2009-06-15 16:51:07 +00:00
Brian Somers
1496abde06 Bump the document date to reflect the 'p' command enhancements.
Suggested by:	trhodes
2009-05-25 21:27:31 +00:00
Brian Somers
d1c77156d8 Enhance the 'p' command so that it understands size qualifiers (K/M/G) and
so that it understands '*' as 'DTRT'.

PR:		68312
Submitted by:	Rene de Vries - rene at tunix dot nl (mostly)
MFC after:	3 weeks
2009-05-25 09:23:26 +00:00
Luigi Rizzo
31fade0527 Reword some entries for NTFS and DOS.
Add entries for DELL and ASUS recovery partitions.

MFC after:	3 days
2009-01-14 22:05:51 +00:00
Luigi Rizzo
22fccf5ce9 Another change from Christoph:
replace the table of partition with a simpler and faster array of strings.
The change in the array is done mechanically, using vi commands.
Most entries in the table are probably 15+ years old and largely outdated,
so the next step is to remove stale entries with more current values.

Submitted by:	Christoph Mallon, with small changes from me
MFC after:	3 days
2009-01-14 21:31:09 +00:00
Luigi Rizzo
40905b6e22 more changes from Christoph:
pass a pointer instead of an index to print_part()
so it does not depend on a static variable.

Submitted by:	Christoph Mallon
MFC after:	3 days
2009-01-14 21:08:19 +00:00
Luigi Rizzo
fbcb16efdf remove unused argument to print_s0()
Submitted by:	Christoph Mallon
MFC after:	3 days
2009-01-14 20:53:46 +00:00
Luigi Rizzo
c4898ccb7c Some small fixes submitted by Christoph Mallon, specifically:
+ Remove a dead field of a struct. It serves no purpose anymore.
+ Remove a \n at the end of the format string of err(); the err()
  function already adds a \n ;
+ remove many unnecessary casts which obfuscate the code.

This file has a huge number of indentation bugs, but I'd rather fix
them when/if we happen to modify the relevant parts of the code.

Submitted by:	Christoph Mallon
MFC after:	3 days
2009-01-13 23:36:38 +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
b31e5ae243 - Make use of the new and g_device_path utility function in libgeom to avoid
duplication of code in fdisk and boot0cfg. Also make use of g_providername to
  fix an issue with fdisk and boot0cfg not using the correct provider when
  writing the MBR.

Reviewed by:	phk
Approved by:	pjd (mentor)
2008-09-07 13:58:35 +00:00
David E. O'Brien
a61d918656 Add a -q[uiet] flag for scripts. 2008-07-31 00:55:29 +00:00
Andre Oppermann
5b93d33118 Add Apple HFS+ (0xAF) MBR partition type identificator.
Submitted by:	rpaulo (SoC2007 student)
2007-05-06 18:48:30 +00:00
Maxim Konovalov
7914c60f5a o Add -p flag: print a slice table in fdisk configuration file format.
Now it is possible to do something like fdisk -p ad0 | fdisk -f - ad1.

PR:		bin/110182
Submitted by:	Jukka A. Ukkonen
MFC after:	1 month
2007-04-30 18:29:36 +00:00
Ruslan Ermilov
75cb6f3da0 - Document -u, -i, and the difference between them better.
- Remove some historical notes about "future" decisions.
2006-12-12 15:26:25 +00:00
Ruslan Ermilov
6028403f2e Document the following change in behavior:
: fdisk.c revision 1.74
: date: 2004/06/14 07:21:19;  author: phk;  state: Exp;  lines: +3 -3
: Make fdisk initialize the first instead of the last slice by default.
2006-12-08 21:50:48 +00:00
Simon L. B. Nielsen
aee85526aa - Fail with an understandable error message if we cannot detect the
sector size, instead of later failing with an error about /boot/mbr
  not being a multiple of the sector size (since we end up with an
  assumed sector size of MAX_SEC_SIZE * 2).
- We query the sector size via an IOCTL anyway, so if that succeeds
  use that instead of probing for it via read(2) calls.  This fixes
  the problem with fdisk failing to operate on at least graid3 and
  md(4) devices on kernels with src/sys/geom/geom_dev.c before
  rev. 1.90, due to fdisk failing to detect the sector size.
- When detecting the root device allow "/" characters in it, which
  happens with e.g. gmirror devices.

Reviewed by:	cperciva
MFC after:	1 week
2006-06-18 22:02:22 +00:00
Craig Rodrigues
d63612b470 Call gctl_free() to free resource allocated with gctl_get_handle().
PR:		bin/84664
Submitted by:	Daan Vreeken <Danovitsch at Vitsch dot net>
MFC after:	3 days
2005-09-17 14:56:10 +00:00