7712 mandoc -Tlint does always exit with error code 0
[unleashed.git] / usr / src / cmd / lvm / rpc.metamhd / mhd_metamhd.c
blobfd00a758bfe7e414e8e2e30fb2ec1cc18ae4380a
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright (c) 1994, 2000 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #pragma ident "%Z%%M% %I% %E% SMI"
29 #include "mhd_local.h"
32 * list drives
34 /*ARGSUSED*/
35 bool_t
36 mhd_list_1_svc(
37 mhd_list_args_t *argp,
38 mhd_list_res_t *resp,
39 struct svc_req *rqstp /* RPC stuff */
42 mhd_error_t *mhep = &resp->status;
43 int err;
45 /* setup, check permissions */
46 (void) memset(resp, 0, sizeof (*resp));
47 if ((err = mhd_init(rqstp, R_OK, mhep)) < 0)
48 return (FALSE);
49 else if (err != 0)
50 return (TRUE);
52 /* doit */
53 (void) mhd_list_drives(argp->path, argp->flags, resp, mhep);
54 return (TRUE);
58 * take ownership of drives
60 /*ARGSUSED*/
61 bool_t
62 mhd_tkown_1_svc(
63 mhd_tkown_args_t *argp,
64 mhd_error_t *mhep,
65 struct svc_req *rqstp /* RPC stuff */
68 int err;
70 /* setup, check permissions */
71 if ((err = mhd_init(rqstp, W_OK, mhep)) < 0)
72 return (FALSE);
73 else if (err != 0)
74 return (TRUE);
76 /* doit */
77 (void) mhd_reserve_drives(&argp->set, &argp->timeouts, argp->ff_mode,
78 argp->options, mhep);
79 return (TRUE);
83 * release ownership of drives
85 /*ARGSUSED*/
86 bool_t
87 mhd_relown_1_svc(
88 mhd_relown_args_t *argp,
89 mhd_error_t *mhep,
90 struct svc_req *rqstp /* RPC stuff */
93 int err;
95 /* setup, check permissions */
96 if ((err = mhd_init(rqstp, W_OK, mhep)) < 0)
97 return (FALSE);
98 else if (err != 0)
99 return (TRUE);
101 /* doit */
102 (void) mhd_release_drives(&argp->set, argp->options, mhep);
103 return (TRUE);
107 * status drives
109 /*ARGSUSED*/
110 bool_t
111 mhd_status_1_svc(
112 mhd_status_args_t *argp,
113 mhd_status_res_t *resp,
114 struct svc_req *rqstp /* RPC stuff */
117 mhd_error_t *mhep = &resp->status;
118 mhd_drive_status_t *status = NULL;
119 int cnt;
120 int err;
122 /* setup, check permissions */
123 (void) memset(resp, 0, sizeof (*resp));
124 if ((err = mhd_init(rqstp, W_OK, mhep)) < 0)
125 return (FALSE);
126 else if (err != 0)
127 return (TRUE);
129 /* doit */
130 if ((cnt = mhd_status_drives(&argp->set, argp->options,
131 &status, mhep)) < 0) {
132 return (TRUE);
134 resp->results.results_len = cnt;
135 resp->results.results_val = status;
136 return (TRUE);