Use getmaxpartitions() from libutil, not a homegrown version.

This commit is contained in:
thorpej 1996-05-16 07:13:01 +00:00
parent 8a5bb3e806
commit 37b8aea219
4 changed files with 14 additions and 39 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.9 1995/03/18 14:58:37 cgd Exp $
# $NetBSD: Makefile,v 1.10 1996/05/16 07:13:01 thorpej Exp $
# @(#)Makefile 8.2 (Berkeley) 3/27/94
PROG= newfs
@ -9,6 +9,9 @@ MOUNT= ${.CURDIR}/../mount
CFLAGS+=-DMFS -I${MOUNT}
.PATH: ${MOUNT} ${.CURDIR}/../disklabel
DPADD= ${LIBUTIL}
LDADD= -lutil
LINKS= ${BINDIR}/newfs ${BINDIR}/mount_mfs
MLINKS= newfs.8 mount_mfs.8 newfs.8 mfs.8

View File

@ -1,4 +1,4 @@
/* $NetBSD: newfs.c,v 1.19 1995/06/28 02:21:02 thorpej Exp $ */
/* $NetBSD: newfs.c,v 1.20 1996/05/16 07:13:03 thorpej Exp $ */
/*
* Copyright (c) 1983, 1989, 1993, 1994
@ -43,7 +43,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)newfs.c 8.8 (Berkeley) 4/18/94";
#else
static char rcsid[] = "$NetBSD: newfs.c,v 1.19 1995/06/28 02:21:02 thorpej Exp $";
static char rcsid[] = "$NetBSD: newfs.c,v 1.20 1996/05/16 07:13:03 thorpej Exp $";
#endif
#endif /* not lint */
@ -69,6 +69,7 @@ static char rcsid[] = "$NetBSD: newfs.c,v 1.19 1995/06/28 02:21:02 thorpej Exp $
#include <string.h>
#include <syslog.h>
#include <unistd.h>
#include <util.h>
#if __STDC__
#include <stdarg.h>
@ -90,8 +91,6 @@ void fatal(const char *fmt, ...);
void fatal();
#endif
int getmaxpartitions __P((void));
#define COMPAT /* allow non-labeled disks */
/*
@ -681,21 +680,6 @@ fatal(fmt, va_alist)
/*NOTREACHED*/
}
int
getmaxpartitions()
{
int maxpart, mib[2];
size_t varlen;
mib[0] = CTL_KERN;
mib[1] = KERN_MAXPARTITIONS;
varlen = sizeof(maxpart);
if (sysctl(mib, 2, &maxpart, &varlen, NULL, 0) < 0)
fatal("getmaxpartitions: %s", strerror(errno));
return (maxpart);
}
usage()
{
if (mfs) {

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.5 1995/03/18 14:58:45 cgd Exp $
# $NetBSD: Makefile,v 1.6 1996/05/16 07:17:49 thorpej Exp $
# @(#)Makefile 8.1 (Berkeley) 6/18/93
PROG= newlfs
@ -6,4 +6,7 @@ SRCS= dkcksum.c lfs.c lfs_cksum.c misc.c newfs.c
MAN= newlfs.8
.PATH: ${.CURDIR}/../../sys/ufs/lfs ${.CURDIR}/../disklabel
DPADD= ${LIBUTIL}
LDADD= -lutil
.include <bsd.prog.mk>

View File

@ -1,4 +1,4 @@
/* $NetBSD: newfs.c,v 1.4 1995/06/28 02:21:32 thorpej Exp $ */
/* $NetBSD: newfs.c,v 1.5 1996/05/16 07:17:50 thorpej Exp $ */
/*-
* Copyright (c) 1989, 1992, 1993
@ -43,7 +43,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)newfs.c 8.3 (Berkeley) 4/22/94";
#else
static char rcsid[] = "$NetBSD: newfs.c,v 1.4 1995/06/28 02:21:32 thorpej Exp $";
static char rcsid[] = "$NetBSD: newfs.c,v 1.5 1996/05/16 07:17:50 thorpej Exp $";
#endif
#endif /* not lint */
@ -69,6 +69,7 @@ static char rcsid[] = "$NetBSD: newfs.c,v 1.4 1995/06/28 02:21:32 thorpej Exp $"
#include <ctype.h>
#include <string.h>
#include <paths.h>
#include <util.h>
#include "config.h"
#include "extern.h"
@ -119,7 +120,6 @@ char *progname, *special;
static struct disklabel *getdisklabel __P((char *, int));
static struct disklabel *debug_readlabel __P((int));
static void rewritelabel __P((char *, int, struct disklabel *));
static int getmaxpartitions __P((void));
static void usage __P((void));
int
@ -432,21 +432,6 @@ rewritelabel(s, fd, lp)
#endif
}
static int
getmaxpartitions()
{
int maxpart, mib[2];
size_t varlen;
mib[0] = CTL_KERN;
mib[1] = KERN_MAXPARTITIONS;
varlen = sizeof(maxpart);
if (sysctl(mib, 2, &maxpart, &varlen, NULL, 0) < 0)
fatal("getmaxpartitions: %s", strerror(errno));
return (maxpart);
}
void
usage()
{