procfs.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * GRUB -- GRand Unified Bootloader
  3. * Copyright (C) 2013 Free Software Foundation, Inc.
  4. *
  5. * GRUB is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * GRUB is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef GRUB_PROCFS_HEADER
  19. #define GRUB_PROCFS_HEADER 1
  20. #include <grub/list.h>
  21. #include <grub/types.h>
  22. struct grub_procfs_entry
  23. {
  24. struct grub_procfs_entry *next;
  25. struct grub_procfs_entry **prev;
  26. const char *name;
  27. char * (*get_contents) (grub_size_t *sz);
  28. };
  29. extern struct grub_procfs_entry *grub_procfs_entries;
  30. static inline void
  31. grub_procfs_register (const char *name __attribute__ ((unused)),
  32. struct grub_procfs_entry *entry)
  33. {
  34. grub_list_push (GRUB_AS_LIST_P (&grub_procfs_entries),
  35. GRUB_AS_LIST (entry));
  36. }
  37. static inline void
  38. grub_procfs_unregister (struct grub_procfs_entry *entry)
  39. {
  40. grub_list_remove (GRUB_AS_LIST (entry));
  41. }
  42. #endif