summaryrefslogtreecommitdiff
path: root/fs/fdos/fs.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2003-06-27 21:31:46 +0000
committerwdenk <wdenk>2003-06-27 21:31:46 +0000
commit8bde7f776c77b343aca29b8c7b58464d915ac245 (patch)
tree20f1fd99975215e7c658454a15cdb4ed4694e2d4 /fs/fdos/fs.c
parent993cad9364c6b87ae429d1ed1130d8153f6f027e (diff)
* Code cleanup:LABEL_2003_06_27_2340
- remove trailing white space, trailing empty lines, C++ comments, etc. - split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c) * Patches by Kenneth Johansson, 25 Jun 2003: - major rework of command structure (work done mostly by Michal Cendrowski and Joakim Kristiansen)
Diffstat (limited to 'fs/fdos/fs.c')
-rw-r--r--fs/fdos/fs.c58
1 files changed, 28 insertions, 30 deletions
diff --git a/fs/fdos/fs.c b/fs/fdos/fs.c
index 68bbde0e27c..3b9d09e4903 100644
--- a/fs/fdos/fs.c
+++ b/fs/fdos/fs.c
@@ -33,16 +33,16 @@
/*-----------------------------------------------------------------------------
- * fill_fs -- Read info on file system
+ * fill_fs -- Read info on file system
*-----------------------------------------------------------------------------
*/
static int fill_fs (BootSector_t *boot, Fs_t *fs)
{
-
+
fs -> fat_start = __le16_to_cpu (boot -> nrsvsect);
fs -> fat_len = __le16_to_cpu (boot -> fatlen);
fs -> nb_fat = boot -> nfat;
-
+
fs -> dir_start = fs -> fat_start + fs -> nb_fat * fs -> fat_len;
fs -> dir_len = __le16_to_cpu (boot -> dirents) * MDIR_SIZE / SZ_STD_SECTOR;
fs -> cluster_size = boot -> clsiz;
@@ -52,7 +52,7 @@ static int fill_fs (BootSector_t *boot, Fs_t *fs)
}
/*-----------------------------------------------------------------------------
- * fs_init --
+ * fs_init --
*-----------------------------------------------------------------------------
*/
int fs_init (Fs_t *fs)
@@ -61,60 +61,58 @@ int fs_init (Fs_t *fs)
/* Initialize physical device */
if (dev_open () < 0) {
- PRINTF ("Unable to initialize the fdc\n");
- return (-1);
+ PRINTF ("Unable to initialize the fdc\n");
+ return (-1);
}
init_subdir ();
-
+
/* Allocate space for read the boot sector */
if ((boot = (BootSector_t *)malloc (sizeof (BootSector_t))) == NULL) {
- PRINTF ("Unable to allocate space for boot sector\n");
- return (-1);
+ PRINTF ("Unable to allocate space for boot sector\n");
+ return (-1);
}
-
+
/* read boot sector */
if (dev_read (boot, 0, 1)){
- PRINTF ("Error during boot sector read\n");
- free (boot);
- return (-1);
+ PRINTF ("Error during boot sector read\n");
+ free (boot);
+ return (-1);
}
/* we verify it'a a DOS diskette */
if (boot -> jump [0] != JUMP_0_1 && boot -> jump [0] != JUMP_0_2) {
- PRINTF ("Not a DOS diskette\n");
- free (boot);
- return (-1);
+ PRINTF ("Not a DOS diskette\n");
+ free (boot);
+ return (-1);
}
if (boot -> descr < MEDIA_STD) {
- /* We handle only recent medias (type F0) */
- PRINTF ("unrecognized diskette type\n");
- free (boot);
- return (-1);
+ /* We handle only recent medias (type F0) */
+ PRINTF ("unrecognized diskette type\n");
+ free (boot);
+ return (-1);
}
if (check_dev (boot, fs) < 0) {
- PRINTF ("Bad diskette\n");
- free (boot);
- return (-1);
+ PRINTF ("Bad diskette\n");
+ free (boot);
+ return (-1);
}
-
+
if (fill_fs (boot, fs) < 0) {
- free (boot);
+ free (boot);
- return (-1);
+ return (-1);
}
/* Read FAT */
if (read_fat (boot, fs) < 0) {
- free (boot);
- return (-1);
+ free (boot);
+ return (-1);
}
free (boot);
return (0);
}
-
-
#endif