ext2fs.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * GRUB -- GRand Unified Bootloader
  3. * Copyright (C) 2000, 2001 Free Software Foundation, Inc.
  4. *
  5. * (C) Copyright 2003 Sysgo Real-Time Solutions, AG <www.elinos.com>
  6. * Pavel Bartusek <pba@sysgo.de>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. */
  22. /* An implementation for the Ext2FS filesystem ported from GRUB.
  23. * Some parts of this code (mainly the structures and defines) are
  24. * from the original ext2 fs code, as found in the linux kernel.
  25. */
  26. #define SECTOR_SIZE 0x200
  27. #define SECTOR_BITS 9
  28. /* Error codes */
  29. typedef enum
  30. {
  31. ERR_NONE = 0,
  32. ERR_BAD_FILENAME,
  33. ERR_BAD_FILETYPE,
  34. ERR_BAD_GZIP_DATA,
  35. ERR_BAD_GZIP_HEADER,
  36. ERR_BAD_PART_TABLE,
  37. ERR_BAD_VERSION,
  38. ERR_BELOW_1MB,
  39. ERR_BOOT_COMMAND,
  40. ERR_BOOT_FAILURE,
  41. ERR_BOOT_FEATURES,
  42. ERR_DEV_FORMAT,
  43. ERR_DEV_VALUES,
  44. ERR_EXEC_FORMAT,
  45. ERR_FILELENGTH,
  46. ERR_FILE_NOT_FOUND,
  47. ERR_FSYS_CORRUPT,
  48. ERR_FSYS_MOUNT,
  49. ERR_GEOM,
  50. ERR_NEED_LX_KERNEL,
  51. ERR_NEED_MB_KERNEL,
  52. ERR_NO_DISK,
  53. ERR_NO_PART,
  54. ERR_NUMBER_PARSING,
  55. ERR_OUTSIDE_PART,
  56. ERR_READ,
  57. ERR_SYMLINK_LOOP,
  58. ERR_UNRECOGNIZED,
  59. ERR_WONT_FIT,
  60. ERR_WRITE,
  61. ERR_BAD_ARGUMENT,
  62. ERR_UNALIGNED,
  63. ERR_PRIVILEGED,
  64. ERR_DEV_NEED_INIT,
  65. ERR_NO_DISK_SPACE,
  66. ERR_NUMBER_OVERFLOW,
  67. MAX_ERR_NUM
  68. } ext2fs_error_t;
  69. extern int ext2fs_set_blk_dev(block_dev_desc_t *rbdd, int part);
  70. extern int ext2fs_ls (char *dirname);
  71. extern int ext2fs_open (char *filename);
  72. extern int ext2fs_read (char *buf, unsigned len);
  73. extern int ext2fs_mount (unsigned part_length);
  74. extern int ext2fs_close(void);