1 /*
2  * Copyright (c) 2022, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef BLOCK_STORAGE_CLIENT_H
9 #define BLOCK_STORAGE_CLIENT_H
10 
11 #include "service/common/client/service_client.h"
12 #include "service/block_storage/block_store/block_store.h"
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 /**
19  * \brief block_storage_client structure
20  *
21  * A block_storage_client is a block_store that communicates with a remote block
22  * storage service provider. Used when block level storage is handled in a
23  * different environment from the client environment.
24  */
25 struct block_storage_client {
26 	struct block_store base_block_store;
27 	struct service_client client;
28 };
29 
30 /**
31  * \brief Initialize a block_storage_client
32  *
33  * \param[in]  block_storage_client  The subject block_storage_client
34  * \param[in]  caller   An rpc_caller for reaching the associated service provider
35  *
36  * \return Pointer to block_store or NULL on failure
37  */
38 struct block_store *block_storage_client_init(
39 	struct block_storage_client *block_storage_client,
40 	struct rpc_caller_session *session);
41 
42 /**
43  * \brief De-initialize a block_storage_client
44  *
45  *  Frees resource allocated during call to block_storage_client_init().
46  *
47  * \param[in]  block_storage_client  The subject block_storage_client
48  */
49 void block_storage_client_deinit(
50 	struct block_storage_client *block_storage_client);
51 
52 
53 #ifdef __cplusplus
54 }
55 #endif
56 
57 #endif /* BLOCK_STORAGE_CLIENT_H */
58