1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright 2023 Solidigm All Rights Reserved 3 */ 4 5 #ifndef FTL_PROPERTY_H 6 #define FTL_PROPERTY_H 7 8 #include "spdk/stdinc.h" 9 10 struct spdk_ftl_dev; 11 struct ftl_property; 12 13 /** 14 * @brief Init the FTL properties system 15 * 16 * @retval 0 Success 17 * @retval Non-zero a Failure 18 */ 19 int ftl_properties_init(struct spdk_ftl_dev *dev); 20 21 /** 22 * @brief Deinit the FTL properties system 23 */ 24 void ftl_properties_deinit(struct spdk_ftl_dev *dev); 25 26 /** 27 * @brief A function to dump the FTL property which type is bool 28 */ 29 void ftl_property_dump_bool(const struct ftl_property *property, struct spdk_json_write_ctx *w); 30 31 /** 32 * @brief A function to dump the FTL property which type is uint64 33 */ 34 void ftl_property_dump_uint64(const struct ftl_property *property, struct spdk_json_write_ctx *w); 35 36 /** 37 * @brief A function to dump the FTL property which type is uint32 38 */ 39 void ftl_property_dump_uint32(const struct ftl_property *property, struct spdk_json_write_ctx *w); 40 41 /** 42 * @brief Dump the value of property into the specified JSON RPC request 43 * 44 * @param property The property to dump to the JSON RPC request 45 * @param[out] w JSON RPC request 46 */ 47 typedef void (*ftl_property_dump_fn)(const struct ftl_property *property, 48 struct spdk_json_write_ctx *w); 49 50 /** 51 * @brief Register a FTL property 52 * 53 * @param dev FTL device 54 * @param name the FTL property name 55 * @param value Pointer to the value of property 56 * @param size The value size of the property 57 * @param dump The function to dump the property to the JSON RPC request 58 */ 59 void ftl_property_register(struct spdk_ftl_dev *dev, const char *name, void *value, size_t size, 60 ftl_property_dump_fn dump); 61 62 /** 63 * @brief Dump FTL properties to the JSON request 64 * 65 * @param dev FTL device 66 * @param request The JSON request where to store the FTL properties 67 */ 68 void ftl_property_dump(struct spdk_ftl_dev *dev, struct spdk_jsonrpc_request *request); 69 70 #endif 71