xref: /spdk/module/bdev/iscsi/bdev_iscsi.h (revision a6dbe3721eb3b5990707fc3e378c95e505dd8ab5)
1488570ebSJim Harris /*   SPDX-License-Identifier: BSD-3-Clause
2*a6dbe372Spaul luse  *   Copyright (C) 2018 Intel Corporation.
307fe6a43SSeth Howell  *   All rights reserved.
407fe6a43SSeth Howell  */
507fe6a43SSeth Howell 
607fe6a43SSeth Howell #ifndef SPDK_BDEV_ISCSI_H
707fe6a43SSeth Howell #define SPDK_BDEV_ISCSI_H
807fe6a43SSeth Howell 
907fe6a43SSeth Howell #include "spdk/bdev.h"
1007fe6a43SSeth Howell 
111519aa47Sgongwei struct spdk_bdev_iscsi_opts {
12c8e594c2Sgongwei 	uint64_t timeout_sec;
131519aa47Sgongwei 	uint64_t timeout_poller_period_us;
141519aa47Sgongwei };
151519aa47Sgongwei 
1607fe6a43SSeth Howell typedef void (*spdk_delete_iscsi_complete)(void *cb_arg, int bdeverrno);
1707fe6a43SSeth Howell 
1807fe6a43SSeth Howell /**
1907fe6a43SSeth Howell  * SPDK bdev iSCSI callback type.
2007fe6a43SSeth Howell  *
2107fe6a43SSeth Howell  * \param cb_arg Completion callback custom arguments
2207fe6a43SSeth Howell  * \param bdev created bdev
2307fe6a43SSeth Howell  * \param status operation status. Zero on success.
2407fe6a43SSeth Howell  */
2507fe6a43SSeth Howell typedef void (*spdk_bdev_iscsi_create_cb)(void *cb_arg, struct spdk_bdev *bdev, int status);
2607fe6a43SSeth Howell 
2707fe6a43SSeth Howell /**
2807fe6a43SSeth Howell  * Create new iSCSI bdev.
2907fe6a43SSeth Howell  *
3007fe6a43SSeth Howell  * \warning iSCSI URL allow providing login and password. Be careful because
3107fe6a43SSeth Howell  * they will show up in configuration dump.
3207fe6a43SSeth Howell  *
3307fe6a43SSeth Howell  * \param name name for new bdev.
3407fe6a43SSeth Howell  * \param url iSCSI URL string.
35dd363297SHailiang Wang  * \param initiator_iqn connection iqn name we identify to target as
3607fe6a43SSeth Howell  * \param cb_fn Completion callback
3707fe6a43SSeth Howell  * \param cb_arg Completion callback custom arguments
3807fe6a43SSeth Howell  * \return 0 on success or negative error code. If success bdev with provided name was created.
3907fe6a43SSeth Howell  */
40dd363297SHailiang Wang int create_iscsi_disk(const char *bdev_name, const char *url, const char *initiator_iqn,
4107fe6a43SSeth Howell 		      spdk_bdev_iscsi_create_cb cb_fn, void *cb_arg);
4207fe6a43SSeth Howell 
4307fe6a43SSeth Howell /**
4407fe6a43SSeth Howell  * Delete iSCSI bdev.
4507fe6a43SSeth Howell  *
464573e4ccSShuhei Matsumoto  * \param bdev_name Name of iSCSI bdev.
4707fe6a43SSeth Howell  * \param cb_fn Completion callback
4807fe6a43SSeth Howell  * \param cb_arg Completion callback custom arguments
4907fe6a43SSeth Howell  */
504573e4ccSShuhei Matsumoto void delete_iscsi_disk(const char *bdev_name, spdk_delete_iscsi_complete cb_fn, void *cb_arg);
511519aa47Sgongwei void bdev_iscsi_get_opts(struct spdk_bdev_iscsi_opts *opts);
521519aa47Sgongwei int bdev_iscsi_set_opts(struct spdk_bdev_iscsi_opts *opts);
5307fe6a43SSeth Howell #endif /* SPDK_BDEV_ISCSI_H */
54