Adding option for bootsector read-only check.
Most boot sectors may contains marker for filesystem state. We can this bit on every mount and warn user if some thing wrong, without checking complete filesystem. Signed-off-by: Oleksij Rempel <bug-track@fisher-privat.net> Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
This commit is contained in:
parent
ce2f8dc349
commit
a307be2b9c
@ -42,16 +42,17 @@
|
|||||||
#include "check.h"
|
#include "check.h"
|
||||||
|
|
||||||
int interactive = 0, rw = 0, list = 0, test = 0, verbose = 0, write_immed = 0;
|
int interactive = 0, rw = 0, list = 0, test = 0, verbose = 0, write_immed = 0;
|
||||||
int atari_format = 0;
|
int atari_format = 0, boot_only = 0;
|
||||||
unsigned n_files = 0;
|
unsigned n_files = 0;
|
||||||
void *mem_queue = NULL;
|
void *mem_queue = NULL;
|
||||||
|
|
||||||
static void usage(char *name)
|
static void usage(char *name)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "usage: %s [-aAflrtvVwy] [-d path -d ...] "
|
fprintf(stderr, "usage: %s [-aAbflrtvVwy] [-d path -d ...] "
|
||||||
"[-u path -u ...]\n%15sdevice\n", name, "");
|
"[-u path -u ...]\n%15sdevice\n", name, "");
|
||||||
fprintf(stderr, " -a automatically repair the file system\n");
|
fprintf(stderr, " -a automatically repair the file system\n");
|
||||||
fprintf(stderr, " -A toggle Atari file system format\n");
|
fprintf(stderr, " -A toggle Atari file system format\n");
|
||||||
|
fprintf(stderr, " -b make read-only boot sector check\n");
|
||||||
fprintf(stderr, " -d path drop that file\n");
|
fprintf(stderr, " -d path drop that file\n");
|
||||||
fprintf(stderr, " -f salvage unused chains to files\n");
|
fprintf(stderr, " -f salvage unused chains to files\n");
|
||||||
fprintf(stderr, " -l list path names\n");
|
fprintf(stderr, " -l list path names\n");
|
||||||
@ -108,7 +109,7 @@ int main(int argc, char **argv)
|
|||||||
interactive = 1;
|
interactive = 1;
|
||||||
check_atari();
|
check_atari();
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "Aad:flnprtu:vVwy")) != EOF)
|
while ((c = getopt(argc, argv, "Aad:bflnprtu:vVwy")) != EOF)
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'A': /* toggle Atari format */
|
case 'A': /* toggle Atari format */
|
||||||
atari_format = !atari_format;
|
atari_format = !atari_format;
|
||||||
@ -120,6 +121,11 @@ int main(int argc, char **argv)
|
|||||||
interactive = 0;
|
interactive = 0;
|
||||||
salvage_files = 1;
|
salvage_files = 1;
|
||||||
break;
|
break;
|
||||||
|
case 'b':
|
||||||
|
rw = 0;
|
||||||
|
interactive = 0;
|
||||||
|
boot_only = 1;
|
||||||
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
file_add(optarg, fdt_drop);
|
file_add(optarg, fdt_drop);
|
||||||
break;
|
break;
|
||||||
@ -165,7 +171,11 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
printf("dosfsck " VERSION ", " VERSION_DATE ", FAT32, LFN\n");
|
printf("dosfsck " VERSION ", " VERSION_DATE ", FAT32, LFN\n");
|
||||||
fs_open(argv[optind], rw);
|
fs_open(argv[optind], rw);
|
||||||
|
|
||||||
read_boot(&fs);
|
read_boot(&fs);
|
||||||
|
if (boot_only)
|
||||||
|
goto exit;
|
||||||
|
|
||||||
if (verify)
|
if (verify)
|
||||||
printf("Starting check/repair pass.\n");
|
printf("Starting check/repair pass.\n");
|
||||||
while (read_fat(&fs), scan_root(&fs))
|
while (read_fat(&fs), scan_root(&fs))
|
||||||
@ -190,6 +200,7 @@ int main(int argc, char **argv)
|
|||||||
n_files_verify = n_files;
|
n_files_verify = n_files;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exit:
|
||||||
if (fs_changed()) {
|
if (fs_changed()) {
|
||||||
if (rw) {
|
if (rw) {
|
||||||
if (interactive)
|
if (interactive)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user