CVS commit: [netbsd-7] src/sbin/gpt

2018-10-15 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Oct 15 07:55:50 UTC 2018

Modified Files:
src/sbin/gpt [netbsd-7]: gpt.c

Log Message:
Pull up the following revisions(s) (requested by mlelstv in ticket #1643):
sbin/gpt/gpt.c: revision 1.76

When changing entries skip those that do not match the -L option.
Should fix PR 53668.


To generate a diff of this commit:
cvs rdiff -u -r1.28.2.2 -r1.28.2.3 src/sbin/gpt/gpt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/gpt/gpt.c
diff -u src/sbin/gpt/gpt.c:1.28.2.2 src/sbin/gpt/gpt.c:1.28.2.3
--- src/sbin/gpt/gpt.c:1.28.2.2	Mon Aug 13 16:12:12 2018
+++ src/sbin/gpt/gpt.c	Mon Oct 15 07:55:49 2018
@@ -35,7 +35,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/gpt.c,v 1.16 2006/07/07 02:44:23 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: gpt.c,v 1.28.2.2 2018/08/13 16:12:12 martin Exp $");
+__RCSID("$NetBSD: gpt.c,v 1.28.2.3 2018/10/15 07:55:49 sborrill Exp $");
 #endif
 
 #include 
@@ -1043,7 +1043,7 @@ gpt_change_ent(gpt_t gpt, const struct g
 			utf16_to_utf8(ent->ent_name,
 			__arraycount(ent->ent_name),
 			utfbuf, __arraycount(utfbuf));
-			if (strcmp((char *)find->label, (char *)utfbuf) == 0)
+			if (strcmp((char *)find->label, (char *)utfbuf) != 0)
 continue;
 		}
 



CVS commit: [netbsd-7] src/sbin/gpt

2015-09-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Sep  8 12:05:02 UTC 2015

Modified Files:
src/sbin/gpt [netbsd-7]: gpt_uuid.h

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #969):
sbin/gpt/gpt_uuid.h: revision 1.4
A change to the GPT_TYPE list also requires a change to the GPT_TYPE
index constants.


To generate a diff of this commit:
cvs rdiff -u -r1.3.2.2 -r1.3.2.3 src/sbin/gpt/gpt_uuid.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/gpt/gpt_uuid.h
diff -u src/sbin/gpt/gpt_uuid.h:1.3.2.2 src/sbin/gpt/gpt_uuid.h:1.3.2.3
--- src/sbin/gpt/gpt_uuid.h:1.3.2.2	Tue Jun  2 19:49:38 2015
+++ src/sbin/gpt/gpt_uuid.h	Tue Sep  8 12:05:02 2015
@@ -47,6 +47,7 @@
 // Must match the array in gpt_uuid.c
 typedef enum {
 	GPT_TYPE_APPLE_HFS = 0,
+	GPT_TYPE_APPLE_UFS,
 	GPT_TYPE_BIOS,
 	GPT_TYPE_EFI,
 	GPT_TYPE_FREEBSD,
@@ -56,6 +57,8 @@ typedef enum {
 	GPT_TYPE_FREEBSD_ZFS,
 	GPT_TYPE_LINUX_DATA,
 	GPT_TYPE_LINUX_SWAP,
+	GPT_TYPE_LINUX_RAID,
+	GPT_TYPE_LINUX_LVM,
 	GPT_TYPE_MS_BASIC_DATA,
 	GPT_TYPE_MS_RESERVED,
 	GPT_TYPE_NETBSD_CCD,



CVS commit: [netbsd-7] src/sbin/gpt

2015-06-29 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Jun 29 17:24:28 UTC 2015

Modified Files:
src/sbin/gpt [netbsd-7]: recover.c

Log Message:
Pull up following revision(s) (requested by jnemeth in ticket #847):
sbin/gpt/recover.c: revision 1.6
Instruct user to use resizedisk if media size has changed, as
resizedisk will adjust the media size in the headers, whereas
recover simply copies the existing header over the missing one.
XXX recover and resizedisk should probably be merged (even if just
partially, so that recover can properly handle media size changes).
Also, reading in the GPT should probably be centralised so that
error handling can be centralised, and users aren't given misleading
messages (i.e. they aren't told to run recover when they should be
running resizedisk).  However, something that can be quickly pulled
up to netbsd-7 was needed, and there isn't time for a major overhaul
or rewrite.


To generate a diff of this commit:
cvs rdiff -u -r1.4.20.1 -r1.4.20.2 src/sbin/gpt/recover.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/gpt/recover.c
diff -u src/sbin/gpt/recover.c:1.4.20.1 src/sbin/gpt/recover.c:1.4.20.2
--- src/sbin/gpt/recover.c:1.4.20.1	Tue Jun  2 19:49:38 2015
+++ src/sbin/gpt/recover.c	Mon Jun 29 17:24:28 2015
@@ -33,7 +33,7 @@
 __FBSDID($FreeBSD: src/sbin/gpt/recover.c,v 1.8 2005/08/31 01:47:19 marcel Exp $);
 #endif
 #ifdef __RCSID
-__RCSID($NetBSD: recover.c,v 1.4.20.1 2015/06/02 19:49:38 snj Exp $);
+__RCSID($NetBSD: recover.c,v 1.4.20.2 2015/06/29 17:24:28 snj Exp $);
 #endif
 
 #include sys/types.h
@@ -64,7 +64,7 @@ usage_recover(void)
 static void
 recover(int fd)
 {
-	off_t last;
+	uint64_t last;
 	map_t *gpt, *tpg;
 	map_t *tbl, *lbt;
 	struct gpt_hdr *hdr;
@@ -92,6 +92,13 @@ recover(int fd)
 
 	last = mediasz / secsz - 1LL;
 
+	if (gpt != NULL 
+	((struct gpt_hdr *)(gpt-map_data))-hdr_lba_alt != last) {
+		warnx(%s: media size has changed, please use 'gpt resizedisk',
+		   device_name);
+		return;
+	}
+
 	if (tbl != NULL  lbt == NULL) {
 		lbt = map_add(last - tbl-map_size, tbl-map_size,
 		MAP_TYPE_SEC_GPT_TBL, tbl-map_data);



CVS commit: [netbsd-7] src/sbin/gpt

2015-06-02 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Jun  2 19:49:38 UTC 2015

Modified Files:
src/sbin/gpt [netbsd-7]: Makefile add.c backup.c biosboot.c create.c
destroy.c gpt.8 gpt.c gpt.h label.c map.c migrate.c recover.c
remove.c resize.c restore.c set.c show.c unset.c
Added Files:
src/sbin/gpt [netbsd-7]: drvctl.c gpt_uuid.c gpt_uuid.h resizedisk.c
type.c

Log Message:
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