xref: /dragonfly/sbin/hammer/hammer.c (revision 9f7604d7)
1 /*
2  * Copyright (c) 2007 The DragonFly Project.  All rights reserved.
3  *
4  * This code is derived from software contributed to The DragonFly Project
5  * by Matthew Dillon <dillon@backplane.com>
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in
15  *    the documentation and/or other materials provided with the
16  *    distribution.
17  * 3. Neither the name of The DragonFly Project nor the names of its
18  *    contributors may be used to endorse or promote products derived
19  *    from this software without specific, prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
25  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  *
34  * $DragonFly: src/sbin/hammer/hammer.c,v 1.44 2008/11/13 02:04:27 dillon Exp $
35  */
36 
37 #include "hammer.h"
38 #include <signal.h>
39 #include <math.h>
40 #include <fstab.h>
41 
42 static void hammer_parsedevs(const char *blkdevs);
43 static void sigalrm(int signo);
44 static void sigintr(int signo);
45 static void usage(int exit_code);
46 
47 int RecurseOpt;
48 int VerboseOpt;
49 int QuietOpt;
50 int NoSyncOpt;
51 int TwoWayPipeOpt;
52 int TimeoutOpt;
53 int DelayOpt = 5;
54 char *SshPort;
55 int ForceYesOpt = 0;
56 int CompressOpt;
57 int ForceOpt;
58 int RunningIoctl;
59 int DidInterrupt;
60 int BulkOpt;
61 u_int64_t BandwidthOpt;
62 u_int64_t SplitupOpt = 4ULL * 1024ULL * 1024ULL * 1024ULL;
63 u_int64_t MemoryLimit = 1024LLU * 1024 * 1024;
64 const char *SplitupOptStr;
65 const char *CyclePath;
66 const char *LinkPath;
67 const char *RestrictTarget;
68 
69 int
70 main(int ac, char **av)
71 {
72 	char *blkdevs = NULL;
73 	char *ptr;
74 	char *restrictcmd = NULL;
75 	u_int32_t status;
76 	int ch;
77 	int cacheSize = 0;
78 
79 	while ((ch = getopt(ac, av,
80 			    "b:c:de:hf:i:m:p:qrs:t:v2yBC:FR:S:T:X")) != -1) {
81 		switch(ch) {
82 		case '2':
83 			TwoWayPipeOpt = 1;
84 			break;
85 		case 'y':
86 			ForceYesOpt = 1;
87 			break;
88 		case 'b':
89 			BandwidthOpt = strtoull(optarg, &ptr, 0);
90 			switch(*ptr) {
91 			case 'g':
92 			case 'G':
93 				BandwidthOpt *= 1024;
94 				/* fall through */
95 			case 'm':
96 			case 'M':
97 				BandwidthOpt *= 1024;
98 				/* fall through */
99 			case 'k':
100 			case 'K':
101 				BandwidthOpt *= 1024;
102 				break;
103 			case '\0':
104 				/* bytes per second if no suffix */
105 				break;
106 			default:
107 				usage(1);
108 			}
109 			break;
110 		case 'S':
111 			SplitupOptStr = strdup(optarg);
112 			SplitupOpt = strtoull(optarg, &ptr, 0);
113 			switch(*ptr) {
114 			case 'g':
115 			case 'G':
116 				SplitupOpt *= 1024;
117 				/* fall through */
118 			case 'm':
119 			case 'M':
120 				SplitupOpt *= 1024;
121 				/* fall through */
122 			case 'k':
123 			case 'K':
124 				SplitupOpt *= 1024;
125 				break;
126 			case '\0':
127 				/* bytes per second if no suffix */
128 				break;
129 			default:
130 				usage(1);
131 			}
132 			break;
133 		case 'c':
134 			CyclePath = optarg;
135 			break;
136 		case 'd':
137 			++DebugOpt;
138 			break;
139 		case 'e':
140 			ScoreBoardFile = optarg;
141 			break;
142 		case 'h':
143 			usage(0);
144 			/* not reached */
145 		case 'i':
146 			DelayOpt = strtol(optarg, NULL, 0);
147 			break;
148 		case 'm':
149 			MemoryLimit = strtouq(optarg, &ptr, 0);
150 			switch(*ptr) {
151 			case 't':
152 			case 'T':
153 				MemoryLimit *= 1024;
154 				/* fall through */
155 			case 'g':
156 			case 'G':
157 				MemoryLimit *= 1024;
158 				/* fall through */
159 			case 'm':
160 			case 'M':
161 				MemoryLimit *= 1024;
162 				/* fall through */
163 			case 'k':
164 			case 'K':
165 				MemoryLimit *= 1024;
166 				/* fall through */
167 			default:
168 				break;
169 			}
170 
171 			/* minimum limit */
172 			if (MemoryLimit < 1024 * 1024)
173 				MemoryLimit = 1024 * 1024;
174 			break;
175 		case 'p':
176 			SshPort = optarg;
177 			break;
178 		case 'r':
179 			RecurseOpt = 1;
180 			break;
181 		case 'f':
182 			blkdevs = optarg;
183 			break;
184 		case 's':
185 			LinkPath = optarg;
186 			break;
187 		case 't':
188 			TimeoutOpt = strtol(optarg, NULL, 0);
189 			break;
190 		case 'v':
191 			if (QuietOpt > 0)
192 				--QuietOpt;
193 			else
194 				++VerboseOpt;
195 			break;
196 		case 'q':
197 			if (VerboseOpt > 0)
198 				--VerboseOpt;
199 			else
200 				++QuietOpt;
201 			break;
202 		case 'B':
203 			BulkOpt = 1;
204 			break;
205 		case 'C':
206 			cacheSize = strtol(optarg, &ptr, 0);
207 			switch(*ptr) {
208 			case 'm':
209 			case 'M':
210 				cacheSize *= 1024;
211 				/* fall through */
212 			case 'k':
213 			case 'K':
214 				cacheSize *= 1024;
215 				++ptr;
216 				break;
217 			case '\0':
218 			case ':':
219 				/* bytes if no suffix */
220 				break;
221 			default:
222 				usage(1);
223 			}
224 			if (*ptr == ':') {
225 				UseReadAhead = strtol(ptr + 1, NULL, 0);
226 				UseReadBehind = -UseReadAhead;
227 			}
228 			if (cacheSize < 1024 * 1024)
229 				cacheSize = 1024 * 1024;
230 			if (UseReadAhead < 0)
231 				usage(1);
232 			if (UseReadAhead * HAMMER_BUFSIZE / cacheSize / 16) {
233 				UseReadAhead = cacheSize / 16 / HAMMER_BUFSIZE;
234 				UseReadBehind = -UseReadAhead;
235 			}
236 			hammer_cache_set(cacheSize);
237 			break;
238 		case 'F':
239 			ForceOpt = 1;
240 			break;
241 		case 'R':
242 			if (restrictcmd == NULL)
243 				restrictcmd = optarg;
244 			break;
245 		case 'T':
246 			if (RestrictTarget == NULL)
247 				RestrictTarget = optarg;
248 			break;
249 		case 'X':
250 			CompressOpt = 1;
251 			break;
252 		default:
253 			usage(1);
254 			/* not reached */
255 		}
256 	}
257 	ac -= optind;
258 	av += optind;
259 	if (ac < 1) {
260 		usage(1);
261 		/* not reached */
262 	}
263 
264 	signal(SIGALRM, sigalrm);
265 	signal(SIGINT, sigintr);
266 
267 	/*
268 	 * Check command restriction (used by hammer ssh-remote).  Several
269 	 * commands may be iterated with a comma.
270 	 */
271 	if (restrictcmd) {
272 		char *elm;
273 
274 		ptr = strdup(restrictcmd);
275 		while ((elm = strsep(&ptr, ",")) != NULL) {
276 			if (strcmp(av[0], elm) == 0)
277 				break;
278 		}
279 		if (elm == NULL) {
280 			fprintf(stderr, "hammer-remote: request does not match "
281 					"restricted command\n");
282 			exit(1);
283 		}
284 		free(ptr);
285 	}
286 
287 	/*
288 	 * Parse commands
289 	 */
290 	if (strcmp(av[0], "synctid") == 0) {
291 		hammer_cmd_synctid(av + 1, ac - 1);
292 		exit(0);
293 	}
294 	if (strcmp(av[0], "namekey2") == 0) {
295 		int64_t key;
296 		int32_t crcx;
297 		int len;
298 		const char *aname = av[1];
299 
300 		if (aname == NULL)
301 			usage(1);
302 		len = strlen(aname);
303 		key = (u_int32_t)crc32(aname, len) & 0xFFFFFFFEU;
304 
305 		switch(len) {
306 		default:
307 			crcx = crc32(aname + 3, len - 5);
308 			crcx = crcx ^ (crcx >> 6) ^ (crcx >> 12);
309 			key |= (int64_t)(crcx & 0x3F) << 42;
310 			/* fall through */
311 		case 5:
312 		case 4:
313 			/* fall through */
314 		case 3:
315 			key |= ((int64_t)(aname[2] & 0x1F) << 48);
316 			/* fall through */
317 		case 2:
318 			key |= ((int64_t)(aname[1] & 0x1F) << 53) |
319 			       ((int64_t)(aname[len-2] & 0x1F) << 37);
320 			/* fall through */
321 		case 1:
322 			key |= ((int64_t)(aname[0] & 0x1F) << 58) |
323 			       ((int64_t)(aname[len-1] & 0x1F) << 32);
324 			/* fall through */
325 		case 0:
326 			break;
327 		}
328 		if (key == 0)
329 			key |= 0x100000000LL;
330 		printf("0x%016jx\n", (uintmax_t)key);
331 		exit(0);
332 	}
333 	if (strcmp(av[0], "namekey1") == 0) {
334 		int64_t key;
335 
336 		if (av[1] == NULL)
337 			usage(1);
338 		key = (int64_t)(crc32(av[1], strlen(av[1])) & 0x7FFFFFFF) << 32;
339 		if (key == 0)
340 			key |= 0x100000000LL;
341 		printf("0x%016jx\n", (uintmax_t)key);
342 		exit(0);
343 	}
344 	if (strcmp(av[0], "namekey32") == 0) {
345 		int32_t key;
346 
347 		if (av[1] == NULL)
348 			usage(1);
349 		key = crc32(av[1], strlen(av[1])) & 0x7FFFFFFF;
350 		if (key == 0)
351 			++key;
352 		printf("0x%08x\n", key);
353 		exit(0);
354 	}
355 	if (strcmp(av[0], "pfs-status") == 0) {
356 		hammer_cmd_pseudofs_status(av + 1, ac - 1);
357 		exit(0);
358 	}
359 	if (strcmp(av[0], "pfs-master") == 0) {
360 		hammer_cmd_pseudofs_create(av + 1, ac - 1, 0);
361 		exit(0);
362 	}
363 	if (strcmp(av[0], "pfs-slave") == 0) {
364 		hammer_cmd_pseudofs_create(av + 1, ac - 1, 1);
365 		exit(0);
366 	}
367 	if (strcmp(av[0], "pfs-update") == 0) {
368 		hammer_cmd_pseudofs_update(av + 1, ac - 1);
369 		exit(0);
370 	}
371 	if (strcmp(av[0], "pfs-upgrade") == 0) {
372 		hammer_cmd_pseudofs_upgrade(av + 1, ac - 1);
373 		exit(0);
374 	}
375 	if (strcmp(av[0], "pfs-downgrade") == 0) {
376 		hammer_cmd_pseudofs_downgrade(av + 1, ac - 1);
377 		exit(0);
378 	}
379 	if (strcmp(av[0], "pfs-destroy") == 0) {
380 		hammer_cmd_pseudofs_destroy(av + 1, ac - 1);
381 		exit(0);
382 	}
383 	if (strcmp(av[0], "prune") == 0) {
384 		hammer_cmd_softprune(av + 1, ac - 1, 0);
385 		exit(0);
386 	}
387 	if (strcmp(av[0], "config") == 0) {
388 		hammer_cmd_config(av + 1, ac - 1);
389 		exit(0);
390 	}
391 	if (strcmp(av[0], "viconfig") == 0) {
392 		hammer_cmd_viconfig(av + 1, ac - 1);
393 		exit(0);
394 	}
395 	if (strcmp(av[0], "cleanup") == 0) {
396 		hammer_cmd_cleanup(av + 1, ac - 1);
397 		exit(0);
398 	}
399 	if (strcmp(av[0], "info") == 0) {
400 		hammer_cmd_info(av + 1, ac - 1);
401 		exit(0);
402 	}
403 	if (strcmp(av[0], "prune-everything") == 0) {
404 		hammer_cmd_softprune(av + 1, ac - 1, 1);
405 		exit(0);
406 	}
407 	if (strcmp(av[0], "ssh-remote") == 0) {
408 		if (ac != 3)
409 			usage(1);
410 		hammer_cmd_sshremote(av[1], av[2]);
411 		exit(0);
412 	}
413 	if (strcmp(av[0], "snap") == 0) {
414 		hammer_cmd_snap(av + 1, ac - 1, 0, 1);
415 		exit(0);
416 	}
417 	if (strcmp(av[0], "snaplo") == 0) {
418 		hammer_cmd_snap(av + 1, ac - 1, 0, 0);
419 		exit(0);
420 	}
421 	if (strcmp(av[0], "snapq") == 0) {
422 		hammer_cmd_snap(av + 1, ac - 1, 1, 0);
423 		exit(0);
424 	}
425 	if (strcmp(av[0], "snapls") == 0) {
426 		hammer_cmd_snapls(av + 1, ac - 1);
427 		exit(0);
428 	}
429 	if (strcmp(av[0], "snaprm") == 0) {
430 		hammer_cmd_snaprm(av + 1, ac - 1);
431 		exit(0);
432 	}
433 	if (strcmp(av[0], "snapshot") == 0) {
434 		hammer_cmd_snapshot(av + 1, ac - 1);
435 		exit(0);
436 	}
437 	if (strcmp(av[0], "bstats") == 0) {
438 		hammer_cmd_bstats(av + 1, ac - 1);
439 		exit(0);
440 	}
441 	if (strcmp(av[0], "iostats") == 0) {
442 		hammer_cmd_iostats(av + 1, ac - 1);
443 		exit(0);
444 	}
445 
446 	if (strncmp(av[0], "history", 7) == 0) {
447 		hammer_cmd_history(av[0] + 7, av + 1, ac - 1);
448 		exit(0);
449 	}
450 	if (strcmp(av[0], "rebalance") == 0) {
451 		signal(SIGINT, sigalrm);
452 		hammer_cmd_rebalance(av + 1, ac - 1);
453 		exit(0);
454 	}
455 	if (strncmp(av[0], "reblock", 7) == 0) {
456 		signal(SIGINT, sigalrm);
457 		if (strcmp(av[0], "reblock") == 0)
458 			hammer_cmd_reblock(av + 1, ac - 1, -1);
459 		else if (strcmp(av[0], "reblock-btree") == 0)
460 			hammer_cmd_reblock(av + 1, ac - 1, HAMMER_IOC_DO_BTREE);
461 		else if (strcmp(av[0], "reblock-inodes") == 0)
462 			hammer_cmd_reblock(av + 1, ac - 1, HAMMER_IOC_DO_INODES);
463 		else if (strcmp(av[0], "reblock-dirs") == 0)
464 			hammer_cmd_reblock(av + 1, ac - 1, HAMMER_IOC_DO_DIRS);
465 		else if (strcmp(av[0], "reblock-data") == 0)
466 			hammer_cmd_reblock(av + 1, ac - 1, HAMMER_IOC_DO_DATA);
467 		else
468 			usage(1);
469 		exit(0);
470 	}
471 	if (strncmp(av[0], "mirror", 6) == 0) {
472 		if (strcmp(av[0], "mirror-read") == 0)
473 			hammer_cmd_mirror_read(av + 1, ac - 1, 0);
474 		else if (strcmp(av[0], "mirror-read-stream") == 0)
475 			hammer_cmd_mirror_read(av + 1, ac - 1, 1);
476 		else if (strcmp(av[0], "mirror-write") == 0)
477 			hammer_cmd_mirror_write(av + 1, ac - 1);
478 		else if (strcmp(av[0], "mirror-copy") == 0)
479 			hammer_cmd_mirror_copy(av + 1, ac - 1, 0);
480 		else if (strcmp(av[0], "mirror-stream") == 0)
481 			hammer_cmd_mirror_copy(av + 1, ac - 1, 1);
482 		else if (strcmp(av[0], "mirror-dump") == 0)
483 			hammer_cmd_mirror_dump();
484 		else
485 			usage(1);
486 		exit(0);
487 	}
488 	if (strcmp(av[0], "dedup-simulate") == 0) {
489 		hammer_cmd_dedup_simulate(av + 1, ac - 1);
490 		exit(0);
491 	}
492 	if (strcmp(av[0], "dedup") == 0) {
493 		hammer_cmd_dedup(av + 1, ac - 1);
494 		exit(0);
495 	}
496 	if (strcmp(av[0], "version") == 0) {
497 		hammer_cmd_get_version(av + 1, ac - 1);
498 		exit(0);
499 	}
500 	if (strcmp(av[0], "version-upgrade") == 0) {
501 		hammer_cmd_set_version(av + 1, ac - 1);
502 		exit(0);
503 	}
504 	if (strcmp(av[0], "volume-add") == 0) {
505 		hammer_cmd_volume_add(av + 1, ac - 1);
506 		exit(0);
507 	}
508 	if (strcmp(av[0], "volume-del") == 0) {
509 		hammer_cmd_volume_del(av + 1, ac - 1);
510 		exit(0);
511 	}
512 	if (strcmp(av[0], "volume-list") == 0) {
513 		hammer_cmd_volume_list(av + 1, ac - 1);
514 		exit(0);
515 	}
516 
517 	uuid_name_lookup(&Hammer_FSType, "DragonFly HAMMER", &status);
518 	if (status != uuid_s_ok) {
519 		errx(1, "uuids file does not have the DragonFly "
520 			"HAMMER filesystem type");
521 	}
522 
523 	if (strcmp(av[0], "show") == 0) {
524 		u_int32_t lo = 0;
525 		intmax_t obj_id = (int64_t)HAMMER_MIN_OBJID;
526 
527 		hammer_parsedevs(blkdevs);
528 		if (ac > 1)
529 			sscanf(av[1], "%08x:%jx", &lo, &obj_id);
530 		hammer_cmd_show(-1, lo, (int64_t)obj_id, 0, NULL, NULL);
531 		exit(0);
532 	}
533 	if (strcmp(av[0], "show-undo") == 0) {
534 		hammer_parsedevs(blkdevs);
535 		hammer_cmd_show_undo();
536 		exit(0);
537 	}
538 	if (strcmp(av[0], "recover") == 0) {
539 		hammer_parsedevs(blkdevs);
540 		if (ac <= 1)
541 			errx(1, "hammer recover required target directory");
542 		hammer_cmd_recover(av[1]);
543 		exit(0);
544 	}
545 	if (strcmp(av[0], "blockmap") == 0) {
546 		hammer_parsedevs(blkdevs);
547 		hammer_cmd_blockmap();
548 		exit(0);
549 	}
550 	if (strcmp(av[0], "checkmap") == 0) {
551 		hammer_parsedevs(blkdevs);
552 		hammer_cmd_checkmap();
553 		exit(0);
554 	}
555 	usage(1);
556 	/* not reached */
557 	return(0);
558 }
559 
560 /*
561  * Parse the device specification.
562  *
563  * Multi-volume hammer devices are colon-separated.  Each element
564  * may be further expanded via /etc/devtab.  One may also specify
565  * a single element which is expanded into multiple elements via
566  * /etc/devtab.
567  */
568 static
569 void
570 hammer_parsedevs(const char *blkdevs)
571 {
572 	char *copy;
573 	char *volname;
574 
575 	if (blkdevs == NULL) {
576 		errx(1, "A -f blkdevs specification is required "
577 			"for this command");
578 	}
579 
580 	copy = strdup(blkdevs);
581 	while ((volname = copy) != NULL) {
582 		if ((copy = strchr(copy, ':')) != NULL)
583 			*copy++ = 0;
584 		volname = getdevpath(volname, 0);
585 		if (strchr(volname, ':'))
586 			hammer_parsedevs(volname);
587 		else
588 			setup_volume(-1, volname, 0, O_RDONLY);
589 	}
590 }
591 
592 static
593 void
594 sigalrm(int signo __unused)
595 {
596 	/* do nothing (interrupts HAMMER ioctl) */
597 }
598 
599 static
600 void
601 sigintr(int signo __unused)
602 {
603 	if (RunningIoctl == 0)
604 		_exit(1);
605 	DidInterrupt = 1;
606 	/* do nothing (interrupts HAMMER ioctl) */
607 }
608 
609 static
610 void
611 usage(int exit_code)
612 {
613 	fprintf(stderr,
614 		"hammer -h\n"
615 		"hammer [-2BqrvXy] [-b bandwidth] [-C cachesize[:readahead]] [-c cyclefile]\n"
616 		"       [-f blkdevs] [-i delay] [-t seconds] [-S splitup]\n"
617 		"	command [argument ...]\n"
618 		"hammer synctid <filesystem> [quick]\n"
619 		"hammer bstats [interval]\n"
620 		"hammer iostats [interval]\n"
621 		"hammer history[@offset[,len]] <file> ...\n"
622 		"hammer namekey1 <path>\n"
623 		"hammer namekey2 <path>\n"
624 		"hammer namekey32 <path>\n"
625 		"hammer cleanup [<filesystem> ...]\n"
626 		"hammer info [<dirpath> ...]\n"
627 		"hammer snapshot [<filesystem>] <snapshot-dir>\n"
628 		"hammer snapshot <filesystem> <snapshot-dir> [<note>]\n"
629 		"hammer prune <softlink-dir>\n"
630 		"hammer prune-everything <filesystem>\n"
631 		"hammer rebalance <filesystem> [saturation_percentage]\n"
632 		"hammer reblock[-btree|-inodes|-dirs|-data] "
633 			"<filesystem> [fill_percentage]\n"
634 		"hammer pfs-status <dirpath> ...\n"
635 		"hammer pfs-master <dirpath> [options]\n"
636 		"hammer pfs-slave <dirpath> [options]\n"
637 		"hammer pfs-update <dirpath> [options]\n"
638 		"hammer pfs-upgrade <dirpath>\n"
639 		"hammer pfs-downgrade <dirpath>\n"
640 		"hammer pfs-destroy <dirpath>\n"
641 		"hammer mirror-read <filesystem> [begin-tid]\n"
642 		"hammer mirror-read-stream <filesystem> [begin-tid]\n"
643 		"hammer mirror-write <filesystem>\n"
644 		"hammer mirror-dump\n"
645 		"hammer mirror-copy [[user@]host:]<filesystem>"
646 				  " [[user@]host:]<filesystem>\n"
647 		"hammer mirror-stream [[user@]host:]<filesystem>"
648 				    " [[user@]host:]<filesystem>\n"
649 		"hammer ssh-remote command filesystem\n"
650 		"hammer version <filesystem>\n"
651 		"hammer version-upgrade <filesystem> <version> [force]\n"
652 		"hammer volume-add <device> <filesystem>\n"
653 		"hammer volume-del <device> <filesystem>\n"
654 		"hammer volume-list <filesystem>\n"
655 	);
656 
657 	fprintf(stderr, "\nHAMMER utility version 3+ commands:\n");
658 
659 	fprintf(stderr,
660 		"hammer config [<filesystem> [<configfile>]]\n"
661 		"hammer viconfig [<filesystem>]\n"
662 		"hammer snap <path> [<note>]\n"
663 		"hammer snaplo <path> [<note>]\n"
664 		"hammer snapq <dir> [<note>]\n"
665 		"hammer snaprm <path> ...\n"
666 		"hammer snaprm <transid> ...\n"
667 		"hammer snaprm <filesystem> <transid> ...\n"
668 		"hammer snapls [<path> ...]\n"
669 	);
670 
671 	fprintf(stderr, "\nHAMMER utility version 4+ commands:\n");
672 
673 	fprintf(stderr,
674 		"hammer -f blkdevs blockmap\n"
675 		"hammer -f blkdevs checkmap\n"
676 		"hammer -f blkdevs [-qqq] show [lo:objid]\n"
677 		"hammer -f blkdevs show-undo\n"
678 		"hammer -f blkdevs recover <target_dir>\n"
679 	);
680 
681 	fprintf(stderr, "\nHAMMER utility version 5+ commands:\n");
682 
683 	fprintf(stderr,
684 		"hammer dedup-simulate <filesystem>\n"
685 		"hammer dedup <filesystem>\n"
686 	);
687 
688 	exit(exit_code);
689 }
690 
691