Removing whitespaces in all files at EOL and EOF.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
This commit is contained in:
parent
1410138d03
commit
b4feb7319f
@ -8,7 +8,7 @@
|
|||||||
(superblock) format of DOS 3.3+, with support for volume ID's and
|
(superblock) format of DOS 3.3+, with support for volume ID's and
|
||||||
volume labels (volume labels are also written to the root
|
volume labels (volume labels are also written to the root
|
||||||
directory, as they should).
|
directory, as they should).
|
||||||
|
|
||||||
18th February 1994 Dave Hudson (dave@humbug.demon.co.uk)
|
18th February 1994 Dave Hudson (dave@humbug.demon.co.uk)
|
||||||
|
|
||||||
Released version 0.2 - clears a bug in the FAT sizing code.
|
Released version 0.2 - clears a bug in the FAT sizing code.
|
||||||
|
|||||||
@ -12,4 +12,3 @@
|
|||||||
|
|
||||||
- dosfsck: read-only sector test (-t without -a or -r); just print
|
- dosfsck: read-only sector test (-t without -a or -r); just print
|
||||||
out errors.
|
out errors.
|
||||||
|
|
||||||
|
|||||||
@ -97,7 +97,7 @@ added to the free disk space except in auto mode (\fB-a\fP).
|
|||||||
List path names of files being processed.
|
List path names of files being processed.
|
||||||
.IP \fB\-n\fP
|
.IP \fB\-n\fP
|
||||||
No-operation mode: non-interactively check for errors, but don't write
|
No-operation mode: non-interactively check for errors, but don't write
|
||||||
anything to the filesystem.
|
anything to the filesystem.
|
||||||
.IP \fB\-r\fP
|
.IP \fB\-r\fP
|
||||||
Interactively repair the file system. The user is asked for advice whenever
|
Interactively repair the file system. The user is asked for advice whenever
|
||||||
there is more than one approach to fix an inconsistency.
|
there is more than one approach to fix an inconsistency.
|
||||||
|
|||||||
@ -9,13 +9,13 @@
|
|||||||
.B \-A
|
.B \-A
|
||||||
]
|
]
|
||||||
[
|
[
|
||||||
.B \-b
|
.B \-b
|
||||||
.I sector-of-backup
|
.I sector-of-backup
|
||||||
]
|
]
|
||||||
[
|
[
|
||||||
.B \-c
|
.B \-c
|
||||||
]
|
]
|
||||||
[
|
[
|
||||||
.B \-l
|
.B \-l
|
||||||
.I filename
|
.I filename
|
||||||
]
|
]
|
||||||
@ -52,7 +52,7 @@
|
|||||||
.I root-dir-entries
|
.I root-dir-entries
|
||||||
]
|
]
|
||||||
[
|
[
|
||||||
.B \-R
|
.B \-R
|
||||||
.I number-of-reserved-sectors
|
.I number-of-reserved-sectors
|
||||||
]
|
]
|
||||||
[
|
[
|
||||||
@ -161,7 +161,7 @@ Sets the message the user receives on attempts to boot this file system
|
|||||||
without having properly installed an operating system. The message
|
without having properly installed an operating system. The message
|
||||||
file must not exceed 418 bytes once line feeds have been converted to
|
file must not exceed 418 bytes once line feeds have been converted to
|
||||||
carriage return-line feed combinations, and tabs have been expanded.
|
carriage return-line feed combinations, and tabs have been expanded.
|
||||||
If the filename is a hyphen (-), the text is taken from standard input.
|
If the filename is a hyphen (-), the text is taken from standard input.
|
||||||
.TP
|
.TP
|
||||||
.BI \-n " volume-name"
|
.BI \-n " volume-name"
|
||||||
Sets the volume name (label) of the file system. The volume name can
|
Sets the volume name (label) of the file system. The volume name can
|
||||||
@ -203,7 +203,7 @@ Dave Hudson - <dave@humbug.demon.co.uk>; modified by Peter Anvin
|
|||||||
is based on code from
|
is based on code from
|
||||||
.BR mke2fs
|
.BR mke2fs
|
||||||
(written by Remy Card - <card@masi.ibp.fr>) which is itself based on
|
(written by Remy Card - <card@masi.ibp.fr>) which is itself based on
|
||||||
.BR mkfs
|
.BR mkfs
|
||||||
(written by Linus Torvalds - <torvalds@cs.helsinki.fi>).
|
(written by Linus Torvalds - <torvalds@cs.helsinki.fi>).
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR dosfsck (8),
|
.BR dosfsck (8),
|
||||||
|
|||||||
10
src/boot.c
10
src/boot.c
@ -62,7 +62,7 @@ static char *get_media_descr( unsigned char media )
|
|||||||
static void dump_boot(DOS_FS *fs,struct boot_sector *b,unsigned lss)
|
static void dump_boot(DOS_FS *fs,struct boot_sector *b,unsigned lss)
|
||||||
{
|
{
|
||||||
unsigned short sectors;
|
unsigned short sectors;
|
||||||
|
|
||||||
printf("Boot sector contents:\n");
|
printf("Boot sector contents:\n");
|
||||||
if (!atari_format) {
|
if (!atari_format) {
|
||||||
char id[9];
|
char id[9];
|
||||||
@ -148,7 +148,7 @@ static void check_backup_boot(DOS_FS *fs, struct boot_sector *b, int lss)
|
|||||||
}
|
}
|
||||||
else return;
|
else return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fs_read(fs->backupboot_start,sizeof(b2),&b2);
|
fs_read(fs->backupboot_start,sizeof(b2),&b2);
|
||||||
if (memcmp(b,&b2,sizeof(b2)) != 0) {
|
if (memcmp(b,&b2,sizeof(b2)) != 0) {
|
||||||
/* there are any differences */
|
/* there are any differences */
|
||||||
@ -233,10 +233,10 @@ static void read_fsinfo(DOS_FS *fs, struct boot_sector *b,int lss)
|
|||||||
}
|
}
|
||||||
else return;
|
else return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fs->fsinfo_start = CF_LE_W(b->info_sector)*lss;
|
fs->fsinfo_start = CF_LE_W(b->info_sector)*lss;
|
||||||
fs_read(fs->fsinfo_start,sizeof(i),&i);
|
fs_read(fs->fsinfo_start,sizeof(i),&i);
|
||||||
|
|
||||||
if (i.magic != CT_LE_L(0x41615252) ||
|
if (i.magic != CT_LE_L(0x41615252) ||
|
||||||
i.signature != CT_LE_L(0x61417272) ||
|
i.signature != CT_LE_L(0x61417272) ||
|
||||||
i.boot_sign != CT_LE_W(0xaa55)) {
|
i.boot_sign != CT_LE_W(0xaa55)) {
|
||||||
@ -322,7 +322,7 @@ void read_boot(DOS_FS *fs)
|
|||||||
|
|
||||||
fs->backupboot_start = CF_LE_W(b.backup_boot)*logical_sector_size;
|
fs->backupboot_start = CF_LE_W(b.backup_boot)*logical_sector_size;
|
||||||
check_backup_boot(fs,&b,logical_sector_size);
|
check_backup_boot(fs,&b,logical_sector_size);
|
||||||
|
|
||||||
read_fsinfo(fs,&b,logical_sector_size);
|
read_fsinfo(fs,&b,logical_sector_size);
|
||||||
}
|
}
|
||||||
else if (!atari_format) {
|
else if (!atari_format) {
|
||||||
|
|||||||
10
src/check.c
10
src/check.c
@ -69,7 +69,7 @@ loff_t alloc_rootdir_entry(DOS_FS *fs, DIR_ENT *de, const char *pattern)
|
|||||||
int i = 0, got = 0;
|
int i = 0, got = 0;
|
||||||
unsigned long clu_num, prev = 0;
|
unsigned long clu_num, prev = 0;
|
||||||
loff_t offset2;
|
loff_t offset2;
|
||||||
|
|
||||||
clu_num = fs->root_cluster;
|
clu_num = fs->root_cluster;
|
||||||
offset = cluster_start(fs,clu_num);
|
offset = cluster_start(fs,clu_num);
|
||||||
while (clu_num > 0 && clu_num != -1) {
|
while (clu_num > 0 && clu_num != -1) {
|
||||||
@ -226,7 +226,7 @@ static int bad_name(unsigned char *name)
|
|||||||
* of OS/2. */
|
* of OS/2. */
|
||||||
if (strncmp(name,"EA DATA SF",11) == 0 ||
|
if (strncmp(name,"EA DATA SF",11) == 0 ||
|
||||||
strncmp(name,"WP ROOT SF",11) == 0) return 0;
|
strncmp(name,"WP ROOT SF",11) == 0) return 0;
|
||||||
|
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < 8; i++) {
|
||||||
if (name[i] < ' ' || name[i] == 0x7f) return 1;
|
if (name[i] < ' ' || name[i] == 0x7f) return 1;
|
||||||
if (name[i] > 0x7f) ++suspicious;
|
if (name[i] > 0x7f) ++suspicious;
|
||||||
@ -262,7 +262,7 @@ static int bad_name(unsigned char *name)
|
|||||||
/* Under GEMDOS, chars >= 128 are never allowed. */
|
/* Under GEMDOS, chars >= 128 are never allowed. */
|
||||||
if (atari_format && suspicious)
|
if (atari_format && suspicious)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* Only complain about too much suspicious chars in interactive mode,
|
/* Only complain about too much suspicious chars in interactive mode,
|
||||||
* never correct them automatically. The chars are all basically ok, so we
|
* never correct them automatically. The chars are all basically ok, so we
|
||||||
* shouldn't auto-correct such names. */
|
* shouldn't auto-correct such names. */
|
||||||
@ -288,7 +288,7 @@ static void truncate_file(DOS_FS *fs,DOS_FILE *file,unsigned long clusters)
|
|||||||
{
|
{
|
||||||
int deleting;
|
int deleting;
|
||||||
unsigned long walk,next,prev;
|
unsigned long walk,next,prev;
|
||||||
|
|
||||||
walk = FSTART(file,fs);
|
walk = FSTART(file,fs);
|
||||||
prev = 0;
|
prev = 0;
|
||||||
if ((deleting = !clusters)) MODIFY_START(file,0,fs);
|
if ((deleting = !clusters)) MODIFY_START(file,0,fs);
|
||||||
@ -735,7 +735,7 @@ static void undelete(DOS_FS *fs,DOS_FILE *file)
|
|||||||
if (left)
|
if (left)
|
||||||
printf("Warning: Did only undelete %lu of %lu cluster%s.\n",clusters-left,
|
printf("Warning: Did only undelete %lu of %lu cluster%s.\n",clusters-left,
|
||||||
clusters,clusters == 1 ? "" : "s");
|
clusters,clusters == 1 ? "" : "s");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -87,7 +87,7 @@ int main(int argc,char **argv)
|
|||||||
int rw,salvage_files,verify,c;
|
int rw,salvage_files,verify,c;
|
||||||
unsigned n_files_check=0, n_files_verify=0;
|
unsigned n_files_check=0, n_files_verify=0;
|
||||||
unsigned long free_clusters;
|
unsigned long free_clusters;
|
||||||
|
|
||||||
rw = salvage_files = verify = 0;
|
rw = salvage_files = verify = 0;
|
||||||
interactive = 1;
|
interactive = 1;
|
||||||
check_atari();
|
check_atari();
|
||||||
|
|||||||
@ -57,7 +57,7 @@ struct boot_sector {
|
|||||||
__u16 heads; /* number of heads */
|
__u16 heads; /* number of heads */
|
||||||
__u32 hidden; /* hidden sectors (unused) */
|
__u32 hidden; /* hidden sectors (unused) */
|
||||||
__u32 total_sect; /* number of sectors (if sectors == 0) */
|
__u32 total_sect; /* number of sectors (if sectors == 0) */
|
||||||
|
|
||||||
/* The following fields are only used by FAT32 */
|
/* The following fields are only used by FAT32 */
|
||||||
__u32 fat32_length; /* sectors/FAT */
|
__u32 fat32_length; /* sectors/FAT */
|
||||||
__u16 flags; /* bit 8: fat mirroring, low 4: active fat */
|
__u16 flags; /* bit 8: fat mirroring, low 4: active fat */
|
||||||
|
|||||||
2
src/io.c
2
src/io.c
@ -57,7 +57,7 @@ static loff_t llseek( int fd, loff_t offset, int whence )
|
|||||||
void fs_open(char *path,int rw)
|
void fs_open(char *path,int rw)
|
||||||
{
|
{
|
||||||
struct stat stbuf;
|
struct stat stbuf;
|
||||||
|
|
||||||
if ((fd = open(path,rw ? O_RDWR : O_RDONLY)) < 0)
|
if ((fd = open(path,rw ? O_RDWR : O_RDONLY)) < 0)
|
||||||
pdie("open %s",path);
|
pdie("open %s",path);
|
||||||
changes = last = NULL;
|
changes = last = NULL;
|
||||||
|
|||||||
@ -61,7 +61,7 @@ static unsigned char fat_uni2esc[64] = {
|
|||||||
copy_lfn_part( __part_uni, lfn ); \
|
copy_lfn_part( __part_uni, lfn ); \
|
||||||
cnv_unicode( __part_uni, CHARS_PER_LFN, 0 ); \
|
cnv_unicode( __part_uni, CHARS_PER_LFN, 0 ); \
|
||||||
})
|
})
|
||||||
|
|
||||||
/* Convert name parts collected so far (from previous slots) from unicode to
|
/* Convert name parts collected so far (from previous slots) from unicode to
|
||||||
* ASCII */
|
* ASCII */
|
||||||
#define CNV_PARTS_SO_FAR() \
|
#define CNV_PARTS_SO_FAR() \
|
||||||
@ -76,7 +76,7 @@ static char *cnv_unicode( const unsigned char *uni, int maxlen, int use_q )
|
|||||||
const unsigned char *up;
|
const unsigned char *up;
|
||||||
unsigned char *out, *cp;
|
unsigned char *out, *cp;
|
||||||
int len, val;
|
int len, val;
|
||||||
|
|
||||||
for( len = 0, up = uni; (up-uni)/2 < maxlen && (up[0] || up[1]); up += 2 ){
|
for( len = 0, up = uni; (up-uni)/2 < maxlen && (up[0] || up[1]); up += 2 ){
|
||||||
if (UNICODE_CONVERTABLE(up[0],up[1]))
|
if (UNICODE_CONVERTABLE(up[0],up[1]))
|
||||||
++len;
|
++len;
|
||||||
@ -125,7 +125,7 @@ static void clear_lfn_slots( int start, int end )
|
|||||||
*/
|
*/
|
||||||
memset( &empty, 0, sizeof(empty) );
|
memset( &empty, 0, sizeof(empty) );
|
||||||
empty.id = DELETED_FLAG;
|
empty.id = DELETED_FLAG;
|
||||||
|
|
||||||
for( i = start; i <= end; ++i ) {
|
for( i = start; i <= end; ++i ) {
|
||||||
fs_write( lfn_offsets[i], sizeof(LFN_ENT), &empty );
|
fs_write( lfn_offsets[i], sizeof(LFN_ENT), &empty );
|
||||||
}
|
}
|
||||||
@ -362,7 +362,7 @@ char *lfn_get( DIR_ENT *de )
|
|||||||
char *lfn;
|
char *lfn;
|
||||||
__u8 sum;
|
__u8 sum;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (de->attr == VFAT_LN_ATTR)
|
if (de->attr == VFAT_LN_ATTR)
|
||||||
die("lfn_get called with LFN directory entry");
|
die("lfn_get called with LFN directory entry");
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
- New options -A, -S, -C
|
- New options -A, -S, -C
|
||||||
- Support for filesystems > 2GB
|
- Support for filesystems > 2GB
|
||||||
- FAT32 support
|
- FAT32 support
|
||||||
|
|
||||||
Copying: Copyright 1993, 1994 David Hudson (dave@humbug.demon.co.uk)
|
Copying: Copyright 1993, 1994 David Hudson (dave@humbug.demon.co.uk)
|
||||||
|
|
||||||
Portions copyright 1992, 1993 Remy Card (card@masi.ibp.fr)
|
Portions copyright 1992, 1993 Remy Card (card@masi.ibp.fr)
|
||||||
@ -85,7 +85,7 @@
|
|||||||
#define CT_LE_W(v) CF_LE_W(v)
|
#define CT_LE_W(v) CF_LE_W(v)
|
||||||
#define CT_LE_L(v) CF_LE_L(v)
|
#define CT_LE_L(v) CF_LE_L(v)
|
||||||
#endif /* defined(__le16_to_cpu) */
|
#endif /* defined(__le16_to_cpu) */
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define CF_LE_W(v) (v)
|
#define CF_LE_W(v) (v)
|
||||||
@ -604,7 +604,7 @@ establish_params (int device_num,int size)
|
|||||||
case 720:
|
case 720:
|
||||||
param.sect = 9 ;
|
param.sect = 9 ;
|
||||||
param.head = 2;
|
param.head = 2;
|
||||||
break;
|
break;
|
||||||
case 1440:
|
case 1440:
|
||||||
param.sect = 9;
|
param.sect = 9;
|
||||||
param.head = 2;
|
param.head = 2;
|
||||||
@ -627,7 +627,7 @@ establish_params (int device_num,int size)
|
|||||||
param.head = 64;
|
param.head = 64;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else /* is a floppy diskette */
|
else /* is a floppy diskette */
|
||||||
{
|
{
|
||||||
@ -658,7 +658,7 @@ establish_params (int device_num,int size)
|
|||||||
bs.dir_entries[0] = (char) 224;
|
bs.dir_entries[0] = (char) 224;
|
||||||
bs.dir_entries[1] = (char) 0;
|
bs.dir_entries[1] = (char) 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5760: /* 3.5", 2, 36, 80 - 2880K */
|
case 5760: /* 3.5", 2, 36, 80 - 2880K */
|
||||||
bs.media = (char) 0xf0;
|
bs.media = (char) 0xf0;
|
||||||
bs.cluster_size = (char) 2;
|
bs.cluster_size = (char) 2;
|
||||||
@ -683,7 +683,7 @@ establish_params (int device_num,int size)
|
|||||||
}
|
}
|
||||||
else if ((device_num & 0xff00) == 0x0700) /* This is a loop device */
|
else if ((device_num & 0xff00) == 0x0700) /* This is a loop device */
|
||||||
{
|
{
|
||||||
if (ioctl (dev, BLKGETSIZE, &loop_size))
|
if (ioctl (dev, BLKGETSIZE, &loop_size))
|
||||||
die ("unable to get loop device size");
|
die ("unable to get loop device size");
|
||||||
|
|
||||||
switch (loop_size) /* Assuming the loop device -> floppy later */
|
switch (loop_size) /* Assuming the loop device -> floppy later */
|
||||||
@ -714,7 +714,7 @@ establish_params (int device_num,int size)
|
|||||||
bs.dir_entries[0] = (char) 224;
|
bs.dir_entries[0] = (char) 224;
|
||||||
bs.dir_entries[1] = (char) 0;
|
bs.dir_entries[1] = (char) 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5760: /* 3.5", 2, 36, 80 - 2880K */
|
case 5760: /* 3.5", 2, 36, 80 - 2880K */
|
||||||
bs.secs_track = CF_LE_W(36);
|
bs.secs_track = CF_LE_W(36);
|
||||||
bs.heads = CF_LE_W(2);
|
bs.heads = CF_LE_W(2);
|
||||||
@ -796,7 +796,7 @@ setup_tables (void)
|
|||||||
unsigned fatdata; /* Sectors for FATs + data area */
|
unsigned fatdata; /* Sectors for FATs + data area */
|
||||||
struct tm *ctime;
|
struct tm *ctime;
|
||||||
struct msdos_volume_info *vi = (size_fat == 32 ? &bs.fat32.vi : &bs.oldfat.vi);
|
struct msdos_volume_info *vi = (size_fat == 32 ? &bs.fat32.vi : &bs.oldfat.vi);
|
||||||
|
|
||||||
if (atari_format)
|
if (atari_format)
|
||||||
/* On Atari, the first few bytes of the boot sector are assigned
|
/* On Atari, the first few bytes of the boot sector are assigned
|
||||||
* differently: The jump code is only 2 bytes (and m68k machine code
|
* differently: The jump code is only 2 bytes (and m68k machine code
|
||||||
@ -836,7 +836,7 @@ setup_tables (void)
|
|||||||
|
|
||||||
if (!atari_format) {
|
if (!atari_format) {
|
||||||
memcpy(vi->volume_label, volume_name, 11);
|
memcpy(vi->volume_label, volume_name, 11);
|
||||||
|
|
||||||
memcpy(bs.boot_jump, dummy_boot_jump, 3);
|
memcpy(bs.boot_jump, dummy_boot_jump, 3);
|
||||||
/* Patch in the correct offset to the boot code */
|
/* Patch in the correct offset to the boot code */
|
||||||
bs.boot_jump[1] = ((size_fat == 32 ?
|
bs.boot_jump[1] = ((size_fat == 32 ?
|
||||||
@ -892,7 +892,7 @@ setup_tables (void)
|
|||||||
unsigned maxclust12, maxclust16, maxclust32;
|
unsigned maxclust12, maxclust16, maxclust32;
|
||||||
unsigned clust12, clust16, clust32;
|
unsigned clust12, clust16, clust32;
|
||||||
int maxclustsize;
|
int maxclustsize;
|
||||||
|
|
||||||
fatdata = num_sectors - cdiv (root_dir_entries * 32, sector_size) -
|
fatdata = num_sectors - cdiv (root_dir_entries * 32, sector_size) -
|
||||||
reserved_sectors;
|
reserved_sectors;
|
||||||
|
|
||||||
@ -1040,14 +1040,14 @@ setup_tables (void)
|
|||||||
bs.fat32.fat32_length = CT_LE_L(fatlength32);
|
bs.fat32.fat32_length = CT_LE_L(fatlength32);
|
||||||
memcpy(vi->fs_type, MSDOS_FAT32_SIGN, 8);
|
memcpy(vi->fs_type, MSDOS_FAT32_SIGN, 8);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
die("FAT not 12, 16 or 32 bits");
|
die("FAT not 12, 16 or 32 bits");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
unsigned clusters, maxclust;
|
unsigned clusters, maxclust;
|
||||||
|
|
||||||
/* GEMDOS always uses a 12 bit FAT on floppies, and always a 16 bit FAT on
|
/* GEMDOS always uses a 12 bit FAT on floppies, and always a 16 bit FAT on
|
||||||
* hard disks. So use 12 bit if the size of the file system suggests that
|
* hard disks. So use 12 bit if the size of the file system suggests that
|
||||||
* this fs is for a floppy disk, if the user hasn't explicitly requested a
|
* this fs is for a floppy disk, if the user hasn't explicitly requested a
|
||||||
@ -1093,7 +1093,7 @@ setup_tables (void)
|
|||||||
if (verbose >= 2)
|
if (verbose >= 2)
|
||||||
printf( "ss=%d: #clu=%d, fat_len=%d, maxclu=%d\n",
|
printf( "ss=%d: #clu=%d, fat_len=%d, maxclu=%d\n",
|
||||||
sector_size, clusters, fat_length, maxclust );
|
sector_size, clusters, fat_length, maxclust );
|
||||||
|
|
||||||
/* last 10 cluster numbers are special (except FAT32: 4 high bits rsvd);
|
/* last 10 cluster numbers are special (except FAT32: 4 high bits rsvd);
|
||||||
* first two numbers are reserved */
|
* first two numbers are reserved */
|
||||||
if (maxclust <= (size_fat == 32 ? MAX_CLUST_32 : (1<<size_fat)-0x10) &&
|
if (maxclust <= (size_fat == 32 ? MAX_CLUST_32 : (1<<size_fat)-0x10) &&
|
||||||
@ -1110,7 +1110,7 @@ setup_tables (void)
|
|||||||
num_sectors >>= 1;
|
num_sectors >>= 1;
|
||||||
sector_size <<= 1;
|
sector_size <<= 1;
|
||||||
} while( sector_size <= GEMDOS_MAX_SECTOR_SIZE );
|
} while( sector_size <= GEMDOS_MAX_SECTOR_SIZE );
|
||||||
|
|
||||||
if (sector_size > GEMDOS_MAX_SECTOR_SIZE)
|
if (sector_size > GEMDOS_MAX_SECTOR_SIZE)
|
||||||
die( "Would need a sector size > 16k, which GEMDOS can't work with");
|
die( "Would need a sector size > 16k, which GEMDOS can't work with");
|
||||||
|
|
||||||
@ -1150,7 +1150,7 @@ setup_tables (void)
|
|||||||
bs.fat32.backup_boot = CT_LE_W(backup_boot);
|
bs.fat32.backup_boot = CT_LE_W(backup_boot);
|
||||||
memset( &bs.fat32.reserved2, 0, sizeof(bs.fat32.reserved2) );
|
memset( &bs.fat32.reserved2, 0, sizeof(bs.fat32.reserved2) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (atari_format) {
|
if (atari_format) {
|
||||||
/* Just some consistency checks */
|
/* Just some consistency checks */
|
||||||
if (num_sectors >= GEMDOS_MAX_SECTORS)
|
if (num_sectors >= GEMDOS_MAX_SECTORS)
|
||||||
@ -1184,7 +1184,7 @@ setup_tables (void)
|
|||||||
die ("Attempting to create a too large file system");
|
die ("Attempting to create a too large file system");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* The two following vars are in hard sectors, i.e. 512 byte sectors! */
|
/* The two following vars are in hard sectors, i.e. 512 byte sectors! */
|
||||||
start_data_sector = (reserved_sectors + nr_fats * fat_length) *
|
start_data_sector = (reserved_sectors + nr_fats * fat_length) *
|
||||||
(sector_size/HARD_SECTOR_SIZE);
|
(sector_size/HARD_SECTOR_SIZE);
|
||||||
@ -1198,7 +1198,7 @@ setup_tables (void)
|
|||||||
{
|
{
|
||||||
printf("%s has %d head%s and %d sector%s per track,\n",
|
printf("%s has %d head%s and %d sector%s per track,\n",
|
||||||
device_name, CF_LE_W(bs.heads), (CF_LE_W(bs.heads) != 1) ? "s" : "",
|
device_name, CF_LE_W(bs.heads), (CF_LE_W(bs.heads) != 1) ? "s" : "",
|
||||||
CF_LE_W(bs.secs_track), (CF_LE_W(bs.secs_track) != 1) ? "s" : "");
|
CF_LE_W(bs.secs_track), (CF_LE_W(bs.secs_track) != 1) ? "s" : "");
|
||||||
printf("logical sector size is %d,\n",sector_size);
|
printf("logical sector size is %d,\n",sector_size);
|
||||||
printf("using 0x%02x media descriptor, with %d sectors;\n",
|
printf("using 0x%02x media descriptor, with %d sectors;\n",
|
||||||
(int) (bs.media), num_sectors);
|
(int) (bs.media), num_sectors);
|
||||||
@ -1270,7 +1270,7 @@ setup_tables (void)
|
|||||||
if (size_fat == 32) {
|
if (size_fat == 32) {
|
||||||
/* For FAT32, create an info sector */
|
/* For FAT32, create an info sector */
|
||||||
struct fat32_fsinfo *info;
|
struct fat32_fsinfo *info;
|
||||||
|
|
||||||
if (!(info_sector = malloc( sector_size )))
|
if (!(info_sector = malloc( sector_size )))
|
||||||
die("Out of memory");
|
die("Out of memory");
|
||||||
memset(info_sector, 0, sector_size);
|
memset(info_sector, 0, sector_size);
|
||||||
@ -1292,7 +1292,7 @@ setup_tables (void)
|
|||||||
/* Info sector also must have boot sign */
|
/* Info sector also must have boot sign */
|
||||||
*(__u16 *)(info_sector + 0x1fe) = CT_LE_W(BOOT_SIGN);
|
*(__u16 *)(info_sector + 0x1fe) = CT_LE_W(BOOT_SIGN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(blank_sector = malloc( sector_size )))
|
if (!(blank_sector = malloc( sector_size )))
|
||||||
die( "Out of memory" );
|
die( "Out of memory" );
|
||||||
memset(blank_sector, 0, sector_size);
|
memset(blank_sector, 0, sector_size);
|
||||||
@ -1423,7 +1423,7 @@ main (int argc, char **argv)
|
|||||||
int create = 0;
|
int create = 0;
|
||||||
unsigned long long cblocks;
|
unsigned long long cblocks;
|
||||||
int min_sector_size;
|
int min_sector_size;
|
||||||
|
|
||||||
if (argc && *argv) { /* What's the program name? */
|
if (argc && *argv) { /* What's the program name? */
|
||||||
char *p;
|
char *p;
|
||||||
program_name = *argv;
|
program_name = *argv;
|
||||||
@ -1434,7 +1434,7 @@ main (int argc, char **argv)
|
|||||||
time(&create_time);
|
time(&create_time);
|
||||||
volume_id = (long)create_time; /* Default volume ID = creation time */
|
volume_id = (long)create_time; /* Default volume ID = creation time */
|
||||||
check_atari();
|
check_atari();
|
||||||
|
|
||||||
printf ("%s " VERSION " (" VERSION_DATE ")\n",
|
printf ("%s " VERSION " (" VERSION_DATE ")\n",
|
||||||
program_name);
|
program_name);
|
||||||
|
|
||||||
@ -1454,7 +1454,7 @@ main (int argc, char **argv)
|
|||||||
usage ();
|
usage ();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'c': /* c : Check FS as we build it */
|
case 'c': /* c : Check FS as we build it */
|
||||||
check = TRUE;
|
check = TRUE;
|
||||||
break;
|
break;
|
||||||
@ -1566,10 +1566,10 @@ main (int argc, char **argv)
|
|||||||
while( i < BOOTCODE_SIZE-1 )
|
while( i < BOOTCODE_SIZE-1 )
|
||||||
dummy_boot_code[i++] = '\0';
|
dummy_boot_code[i++] = '\0';
|
||||||
dummy_boot_code[BOOTCODE_SIZE-1] = '\0'; /* Just in case */
|
dummy_boot_code[BOOTCODE_SIZE-1] = '\0'; /* Just in case */
|
||||||
|
|
||||||
if ( ch != EOF )
|
if ( ch != EOF )
|
||||||
printf ("Warning: message too long; truncated\n");
|
printf ("Warning: message too long; truncated\n");
|
||||||
|
|
||||||
if ( msgfile != stdin )
|
if ( msgfile != stdin )
|
||||||
fclose(msgfile);
|
fclose(msgfile);
|
||||||
}
|
}
|
||||||
@ -1596,7 +1596,7 @@ main (int argc, char **argv)
|
|||||||
usage ();
|
usage ();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 's': /* s : Sectors per cluster */
|
case 's': /* s : Sectors per cluster */
|
||||||
sectors_per_cluster = (int) strtol (optarg, &tmp, 0);
|
sectors_per_cluster = (int) strtol (optarg, &tmp, 0);
|
||||||
if (*tmp || (sectors_per_cluster != 1 && sectors_per_cluster != 2
|
if (*tmp || (sectors_per_cluster != 1 && sectors_per_cluster != 2
|
||||||
@ -1625,7 +1625,7 @@ main (int argc, char **argv)
|
|||||||
case 'v': /* v : Verbose execution */
|
case 'v': /* v : Verbose execution */
|
||||||
++verbose;
|
++verbose;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf( "Unknown option: %c\n", c );
|
printf( "Unknown option: %c\n", c );
|
||||||
usage ();
|
usage ();
|
||||||
@ -1694,7 +1694,7 @@ main (int argc, char **argv)
|
|||||||
if (llseek( dev, 0, SEEK_SET ) != 0)
|
if (llseek( dev, 0, SEEK_SET ) != 0)
|
||||||
die( "seek failed" );
|
die( "seek failed" );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fstat (dev, &statbuf) < 0)
|
if (fstat (dev, &statbuf) < 0)
|
||||||
die ("unable to stat %s");
|
die ("unable to stat %s");
|
||||||
if (!S_ISBLK (statbuf.st_mode)) {
|
if (!S_ISBLK (statbuf.st_mode)) {
|
||||||
@ -1736,11 +1736,11 @@ main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sector_size > 4096)
|
if (sector_size > 4096)
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Warning: sector size is set to %d > 4096, such filesystem will not propably mount\n",
|
"Warning: sector size is set to %d > 4096, such filesystem will not propably mount\n",
|
||||||
sector_size);
|
sector_size);
|
||||||
|
|
||||||
establish_params (statbuf.st_rdev,statbuf.st_size);
|
establish_params (statbuf.st_rdev,statbuf.st_size);
|
||||||
/* Establish the media parameters */
|
/* Establish the media parameters */
|
||||||
|
|
||||||
setup_tables (); /* Establish the file system tables */
|
setup_tables (); /* Establish the file system tables */
|
||||||
|
|||||||
@ -5,4 +5,3 @@
|
|||||||
#define VERSION_DATE "12 Mar 2005"
|
#define VERSION_DATE "12 Mar 2005"
|
||||||
|
|
||||||
#endif /* _version_h */
|
#endif /* _version_h */
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user