Definitions.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright (c) 2022, Undefine <undefine@undefine.pl>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/DOSPackedTime.h>
  8. #include <AK/EnumBits.h>
  9. #include <AK/Types.h>
  10. #include <Kernel/API/FileSystem/FATStructures.h>
  11. #include <Kernel/Library/KBuffer.h>
  12. namespace Kernel {
  13. enum DOSBIOSParameterBlockVersion {
  14. DOS_BPB_UNKNOWN,
  15. DOS_BPB_3, // Version 3.4.
  16. DOS_BPB_4, // Version 4.0
  17. DOS_BPB_7 // Version 7.0
  18. };
  19. enum class FATVersion {
  20. FAT12,
  21. FAT16,
  22. FAT32,
  23. };
  24. enum class FATAttributes : u8 {
  25. ReadOnly = 0x01,
  26. Hidden = 0x02,
  27. System = 0x04,
  28. VolumeID = 0x08,
  29. Directory = 0x10,
  30. Archive = 0x20,
  31. LongFileName = 0x0F
  32. };
  33. AK_ENUM_BITWISE_OPERATORS(FATAttributes);
  34. struct [[gnu::packed]] FATEntry {
  35. char filename[8];
  36. char extension[3];
  37. FATAttributes attributes;
  38. u8 unused1;
  39. u8 creation_time_seconds;
  40. DOSPackedTime creation_time;
  41. DOSPackedDate creation_date;
  42. DOSPackedDate last_accessed_date;
  43. u16 first_cluster_high;
  44. DOSPackedTime modification_time;
  45. DOSPackedDate modification_date;
  46. u16 first_cluster_low;
  47. u32 file_size;
  48. };
  49. static_assert(AssertSize<FATEntry, 32>());
  50. struct [[gnu::packed]] FATLongFileNameEntry {
  51. u8 entry_index;
  52. u16 characters1[5];
  53. FATAttributes attributes;
  54. u8 entry_type;
  55. u8 checksum;
  56. u16 characters2[6];
  57. u16 zero;
  58. u16 characters3[2];
  59. };
  60. static_assert(AssertSize<FATLongFileNameEntry, 32>());
  61. }