You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 regels
2.6 KiB

  1. #ifndef MAIN_H
  2. #define MAIN_H
  3. #define SPACE_MBR_RECORD 2048 /* Sectors*/
  4. #define SPACE_VBR_RECORD 2048 /* Sectors*/
  5. #define SIZE_FSCI_RECORD 1 /* Sectors*/
  6. #define DEFAULT_ENTRY_SIZE 1 /* Sectors*/
  7. #define SECTOR_SIZE 512 /* BYTES*/
  8. #define NUMBER_OF_MBR_PARTITIONS 4
  9. #define DEFAULT_FILE_SIZE 4 /* This is in sectors*/
  10. #define DEFAULT_DATA_POINTER_SIZE 4 /* This is in sectors*/
  11. #define DEFAULT_TABLE_SIZE 16
  12. #define NUM_DATA_POINTERS 27
  13. #include "std_singos/stdio.h"
  14. #include "std_singos/stdlib.h"
  15. #include "std_singos/string.h"
  16. #include "driver/disk.h"
  17. #include "implementation/lsfs.h"
  18. void dump_ax(input);
  19. void print_stack(argument);
  20. void print_newline();
  21. typedef struct Directory_Table Directory_Table;
  22. typedef struct Struct_Table_Entry Table_Entry;
  23. typedef struct struct_partition_control partition_control;
  24. typedef struct File_System_Control_Information FSCI;
  25. typedef struct meta_information_format mif;
  26. typedef struct tag_record tag_record;
  27. typedef struct Parameter_Struct Parameter_Struct;
  28. typedef enum Table_Entry_Kind
  29. {
  30. /* These are specific values since, is has to corrospond to the implementation in assembly*/
  31. ENTRY_EMPTY = 0,
  32. ENTRY_FILE = 1,
  33. ENTRY_DIRECTORY = 2,
  34. } Table_Entry_Kind;
  35. typedef enum Service_Action
  36. {
  37. SERIVCE_LOAD_DISK = 1,
  38. SERVICE_FIND_ENTRY = 2,
  39. SERIVCE_READ_DATA = 3,
  40. SERIVCE_WRITE_DATA = 4,
  41. } Service_Action;
  42. struct Struct_Table_Entry
  43. {
  44. char filename[256];
  45. long file_id[2];
  46. long file_size[2];
  47. void* ext_file_data_low;
  48. void* ext_file_data_high;
  49. long number_sector_s; /* <- Just try to remove the last undercore and compile . */
  50. short entry_kind;
  51. short extra_control_bits1;
  52. short extra_control_bits2;
  53. short extra_control_bits3;
  54. long table_entry_sector_index[2];
  55. long data_pointer[NUM_DATA_POINTERS * 2]; /* if it is a directory, the first pointer will be to the next table. */
  56. };
  57. struct File_System_Control_Information
  58. {
  59. char filesystem_information[256];
  60. long master_table_index[2];
  61. long this_partition_offset_on_disk[2];
  62. long next_free_sector[2];
  63. long next_uniqe_id[2]; /* both files and directories gets this. */
  64. long next_sector_reuse_pointer[2];
  65. long last_sector_index_on_partition[2];
  66. long maximum_sectors_on_disk[2];
  67. long sector_size_on_disk[2];
  68. long not_used[48];
  69. };
  70. typedef struct Directory_Table
  71. {
  72. Table_Entry entries[DEFAULT_TABLE_SIZE];
  73. };
  74. struct Parameter_Struct
  75. {
  76. char* path;
  77. char* new_path;
  78. int buffer_segment;
  79. int buffer_address;
  80. int buffer_size;
  81. int data_length;
  82. int byte_offset_into_file;
  83. Table_Entry_Kind entry_kind;
  84. };
  85. #endif