Debug.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*++
  2. Copyright (c) 2005, Intel Corporation
  3. All rights reserved. This program and the accompanying materials are licensed and made available
  4. under the terms and conditions of the BSD License which accompanies this
  5. distribution. The full text of the license may be found at
  6. http://opensource.org/licenses/bsd-license.php
  7. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  9. Module Name:
  10. debug.c
  11. Abstract:
  12. Debug functions for fat driver
  13. Revision History
  14. --*/
  15. #include "Fat.h"
  16. VOID
  17. FatDumpFatTable (
  18. IN FAT_VOLUME *Volume
  19. )
  20. /*++
  21. Routine Description:
  22. Dump all the FAT Entry of the FAT table in the volume
  23. Arguments:
  24. Volume - The volume whose FAT info will be dumped
  25. Returns:
  26. None
  27. --*/
  28. {
  29. UINTN EntryValue;
  30. UINTN MaxIndex;
  31. UINTN Index;
  32. CHAR16 *Pointer;
  33. MaxIndex = Volume->MaxCluster + 2;
  34. Print (L"Dump of Fat Table, MaxCluster %x\n", MaxIndex);
  35. for (Index = 0; Index < MaxIndex; Index++) {
  36. EntryValue = FatGetFatEntry (Volume, Index);
  37. if (EntryValue != FAT_CLUSTER_FREE) {
  38. Pointer = NULL;
  39. switch (EntryValue) {
  40. case FAT_CLUSTER_RESERVED:
  41. Pointer = L"RESREVED";
  42. break;
  43. case FAT_CLUSTER_BAD:
  44. Pointer = L"BAD";
  45. break;
  46. }
  47. if (FAT_END_OF_FAT_CHAIN (EntryValue)) {
  48. Pointer = L"LAST";
  49. }
  50. if (Pointer != NULL) {
  51. Print (L"Entry %x = %s\n", Index, Pointer);
  52. } else {
  53. Print (L"Entry %x = %x\n", Index, EntryValue);
  54. }
  55. }
  56. }
  57. }