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 (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 /* 23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _LIBDSERV_H 28 #define _LIBDSERV_H 29 30 #include <libscf.h> 31 #include <syslog.h> 32 #include <rpc/rpc.h> 33 #include <nfs/nfs4.h> 34 #include <nfs/nfssys.h> 35 36 #ifdef __cplusplus 37 extern "C" { 38 #endif 39 40 #define DSERV_PROP_ZPOOLS "zpools" 41 #define DSERV_PROP_MDS "mds" 42 43 typedef enum { 44 DSERV_ERR_NONE = 0, 45 DSERV_ERR_SCF, 46 DSERV_ERR_INVALID_PROP, 47 DSERV_ERR_NOINSTANCE, 48 DSERV_ERR_HAVEINSTANCE, 49 DSERV_ERR_NOSUCHINSTANCE, 50 DSERV_ERR_LONGDATASET, 51 DSERV_ERR_DUPLICATE_DATASET, 52 DSERV_ERR_DATASET_NOT_FOUND, 53 DSERV_ERR_MDS_EXISTS, 54 DSERV_ERR_MDS_NOT_FOUND, 55 DSERV_ERR_DEVOPEN, 56 DSERV_ERR_DEVNOTOPEN, 57 DSERV_ERR_NFSSYS 58 } dserv_error_t; 59 60 #define DSERV_INSTANCE_CREATE 0x01 61 62 #define DSERV_DEFAULT_INSTANCE "default" 63 64 typedef struct dserv_handle dserv_handle_t; 65 66 void dserv_log(dserv_handle_t *, int, const char *, ...); 67 dserv_handle_t *dserv_handle_create(void); 68 void dserv_handle_destroy(dserv_handle_t *); 69 int dserv_setinstance(dserv_handle_t *, const char *, int); 70 void dserv_dropinstance(dserv_handle_t *); 71 int dserv_myinstance(dserv_handle_t *); 72 dserv_error_t dserv_error(dserv_handle_t *); 73 void dserv_error_reset(dserv_handle_t *); 74 const char *dserv_strerror(dserv_handle_t *); 75 int dserv_enable(dserv_handle_t *); 76 int dserv_disable(dserv_handle_t *); 77 int dserv_maintenance(dserv_handle_t *); 78 int dserv_refresh(dserv_handle_t *); 79 int dserv_create_instance(dserv_handle_t *, const char *); 80 int dserv_destroy_instance(dserv_handle_t *, const char *); 81 void dserv_set_pool_id(dserv_handle_t *, const int); 82 int dserv_addprop(dserv_handle_t *, const char *, const char *); 83 int dserv_dropprop(dserv_handle_t *, const char *, const char *); 84 char *dserv_firstpool(dserv_handle_t *); 85 char *dserv_nextpool(dserv_handle_t *); 86 char *dserv_getmds(dserv_handle_t *); 87 88 int dserv_kmod_regpool(dserv_handle_t *, const char *); 89 int dserv_kmod_setmds(dserv_handle_t *, dserv_setmds_args_t *); 90 int dserv_kmod_svc(dserv_handle_t *, dserv_svc_args_t *); 91 int dserv_kmod_setport(dserv_handle_t *, dserv_setport_args_t *); 92 int dserv_kmod_reportavail(dserv_handle_t *); 93 int dserv_kmod_instance_shutdown(dserv_handle_t *); 94 95 #ifdef __cplusplus 96 } 97 #endif 98 99 #endif /* _LIBDSERV_H */ 100