Sun Aug 28 15:46:26 2011 UTC ()
fix the sparc build


(gson)
diff -r1.133 -r1.134 src/sbin/fdisk/fdisk.c

cvs diff -r1.133 -r1.134 src/sbin/fdisk/fdisk.c (expand / switch to unified diff)

--- src/sbin/fdisk/fdisk.c 2011/08/27 20:49:03 1.133
+++ src/sbin/fdisk/fdisk.c 2011/08/28 15:46:26 1.134
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: fdisk.c,v 1.133 2011/08/27 20:49:03 christos Exp $ */ 1/* $NetBSD: fdisk.c,v 1.134 2011/08/28 15:46:26 gson Exp $ */
2 2
3/* 3/*
4 * Mach Operating System 4 * Mach Operating System
5 * Copyright (c) 1992 Carnegie Mellon University 5 * Copyright (c) 1992 Carnegie Mellon University
6 * All Rights Reserved. 6 * All Rights Reserved.
7 * 7 *
8 * Permission to use, copy, modify and distribute this software and its 8 * Permission to use, copy, modify and distribute this software and its
9 * documentation is hereby granted, provided that both the copyright 9 * documentation is hereby granted, provided that both the copyright
10 * notice and this permission notice appear in all copies of the 10 * notice and this permission notice appear in all copies of the
11 * software, derivative works or modified versions, and any portions 11 * software, derivative works or modified versions, and any portions
12 * thereof, and that both notices appear in supporting documentation. 12 * thereof, and that both notices appear in supporting documentation.
13 * 13 *
14 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 14 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
@@ -29,27 +29,27 @@ @@ -29,27 +29,27 @@
29/* 29/*
30 * 14-Dec-89 Robert Baron (rvb) at Carnegie-Mellon University 30 * 14-Dec-89 Robert Baron (rvb) at Carnegie-Mellon University
31 * Copyright (c) 1989 Robert. V. Baron 31 * Copyright (c) 1989 Robert. V. Baron
32 * Created. 32 * Created.
33 */ 33 */
34 34
35#if HAVE_NBTOOL_CONFIG_H 35#if HAVE_NBTOOL_CONFIG_H
36#include "nbtool_config.h" 36#include "nbtool_config.h"
37#endif 37#endif
38 38
39#include <sys/cdefs.h> 39#include <sys/cdefs.h>
40 40
41#ifndef lint 41#ifndef lint
42__RCSID("$NetBSD: fdisk.c,v 1.133 2011/08/27 20:49:03 christos Exp $"); 42__RCSID("$NetBSD: fdisk.c,v 1.134 2011/08/28 15:46:26 gson Exp $");
43#endif /* not lint */ 43#endif /* not lint */
44 44
45#define MBRPTYPENAMES 45#define MBRPTYPENAMES
46#include <sys/types.h> 46#include <sys/types.h>
47#include <sys/param.h> 47#include <sys/param.h>
48#include <sys/stat.h> 48#include <sys/stat.h>
49#include <ctype.h> 49#include <ctype.h>
50#include <err.h> 50#include <err.h>
51#include <errno.h> 51#include <errno.h>
52#include <fcntl.h> 52#include <fcntl.h>
53#include <paths.h> 53#include <paths.h>
54#include <stdarg.h> 54#include <stdarg.h>
55#include <stddef.h> 55#include <stddef.h>
@@ -282,36 +282,36 @@ static int read_disk(daddr_t, void *); @@ -282,36 +282,36 @@ static int read_disk(daddr_t, void *);
282static int write_disk(daddr_t, void *); 282static int write_disk(daddr_t, void *);
283static int get_params(void); 283static int get_params(void);
284static int read_s0(daddr_t, struct mbr_sector *); 284static int read_s0(daddr_t, struct mbr_sector *);
285static int write_mbr(void); 285static int write_mbr(void);
286static int read_gpt(daddr_t, struct gpt_hdr *); 286static int read_gpt(daddr_t, struct gpt_hdr *);
287static int delete_gpt(struct gpt_hdr *); 287static int delete_gpt(struct gpt_hdr *);
288static int yesno(const char *, ...); 288static int yesno(const char *, ...);
289static int64_t decimal(const char *, int64_t, int, int64_t, int64_t); 289static int64_t decimal(const char *, int64_t, int, int64_t, int64_t);
290#define DEC_SEC 1 /* asking for a sector number */ 290#define DEC_SEC 1 /* asking for a sector number */
291#define DEC_RND 2 /* round to end of first track */ 291#define DEC_RND 2 /* round to end of first track */
292#define DEC_RND_0 4 /* convert 0 to size of a track */ 292#define DEC_RND_0 4 /* convert 0 to size of a track */
293#define DEC_RND_DOWN 8 /* subtract 1 track */ 293#define DEC_RND_DOWN 8 /* subtract 1 track */
294#define DEC_RND_DOWN_2 16 /* subtract 2 tracks */ 294#define DEC_RND_DOWN_2 16 /* subtract 2 tracks */
295static void string(const char *, int, char *); 
296static int ptn_id(const char *, int *); 295static int ptn_id(const char *, int *);
297static int type_match(const void *, const void *); 296static int type_match(const void *, const void *);
298static const char *get_type(int); 297static const char *get_type(int);
299static int get_mapping(int, unsigned int *, unsigned int *, unsigned int *, unsigned long *); 298static int get_mapping(int, unsigned int *, unsigned int *, unsigned int *, unsigned long *);
300#ifdef BOOTSEL 299#ifdef BOOTSEL
301static daddr_t configure_bootsel(daddr_t); 300static daddr_t configure_bootsel(daddr_t);
302static void install_bootsel(int); 301static void install_bootsel(int);
303static daddr_t get_default_boot(void); 302static daddr_t get_default_boot(void);
304static void set_default_boot(daddr_t); 303static void set_default_boot(daddr_t);
 304static void string(const char *, int, char *);
305#endif 305#endif
306 306
307static void 307static void
308initvar_disk(const char **diskp) 308initvar_disk(const char **diskp)
309{ 309{
310#if !HAVE_NBTOOL_CONFIG_H 310#if !HAVE_NBTOOL_CONFIG_H
311 int mib[2]; 311 int mib[2];
312 size_t len; 312 size_t len;
313 char *root_device; 313 char *root_device;
314 314
315 mib[0] = CTL_KERN; 315 mib[0] = CTL_KERN;
316 mib[1] = KERN_ROOT_DEVICE; 316 mib[1] = KERN_ROOT_DEVICE;
317 if (sysctl(mib, 2, NULL, &len, NULL, 0) == -1 || 317 if (sysctl(mib, 2, NULL, &len, NULL, 0) == -1 ||