odc.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /* cpio.c - cpio and tar filesystem. */
  2. /*
  3. * GRUB -- GRand Unified Bootloader
  4. * Copyright (C) 2007,2008,2009,2013 Free Software Foundation, Inc.
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #include <grub/misc.h>
  20. #define ALIGN_CPIO(x) x
  21. #define MAGIC "070707"
  22. struct head
  23. {
  24. char magic[6];
  25. char dev[6];
  26. char ino[6];
  27. char mode[6];
  28. char uid[6];
  29. char gid[6];
  30. char nlink[6];
  31. char rdev[6];
  32. char mtime[11];
  33. char namesize[6];
  34. char filesize[11];
  35. } GRUB_PACKED;
  36. static inline unsigned long long
  37. read_number (const char *str, grub_size_t size)
  38. {
  39. unsigned long long ret = 0;
  40. while (size-- && *str >= '0' && *str <= '7')
  41. ret = (ret << 3) | (*str++ & 0xf);
  42. return ret;
  43. }
  44. #define FSNAME "odc"
  45. #include "cpio_common.c"
  46. GRUB_MOD_INIT (odc)
  47. {
  48. grub_fs_register (&grub_cpio_fs);
  49. }
  50. GRUB_MOD_FINI (odc)
  51. {
  52. grub_fs_unregister (&grub_cpio_fs);
  53. }