Try the DIOCGWEDGEINFO ioctl first. If that succeeds (i.e. the block
device is a wedge), use the partition type string from the dkwedge_info structure to get the file system type.
This commit is contained in:
parent
0e37eeed2c
commit
ef92b0de59
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: fsck.c,v 1.35 2004/08/19 22:28:38 christos Exp $ */
|
||||
/* $NetBSD: fsck.c,v 1.36 2004/09/25 03:32:52 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christos Zoulas. All rights reserved.
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: fsck.c,v 1.35 2004/08/19 22:28:38 christos Exp $");
|
||||
__RCSID("$NetBSD: fsck.c,v 1.36 2004/09/25 03:32:52 thorpej Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -45,6 +45,7 @@ __RCSID("$NetBSD: fsck.c,v 1.35 2004/08/19 22:28:38 christos Exp $");
|
||||
#include <sys/wait.h>
|
||||
#define FSTYPENAMES
|
||||
#define FSCKNAMES
|
||||
#include <sys/disk.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
@ -490,10 +491,10 @@ mangle(char *opts, int *argcp, const char ***argvp, int *maxargcp)
|
||||
*maxargcp = maxargc;
|
||||
}
|
||||
|
||||
|
||||
const static char *
|
||||
getfslab(const char *str)
|
||||
{
|
||||
static struct dkwedge_info dkw;
|
||||
struct disklabel dl;
|
||||
int fd;
|
||||
char p;
|
||||
@ -504,6 +505,13 @@ getfslab(const char *str)
|
||||
if ((fd = open(str, O_RDONLY)) == -1)
|
||||
err(1, "cannot open `%s'", str);
|
||||
|
||||
/* First check to see if it's a wedge. */
|
||||
if (ioctl(fd, DIOCGWEDGEINFO, &dkw) == 0) {
|
||||
/* Yup, this is easy. */
|
||||
(void) close(fd);
|
||||
return (dkw.dkw_ptype);
|
||||
}
|
||||
|
||||
if (ioctl(fd, DIOCGDINFO, &dl) == -1)
|
||||
err(1, "cannot get disklabel for `%s'", str);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mount.c,v 1.72 2004/08/19 23:02:09 christos Exp $ */
|
||||
/* $NetBSD: mount.c,v 1.73 2004/09/25 03:32:52 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1989, 1993, 1994
|
||||
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1989, 1993, 1994\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)mount.c 8.25 (Berkeley) 5/8/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: mount.c,v 1.72 2004/08/19 23:02:09 christos Exp $");
|
||||
__RCSID("$NetBSD: mount.c,v 1.73 2004/09/25 03:32:52 thorpej Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -59,6 +59,7 @@ __RCSID("$NetBSD: mount.c,v 1.72 2004/08/19 23:02:09 christos Exp $");
|
||||
|
||||
#define MOUNTNAMES
|
||||
#include <fcntl.h>
|
||||
#include <sys/disk.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
@ -660,6 +661,7 @@ static const char *
|
||||
getfslab(str)
|
||||
const char *str;
|
||||
{
|
||||
static struct dkwedge_info dkw;
|
||||
struct disklabel dl;
|
||||
int fd;
|
||||
int part;
|
||||
@ -689,6 +691,13 @@ getfslab(str)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/* Check to see if this is a wedge. */
|
||||
if (ioctl(fd, DIOCGWEDGEINFO, &dkw) == 0) {
|
||||
/* Yup, this is easy. */
|
||||
(void) close(fd);
|
||||
return (dkw.dkw_ptype);
|
||||
}
|
||||
|
||||
if (ioctl(fd, DIOCGDINFO, &dl) == -1) {
|
||||
(void) close(fd);
|
||||
return (NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user