Applying Debians 99-conglomeration.dpatch (no other information
available). Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
This commit is contained in:
parent
3b5ed8a4b1
commit
739a6fb288
@ -305,14 +305,14 @@ static void truncate_file(DOS_FS *fs,DOS_FILE *file,unsigned long clusters)
|
|||||||
static void auto_rename(DOS_FILE *file)
|
static void auto_rename(DOS_FILE *file)
|
||||||
{
|
{
|
||||||
DOS_FILE *first,*walk;
|
DOS_FILE *first,*walk;
|
||||||
int number;
|
unsigned long int number;
|
||||||
|
|
||||||
if (!file->offset) return; /* cannot rename FAT32 root dir */
|
if (!file->offset) return; /* cannot rename FAT32 root dir */
|
||||||
first = file->parent ? file->parent->first : root;
|
first = file->parent ? file->parent->first : root;
|
||||||
number = 0;
|
number = 0;
|
||||||
while (1) {
|
while (1) {
|
||||||
sprintf(file->dir_ent.name,"FSCK%04d",number);
|
sprintf(file->dir_ent.name, "FSCK%04d", number / 1000);
|
||||||
strncpy(file->dir_ent.ext,"REN",3);
|
sprintf(file->dir_ent.name, "%03d", number % 1000);
|
||||||
for (walk = first; walk; walk = walk->next)
|
for (walk = first; walk; walk = walk->next)
|
||||||
if (walk != file && !strncmp(walk->dir_ent.name,file->dir_ent.
|
if (walk != file && !strncmp(walk->dir_ent.name,file->dir_ent.
|
||||||
name,MSDOS_NAME)) break;
|
name,MSDOS_NAME)) break;
|
||||||
@ -321,6 +321,9 @@ static void auto_rename(DOS_FILE *file)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
number++;
|
number++;
|
||||||
|
if (number > 9999999) {
|
||||||
|
die("Too many files need repair.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
die("Can't generate a unique name.");
|
die("Can't generate a unique name.");
|
||||||
}
|
}
|
||||||
@ -450,10 +453,10 @@ static int check_file(DOS_FS *fs,DOS_FILE *file)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!(file->dir_ent.attr & ATTR_DIR) && CF_LE_L(file->dir_ent.size) <=
|
if (!(file->dir_ent.attr & ATTR_DIR) && CF_LE_L(file->dir_ent.size) <=
|
||||||
clusters*fs->cluster_size) {
|
(unsigned long long)clusters*fs->cluster_size) {
|
||||||
printf("%s\n File size is %u bytes, cluster chain length is > %lu "
|
printf("%s\n File size is %u bytes, cluster chain length is > %llu "
|
||||||
"bytes.\n Truncating file to %u bytes.\n",path_name(file),
|
"bytes.\n Truncating file to %u bytes.\n",path_name(file),
|
||||||
CF_LE_L(file->dir_ent.size),clusters*fs->cluster_size,
|
CF_LE_L(file->dir_ent.size),(unsigned long long)clusters*fs->cluster_size,
|
||||||
CF_LE_L(file->dir_ent.size));
|
CF_LE_L(file->dir_ent.size));
|
||||||
truncate_file(fs,file,clusters);
|
truncate_file(fs,file,clusters);
|
||||||
break;
|
break;
|
||||||
@ -469,20 +472,20 @@ static int check_file(DOS_FS *fs,DOS_FILE *file)
|
|||||||
else clusters2++;
|
else clusters2++;
|
||||||
restart = file->dir_ent.attr & ATTR_DIR;
|
restart = file->dir_ent.attr & ATTR_DIR;
|
||||||
if (!owner->offset) {
|
if (!owner->offset) {
|
||||||
printf( " Truncating second to %lu bytes because first "
|
printf( " Truncating second to %llu bytes because first "
|
||||||
"is FAT32 root dir.\n", clusters2*fs->cluster_size );
|
"is FAT32 root dir.\n", (unsigned long long)clusters2*fs->cluster_size );
|
||||||
do_trunc = 2;
|
do_trunc = 2;
|
||||||
}
|
}
|
||||||
else if (!file->offset) {
|
else if (!file->offset) {
|
||||||
printf( " Truncating first to %lu bytes because second "
|
printf( " Truncating first to %llu bytes because second "
|
||||||
"is FAT32 root dir.\n", clusters*fs->cluster_size );
|
"is FAT32 root dir.\n", (unsigned long long)clusters*fs->cluster_size );
|
||||||
do_trunc = 1;
|
do_trunc = 1;
|
||||||
}
|
}
|
||||||
else if (interactive)
|
else if (interactive)
|
||||||
printf("1) Truncate first to %lu bytes%s\n"
|
printf("1) Truncate first to %llu bytes%s\n"
|
||||||
"2) Truncate second to %lu bytes\n",clusters*fs->cluster_size,
|
"2) Truncate second to %llu bytes\n",(unsigned long long)clusters*fs->cluster_size,
|
||||||
restart ? " and restart" : "",clusters2*fs->cluster_size);
|
restart ? " and restart" : "",(unsigned long long)clusters2*fs->cluster_size);
|
||||||
else printf(" Truncating second to %lu bytes.\n",clusters2*
|
else printf(" Truncating second to %llu bytes.\n",(unsigned long long)clusters2*
|
||||||
fs->cluster_size);
|
fs->cluster_size);
|
||||||
if (do_trunc != 2 &&
|
if (do_trunc != 2 &&
|
||||||
(do_trunc == 1 ||
|
(do_trunc == 1 ||
|
||||||
@ -494,12 +497,13 @@ static int check_file(DOS_FS *fs,DOS_FILE *file)
|
|||||||
if (this == curr) {
|
if (this == curr) {
|
||||||
if (prev) set_fat(fs,prev,-1);
|
if (prev) set_fat(fs,prev,-1);
|
||||||
else MODIFY_START(owner,0,fs);
|
else MODIFY_START(owner,0,fs);
|
||||||
MODIFY(owner,size,CT_LE_L(clusters*fs->cluster_size));
|
MODIFY(owner,size,CT_LE_L((unsigned long long)clusters*fs->cluster_size));
|
||||||
if (restart) return 1;
|
if (restart) return 1;
|
||||||
while (this > 0 && this != -1) {
|
while (this > 0 && this != -1) {
|
||||||
set_owner(fs,this,NULL);
|
set_owner(fs,this,NULL);
|
||||||
this = next_cluster(fs,this);
|
this = next_cluster(fs,this);
|
||||||
}
|
}
|
||||||
|
this = curr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
clusters++;
|
clusters++;
|
||||||
@ -520,11 +524,11 @@ static int check_file(DOS_FS *fs,DOS_FILE *file)
|
|||||||
prev = curr;
|
prev = curr;
|
||||||
}
|
}
|
||||||
if (!(file->dir_ent.attr & ATTR_DIR) && CF_LE_L(file->dir_ent.size) >
|
if (!(file->dir_ent.attr & ATTR_DIR) && CF_LE_L(file->dir_ent.size) >
|
||||||
clusters*fs->cluster_size) {
|
(unsigned long long)clusters*fs->cluster_size) {
|
||||||
printf("%s\n File size is %u bytes, cluster chain length is %lu bytes."
|
printf("%s\n File size is %u bytes, cluster chain length is %llu bytes."
|
||||||
"\n Truncating file to %lu bytes.\n",path_name(file),CF_LE_L(file->
|
"\n Truncating file to %lu bytes.\n",path_name(file),CF_LE_L(file->
|
||||||
dir_ent.size),clusters*fs->cluster_size,clusters*fs->cluster_size);
|
dir_ent.size),(unsigned long long)clusters*fs->cluster_size,(unsigned long long)clusters*fs->cluster_size);
|
||||||
MODIFY(file,size,CT_LE_L(clusters*fs->cluster_size));
|
MODIFY(file,size,CT_LE_L((unsigned long long)clusters*fs->cluster_size));
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,7 +54,7 @@ void read_fat(DOS_FS *fs)
|
|||||||
void *first,*second = NULL;
|
void *first,*second = NULL;
|
||||||
int first_ok,second_ok;
|
int first_ok,second_ok;
|
||||||
|
|
||||||
eff_size = ((fs->clusters+2)*fs->fat_bits+7)/8;
|
eff_size = ((fs->clusters+2ULL)*fs->fat_bits+7)/8ULL;
|
||||||
first = alloc(eff_size);
|
first = alloc(eff_size);
|
||||||
fs_read(fs->fat_start,eff_size,first);
|
fs_read(fs->fat_start,eff_size,first);
|
||||||
if (fs->nfats > 1) {
|
if (fs->nfats > 1) {
|
||||||
@ -101,7 +101,7 @@ void read_fat(DOS_FS *fs)
|
|||||||
if (second) {
|
if (second) {
|
||||||
free(second);
|
free(second);
|
||||||
}
|
}
|
||||||
fs->fat = qalloc(&mem_queue,sizeof(FAT_ENTRY)*(fs->clusters+2));
|
fs->fat = qalloc(&mem_queue,sizeof(FAT_ENTRY)*(fs->clusters+2ULL));
|
||||||
for (i = 2; i < fs->clusters+2; i++) get_fat(&fs->fat[i],first,i,fs);
|
for (i = 2; i < fs->clusters+2; i++) get_fat(&fs->fat[i],first,i,fs);
|
||||||
for (i = 2; i < fs->clusters+2; i++)
|
for (i = 2; i < fs->clusters+2; i++)
|
||||||
if (fs->fat[i].value >= fs->clusters+2 &&
|
if (fs->fat[i].value >= fs->clusters+2 &&
|
||||||
@ -179,7 +179,7 @@ unsigned long next_cluster(DOS_FS *fs,unsigned long cluster)
|
|||||||
|
|
||||||
loff_t cluster_start(DOS_FS *fs,unsigned long cluster)
|
loff_t cluster_start(DOS_FS *fs,unsigned long cluster)
|
||||||
{
|
{
|
||||||
return fs->data_start+((loff_t)cluster-2)*fs->cluster_size;
|
return fs->data_start+((loff_t)cluster-2)*(unsigned long long)fs->cluster_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -227,8 +227,8 @@ void reclaim_free(DOS_FS *fs)
|
|||||||
reclaimed++;
|
reclaimed++;
|
||||||
}
|
}
|
||||||
if (reclaimed)
|
if (reclaimed)
|
||||||
printf("Reclaimed %d unused cluster%s (%d bytes).\n",reclaimed,
|
printf("Reclaimed %d unused cluster%s (%llu bytes).\n",reclaimed,
|
||||||
reclaimed == 1 ? "" : "s",reclaimed*fs->cluster_size);
|
reclaimed == 1 ? "" : "s",(unsigned long long)reclaimed*fs->cluster_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -307,8 +307,8 @@ void reclaim_file(DOS_FS *fs)
|
|||||||
fs_write(offset,sizeof(DIR_ENT),&de);
|
fs_write(offset,sizeof(DIR_ENT),&de);
|
||||||
}
|
}
|
||||||
if (reclaimed)
|
if (reclaimed)
|
||||||
printf("Reclaimed %d unused cluster%s (%d bytes) in %d chain%s.\n",
|
printf("Reclaimed %d unused cluster%s (%llu bytes) in %d chain%s.\n",
|
||||||
reclaimed,reclaimed == 1 ? "" : "s",reclaimed*fs->cluster_size,files,
|
reclaimed,reclaimed == 1 ? "" : "s",(unsigned long long)reclaimed*fs->cluster_size,files,
|
||||||
files == 1 ? "" : "s");
|
files == 1 ? "" : "s");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user