lsdev.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * GRUB -- GRand Unified Bootloader
  3. * Copyright (C) 2011 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. #include <grub/dl.h>
  19. #include <grub/misc.h>
  20. #include <grub/command.h>
  21. #include <grub/i18n.h>
  22. #include <grub/arc/arc.h>
  23. GRUB_MOD_LICENSE ("GPLv3+");
  24. /* Helper for grub_cmd_lsdev. */
  25. static int
  26. grub_cmd_lsdev_iter (const char *name,
  27. const struct grub_arc_component *comp __attribute__ ((unused)),
  28. void *data __attribute__ ((unused)))
  29. {
  30. grub_printf ("%s\n", name);
  31. return 0;
  32. }
  33. static grub_err_t
  34. grub_cmd_lsdev (grub_command_t cmd __attribute__ ((unused)),
  35. int argc __attribute__ ((unused)),
  36. char **args __attribute__ ((unused)))
  37. {
  38. grub_arc_iterate_devs (grub_cmd_lsdev_iter, 0, 0);
  39. return 0;
  40. }
  41. static grub_command_t cmd;
  42. GRUB_MOD_INIT(lsdev)
  43. {
  44. cmd = grub_register_command ("lsdev", grub_cmd_lsdev, "",
  45. N_("List devices."));
  46. }
  47. GRUB_MOD_FINI(lsdev)
  48. {
  49. grub_unregister_command (cmd);
  50. }