- constify mkfs()'s first arg
- slightly reorder steps in -F image creation
This commit is contained in:
parent
852833fff1
commit
2b2279d9a5
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: extern.h,v 1.3 2000/12/01 12:03:27 simonb Exp $ */
|
||||
/* $NetBSD: extern.h,v 1.4 2001/07/30 07:45:08 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Christos Zoulas. All rights reserved.
|
||||
@ -30,7 +30,7 @@
|
||||
*/
|
||||
|
||||
/* prototypes */
|
||||
void mkfs(struct partition *, char *, int, int);
|
||||
void mkfs(struct partition *, const char *, int, int);
|
||||
|
||||
/* * variables set up by front end. */
|
||||
extern int mfs; /* run as the memory based filesystem */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mkfs.c,v 1.48 2001/07/30 07:13:58 lukem Exp $ */
|
||||
/* $NetBSD: mkfs.c,v 1.49 2001/07/30 07:45:08 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1989, 1993
|
||||
@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: mkfs.c,v 1.48 2001/07/30 07:13:58 lukem Exp $");
|
||||
__RCSID("$NetBSD: mkfs.c,v 1.49 2001/07/30 07:45:08 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -118,7 +118,7 @@ char writebuf[MAXBSIZE];
|
||||
int fsi, fso;
|
||||
|
||||
void
|
||||
mkfs(struct partition *pp, char *fsys, int fi, int fo)
|
||||
mkfs(struct partition *pp, const char *fsys, int fi, int fo)
|
||||
{
|
||||
int32_t i, mincpc, mincpg, inospercg;
|
||||
int32_t cylno, rpos, blk, j, warn = 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: newfs.c,v 1.43 2001/07/29 09:55:22 lukem Exp $ */
|
||||
/* $NetBSD: newfs.c,v 1.44 2001/07/30 07:45:08 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1989, 1993, 1994
|
||||
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1989, 1993, 1994\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)newfs.c 8.13 (Berkeley) 5/1/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: newfs.c,v 1.43 2001/07/29 09:55:22 lukem Exp $");
|
||||
__RCSID("$NetBSD: newfs.c,v 1.44 2001/07/30 07:45:08 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -403,12 +403,13 @@ main(int argc, char *argv[])
|
||||
if (Fflag && (stat(special, &st) != -1 && !S_ISREG(st.st_mode)))
|
||||
errx(1, "%s is not a regular file", special);
|
||||
if (Fflag && !Nflag) { /* creating image in a regular file */
|
||||
if (fssize == 0)
|
||||
errx(1, "need to specify size when using -F");
|
||||
fso = open(special, O_RDWR | O_CREAT | O_TRUNC, 0777);
|
||||
if (fso == -1)
|
||||
err(1, "can't open file %s", special);
|
||||
fsi = dup(fso);
|
||||
if (fssize == 0)
|
||||
errx(1, "need to specify size when using -F");
|
||||
if ((fsi = dup(fso)) == -1)
|
||||
err(1, "can't dup(2) image fd");
|
||||
if (ftruncate(fso, (off_t)fssize * sectorsize) == -1)
|
||||
err(1, "can't resize %s to %d",
|
||||
special, fssize);
|
||||
|
Loading…
x
Reference in New Issue
Block a user