1 /* 2 * CDDL HEADER START 3 * 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. 8 * 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. 13 * 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] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright (c) 1994, 2000 by Sun Microsystems, Inc. 24 * All rights reserved. 25 */ 26 27 #pragma ident "%Z%%M% %I% %E% SMI" 28 29 #include "mhd_local.h" 30 31 /* 32 * list drives 33 */ 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 */ 40 ) 41 { 42 mhd_error_t *mhep = &resp->status; 43 int err; 44 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); 51 52 /* doit */ 53 (void) mhd_list_drives(argp->path, argp->flags, resp, mhep); 54 return (TRUE); 55 } 56 57 /* 58 * take ownership of drives 59 */ 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 */ 66 ) 67 { 68 int err; 69 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); 75 76 /* doit */ 77 (void) mhd_reserve_drives(&argp->set, &argp->timeouts, argp->ff_mode, 78 argp->options, mhep); 79 return (TRUE); 80 } 81 82 /* 83 * release ownership of drives 84 */ 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 */ 91 ) 92 { 93 int err; 94 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); 100 101 /* doit */ 102 (void) mhd_release_drives(&argp->set, argp->options, mhep); 103 return (TRUE); 104 } 105 106 /* 107 * status drives 108 */ 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 */ 115 ) 116 { 117 mhd_error_t *mhep = &resp->status; 118 mhd_drive_status_t *status = NULL; 119 int cnt; 120 int err; 121 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); 128 129 /* doit */ 130 if ((cnt = mhd_status_drives(&argp->set, argp->options, 131 &status, mhep)) < 0) { 132 return (TRUE); 133 } 134 resp->results.results_len = cnt; 135 resp->results.results_val = status; 136 return (TRUE); 137 } 138