7712 mandoc -Tlint does always exit with error code 0
[unleashed.git] / usr / src / cmd / lvm / rpc.metamedd / med_svc_subr.c
blobd9d1f33ec321f909da28eabd9145c76950fe8bc7
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) 1993, 2000 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #pragma ident "%Z%%M% %I% %E% SMI"
29 #include "med_local.h"
32 * return a response
34 /*ARGSUSED*/
35 bool_t
36 med_null_1_svc(
37 void *argp,
38 med_err_t *res,
39 struct svc_req *rqstp /* RPC stuff */
42 /* Initialization */
43 *res = med_null_err;
45 /* do nothing */
46 return (TRUE);
50 * Update the mediator data file.
52 /*ARGSUSED*/
53 bool_t
54 med_upd_data_1_svc(
55 med_upd_data_args_t *argp,
56 med_err_t *res,
57 struct svc_req *rqstp /* RPC stuff */
60 int err;
62 /* Initialization */
63 *res = med_null_err;
65 /* setup, check permissions */
66 if ((err = med_init(rqstp, W_OK, res)) < 0)
67 return (FALSE);
68 else if (err != 0)
69 return (TRUE);
71 /* doit */
72 if (med_db_init(res))
73 goto out;
75 (void) med_db_put_data(&argp->med, &argp->med_data, res);
77 out:
78 return (TRUE);
82 * Get the mediator data
84 /*ARGSUSED*/
85 bool_t
86 med_get_data_1_svc(
87 med_args_t *argp,
88 med_get_data_res_t *res,
89 struct svc_req *rqstp /* RPC stuff */
92 int err;
93 med_data_t *meddp;
94 med_err_t *medep = &res->med_status;
96 /* Initialization */
97 (void) memset(res, 0, sizeof (*res));
98 *medep = med_null_err;
100 /* setup, check permissions */
101 if ((err = med_init(rqstp, R_OK, medep)) < 0)
102 return (FALSE);
103 else if (err != 0)
104 return (TRUE);
106 /* doit */
107 if (med_db_init(medep))
108 goto out;
110 if ((meddp = med_db_get_data(&argp->med, medep)) == NULL)
111 goto out;
113 res->med_data = *meddp; /* structure assignment */
115 out:
116 return (TRUE);
120 * Update the mediator record.
122 /*ARGSUSED*/
123 bool_t
124 med_upd_rec_1_svc(
125 med_upd_rec_args_t *argp,
126 med_err_t *res,
127 struct svc_req *rqstp /* RPC stuff */
130 int err;
132 /* Initialization */
133 *res = med_null_err;
135 /* setup, check permissions */
136 if ((err = med_init(rqstp, W_OK, res)) < 0)
137 return (FALSE);
138 else if (err != 0)
139 return (TRUE);
141 /* doit */
142 if (med_db_init(res))
143 goto out;
145 (void) med_db_put_rec(&argp->med, &argp->med_rec, res);
147 out:
148 return (TRUE);
152 * Get the mediator record
154 /*ARGSUSED*/
155 bool_t
156 med_get_rec_1_svc(
157 med_args_t *argp,
158 med_get_rec_res_t *res,
159 struct svc_req *rqstp /* RPC stuff */
162 med_rec_t *medrp;
163 int err;
164 med_err_t *medep = &res->med_status;
166 /* Initialization */
167 (void) memset(res, 0, sizeof (*res));
168 *medep = med_null_err;
170 /* setup, check permissions */
171 if ((err = med_init(rqstp, R_OK, medep)) < 0)
172 return (FALSE);
173 else if (err != 0)
174 return (TRUE);
176 /* doit */
177 if (med_db_init(medep))
178 goto out;
180 if ((medrp = med_db_get_rec(&argp->med, medep)) == NULL)
181 goto out;
183 res->med_rec = *medrp; /* structure assignment */
185 out:
186 return (TRUE);
190 * return the official host name for the callee
192 /*ARGSUSED*/
193 bool_t
194 med_hostname_1_svc(
195 void *argp,
196 med_hnm_res_t *res,
197 struct svc_req *rqstp /* RPC stuff */
200 med_err_t *medep = &res->med_status;
201 int err;
203 /* Initialization */
204 (void) memset(res, 0, sizeof (*res));
205 *medep = med_null_err;
207 /* setup, check permissions */
208 if ((err = med_init(rqstp, R_OK, medep)) < 0)
209 return (FALSE);
210 else if (err != 0)
211 return (TRUE);
213 /* doit */
214 res->med_hnm = Strdup(mynode());
216 return (TRUE);