From fd00d7ea0adb4d25eb36eef835aa04bf4111e7dd Mon Sep 17 00:00:00 2001 From: Sebastian Vater Date: Fri, 1 Aug 2025 14:36:25 +0200 Subject: Added basic formatting for of iSCSI header and implementation file for doxygen, so documentation is fully properly readable now. --- src/server/iscsi.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/server/iscsi.c') diff --git a/src/server/iscsi.c b/src/server/iscsi.c index 4e96e06..48a4883 100644 --- a/src/server/iscsi.c +++ b/src/server/iscsi.c @@ -34,9 +34,9 @@ * @brief iSCSI implementation for DNBD3. * * This file contains the iSCSI implementation according to - * RFC7143 for dnbd3-server. + * RFC7143 for dnbd3-server.\n * All server-side network sending and client-side network - * receiving code is done here. + * receiving code is done here.\n * @see https://www.rfc-editor.org/rfc/rfc7143 */ @@ -140,10 +140,10 @@ uint8_t *iscsi_sprintf_alloc(const char *format, ... ) * @brief Creates an empty hash map with either specified or default capacity. * * Creates a ultra hardcore speed optimized empty hash map and - * allocates enough buckets to hold default capacity elements. + * allocates enough buckets to hold default capacity elements.\n * The speed optimizations require all keys having a size of * a multiple of 8 bytes with zero padding. Also the capacity - * always nas to be a power of two. + * always nas to be a power of two.\n * TODO: Move all hash map related functions to different source file * later and implement in a lock-free way for better concurrency. * @@ -358,7 +358,7 @@ static iscsi_hashmap_bucket *iscsi_hashmap_find_entry(iscsi_hashmap *map, const * @brief Creates a key suitable for hashmap usage (ensures 8-byte boundary and zero padding). * * Creates a key from data and size and ensures - * its requirements for usage in hash map buckets. + * its requirements for usage in hash map buckets.\n * Currently keys to be used in a hash map bucket * require a size of multiple by 8 bytes with * the zero padding. @@ -433,7 +433,7 @@ int iscsi_hashmap_key_destroy_value_callback(uint8_t *key, const size_t key_size * * Adds a key / value pair to a specified hash map * bucket list, if it doesn't exist already. The - * buckets are resized automatically if required. + * buckets are resized automatically if required.\n * This function neither does make a copy of the key, * nor of the value. Keys should be allocated using * the function iscsi_hashmap_key_create or freed by @@ -488,7 +488,7 @@ int iscsi_hashmap_put(iscsi_hashmap *map, const uint8_t *key, const size_t key_s * does exist, value will be set in `*out_in`, * meaning the value of the pair will be in * '*out_in` regardless of whether or not it it - * existed in the first place. + * existed in the first place.\n * The buckets are resized automatically if required. * This function neither does make a copy of the key, * nor of the value. Keys should be allocated using @@ -549,7 +549,7 @@ int iscsi_hashmap_get_put(iscsi_hashmap *map, const uint8_t *key, const size_t k * invoked in order to allow, e.g. deallocation of * resources, if necessary. The buckets are resized * automatically if required. This function neither - * does make a copy of the key, nor of the value. + * does make a copy of the key, nor of the value.\n * Keys should be allocated using the function * iscsi_hashmap_key_create or freed by using * iscsi_hashmap_key_destroy in order to ensure the @@ -701,7 +701,7 @@ void iscsi_hashmap_remove(iscsi_hashmap *map, const uint8_t *key, const size_t k /** * @brief Marks an element for removal by setting key and value both to NULL, but invokes a callback function before actual marking for removal. * - * Removes an element from the bucket list of the hash map. + * Removes an element from the bucket list of the hash map.\n * Buckets are marked as removed by setting their key and * value to NULL. The actual removal will be done upon next * resize operation. A callback function is invoked if the @@ -850,7 +850,7 @@ void iscsi_destroy_packet(iscsi_bhs_packet *packet_data) * * Constructs and appends an Additional Header Segment (AHS) to already allocated * packet data. There is no guarantee that the pointer stays the same. Any references - * to the old structure need to be updated! + * to the old structure need to be updated!\n * This function currently throws away any data beyond AHS. * * @param[in] packet_data Pointer to packet data to append to. If NULL, a Basic @@ -970,9 +970,9 @@ iscsi_ahs_packet *iscsi_get_ahs_packet(const iscsi_bhs_packet *packet_data, cons /** * @brief Allocate and initialize an iSCSI DS packet and append to existing data stream. * - * Constructs and appends DataSegment (DS) to already allocated packet data. + * Constructs and appends DataSegment (DS) to already allocated packet data.\n * There is no guarantee that the pointer stays the same. Any references - * to the old structure need to be updated! + * to the old structure need to be updated!\n * This function currently erases an already available DataSegment and * throws away any data beyond DS. * @@ -1054,7 +1054,7 @@ static const uint32_t crc32c_lut[] = { // Created with a polynomial reflect valu /** * @brief Calculates digest (CRC32C). * - * Calculates CRC32C with 0x82F63B78 polynomial reflect according to iSCSI specs + * Calculates CRC32C with 0x82F63B78 polynomial reflect according to iSCSI specs.\n * TODO: Implement optimized SSE4.2 and ARM versions * * @param[in] data Pointer to data to calculate CRC32C for. @@ -1116,7 +1116,7 @@ int iscsi_validate_header_digest(const iscsi_bhs_packet *packet_data) * @brief Calculate iSCSI data digest (CRC32C). * * Calculates data digest (CRC32) with 0x82F63B78 polynomial reflect - * of a whole DataSegment (CRC32C) according to the iSCSI specs. + * of a whole DataSegment (CRC32C) according to the iSCSI specs.\n * The resulting CRC32C will be stored in the iSCSI packet. * * @param[in] packet_data Pointer to ISCSI DS packet to calculate CRC32C for. @@ -1234,7 +1234,7 @@ static int iscsi_validate_key_value_pairs(const uint8_t *packet_data, uint len) /** * @brief Check if valid iSCSI packet and validate if necessarily. * - * Checks whether packet data is an iSCSI packet or not. + * Checks whether packet data is an iSCSI packet or not.\n * Since iSCSI doesn't have a magic identifier for its packets, a * partial heuristic approach is needed for it. There is not always * a guarantee that a packet clearly belongs to iSCSI. If header -- cgit v1.2.3-55-g7522