The NetBSD Project

CVS log for src/sbin/gpt/resize.c

[BACK] Up to [cvs.NetBSD.org] / src / sbin / gpt

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.25 / (download) - annotate - [select for diffs], Sun May 24 14:42:44 2020 UTC (3 years, 10 months ago) by jmcneill
Branch: MAIN
CVS Tags: netbsd-10-base, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x, HEAD
Changes since 1.24: +22 -7 lines
Diff to previous 1.24 (colored) to selected 1.19 (colored)

Exit gracefully when auto-expanding a partition and it is already the
correct size. Add a -q flag to "resize" and "resizedisk" commands to skip
printing warnings in the already resize paths.

Revision 1.22.16.1 / (download) - annotate - [select for diffs], Mon Jun 10 22:05:33 2019 UTC (4 years, 9 months ago) by christos
Branch: phil-wifi
Changes since 1.22: +21 -6 lines
Diff to previous 1.22 (colored) next main 1.23 (colored) to selected 1.19 (colored)

Sync with HEAD

Revision 1.24 / (download) - annotate - [select for diffs], Sun Mar 24 13:31:00 2019 UTC (5 years ago) by martin
Branch: MAIN
CVS Tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, phil-wifi-20191119, phil-wifi-20190609, netbsd-9-base, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9, is-mlppp-base, is-mlppp
Changes since 1.23: +20 -5 lines
Diff to previous 1.23 (colored) to selected 1.19 (colored)

Add support for specifying the partition to resize via -b startsec
(similar to label and other subcommands). Do not fully add gpt_find
functionality here, as resizing multiple partitions in one go does not
make sense.

Revision 1.8.6.2 / (download) - annotate - [select for diffs], Mon Aug 13 16:12:12 2018 UTC (5 years, 7 months ago) by martin
Branch: netbsd-7
CVS Tags: netbsd-7-2-RELEASE
Changes since 1.8.6.1: +57 -176 lines
Diff to previous 1.8.6.1 (colored) to branchpoint 1.8 (colored) next main 1.9 (colored) to selected 1.19 (colored)

Catch up to current for the following, requested by sborrill in ticket #1629:

	sbin/gpt/gpt_private.h                          up to 1.2
	sbin/gpt/header.c                               up to 1.9
	sbin/gpt/main.c                                 up to 1.11
	sbin/gpt/drvctl.c				delete
	sbin/gpt/Makefile				up to 1.18
	sbin/gpt/add.c					up to 1.44
	sbin/gpt/backup.c				up to 1.18
	sbin/gpt/biosboot.c				up to 1.30
	sbin/gpt/create.c				up to 1.23
	sbin/gpt/destroy.c				up to 1.10
	sbin/gpt/gpt.8					up to 1.63
	sbin/gpt/gpt.c					up to 1.75
	sbin/gpt/gpt.h					up to 1.38
	sbin/gpt/gpt_uuid.c				up to 1.15
	sbin/gpt/gpt_uuid.h				up to 1.7
	sbin/gpt/label.c				up to 1.29
	sbin/gpt/map.c					up to 1.14
	sbin/gpt/map.h					up to 1.6
	sbin/gpt/migrate.c				up to 1.33
	sbin/gpt/recover.c				up to 1.18
	sbin/gpt/remove.c				up to 1.22
	sbin/gpt/resize.c				up to 1.23
	sbin/gpt/resizedisk.c				up to 1.17
	sbin/gpt/restore.c				up to 1.18
	sbin/gpt/set.c					up to 1.14
	sbin/gpt/show.c 				up to 1.41
	sbin/gpt/type.c 				up to 1.15
	sbin/gpt/unset.c				up to 1.14

Many changes including:
- Significant refactoring
- PR/51230: Add the ability to set the active flag in the PMBR
- Let individual commands decide if ioctl(DIOCMWEDGES) should be done
- Add a "header" subcommand that displays information about the size of
  the disk along with information from the GPT header if it exists
- Add listing commands for type, set and unset
- Add help and formatting for set and unset
- Change show to print all the attribute info in one line.
- Improve documentation, including booting and exit status
- Check device parameter to avoid segfaults

Revision 1.22.14.1 / (download) - annotate - [select for diffs], Sat Jul 28 04:37:23 2018 UTC (5 years, 8 months ago) by pgoyette
Branch: pgoyette-compat
CVS Tags: pgoyette-compat-merge-20190127
Changes since 1.22: +2 -2 lines
Diff to previous 1.22 (colored) next main 1.23 (colored) to selected 1.19 (colored)

Sync with HEAD

Revision 1.23 / (download) - annotate - [select for diffs], Tue Jul 3 03:41:24 2018 UTC (5 years, 8 months ago) by jnemeth
Branch: MAIN
CVS Tags: pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728
Changes since 1.22: +2 -2 lines
Diff to previous 1.22 (colored) to selected 1.19 (colored)

Not all things that write to the disk do something that dk(4) will
be interested in.  Let individual commands decide if ioctl(DIOCMWEDGES)
should be done.  I was conservative and set the flag on any command
that might create/modify/delete partitions in any way.

Revision 1.22 / (download) - annotate - [select for diffs], Fri Dec 4 16:54:28 2015 UTC (8 years, 3 months ago) by christos
Branch: MAIN
CVS Tags: prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, phil-wifi-base, pgoyette-localcount-base, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount, pgoyette-compat-base, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, perseant-stdc-iso10646-base, perseant-stdc-iso10646, netbsd-8-base, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, netbsd-8, matt-nb8-mediatek-base, matt-nb8-mediatek, localcount-20160914, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan
Branch point for: phil-wifi, pgoyette-compat
Changes since 1.21: +2 -2 lines
Diff to previous 1.21 (colored) to selected 1.19 (colored)

Kill newline

Revision 1.21 / (download) - annotate - [select for diffs], Thu Dec 3 02:02:43 2015 UTC (8 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.20: +5 -3 lines
Diff to previous 1.20 (colored) to selected 1.19 (colored)

WARNS=6

Revision 1.20 / (download) - annotate - [select for diffs], Thu Dec 3 01:16:21 2015 UTC (8 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.19: +1 -3 lines
Diff to previous 1.19 (colored)

remove extra assignment

Revision 1.19 / (download) - annotate - [selected], Thu Dec 3 01:07:28 2015 UTC (8 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.18: +6 -7 lines
Diff to previous 1.18 (colored)

eliminate static globals so that commands can be re-used.

Revision 1.18 / (download) - annotate - [select for diffs], Wed Dec 2 20:01:44 2015 UTC (8 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.17: +2 -8 lines
Diff to previous 1.17 (colored) to selected 1.19 (colored)

- check errors from map allocation
- make map_resize return -1 instead of 0, and handle errors locally
  explaining what's going wrong

Revision 1.17 / (download) - annotate - [select for diffs], Tue Dec 1 19:25:24 2015 UTC (8 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.16: +4 -54 lines
Diff to previous 1.16 (colored) to selected 1.19 (colored)

refactor more duplicated code.

Revision 1.16 / (download) - annotate - [select for diffs], Tue Dec 1 16:32:19 2015 UTC (8 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.15: +27 -23 lines
Diff to previous 1.15 (colored) to selected 1.19 (colored)

Refactor the command dispatching and help printing logic.

Revision 1.15 / (download) - annotate - [select for diffs], Tue Dec 1 09:05:33 2015 UTC (8 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.14: +54 -116 lines
Diff to previous 1.14 (colored) to selected 1.19 (colored)

Firs step of refactoring, remove all globals, factor out some common code,
handle alternate usage but not advertise it.

Revision 1.14 / (download) - annotate - [select for diffs], Tue Dec 1 02:03:55 2015 UTC (8 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.13: +3 -3 lines
Diff to previous 1.13 (colored) to selected 1.19 (colored)

- 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

Revision 1.13 / (download) - annotate - [select for diffs], Mon Nov 30 19:59:34 2015 UTC (8 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.12: +3 -5 lines
Diff to previous 1.12 (colored) to selected 1.19 (colored)

- 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.

Revision 1.12 / (download) - annotate - [select for diffs], Sun Nov 29 00:14:46 2015 UTC (8 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.11: +3 -5 lines
Diff to previous 1.11 (colored) to selected 1.19 (colored)

merge the create errors in one place and fix them.

Revision 1.8.6.1 / (download) - annotate - [select for diffs], Tue Jun 2 19:49:38 2015 UTC (8 years, 9 months ago) by snj
Branch: netbsd-7
CVS Tags: netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0
Changes since 1.8: +6 -5 lines
Diff to previous 1.8 (colored) to selected 1.19 (colored)

Pull up following revision(s) (requested by jnemeth in ticket #774):
	sbin/gpt/Makefile: revisions 1.9-1.13
	sbin/gpt/add.c: revisions 1.25-1.27
	sbin/gpt/backup.c: revisions 1.2-1.8
	sbin/gpt/biosboot.c: revisions 1.8-1.14
	sbin/gpt/create.c: revisions 1.8-1.12
	sbin/gpt/destroy.c: revisions 1.5-1.6
	sbin/gpt/drvctl.c: revision 1.1
	sbin/gpt/gpt.8: revisions 1.29-1.36
	sbin/gpt/gpt.c: revisions 1.29-1.40
	sbin/gpt/gpt.h: revisions 1.12-1.18
	sbin/gpt/gpt_uuid.c: revisions 1.1-1.10
	sbin/gpt/gpt_uuid.h: revisions 1.1-1.3
	sbin/gpt/label.c: revisions 1.15-1.18
	sbin/gpt/map.c: revision 1.7
	sbin/gpt/migrate.c: revisions 1.15-1.21
	sbin/gpt/recover.c: revision 1.5
	sbin/gpt/remove.c: revisions 1.13-1.16
	sbin/gpt/resize.c: revisions 1.9-1.11
	sbin/gpt/resizedisk.c: revisions 1.1-1.6
	sbin/gpt/restore.c: revisions 1.2-1.7
	sbin/gpt/set.c: revisions 1.3-1.5
	sbin/gpt/show.c: revision 1.16-1.21
	sbin/gpt/type.c: revisions 1.1-1.6
	sbin/gpt/unset.c: revisions 1.3-1.5
- record the sector size of the disk
- correct confusion with end_cylinder and end_sector in MBRs
--
- dump all partitions, not just ones that are in use
- while here, squash a memory leak
     It shouldn't be necessary to backup unused partitions, however
the partition GUID is created at the time the GPT is created and
is never changed.  It shouldn't matter if the GUID of an unused
partition changes, but there may be some special case where it
does.  Since it isn't a big deal to record the unused partitions,
might as well do it.
--
Initial cut of gpt restore.  This functions correctly in testing,
but isn't all that pretty.  It has minimal error testing and may
leak memory.  It also only works with empty disks.  If passed "-F"
flag, it will blank the disk for you.
--
document the new restore subcommand
--
- make gpt_gpt() available for use directly by subcommands
- create new resizedisk disk subcommand for relocating backup GPT
--
Fix compile error observed on i386. Use PRIu64.
--
no C99isms in tool code
--
- handle a GPT that isn't an exact multiple of a sector
- adjust PMBR size, in case new disk is a different size
- don't leak as much memory
- clean up error handling somewhat
--
PR/44218 - David Young -- add "type" subcommand to change a partition type
--
PR/47990 - Dr. Wolfgang Stukenbrock -- add "-L <label>" as selector option
--
minor toolification: need libprop...
--
more toolification
--
more toolification changes
--
remove compat defines.
--
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.
--
Check size of correct buffer.  Note, just being pedantic as the buffer
being checked is the same size as the one that should have been checked.
--
correctly show partition type in the new world order
--
actually return the uuid when parsing one that is in numeric format
--
using random values for hdr->hdr_guid does not work very well
--
oops, forgot to update end of data area
--
It's HAVE_NBTOOL_CONFIG_H, not HAVE_NBTOOLS_CONFIG_H
--
Fix tools build on !NetBSD.
--
include <sys/endian.h> for both the non-tools build,
and the tools build on a host where the file exists.
Fixes a build problem on FreeBSD, reported by Herbert J. Skuhra, where
tools/compat's configure detected that be32dec() and friends were
available in the host's <sys/endian.h>, so tools/compat did not provide
its own versions.
--
"0" is not guaranteed to be unique
--
provide a copy of the kernel uuid generator (with portable API calls) for
tools.
--
Allow specifying sector and media size on the command line.
--
Remove trailing whitespace.
--
Make gpt(8) generate v4 (random) uuids.
Don't needlessly leak your date/time and MAC address when you edit
the disk.
Read from /dev/urandom rather than calling arc4random or anything,
since this is a tool.  (Cygwin seems to have /dev/urandom, but yell
if this breaks the build on your exotic platform because it lacks
/dev/urandom.)
ok apb
--
Paranoia: choke noisily on EOF from /dev/urandom.
--
Report the argument instead of (null) when opendisk fails.
--
handle constness
--
handle constness better
--
Add some more common partition types.
--
Bump date for previous.
--
Fix handling of -t option for the type command.
Match any type, when no option is given, just like for the label command.
--
Factor out the getdisksize() drvctl method, and provide an alternative that
directly uses the disk ioctl's instead of relying on the drvctl device driver
which is currently not mandatory.

Revision 1.11 / (download) - annotate - [select for diffs], Tue Sep 30 17:59:59 2014 UTC (9 years, 5 months ago) by christos
Branch: MAIN
Changes since 1.10: +2 -5 lines
Diff to previous 1.10 (colored) to selected 1.19 (colored)

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.

Revision 1.10 / (download) - annotate - [select for diffs], Tue Sep 30 02:12:55 2014 UTC (9 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.9: +2 -2 lines
Diff to previous 1.9 (colored) to selected 1.19 (colored)

remove compat defines.

Revision 1.9 / (download) - annotate - [select for diffs], Mon Sep 29 20:28:57 2014 UTC (9 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.8: +5 -1 lines
Diff to previous 1.8 (colored) to selected 1.19 (colored)

minor toolification: need libprop...

Revision 1.8.8.2 / (download) - annotate - [select for diffs], Wed Aug 20 00:02:25 2014 UTC (9 years, 7 months ago) by tls
Branch: tls-maxphys
Changes since 1.8.8.1: +267 -0 lines
Diff to previous 1.8.8.1 (colored) to branchpoint 1.8 (colored) next main 1.9 (colored) to selected 1.19 (colored)

Rebase to HEAD as of a few days ago.

Revision 1.8.4.2 / (download) - annotate - [select for diffs], Thu May 22 11:37:28 2014 UTC (9 years, 10 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.8.4.1: +267 -0 lines
Diff to previous 1.8.4.1 (colored) to branchpoint 1.8 (colored) next main 1.9 (colored) to selected 1.19 (colored)

sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")

Revision 1.8.8.1, Tue Dec 10 01:05:00 2013 UTC (10 years, 3 months ago) by tls
Branch: tls-maxphys
Changes since 1.8: +0 -267 lines
FILE REMOVED

file resize.c was added on branch tls-maxphys on 2014-08-20 00:02:25 +0000

Revision 1.8.4.1, Tue Dec 10 01:05:00 2013 UTC (10 years, 3 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.8: +0 -267 lines
FILE REMOVED

file resize.c was added on branch yamt-pagecache on 2014-05-22 11:37:28 +0000

Revision 1.8 / (download) - annotate - [select for diffs], Tue Dec 10 01:05:00 2013 UTC (10 years, 3 months ago) by jnemeth
Branch: MAIN
CVS Tags: yamt-pagecache-base9, tls-maxphys-base, tls-earlyentropy-base, tls-earlyentropy, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, netbsd-7-base
Branch point for: yamt-pagecache, tls-maxphys, netbsd-7
Changes since 1.7: +2 -2 lines
Diff to previous 1.7 (colored) to selected 1.19 (colored)

Explicitly state which partition was added/modified.

Revision 1.7 / (download) - annotate - [select for diffs], Sun Dec 8 09:32:51 2013 UTC (10 years, 3 months ago) by jnemeth
Branch: MAIN
Changes since 1.6: +40 -11 lines
Diff to previous 1.6 (colored) to selected 1.19 (colored)

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.

Revision 1.6 / (download) - annotate - [select for diffs], Fri Dec 6 02:31:31 2013 UTC (10 years, 3 months ago) by jnemeth
Branch: MAIN
Changes since 1.5: +4 -5 lines
Diff to previous 1.5 (colored) to selected 1.19 (colored)

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.

Revision 1.5 / (download) - annotate - [select for diffs], Thu Nov 28 01:37:14 2013 UTC (10 years, 4 months ago) by jnemeth
Branch: MAIN
Changes since 1.4: +3 -1 lines
Diff to previous 1.4 (colored) to selected 1.19 (colored)

when calling dehumanize_number() make sure the resulting number is >= 1

Revision 1.4 / (download) - annotate - [select for diffs], Wed Nov 27 20:34:34 2013 UTC (10 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.3: +2 -2 lines
Diff to previous 1.3 (colored) to selected 1.19 (colored)

CID 1132764: Bogus test

Revision 1.3 / (download) - annotate - [select for diffs], Wed Nov 27 01:47:53 2013 UTC (10 years, 4 months ago) by jnemeth
Branch: MAIN
Changes since 1.2: +1 -6 lines
Diff to previous 1.2 (colored) to selected 1.19 (colored)

Remove FreeBSD specific code as per message to tech-userlevel.

Revision 1.2 / (download) - annotate - [select for diffs], Fri Nov 22 03:50:05 2013 UTC (10 years, 4 months ago) by jnemeth
Branch: MAIN
Changes since 1.1: +3 -2 lines
Diff to previous 1.1 (colored) to selected 1.19 (colored)

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.

Revision 1.1 / (download) - annotate - [select for diffs], Wed Nov 20 08:08:47 2013 UTC (10 years, 4 months ago) by jnemeth
Branch: MAIN
Diff to selected 1.19 (colored)

Add a resize command.  This command was inspired by FreeBSD's gpart(8),
but the code was written by myself.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>