Allow the specification of a mountpoint, and resolve it s disk device
using the fstab. Closes PR bin/129. Submitted by: jmg@nike.efn.org (John-Mark Gurney)
This commit is contained in:
parent
4f6653b930
commit
2f77dcf6ad
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=19185
@ -45,6 +45,7 @@ static const char sccsid[] = "@(#)preen.c 8.1 (Berkeley) 6/5/93";
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <fstab.h>
|
||||||
#include "fsck.h"
|
#include "fsck.h"
|
||||||
|
|
||||||
struct part {
|
struct part {
|
||||||
@ -292,7 +293,8 @@ blockcheck(name)
|
|||||||
{
|
{
|
||||||
struct stat stslash, stblock, stchar;
|
struct stat stslash, stblock, stchar;
|
||||||
char *raw;
|
char *raw;
|
||||||
int retried = 0;
|
struct fstab *fsinfo;
|
||||||
|
int retried = 0, l;
|
||||||
|
|
||||||
hotroot = 0;
|
hotroot = 0;
|
||||||
if (stat("/", &stslash) < 0) {
|
if (stat("/", &stslash) < 0) {
|
||||||
@ -325,6 +327,19 @@ blockcheck(name)
|
|||||||
name = unrawname(name);
|
name = unrawname(name);
|
||||||
retried++;
|
retried++;
|
||||||
goto retry;
|
goto retry;
|
||||||
|
} else if ((stblock.st_mode & S_IFMT) == S_IFDIR && !retried) {
|
||||||
|
l = strlen(name) - 1;
|
||||||
|
if (l > 0 && name[l] == '/')
|
||||||
|
/* remove trailing slash */
|
||||||
|
name[l] = '\0';
|
||||||
|
if(!(fsinfo=getfsfile(name))) {
|
||||||
|
printf("Can't resolve %s to character special device",
|
||||||
|
name);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
name = fsinfo->fs_spec;
|
||||||
|
retried++;
|
||||||
|
goto retry;
|
||||||
}
|
}
|
||||||
printf("Can't make sense out of name %s\n", name);
|
printf("Can't make sense out of name %s\n", name);
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -45,6 +45,7 @@ static const char sccsid[] = "@(#)preen.c 8.1 (Berkeley) 6/5/93";
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <fstab.h>
|
||||||
#include "fsck.h"
|
#include "fsck.h"
|
||||||
|
|
||||||
struct part {
|
struct part {
|
||||||
@ -292,7 +293,8 @@ blockcheck(name)
|
|||||||
{
|
{
|
||||||
struct stat stslash, stblock, stchar;
|
struct stat stslash, stblock, stchar;
|
||||||
char *raw;
|
char *raw;
|
||||||
int retried = 0;
|
struct fstab *fsinfo;
|
||||||
|
int retried = 0, l;
|
||||||
|
|
||||||
hotroot = 0;
|
hotroot = 0;
|
||||||
if (stat("/", &stslash) < 0) {
|
if (stat("/", &stslash) < 0) {
|
||||||
@ -325,6 +327,19 @@ blockcheck(name)
|
|||||||
name = unrawname(name);
|
name = unrawname(name);
|
||||||
retried++;
|
retried++;
|
||||||
goto retry;
|
goto retry;
|
||||||
|
} else if ((stblock.st_mode & S_IFMT) == S_IFDIR && !retried) {
|
||||||
|
l = strlen(name) - 1;
|
||||||
|
if (l > 0 && name[l] == '/')
|
||||||
|
/* remove trailing slash */
|
||||||
|
name[l] = '\0';
|
||||||
|
if(!(fsinfo=getfsfile(name))) {
|
||||||
|
printf("Can't resolve %s to character special device",
|
||||||
|
name);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
name = fsinfo->fs_spec;
|
||||||
|
retried++;
|
||||||
|
goto retry;
|
||||||
}
|
}
|
||||||
printf("Can't make sense out of name %s\n", name);
|
printf("Can't make sense out of name %s\n", name);
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -45,6 +45,7 @@ static const char sccsid[] = "@(#)preen.c 8.1 (Berkeley) 6/5/93";
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <fstab.h>
|
||||||
#include "fsck.h"
|
#include "fsck.h"
|
||||||
|
|
||||||
struct part {
|
struct part {
|
||||||
@ -292,7 +293,8 @@ blockcheck(name)
|
|||||||
{
|
{
|
||||||
struct stat stslash, stblock, stchar;
|
struct stat stslash, stblock, stchar;
|
||||||
char *raw;
|
char *raw;
|
||||||
int retried = 0;
|
struct fstab *fsinfo;
|
||||||
|
int retried = 0, l;
|
||||||
|
|
||||||
hotroot = 0;
|
hotroot = 0;
|
||||||
if (stat("/", &stslash) < 0) {
|
if (stat("/", &stslash) < 0) {
|
||||||
@ -325,6 +327,19 @@ blockcheck(name)
|
|||||||
name = unrawname(name);
|
name = unrawname(name);
|
||||||
retried++;
|
retried++;
|
||||||
goto retry;
|
goto retry;
|
||||||
|
} else if ((stblock.st_mode & S_IFMT) == S_IFDIR && !retried) {
|
||||||
|
l = strlen(name) - 1;
|
||||||
|
if (l > 0 && name[l] == '/')
|
||||||
|
/* remove trailing slash */
|
||||||
|
name[l] = '\0';
|
||||||
|
if(!(fsinfo=getfsfile(name))) {
|
||||||
|
printf("Can't resolve %s to character special device",
|
||||||
|
name);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
name = fsinfo->fs_spec;
|
||||||
|
retried++;
|
||||||
|
goto retry;
|
||||||
}
|
}
|
||||||
printf("Can't make sense out of name %s\n", name);
|
printf("Can't make sense out of name %s\n", name);
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -45,6 +45,7 @@ static const char sccsid[] = "@(#)preen.c 8.1 (Berkeley) 6/5/93";
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <fstab.h>
|
||||||
#include "fsck.h"
|
#include "fsck.h"
|
||||||
|
|
||||||
struct part {
|
struct part {
|
||||||
@ -292,7 +293,8 @@ blockcheck(name)
|
|||||||
{
|
{
|
||||||
struct stat stslash, stblock, stchar;
|
struct stat stslash, stblock, stchar;
|
||||||
char *raw;
|
char *raw;
|
||||||
int retried = 0;
|
struct fstab *fsinfo;
|
||||||
|
int retried = 0, l;
|
||||||
|
|
||||||
hotroot = 0;
|
hotroot = 0;
|
||||||
if (stat("/", &stslash) < 0) {
|
if (stat("/", &stslash) < 0) {
|
||||||
@ -325,6 +327,19 @@ blockcheck(name)
|
|||||||
name = unrawname(name);
|
name = unrawname(name);
|
||||||
retried++;
|
retried++;
|
||||||
goto retry;
|
goto retry;
|
||||||
|
} else if ((stblock.st_mode & S_IFMT) == S_IFDIR && !retried) {
|
||||||
|
l = strlen(name) - 1;
|
||||||
|
if (l > 0 && name[l] == '/')
|
||||||
|
/* remove trailing slash */
|
||||||
|
name[l] = '\0';
|
||||||
|
if(!(fsinfo=getfsfile(name))) {
|
||||||
|
printf("Can't resolve %s to character special device",
|
||||||
|
name);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
name = fsinfo->fs_spec;
|
||||||
|
retried++;
|
||||||
|
goto retry;
|
||||||
}
|
}
|
||||||
printf("Can't make sense out of name %s\n", name);
|
printf("Can't make sense out of name %s\n", name);
|
||||||
return (0);
|
return (0);
|
||||||
|
Loading…
Reference in New Issue
Block a user