Commit Graph

42 Commits

Author SHA1 Message Date
christos e37a2a9523 CID 1341561: Argument memory leak 2015-12-03 21:46:22 +00:00
christos 560e3b65f3 CID 1341560: Free arg. 2015-12-03 21:43:25 +00:00
christos d293a8ecdb CID 1341548: Check error returns 2015-12-03 20:58:08 +00:00
christos 5c1ccc6e9b WARNS=6 2015-12-03 02:02:43 +00:00
christos da0a3b4c0b eliminate static globals so that commands can be re-used. 2015-12-03 01:07:28 +00:00
jnemeth de2c104cf3 hrmm...
i386devel: {245} ./gpt add -b 1000 -s 1000 disk
Segmentation fault (core dumped)

Where's my flyswatter?   .......zzzzzzzap
2015-12-02 11:20:34 +00:00
christos cdf86847f5 refactor the utf code so that it does not leak memory. 2015-12-02 04:07:11 +00:00
christos b732231137 - write a function to set the entity, so that we don't reset to guid.
- entry 0 means create entry.
2015-12-02 01:01:55 +00:00
christos 0f004afe33 merge command line parsers and check all memory allocations. 2015-12-01 23:29:07 +00:00
christos bbb4a8ab26 refactor more duplicated code. 2015-12-01 19:25:24 +00:00
christos 8ca93e4658 Refactor the command dispatching and help printing logic. 2015-12-01 16:32:19 +00:00
christos 0b43d398b9 Firs step of refactoring, remove all globals, factor out some common code,
handle alternate usage but not advertise it.
2015-12-01 09:05:33 +00:00
christos 68bc3825b8 - use gpt_msg to print informational messages (perhaps these should be printed
only with -v)
- don't print any messages with gpt_msg if quiet
- print a message if we didn't reconfigure the wedges
2015-12-01 02:03:55 +00:00
christos e4ed2565fe - automatically sync the wedge information unless -n is specified.
- document the general options in the traditional way.
- split the main program into a separate file.
2015-11-30 19:59:34 +00:00
christos ca4e0dcdd1 merge the create errors in one place and fix them. 2015-11-29 00:14:46 +00:00
christos 21c34dbb1d Add internal uuid support, since the linux+macos versions of the library
are different than than *bsd ones, and others might not have it at all.
2014-09-30 17:59:59 +00:00
christos c917041fda remove compat defines. 2014-09-30 02:12:55 +00:00
christos a50708a134 minor toolification: need libprop... 2014-09-29 20:28:57 +00:00
jnemeth 53733ab887 Explicitly state which partition was added/modified. 2013-12-10 01:05:00 +00:00
jnemeth 2098c8504e For the add and resize subcommands, change the -s option. If there is
no suffix, or the suffix is 's' or 'S', size is in sectors (as before)
otherwise size is in bytes.
2013-12-08 09:32:51 +00:00
jnemeth 024b3f7622 Don't attempt to create/resize an unaligned partition if the attempt
to create/resize an aligned one failed.  This simplifies the code
and prevents surprises.  If the user wants an unaligned partition
in the case where an aligned one fails, they can simply retry the
command without the "-a" option.  This change was requested by
wiz@, and after some thought I agree with it.
2013-12-06 02:31:31 +00:00
jnemeth 2b199b9458 when calling dehumanize_number() make sure the resulting number is >= 1 2013-11-28 01:37:14 +00:00
jnemeth 9299334f79 Remove FreeBSD specific code as per message to tech-userlevel. 2013-11-27 01:47:53 +00:00
jnemeth 9ceccfb63b change the "-b blocknr" parameter to accept a "human number" 2013-11-22 04:21:02 +00:00
jnemeth 4f22d16faa In the manpage:
- s/-b number/-b blocknr/
- s/-s count/-s sectors/
- s/-p count/-p partitions/

In the program:
- s/-b lba/-b blocknr/
- s/-s lba/-s sectors/

This makes the documentation in the manpage and the program consistent
and makes it more clear what the parameters are.  Also, "-s lba" was
just plain wrong since LBA stands for Logical Block Address[ing], and
the -s option didn't represent any kind of address, but rather a size.
2013-11-22 03:50:05 +00:00
jnemeth 49ca570b23 delete an errant where it is obvious what the code is doing 2013-11-19 22:41:43 +00:00
jnemeth 477692ee49 When setting a label on the new partition, be sure to set the label
in the secondary partition table as well.
2013-11-19 19:10:29 +00:00
jnemeth 650728b4e3 Add two new options to the "add" subcommand:
-a alignment -- attempt to align the start and size of the partition
-l label -- supply a label for the partition

These options were inspired by FreeBSD's gpart(8) command, but the
code was written by me.
2013-11-19 05:03:41 +00:00
wiz 0d33e4d5b7 Instead of 'no space', say 'not enough space' in error message. 2013-05-26 21:26:17 +00:00
jakllsch 0c2fc5cb54 Make pre-initialized partition type uuid_t symbols 'static const'.
This conserves a few hundred bytes of total program size by
allowing the linker to merge duplicates.
2013-04-13 18:32:01 +00:00
jakllsch 287267eb57 Clean up gpt(8) a bit more
uuid_create_nil(3) and uuid_is_nil(3) take a uuid_t*, not a pointer to
an array of bytes merely casted to compatible type.

Additonally, there no need for extra casts and address-of operations when
using le_uuid_*() functions.

Furthermore, le_uuid_*() are identical to uuid_*_le functions in
libc/libuuid, so use those instead on NetBSD.
2013-04-13 18:04:33 +00:00
joerg a4b65553ae Use __dead 2011-08-27 17:38:16 +00:00
riz e048211e44 Clarify the 'dkctl addwedge' usage message after creating a GPT
partition.
2011-01-06 17:51:28 +00:00
jakllsch 5da707b805 UFS is called FFS in the NetBSD case. Display as such and accept as input. 2011-01-06 16:30:40 +00:00
uebayasi cede8f9855 Let 'gpt add' suggest a collect device name so that opendisk(3) called by
dkctl(8) succeeds.
2009-02-07 18:12:22 +00:00
uebayasi 0edd7181ba Make manual and usage consistent. No functional changes. 2009-02-07 17:21:44 +00:00
riz 42a4e6ef13 As discussed on tech-userlevel, add NetBSD GPT partition types for
swap, ffs, lfs, raidframe, ccd and cgd.  gpt(8) now defaults to
NetBSD ffs if no type is given, but previous FreeBSD types are
still recognized in the DKWEDGE_AUTODISCOVER code.
2007-12-28 19:53:09 +00:00
riz 0fac2edb7f Fix the usage strings for each command, and print them all for the
"global" usage.  It's still a little ugly, but hopefully not as
fantastically confusing as before...
2007-12-18 21:46:45 +00:00
riz 16a0235c60 Use strtoll() when converting a 64-bit quantity. This makes "gpt add"
work with an offset of more than 2147483647 sectors.  While I'm here,
use strtoul() when converting an unsigned quantity.
2007-02-16 17:13:02 +00:00
he 565d8259e3 Add initialization of a variable where gcc for some archs thinks
that it may be used un-initialized.  From cursory inspection it is
not obvious that gcc is wrong.
2006-10-17 21:14:03 +00:00
christos 9b52236568 Make this work under NetBSD. 2006-10-15 22:36:29 +00:00
christos 5819a8c09d Import the gpt tool from FreeBSD 2006-10-15 22:34:15 +00:00