ctld.h (274853) | ctld.h (278037) |
---|---|
1/*- 2 * Copyright (c) 2012 The FreeBSD Foundation 3 * All rights reserved. 4 * 5 * This software was developed by Edward Tomasz Napierala under sponsorship 6 * from the FreeBSD Foundation. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 12 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * | 1/*- 2 * Copyright (c) 2012 The FreeBSD Foundation 3 * All rights reserved. 4 * 5 * This software was developed by Edward Tomasz Napierala under sponsorship 6 * from the FreeBSD Foundation. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 12 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * |
29 * $FreeBSD: head/usr.sbin/ctld/ctld.h 274853 2014-11-22 15:09:18Z mav $ | 29 * $FreeBSD: head/usr.sbin/ctld/ctld.h 278037 2015-02-01 21:50:28Z mav $ |
30 */ 31 32#ifndef CTLD_H 33#define CTLD_H 34 35#include <sys/queue.h> 36#ifdef ICL_KERNEL_PROXY 37#include <sys/types.h> 38#endif 39#include <sys/socket.h> 40#include <stdbool.h> 41#include <libutil.h> 42#include <openssl/md5.h> 43 44#define DEFAULT_CONFIG_PATH "/etc/ctl.conf" 45#define DEFAULT_PIDFILE "/var/run/ctld.pid" 46#define DEFAULT_BLOCKSIZE 512 47 | 30 */ 31 32#ifndef CTLD_H 33#define CTLD_H 34 35#include <sys/queue.h> 36#ifdef ICL_KERNEL_PROXY 37#include <sys/types.h> 38#endif 39#include <sys/socket.h> 40#include <stdbool.h> 41#include <libutil.h> 42#include <openssl/md5.h> 43 44#define DEFAULT_CONFIG_PATH "/etc/ctl.conf" 45#define DEFAULT_PIDFILE "/var/run/ctld.pid" 46#define DEFAULT_BLOCKSIZE 512 47 |
48#define MAX_LUNS 1024 |
|
48#define MAX_NAME_LEN 223 49#define MAX_DATA_SEGMENT_LENGTH (128 * 1024) 50#define MAX_BURST_LENGTH 16776192 51#define SOCKBUF_SIZE 1048576 52 53struct auth { 54 TAILQ_ENTRY(auth) a_next; 55 struct auth_group *a_auth_group; --- 71 unchanged lines hidden (view full) --- 127 TAILQ_ENTRY(lun_option) lo_next; 128 struct lun *lo_lun; 129 char *lo_name; 130 char *lo_value; 131}; 132 133struct lun { 134 TAILQ_ENTRY(lun) l_next; | 49#define MAX_NAME_LEN 223 50#define MAX_DATA_SEGMENT_LENGTH (128 * 1024) 51#define MAX_BURST_LENGTH 16776192 52#define SOCKBUF_SIZE 1048576 53 54struct auth { 55 TAILQ_ENTRY(auth) a_next; 56 struct auth_group *a_auth_group; --- 71 unchanged lines hidden (view full) --- 128 TAILQ_ENTRY(lun_option) lo_next; 129 struct lun *lo_lun; 130 char *lo_name; 131 char *lo_value; 132}; 133 134struct lun { 135 TAILQ_ENTRY(lun) l_next; |
136 struct conf *l_conf; |
|
135 TAILQ_HEAD(, lun_option) l_options; | 137 TAILQ_HEAD(, lun_option) l_options; |
136 struct target *l_target; 137 int l_lun; | 138 char *l_name; |
138 char *l_backend; 139 int l_blocksize; 140 char *l_device_id; 141 char *l_path; | 139 char *l_backend; 140 int l_blocksize; 141 char *l_device_id; 142 char *l_path; |
143 char *l_scsiname; |
|
142 char *l_serial; 143 int64_t l_size; 144 145 int l_ctl_lun; 146}; 147 148struct target { 149 TAILQ_ENTRY(target) t_next; | 144 char *l_serial; 145 int64_t l_size; 146 147 int l_ctl_lun; 148}; 149 150struct target { 151 TAILQ_ENTRY(target) t_next; |
150 TAILQ_HEAD(, lun) t_luns; | |
151 struct conf *t_conf; | 152 struct conf *t_conf; |
153 struct lun *t_luns[MAX_LUNS]; |
|
152 struct auth_group *t_auth_group; 153 struct portal_group *t_portal_group; 154 char *t_name; 155 char *t_alias; 156 char *t_redirection; | 154 struct auth_group *t_auth_group; 155 struct portal_group *t_portal_group; 156 char *t_name; 157 char *t_alias; 158 char *t_redirection; |
159 160 uint32_t t_ctl_port; |
|
157}; 158 159struct isns { 160 TAILQ_ENTRY(isns) i_next; 161 struct conf *i_conf; 162 char *i_addr; 163 struct addrinfo *i_ai; 164}; 165 166struct conf { 167 char *conf_pidfile_path; | 161}; 162 163struct isns { 164 TAILQ_ENTRY(isns) i_next; 165 struct conf *i_conf; 166 char *i_addr; 167 struct addrinfo *i_ai; 168}; 169 170struct conf { 171 char *conf_pidfile_path; |
172 TAILQ_HEAD(, lun) conf_luns; |
|
168 TAILQ_HEAD(, target) conf_targets; 169 TAILQ_HEAD(, auth_group) conf_auth_groups; 170 TAILQ_HEAD(, portal_group) conf_portal_groups; 171 TAILQ_HEAD(, isns) conf_isns; 172 int conf_isns_period; 173 int conf_isns_timeout; 174 int conf_debug; 175 int conf_timeout; --- 138 unchanged lines hidden (view full) --- 314void isns_deregister(struct isns *isns); 315 316struct target *target_new(struct conf *conf, const char *name); 317void target_delete(struct target *target); 318struct target *target_find(struct conf *conf, 319 const char *name); 320int target_set_redirection(struct target *target, 321 const char *addr); | 173 TAILQ_HEAD(, target) conf_targets; 174 TAILQ_HEAD(, auth_group) conf_auth_groups; 175 TAILQ_HEAD(, portal_group) conf_portal_groups; 176 TAILQ_HEAD(, isns) conf_isns; 177 int conf_isns_period; 178 int conf_isns_timeout; 179 int conf_debug; 180 int conf_timeout; --- 138 unchanged lines hidden (view full) --- 319void isns_deregister(struct isns *isns); 320 321struct target *target_new(struct conf *conf, const char *name); 322void target_delete(struct target *target); 323struct target *target_find(struct conf *conf, 324 const char *name); 325int target_set_redirection(struct target *target, 326 const char *addr); |
327void target_set_ctl_port(struct target *target, 328 uint32_t value); |
|
322 | 329 |
323struct lun *lun_new(struct target *target, int lun_id); | 330struct lun *lun_new(struct conf *conf, const char *name); |
324void lun_delete(struct lun *lun); | 331void lun_delete(struct lun *lun); |
325struct lun *lun_find(const struct target *target, int lun_id); | 332struct lun *lun_find(const struct conf *conf, const char *name); |
326void lun_set_backend(struct lun *lun, const char *value); 327void lun_set_blocksize(struct lun *lun, size_t value); 328void lun_set_device_id(struct lun *lun, const char *value); 329void lun_set_path(struct lun *lun, const char *value); | 333void lun_set_backend(struct lun *lun, const char *value); 334void lun_set_blocksize(struct lun *lun, size_t value); 335void lun_set_device_id(struct lun *lun, const char *value); 336void lun_set_path(struct lun *lun, const char *value); |
337void lun_set_scsiname(struct lun *lun, const char *value); |
|
330void lun_set_serial(struct lun *lun, const char *value); 331void lun_set_size(struct lun *lun, size_t value); 332void lun_set_ctl_lun(struct lun *lun, uint32_t value); 333 334struct lun_option *lun_option_new(struct lun *lun, 335 const char *name, const char *value); 336void lun_option_delete(struct lun_option *clo); 337struct lun_option *lun_option_find(const struct lun *lun, 338 const char *name); 339void lun_option_set(struct lun_option *clo, 340 const char *value); 341 342void kernel_init(void); 343int kernel_lun_add(struct lun *lun); 344int kernel_lun_resize(struct lun *lun); 345int kernel_lun_remove(struct lun *lun); 346void kernel_handoff(struct connection *conn); 347int kernel_port_add(struct target *targ); | 338void lun_set_serial(struct lun *lun, const char *value); 339void lun_set_size(struct lun *lun, size_t value); 340void lun_set_ctl_lun(struct lun *lun, uint32_t value); 341 342struct lun_option *lun_option_new(struct lun *lun, 343 const char *name, const char *value); 344void lun_option_delete(struct lun_option *clo); 345struct lun_option *lun_option_find(const struct lun *lun, 346 const char *name); 347void lun_option_set(struct lun_option *clo, 348 const char *value); 349 350void kernel_init(void); 351int kernel_lun_add(struct lun *lun); 352int kernel_lun_resize(struct lun *lun); 353int kernel_lun_remove(struct lun *lun); 354void kernel_handoff(struct connection *conn); 355int kernel_port_add(struct target *targ); |
356int kernel_port_update(struct target *targ); |
|
348int kernel_port_remove(struct target *targ); 349void kernel_capsicate(void); 350 351#ifdef ICL_KERNEL_PROXY 352void kernel_listen(struct addrinfo *ai, bool iser, 353 int portal_id); 354void kernel_accept(int *connection_id, int *portal_id, 355 struct sockaddr *client_sa, --- 43 unchanged lines hidden --- | 357int kernel_port_remove(struct target *targ); 358void kernel_capsicate(void); 359 360#ifdef ICL_KERNEL_PROXY 361void kernel_listen(struct addrinfo *ai, bool iser, 362 int portal_id); 363void kernel_accept(int *connection_id, int *portal_id, 364 struct sockaddr *client_sa, --- 43 unchanged lines hidden --- |