Skip to content

Commit 3a2a690

Browse files
authored
Enhance comments in tape.c for clarity
Added comments to clarify memory allocation and buffer usage.
1 parent 8a41907 commit 3a2a690

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/libltfs/tape.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3118,15 +3118,17 @@ int tape_set_attribute_to_cm(struct device_data* dev,
31183118
return -1;
31193119
}
31203120

3121+
/* we reserve the size of the attribute + the MAM header size since the buffer will contain both */
31213122
attr_data = calloc(1, attr_size + TC_MAM_PAGE_HEADER_SIZE);
31223123
if (!attr_data)
31233124
return -LTFS_NO_MEMORY;
31243125

3126+
/* fill the MAM header information */
31253127
ltfs_u16tobe(attr_data, type); /* set attribute type */
31263128
attr_data[2] = format; /* set data format type */
31273129
ltfs_u16tobe(attr_data + 3, attr_size); /* set data size */
31283130

3129-
/* data becomes the available space after TC_MAM_PAGE_HEADER_SIZE to start writing in , that is the reason why we add it here*/
3131+
/* data becomes the remaining space after TC_MAM_PAGE_HEADER_SIZE to start writing in, that is the reason why we add it here to the buffer address */
31303132
data = attr_data + TC_MAM_PAGE_HEADER_SIZE;
31313133

31323134
/* set attribute data */

0 commit comments

Comments
 (0)