1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright (c) Intel Corporation. 3 * All rights reserved. 4 */ 5 6 #ifndef SPDK_BDEV_ISCSI_H 7 #define SPDK_BDEV_ISCSI_H 8 9 #include "spdk/bdev.h" 10 11 struct spdk_bdev_iscsi_opts { 12 uint64_t timeout; 13 uint64_t timeout_poller_period_us; 14 }; 15 16 typedef void (*spdk_delete_iscsi_complete)(void *cb_arg, int bdeverrno); 17 18 /** 19 * SPDK bdev iSCSI callback type. 20 * 21 * \param cb_arg Completion callback custom arguments 22 * \param bdev created bdev 23 * \param status operation status. Zero on success. 24 */ 25 typedef void (*spdk_bdev_iscsi_create_cb)(void *cb_arg, struct spdk_bdev *bdev, int status); 26 27 /** 28 * Create new iSCSI bdev. 29 * 30 * \warning iSCSI URL allow providing login and password. Be careful because 31 * they will show up in configuration dump. 32 * 33 * \param name name for new bdev. 34 * \param url iSCSI URL string. 35 * \param initiator_iqn connection iqn name we identify to target as 36 * \param cb_fn Completion callback 37 * \param cb_arg Completion callback custom arguments 38 * \return 0 on success or negative error code. If success bdev with provided name was created. 39 */ 40 int create_iscsi_disk(const char *bdev_name, const char *url, const char *initiator_iqn, 41 spdk_bdev_iscsi_create_cb cb_fn, void *cb_arg); 42 43 /** 44 * Delete iSCSI bdev. 45 * 46 * \param bdev_name Name of iSCSI bdev. 47 * \param cb_fn Completion callback 48 * \param cb_arg Completion callback custom arguments 49 */ 50 void delete_iscsi_disk(const char *bdev_name, spdk_delete_iscsi_complete cb_fn, void *cb_arg); 51 void bdev_iscsi_get_opts(struct spdk_bdev_iscsi_opts *opts); 52 int bdev_iscsi_set_opts(struct spdk_bdev_iscsi_opts *opts); 53 #endif /* SPDK_BDEV_ISCSI_H */ 54