blkid.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * Print UUIDs on all filesystems
  4. *
  5. * Copyright (C) 2008 Denys Vlasenko.
  6. *
  7. * Licensed under GPLv2, see file LICENSE in this source tree.
  8. */
  9. //config:config BLKID
  10. //config: bool "blkid (12 kb)"
  11. //config: default y
  12. //config: select VOLUMEID
  13. //config: help
  14. //config: Lists labels and UUIDs of all filesystems.
  15. //config:
  16. //config:config FEATURE_BLKID_TYPE
  17. //config: bool "Print filesystem type"
  18. //config: default y
  19. //config: depends on BLKID
  20. //config: help
  21. //config: Show TYPE="filesystem type"
  22. //applet:IF_BLKID(APPLET_NOEXEC(blkid, blkid, BB_DIR_SBIN, BB_SUID_DROP, blkid))
  23. //kbuild:lib-$(CONFIG_BLKID) += blkid.o
  24. //usage:#define blkid_trivial_usage
  25. //usage: "[BLOCKDEV]..."
  26. //usage:#define blkid_full_usage "\n\n"
  27. //usage: "Print UUIDs of all filesystems"
  28. #include "libbb.h"
  29. #include "volume_id.h"
  30. int blkid_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
  31. int blkid_main(int argc UNUSED_PARAM, char **argv)
  32. {
  33. int scan_devices = 1;
  34. while (*++argv) {
  35. /* Note: bogus device names don't cause any error messages */
  36. add_to_uuid_cache(*argv);
  37. scan_devices = 0;
  38. }
  39. display_uuid_cache(scan_devices);
  40. return 0;
  41. }