4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
35 #include <sys/types.h>
38 #include "rmm_common.h"
40 char *progname
= "volcheck";
46 gettext("usage: %s [-t #secs -i #secs] [-v] [path | nickname]\n"),
49 gettext("If path is not supplied all media is checked\n"));
53 main(int argc
, char **argv
)
55 const char *opts
= "itv";
57 boolean_t opt_i
= B_FALSE
;
58 boolean_t opt_t
= B_FALSE
;
59 boolean_t opt_v
= B_FALSE
;
60 LibHalContext
*hal_ctx
;
62 rmm_error_t rmm_error
;
65 while ((c
= getopt(argc
, argv
, opts
)) != EOF
) {
82 if ((hal_ctx
= rmm_hal_init(0, 0, 0, 0, &error
, &rmm_error
)) == NULL
) {
83 (void) fprintf(stderr
,
84 gettext("HAL initialization failed: %s\n"),
85 rmm_strerror(&error
, rmm_error
));
86 rmm_dbus_error_free(&error
);
91 /* no name provided, check all */
92 ret
= rmm_rescan(hal_ctx
, NULL
, B_FALSE
);
94 for (; optind
< argc
; optind
++) {
95 if (rmm_rescan(hal_ctx
, argv
[optind
], B_FALSE
) != 0) {
101 rmm_hal_fini(hal_ctx
);