Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-7]: src/sbin/fsck Pull up following revision(s) (requested by jne...
details: https://anonhg.NetBSD.org/src/rev/5374ae5f7787
branches: netbsd-7
changeset: 799370:5374ae5f7787
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Mon May 25 09:10:48 2015 +0000
description:
Pull up following revision(s) (requested by jnemeth in ticket #793):
sbin/fsck/partutil.c: revision 1.13
sbin/fsck/partutil.h: revision 1.3
Provide a simple getdisksize() api for gpt(8).
diffstat:
sbin/fsck/partutil.c | 29 ++++++++++++++++++++++++++---
sbin/fsck/partutil.h | 5 ++++-
2 files changed, 30 insertions(+), 4 deletions(-)
diffs (78 lines):
diff -r 1ff9774c385d -r 5374ae5f7787 sbin/fsck/partutil.c
--- a/sbin/fsck/partutil.c Mon May 25 09:05:25 2015 +0000
+++ b/sbin/fsck/partutil.c Mon May 25 09:10:48 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: partutil.c,v 1.12 2013/04/13 22:08:57 jakllsch Exp $ */
+/* $NetBSD: partutil.c,v 1.12.6.1 2015/05/25 09:10:48 msaitoh Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -30,9 +30,10 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: partutil.c,v 1.12 2013/04/13 22:08:57 jakllsch Exp $");
+__RCSID("$NetBSD: partutil.c,v 1.12.6.1 2015/05/25 09:10:48 msaitoh Exp $");
#include <sys/types.h>
+#include <sys/param.h>
#include <sys/disklabel.h>
#include <sys/disk.h>
#include <sys/ioctl.h>
@@ -135,8 +136,10 @@
"DIOCGDINFO for disk device %s", s);
}
+ if (dkw == NULL)
+ return 0;
+
/* DIOCGDINFO didn't fail */
-
(void)memset(dkw, 0, sizeof(*dkw));
if (stat(s, &sb) == -1)
@@ -161,3 +164,23 @@
return 0;
}
+
+int
+getdisksize(const char *name, u_int *secsize, off_t *mediasize)
+{
+ char buf[MAXPATHLEN];
+ struct disk_geom geo;
+ int fd, error;
+
+ if ((fd = opendisk(name, O_RDONLY, buf, sizeof(buf), 0)) == -1)
+ return -1;
+
+ error = getdiskinfo(name, fd, NULL, &geo, NULL);
+ close(fd);
+ if (error)
+ return error;
+
+ *secsize = geo.dg_secsize;
+ *mediasize = geo.dg_secsize * geo.dg_secperunit;
+ return 0;
+}
diff -r 1ff9774c385d -r 5374ae5f7787 sbin/fsck/partutil.h
--- a/sbin/fsck/partutil.h Mon May 25 09:05:25 2015 +0000
+++ b/sbin/fsck/partutil.h Mon May 25 09:10:48 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: partutil.h,v 1.2 2008/04/28 20:23:08 martin Exp $ */
+/* $NetBSD: partutil.h,v 1.2.40.1 2015/05/25 09:10:48 msaitoh Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -32,8 +32,11 @@
#define _PARTUTIL_H_
__BEGIN_DECLS
+struct dkwedge_info;
+struct disk_geom;
int getdiskinfo(const char *, int, const char *,
struct disk_geom *, struct dkwedge_info *);
+int getdisksize(const char *, u_int *, off_t *);
__END_DECLS
#endif /* _PARTUTIL_H_ */
Home |
Main Index |
Thread Index |
Old Index