libfusefdc: reformatted UDI i/o code
[zymosis.git] / src / libfusefdc / trdos.h
blob5c8328b8688d591c5a988f5731a8f14c829a3126
1 /* trdos.h: Routines for handling the TR-DOS filesystem
2 Copyright (c) 2016 Sergio BaldovĂ­
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 Author contact information:
20 E-mail: serbalgi@gmail.com
23 #ifndef FUSE_TRDOS_H
24 #define FUSE_TRDOS_H
26 #include <stdint.h>
29 typedef struct trdos_spec_t {
30 uint8_t first_free_sector; /* 0 to 15 */
31 uint8_t first_free_track; /* 0 to ? */
32 uint8_t disk_type;
33 uint8_t file_count;
34 uint16_t free_sectors;
35 uint8_t id;
36 char password[9]; /* not null-terminated */
37 uint8_t deleted_files;
38 char disk_label[8]; /* not null-terminated */
39 } trdos_spec_t;
42 typedef struct trdos_dirent_t {
43 char filename[8]; /* not null-terminated */
44 char file_extension;
45 uint16_t param1;
46 uint16_t param2;
47 uint8_t file_length; /* in sectors */
48 uint8_t start_sector; /* 0 to 15 */
49 uint8_t start_track; /* 0 to ? */
50 } trdos_dirent_t;
53 typedef struct trdos_boot_info_t {
54 int have_boot_file;
55 int basic_files_count;
56 char first_basic_file[8]; /* not null-terminated */
57 } trdos_boot_info_t;
60 int trdos_read_spec (trdos_spec_t *spec, const uint8_t *src);
62 void trdos_write_spec (uint8_t *dest, const trdos_spec_t *spec);
64 int trdos_read_dirent (trdos_dirent_t *entry, const uint8_t *src);
66 void trdos_write_dirent (uint8_t *dest, const trdos_dirent_t *entry);
68 int trdos_read_fat (trdos_boot_info_t *info, const uint8_t *sectors, unsigned int seclen );
71 #endif