Allow root-reloading also for chr devices.
This commit is contained in:
parent
f55c07ab93
commit
703eaae72d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=53754
@ -71,10 +71,8 @@ char hotroot;
|
|||||||
|
|
||||||
static void addpart __P((char *name, char *fsname, long auxdata));
|
static void addpart __P((char *name, char *fsname, long auxdata));
|
||||||
static struct disk *finddisk __P((char *name));
|
static struct disk *finddisk __P((char *name));
|
||||||
static char *rawname __P((char *name));
|
|
||||||
static int startdisk __P((struct disk *dk,
|
static int startdisk __P((struct disk *dk,
|
||||||
int (*checkit)(char *, char *, long, int)));
|
int (*checkit)(char *, char *, long, int)));
|
||||||
static char *unrawname __P((char *name));
|
|
||||||
|
|
||||||
int
|
int
|
||||||
checkfstab(preen, maxrun, docheck, chkit)
|
checkfstab(preen, maxrun, docheck, chkit)
|
||||||
@ -311,10 +309,11 @@ blockcheck(origname)
|
|||||||
printf("Can't stat %s: %s\n", newname, strerror(errno));
|
printf("Can't stat %s: %s\n", newname, strerror(errno));
|
||||||
return (origname);
|
return (origname);
|
||||||
}
|
}
|
||||||
if ((stblock.st_mode & S_IFMT) == S_IFBLK) {
|
if ((stblock.st_mode & S_IFMT) == S_IFBLK ||
|
||||||
|
(stblock.st_mode & S_IFMT) == S_IFCHR) {
|
||||||
if (stslash.st_dev == stblock.st_rdev)
|
if (stslash.st_dev == stblock.st_rdev)
|
||||||
hotroot++;
|
hotroot++;
|
||||||
raw = rawname(newname);
|
raw = newname;
|
||||||
if (stat(raw, &stchar) < 0) {
|
if (stat(raw, &stchar) < 0) {
|
||||||
printf("Can't stat %s: %s\n", raw, strerror(errno));
|
printf("Can't stat %s: %s\n", raw, strerror(errno));
|
||||||
return (origname);
|
return (origname);
|
||||||
@ -327,10 +326,6 @@ blockcheck(origname)
|
|||||||
printf("%s is not a character device\n", raw);
|
printf("%s is not a character device\n", raw);
|
||||||
return (origname);
|
return (origname);
|
||||||
}
|
}
|
||||||
} else if ((stblock.st_mode & S_IFMT) == S_IFCHR && !retried) {
|
|
||||||
newname = unrawname(newname);
|
|
||||||
retried++;
|
|
||||||
goto retry;
|
|
||||||
} else if ((stblock.st_mode & S_IFMT) == S_IFDIR && !retried) {
|
} else if ((stblock.st_mode & S_IFMT) == S_IFDIR && !retried) {
|
||||||
len = strlen(origname) - 1;
|
len = strlen(origname) - 1;
|
||||||
if (len > 0 && origname[len] == '/')
|
if (len > 0 && origname[len] == '/')
|
||||||
@ -351,39 +346,3 @@ blockcheck(origname)
|
|||||||
*/
|
*/
|
||||||
return (origname);
|
return (origname);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
|
||||||
unrawname(name)
|
|
||||||
char *name;
|
|
||||||
{
|
|
||||||
char *dp;
|
|
||||||
struct stat stb;
|
|
||||||
|
|
||||||
if ((dp = strrchr(name, '/')) == 0)
|
|
||||||
return (name);
|
|
||||||
if (stat(name, &stb) < 0)
|
|
||||||
return (name);
|
|
||||||
if ((stb.st_mode & S_IFMT) != S_IFCHR)
|
|
||||||
return (name);
|
|
||||||
if (dp[1] != 'r')
|
|
||||||
return (name);
|
|
||||||
(void)strcpy(&dp[1], &dp[2]);
|
|
||||||
return (name);
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *
|
|
||||||
rawname(name)
|
|
||||||
char *name;
|
|
||||||
{
|
|
||||||
static char rawbuf[32];
|
|
||||||
char *dp;
|
|
||||||
|
|
||||||
if ((dp = strrchr(name, '/')) == 0)
|
|
||||||
return (0);
|
|
||||||
*dp = 0;
|
|
||||||
(void)strcpy(rawbuf, name);
|
|
||||||
*dp = '/';
|
|
||||||
(void)strcat(rawbuf, "/r");
|
|
||||||
(void)strcat(rawbuf, &dp[1]);
|
|
||||||
return (rawbuf);
|
|
||||||
}
|
|
||||||
|
@ -71,10 +71,8 @@ char hotroot;
|
|||||||
|
|
||||||
static void addpart __P((char *name, char *fsname, long auxdata));
|
static void addpart __P((char *name, char *fsname, long auxdata));
|
||||||
static struct disk *finddisk __P((char *name));
|
static struct disk *finddisk __P((char *name));
|
||||||
static char *rawname __P((char *name));
|
|
||||||
static int startdisk __P((struct disk *dk,
|
static int startdisk __P((struct disk *dk,
|
||||||
int (*checkit)(char *, char *, long, int)));
|
int (*checkit)(char *, char *, long, int)));
|
||||||
static char *unrawname __P((char *name));
|
|
||||||
|
|
||||||
int
|
int
|
||||||
checkfstab(preen, maxrun, docheck, chkit)
|
checkfstab(preen, maxrun, docheck, chkit)
|
||||||
@ -311,10 +309,11 @@ blockcheck(origname)
|
|||||||
printf("Can't stat %s: %s\n", newname, strerror(errno));
|
printf("Can't stat %s: %s\n", newname, strerror(errno));
|
||||||
return (origname);
|
return (origname);
|
||||||
}
|
}
|
||||||
if ((stblock.st_mode & S_IFMT) == S_IFBLK) {
|
if ((stblock.st_mode & S_IFMT) == S_IFBLK ||
|
||||||
|
(stblock.st_mode & S_IFMT) == S_IFCHR) {
|
||||||
if (stslash.st_dev == stblock.st_rdev)
|
if (stslash.st_dev == stblock.st_rdev)
|
||||||
hotroot++;
|
hotroot++;
|
||||||
raw = rawname(newname);
|
raw = newname;
|
||||||
if (stat(raw, &stchar) < 0) {
|
if (stat(raw, &stchar) < 0) {
|
||||||
printf("Can't stat %s: %s\n", raw, strerror(errno));
|
printf("Can't stat %s: %s\n", raw, strerror(errno));
|
||||||
return (origname);
|
return (origname);
|
||||||
@ -327,10 +326,6 @@ blockcheck(origname)
|
|||||||
printf("%s is not a character device\n", raw);
|
printf("%s is not a character device\n", raw);
|
||||||
return (origname);
|
return (origname);
|
||||||
}
|
}
|
||||||
} else if ((stblock.st_mode & S_IFMT) == S_IFCHR && !retried) {
|
|
||||||
newname = unrawname(newname);
|
|
||||||
retried++;
|
|
||||||
goto retry;
|
|
||||||
} else if ((stblock.st_mode & S_IFMT) == S_IFDIR && !retried) {
|
} else if ((stblock.st_mode & S_IFMT) == S_IFDIR && !retried) {
|
||||||
len = strlen(origname) - 1;
|
len = strlen(origname) - 1;
|
||||||
if (len > 0 && origname[len] == '/')
|
if (len > 0 && origname[len] == '/')
|
||||||
@ -351,39 +346,3 @@ blockcheck(origname)
|
|||||||
*/
|
*/
|
||||||
return (origname);
|
return (origname);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
|
||||||
unrawname(name)
|
|
||||||
char *name;
|
|
||||||
{
|
|
||||||
char *dp;
|
|
||||||
struct stat stb;
|
|
||||||
|
|
||||||
if ((dp = strrchr(name, '/')) == 0)
|
|
||||||
return (name);
|
|
||||||
if (stat(name, &stb) < 0)
|
|
||||||
return (name);
|
|
||||||
if ((stb.st_mode & S_IFMT) != S_IFCHR)
|
|
||||||
return (name);
|
|
||||||
if (dp[1] != 'r')
|
|
||||||
return (name);
|
|
||||||
(void)strcpy(&dp[1], &dp[2]);
|
|
||||||
return (name);
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *
|
|
||||||
rawname(name)
|
|
||||||
char *name;
|
|
||||||
{
|
|
||||||
static char rawbuf[32];
|
|
||||||
char *dp;
|
|
||||||
|
|
||||||
if ((dp = strrchr(name, '/')) == 0)
|
|
||||||
return (0);
|
|
||||||
*dp = 0;
|
|
||||||
(void)strcpy(rawbuf, name);
|
|
||||||
*dp = '/';
|
|
||||||
(void)strcat(rawbuf, "/r");
|
|
||||||
(void)strcat(rawbuf, &dp[1]);
|
|
||||||
return (rawbuf);
|
|
||||||
}
|
|
||||||
|
@ -71,10 +71,8 @@ char hotroot;
|
|||||||
|
|
||||||
static void addpart __P((char *name, char *fsname, long auxdata));
|
static void addpart __P((char *name, char *fsname, long auxdata));
|
||||||
static struct disk *finddisk __P((char *name));
|
static struct disk *finddisk __P((char *name));
|
||||||
static char *rawname __P((char *name));
|
|
||||||
static int startdisk __P((struct disk *dk,
|
static int startdisk __P((struct disk *dk,
|
||||||
int (*checkit)(char *, char *, long, int)));
|
int (*checkit)(char *, char *, long, int)));
|
||||||
static char *unrawname __P((char *name));
|
|
||||||
|
|
||||||
int
|
int
|
||||||
checkfstab(preen, maxrun, docheck, chkit)
|
checkfstab(preen, maxrun, docheck, chkit)
|
||||||
@ -311,10 +309,11 @@ blockcheck(origname)
|
|||||||
printf("Can't stat %s: %s\n", newname, strerror(errno));
|
printf("Can't stat %s: %s\n", newname, strerror(errno));
|
||||||
return (origname);
|
return (origname);
|
||||||
}
|
}
|
||||||
if ((stblock.st_mode & S_IFMT) == S_IFBLK) {
|
if ((stblock.st_mode & S_IFMT) == S_IFBLK ||
|
||||||
|
(stblock.st_mode & S_IFMT) == S_IFCHR) {
|
||||||
if (stslash.st_dev == stblock.st_rdev)
|
if (stslash.st_dev == stblock.st_rdev)
|
||||||
hotroot++;
|
hotroot++;
|
||||||
raw = rawname(newname);
|
raw = newname;
|
||||||
if (stat(raw, &stchar) < 0) {
|
if (stat(raw, &stchar) < 0) {
|
||||||
printf("Can't stat %s: %s\n", raw, strerror(errno));
|
printf("Can't stat %s: %s\n", raw, strerror(errno));
|
||||||
return (origname);
|
return (origname);
|
||||||
@ -327,10 +326,6 @@ blockcheck(origname)
|
|||||||
printf("%s is not a character device\n", raw);
|
printf("%s is not a character device\n", raw);
|
||||||
return (origname);
|
return (origname);
|
||||||
}
|
}
|
||||||
} else if ((stblock.st_mode & S_IFMT) == S_IFCHR && !retried) {
|
|
||||||
newname = unrawname(newname);
|
|
||||||
retried++;
|
|
||||||
goto retry;
|
|
||||||
} else if ((stblock.st_mode & S_IFMT) == S_IFDIR && !retried) {
|
} else if ((stblock.st_mode & S_IFMT) == S_IFDIR && !retried) {
|
||||||
len = strlen(origname) - 1;
|
len = strlen(origname) - 1;
|
||||||
if (len > 0 && origname[len] == '/')
|
if (len > 0 && origname[len] == '/')
|
||||||
@ -351,39 +346,3 @@ blockcheck(origname)
|
|||||||
*/
|
*/
|
||||||
return (origname);
|
return (origname);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
|
||||||
unrawname(name)
|
|
||||||
char *name;
|
|
||||||
{
|
|
||||||
char *dp;
|
|
||||||
struct stat stb;
|
|
||||||
|
|
||||||
if ((dp = strrchr(name, '/')) == 0)
|
|
||||||
return (name);
|
|
||||||
if (stat(name, &stb) < 0)
|
|
||||||
return (name);
|
|
||||||
if ((stb.st_mode & S_IFMT) != S_IFCHR)
|
|
||||||
return (name);
|
|
||||||
if (dp[1] != 'r')
|
|
||||||
return (name);
|
|
||||||
(void)strcpy(&dp[1], &dp[2]);
|
|
||||||
return (name);
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *
|
|
||||||
rawname(name)
|
|
||||||
char *name;
|
|
||||||
{
|
|
||||||
static char rawbuf[32];
|
|
||||||
char *dp;
|
|
||||||
|
|
||||||
if ((dp = strrchr(name, '/')) == 0)
|
|
||||||
return (0);
|
|
||||||
*dp = 0;
|
|
||||||
(void)strcpy(rawbuf, name);
|
|
||||||
*dp = '/';
|
|
||||||
(void)strcat(rawbuf, "/r");
|
|
||||||
(void)strcat(rawbuf, &dp[1]);
|
|
||||||
return (rawbuf);
|
|
||||||
}
|
|
||||||
|
@ -71,10 +71,8 @@ char hotroot;
|
|||||||
|
|
||||||
static void addpart __P((char *name, char *fsname, long auxdata));
|
static void addpart __P((char *name, char *fsname, long auxdata));
|
||||||
static struct disk *finddisk __P((char *name));
|
static struct disk *finddisk __P((char *name));
|
||||||
static char *rawname __P((char *name));
|
|
||||||
static int startdisk __P((struct disk *dk,
|
static int startdisk __P((struct disk *dk,
|
||||||
int (*checkit)(char *, char *, long, int)));
|
int (*checkit)(char *, char *, long, int)));
|
||||||
static char *unrawname __P((char *name));
|
|
||||||
|
|
||||||
int
|
int
|
||||||
checkfstab(preen, maxrun, docheck, chkit)
|
checkfstab(preen, maxrun, docheck, chkit)
|
||||||
@ -311,10 +309,11 @@ blockcheck(origname)
|
|||||||
printf("Can't stat %s: %s\n", newname, strerror(errno));
|
printf("Can't stat %s: %s\n", newname, strerror(errno));
|
||||||
return (origname);
|
return (origname);
|
||||||
}
|
}
|
||||||
if ((stblock.st_mode & S_IFMT) == S_IFBLK) {
|
if ((stblock.st_mode & S_IFMT) == S_IFBLK ||
|
||||||
|
(stblock.st_mode & S_IFMT) == S_IFCHR) {
|
||||||
if (stslash.st_dev == stblock.st_rdev)
|
if (stslash.st_dev == stblock.st_rdev)
|
||||||
hotroot++;
|
hotroot++;
|
||||||
raw = rawname(newname);
|
raw = newname;
|
||||||
if (stat(raw, &stchar) < 0) {
|
if (stat(raw, &stchar) < 0) {
|
||||||
printf("Can't stat %s: %s\n", raw, strerror(errno));
|
printf("Can't stat %s: %s\n", raw, strerror(errno));
|
||||||
return (origname);
|
return (origname);
|
||||||
@ -327,10 +326,6 @@ blockcheck(origname)
|
|||||||
printf("%s is not a character device\n", raw);
|
printf("%s is not a character device\n", raw);
|
||||||
return (origname);
|
return (origname);
|
||||||
}
|
}
|
||||||
} else if ((stblock.st_mode & S_IFMT) == S_IFCHR && !retried) {
|
|
||||||
newname = unrawname(newname);
|
|
||||||
retried++;
|
|
||||||
goto retry;
|
|
||||||
} else if ((stblock.st_mode & S_IFMT) == S_IFDIR && !retried) {
|
} else if ((stblock.st_mode & S_IFMT) == S_IFDIR && !retried) {
|
||||||
len = strlen(origname) - 1;
|
len = strlen(origname) - 1;
|
||||||
if (len > 0 && origname[len] == '/')
|
if (len > 0 && origname[len] == '/')
|
||||||
@ -351,39 +346,3 @@ blockcheck(origname)
|
|||||||
*/
|
*/
|
||||||
return (origname);
|
return (origname);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
|
||||||
unrawname(name)
|
|
||||||
char *name;
|
|
||||||
{
|
|
||||||
char *dp;
|
|
||||||
struct stat stb;
|
|
||||||
|
|
||||||
if ((dp = strrchr(name, '/')) == 0)
|
|
||||||
return (name);
|
|
||||||
if (stat(name, &stb) < 0)
|
|
||||||
return (name);
|
|
||||||
if ((stb.st_mode & S_IFMT) != S_IFCHR)
|
|
||||||
return (name);
|
|
||||||
if (dp[1] != 'r')
|
|
||||||
return (name);
|
|
||||||
(void)strcpy(&dp[1], &dp[2]);
|
|
||||||
return (name);
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *
|
|
||||||
rawname(name)
|
|
||||||
char *name;
|
|
||||||
{
|
|
||||||
static char rawbuf[32];
|
|
||||||
char *dp;
|
|
||||||
|
|
||||||
if ((dp = strrchr(name, '/')) == 0)
|
|
||||||
return (0);
|
|
||||||
*dp = 0;
|
|
||||||
(void)strcpy(rawbuf, name);
|
|
||||||
*dp = '/';
|
|
||||||
(void)strcat(rawbuf, "/r");
|
|
||||||
(void)strcat(rawbuf, &dp[1]);
|
|
||||||
return (rawbuf);
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user