scsi: change sg_count to uint32.

coding style.

Change-Id: Ie2e1a71e55b8fe8ac984d47b9b97409b1e436b69
Reviewed-on: https://review.haiku-os.org/c/1489
Reviewed-by: Rene Gollent <[email protected]>
This commit is contained in:
Jérôme Duval
2019-05-28 17:43:10 +00:00
committed by Rene Gollent
parent 061236d419
commit e5b82f8034
5 changed files with 27 additions and 24 deletions
@@ -29,8 +29,8 @@ status_t get_iovec_memory_map(
size_t vec_offset, // number of bytes to skip at beginning of vec
size_t len, // number of bytes to analyze
physical_entry *map, // resulting memory map
size_t max_entries, // max number of entries in map
size_t *num_entries, // actual number of map entries used
uint32 max_entries, // max number of entries in map
uint32 *num_entries, // actual number of map entries used
size_t *mapped_len // actual number of bytes described by map
);
@@ -296,7 +296,7 @@ scsi_alloc_dma_buffer_sg_orig(dma_buffer *buffer, size_t size)
buffer->sg_count_max_orig = size / sizeof(physical_entry);
SHOW_INFO(3, "Got up to %" B_PRIuSIZE " S/G entries to original data",
SHOW_INFO(3, "Got up to %" B_PRIu32 " S/G entries to original data",
buffer->sg_count_max_orig);
return true;
@@ -35,7 +35,7 @@ fill_temp_sg(scsi_ccb *ccb)
ccb->data,
ccb->data_length
};
size_t num_entries;
uint32 num_entries;
size_t mapped_len;
physical_entry *temp_sg = (physical_entry *)ccb->sg_list;
@@ -67,7 +67,7 @@ fill_temp_sg(scsi_ccb *ccb)
SHOW_FLOW(4, "addr=%#" B_PRIxPHYSADDR ", size=%" B_PRIxPHYSADDR
", max_len=%" B_PRIxADDR ", idx=%" B_PRId32 ", num=%"
B_PRIuSIZE, temp_sg[cur_idx].address, temp_sg[cur_idx].size,
B_PRIu32, temp_sg[cur_idx].address, temp_sg[cur_idx].size,
max_len, cur_idx, num_entries);
if (max_len < temp_sg[cur_idx].size) {
@@ -125,18 +125,18 @@ typedef struct dma_buffer {
size_t size; // size of DMA buffer
area_id sg_list_area; // area of S/G list
physical_entry *sg_list; // address of S/G list
size_t sg_count; // number of entries in S/G list
uint32 sg_count; // number of entries in S/G list
bool inuse; // true, if in use
bigtime_t last_use; // timestamp of last usage
area_id sg_orig; // area of S/G list to original data
physical_entry *sg_list_orig; // S/G list to original data
size_t sg_count_max_orig; // maximum size (in entries)
size_t sg_count_orig; // current size (in entries)
uint32 sg_count_max_orig; // maximum size (in entries)
uint32 sg_count_orig; // current size (in entries)
uchar *orig_data; // pointer to original data
const physical_entry *orig_sg_list; // original S/G list
size_t orig_sg_count; // size of original S/G list
uint32 orig_sg_count; // size of original S/G list
} dma_buffer;
@@ -27,13 +27,13 @@
status_t
get_iovec_memory_map(iovec *vec, size_t vec_count, size_t vec_offset, size_t len,
physical_entry *map, size_t max_entries, size_t *num_entries, size_t *mapped_len)
physical_entry *map, uint32 max_entries, uint32 *num_entries, size_t *mapped_len)
{
size_t cur_idx;
uint32 cur_idx;
size_t left_len;
SHOW_FLOW(3, "vec_count=%" B_PRIuSIZE ", vec_offset=%" B_PRIuSIZE ", len=%"
B_PRIuSIZE ", max_entries=%" B_PRIuSIZE, vec_count, vec_offset, len,
B_PRIuSIZE ", max_entries=%" B_PRIu32, vec_count, vec_offset, len,
max_entries);
// skip iovec blocks if needed
@@ -43,15 +43,16 @@ get_iovec_memory_map(iovec *vec, size_t vec_count, size_t vec_offset, size_t len
++vec;
}
for (left_len = len, cur_idx = 0; left_len > 0 && vec_count > 0 && cur_idx < max_entries;) {
for (left_len = len, cur_idx = 0; left_len > 0 && vec_count > 0
&& cur_idx < max_entries;) {
char *range_start;
size_t range_len;
status_t res;
size_t cur_num_entries, cur_mapped_len;
uint32 cur_num_entries, cur_mapped_len;
uint32 tmp_idx;
SHOW_FLOW( 3, "left_len=%d, vec_count=%d, cur_idx=%d",
(int)left_len, (int)vec_count, (int)cur_idx );
SHOW_FLOW( 3, "left_len=%d, vec_count=%d, cur_idx=%" B_PRIu32,
(int)left_len, (int)vec_count, cur_idx );
// map one iovec
range_start = (char *)vec->iov_base + vec_offset;
@@ -85,15 +86,16 @@ get_iovec_memory_map(iovec *vec, size_t vec_count, size_t vec_offset, size_t len
}
if (cur_mapped_len == 0) {
panic("get_memory_map() returned empty list; left_len=%d, idx=%d/%d",
(int)left_len, (int)cur_idx, (int)max_entries);
SHOW_ERROR(2, "get_memory_map() returned empty list; left_len=%d, idx=%d/%d",
(int)left_len, (int)cur_idx, (int)max_entries);
panic("get_memory_map() returned empty list; left_len=%d, idx=%"
B_PRIu32 "/%" B_PRIu32, (int)left_len, cur_idx, max_entries);
SHOW_ERROR(2, "get_memory_map() returned empty list; left_len=%d, "
"idx=%" B_PRIu32 "/%" B_PRIu32, (int)left_len, cur_idx,
max_entries);
return B_ERROR;
}
SHOW_FLOW( 3, "cur_num_entries=%d, cur_mapped_len=%x",
(int)cur_num_entries, (int)cur_mapped_len );
SHOW_FLOW( 3, "cur_num_entries=%" B_PRIu32 ", cur_mapped_len=%x",
cur_num_entries, (int)cur_mapped_len );
// try to combine with previous sg block
if (cur_num_entries > 0 && cur_idx > 0
@@ -101,7 +103,8 @@ get_iovec_memory_map(iovec *vec, size_t vec_count, size_t vec_offset, size_t len
== map[cur_idx - 1].address + map[cur_idx - 1].size) {
SHOW_FLOW0( 3, "combine with previous chunk" );
map[cur_idx - 1].size += map[cur_idx].size;
memcpy(&map[cur_idx], &map[cur_idx + 1], (cur_num_entries - 1) * sizeof(map[0]));
memcpy(&map[cur_idx], &map[cur_idx + 1],
(cur_num_entries - 1) * sizeof(map[0]));
--cur_num_entries;
}
@@ -118,7 +121,7 @@ get_iovec_memory_map(iovec *vec, size_t vec_count, size_t vec_offset, size_t len
*num_entries = cur_idx;
*mapped_len = len - left_len;
SHOW_FLOW( 3, "num_entries=%" B_PRIuSIZE ", mapped_len=%" B_PRIxSIZE,
SHOW_FLOW( 3, "num_entries=%" B_PRIu32 ", mapped_len=%" B_PRIxSIZE,
*num_entries, *mapped_len);
return B_OK;