summaryrefslogtreecommitdiff
path: root/util-linux/blkid.c
blob: f353cf248453da2c3553ace4d95450d45d67be91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* vi: set sw=4 ts=4: */
/*
 * Print UUIDs on all filesystems
 *
 * Copyright (C) 2008 Denys Vlasenko.
 *
 * Licensed under GPLv2, see file LICENSE in this source tree.
 */
//config:config BLKID
//config:	bool "blkid (11 kb)"
//config:	default y
//config:	select PLATFORM_LINUX
//config:	select VOLUMEID
//config:	help
//config:	Lists labels and UUIDs of all filesystems.
//config:	WARNING:
//config:	With all submodules selected, it will add ~8k to busybox.
//config:
//config:config FEATURE_BLKID_TYPE
//config:	bool "Print filesystem type"
//config:	default n
//config:	depends on BLKID
//config:	help
//config:	Show TYPE="filesystem type"

//applet:IF_BLKID(APPLET(blkid, BB_DIR_SBIN, BB_SUID_DROP))

//kbuild:lib-$(CONFIG_BLKID) += blkid.o

//usage:#define blkid_trivial_usage
//usage:       "[BLOCKDEV]..."
//usage:#define blkid_full_usage "\n\n"
//usage:       "Print UUIDs of all filesystems"

#include "libbb.h"
#include "volume_id.h"

int blkid_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int blkid_main(int argc UNUSED_PARAM, char **argv)
{
	int scan_devices = 1;

	while (*++argv) {
		/* Note: bogus device names don't cause any error messages */
		add_to_uuid_cache(*argv);
		scan_devices = 0;
	}

	display_uuid_cache(scan_devices);
	return 0;
}