+2007-05-18 Theodore Tso <tytso@mit.edu>
+
+ * blkid.c (main): Add -g option to blkid which will garbage
+ collect the cache.
+
2007-05-07 Eric Sandeen <sandeen@redhat.com>
* mke2fs.c (PRS): Make defaults more sane when /etc/mke2fs.conf
.SH SYNOPSIS
.B blkid
[
-.B \-hlv
+.B \-ghlv
]
[
[
scanned but not necessarily available at this time), specify
.IR /dev/null.
.TP
+.B \-g
+Perform a garbage collection pass on the blkid cache.
+.TP
.B \-h
Display a usage message and exit.
.TP
print_version(out);
fprintf(out,
- "usage:\t%s [-c <file>] [-hl] [-o format] "
+ "usage:\t%s [-c <file>] [-ghl] [-o format] "
"[-s <tag>] [-t <token>]\n [-v] [-w <file>] [dev ...]\n"
"\t-c\tcache file (default: /etc/blkid.tab, /dev/null = none)\n"
"\t-h\tprint this usage message and exit\n"
+ "\t-g\tgarbage collect the blkid cache\n"
"\t-s\tshow specified tag(s) (default show all tags)\n"
"\t-t\tfind device with a specific token (NAME=value pair)\n"
"\t-l\tlookup the the first device with arguments specified by -t\n"
int err = 4;
unsigned int i;
int output_format = 0;
- int lookup = 0;
+ int lookup = 0, gc = 0;
int c;
- while ((c = getopt (argc, argv, "c:f:hlo:s:t:w:v")) != EOF)
+ while ((c = getopt (argc, argv, "c:f:ghlo:s:t:w:v")) != EOF)
switch (c) {
case 'c':
if (optarg && !*optarg)
case 'l':
lookup++;
break;
+ case 'g':
+ gc = 1;
+ break;
case 'o':
if (!strcmp(optarg, "value"))
output_format = OUTPUT_VALUE_ONLY;
goto exit;
err = 2;
- if (lookup) {
+ if (gc) {
+ blkid_gc_cache(cache);
+ } else if (lookup) {
blkid_dev dev;
if (!search_type) {