Converted to Lite2 mount interface - don't use numeric filesystem

types.  The NetBSD compatibility cruft was more correct for -current
than FreeBSD's own code.  It just used NetBSD #defines instead of
string literals for the filesystem names.  NetBSD's MOUNT_UFS is
"ffs", so using a literal "ufs" gives wrong results, but this is
unimportant, especially for bootstrapping.

Fixed style bugs in trymmap().

Fixed some disordered declarations.
This commit is contained in:
Bruce Evans 1998-01-20 13:52:32 +00:00
parent d63b9ba46a
commit 8339e4f43d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=32652

View File

@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "From: @(#)xinstall.c 8.1 (Berkeley) 7/21/93";
#endif
static const char rcsid[] =
"$Id: xinstall.c,v 1.29 1998/01/11 11:43:36 peter Exp $";
"$Id: xinstall.c,v 1.30 1998/01/13 02:12:43 alex Exp $";
#endif /* not lint */
/*-
@ -87,7 +87,7 @@ static const char rcsid[] =
#define MAP_FAILED ((void *)-1) /* from <sys/mman.h> */
#endif
int debug, docompare, docopy, dodir, dopreserve, dostrip, verbose, nommap;
int debug, docompare, docopy, dodir, dopreserve, dostrip, nommap, verbose;
int mode = S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;
char *group, *owner, pathbuf[MAXPATHLEN];
char pathbuf2[MAXPATHLEN];
@ -712,22 +712,18 @@ int
trymmap(fd)
int fd;
{
/*
* The ifdef is for bootstrapping - f_fstypename doesn't exist in
* pre-Lite2-merge systems.
*/
#ifdef MFSNAMELEN
struct statfs stfs;
if (nommap || fstatfs(fd, &stfs) < 0)
return 0;
/* NetBSD MOUNT_XXX defines are strings, but doesn't have a MOUNT_NONE. */
#ifdef MOUNT_NONE
switch(stfs.f_type) {
case MOUNT_UFS: /* should be safe.. */
case MOUNT_CD9660: /* should be safe.. */
return 1;
}
#else
if (strcmp(stfs.f_fstypename,MOUNT_UFS) == 0 ||
strcmp(stfs.f_fstypename,MOUNT_CD9660) == 0)
return 1;
if (nommap || fstatfs(fd, &stfs) != 0)
return (0);
if (strcmp(stfs.f_fstypename, "ufs") == 0 ||
strcmp(stfs.f_fstypename, "cd9660") == 0)
return (1);
#endif
return 0;
return (0);
}