2 * CDDL HEADER START
3 *
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.
7 *
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.
12 *
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]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <unistd.h>
29 #include <fcntl.h>
30 #include <string.h>
31 #include <strings.h>
32 #include <signal.h>
33 #include <errno.h>
34 #include <libintl.h>
35 #include <sys/types.h>
36
37 #include "vold.h"
38 #include "rmm_common.h"
39
40 char *progname = "volcheck";
41
42 static void
43 usage()
44 {
45 fprintf(stderr,
46 gettext("usage: %s [-t #secs -i #secs] [-v] [path | nickname]\n"),
47 progname);
48 fprintf(stderr,
49 gettext("If path is not supplied all media is checked\n"));
50 }
51
52 int
53 main(int argc, char **argv)
54 {
55 const char *opts = "itv";
56 int c;
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;
61 DBusError error;
62 rmm_error_t rmm_error;
63 int ret = 0;
64
65 vold_init(argc, argv);
66
67 while ((c = getopt(argc, argv, opts)) != EOF) {
68 switch (c) {
69 case 'i':
70 opt_i = B_TRUE;
71 break;
72 case 't':
73 opt_t = B_TRUE;
74 break;
75 case 'v':
76 opt_v = B_TRUE;
77 break;
78 default:
79 usage();
80 return (1);
81 }
82 }
83
84 if ((hal_ctx = rmm_hal_init(0, 0, 0, 0, &error, &rmm_error)) == NULL) {
85 (void) fprintf(stderr,
86 gettext("HAL initialization failed: %s\n"),
87 rmm_strerror(&error, rmm_error));
88 rmm_dbus_error_free(&error);
89 return (1);
90 }
91
92 if (optind == argc) {
93 /* no name provided, check all */
94 ret = rmm_rescan(hal_ctx, NULL, B_FALSE);
95 } else {
96 for (; optind < argc; optind++) {
|
2 * CDDL HEADER START
3 *
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.
7 *
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.
12 *
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]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2017 Gary Mills
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <unistd.h>
30 #include <fcntl.h>
31 #include <string.h>
32 #include <strings.h>
33 #include <signal.h>
34 #include <errno.h>
35 #include <libintl.h>
36 #include <sys/types.h>
37
38 #include "vold.h"
39 #include "rmm_common.h"
40
41 char *progname = "volcheck";
42
43 static void
44 usage()
45 {
46 fprintf(stderr,
47 gettext("usage: %s [-t #secs -i #secs] [-v] [path | nickname]\n"),
48 progname);
49 fprintf(stderr,
50 gettext("If path is not supplied all media is checked\n"));
51 }
52
53 int
54 main(int argc, char **argv)
55 {
56 const char *opts = "itv";
57 int c;
58 LibHalContext *hal_ctx;
59 DBusError error;
60 rmm_error_t rmm_error;
61 int ret = 0;
62
63 vold_init(argc, argv);
64
65 while ((c = getopt(argc, argv, opts)) != EOF) {
66 switch (c) {
67 case 'i':
68 break;
69 case 't':
70 break;
71 case 'v':
72 break;
73 default:
74 usage();
75 return (1);
76 }
77 }
78
79 if ((hal_ctx = rmm_hal_init(0, 0, 0, 0, &error, &rmm_error)) == NULL) {
80 (void) fprintf(stderr,
81 gettext("HAL initialization failed: %s\n"),
82 rmm_strerror(&error, rmm_error));
83 rmm_dbus_error_free(&error);
84 return (1);
85 }
86
87 if (optind == argc) {
88 /* no name provided, check all */
89 ret = rmm_rescan(hal_ctx, NULL, B_FALSE);
90 } else {
91 for (; optind < argc; optind++) {
|