Make scsi_allocated_memory private to scsi-lowlevel and remove the ptr pointer

Change the list-head structure for in-task scsi memory allocations to
be private to scsi-lowlevel since is is never accessed from anyehwere else and
it is private to this function.
Remove the pointer to the user data in the list head and replace it with a zero length buffer at the end of the header.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This commit is contained in:
Ronnie Sahlberg
2012-11-11 08:03:44 -08:00
parent a0b9080c6c
commit 4de36794f2
2 changed files with 5 additions and 7 deletions

View File

@@ -299,11 +299,6 @@ struct scsi_data {
unsigned char *data;
};
struct scsi_allocated_memory {
struct scsi_allocated_memory *next;
void *ptr;
};
enum scsi_residual {
SCSI_RESIDUAL_NO_RESIDUAL = 0,
SCSI_RESIDUAL_UNDERFLOW,

View File

@@ -39,6 +39,10 @@
#include "scsi-lowlevel.h"
#include "iscsi-private.h"
struct scsi_allocated_memory {
struct scsi_allocated_memory *next;
char buf[0];
};
void
scsi_free_scsi_task(struct scsi_task *task)
@@ -64,9 +68,8 @@ scsi_malloc(struct scsi_task *task, size_t size)
return NULL;
}
memset(mem, 0, sizeof(struct scsi_allocated_memory) + size);
mem->ptr = (void *) ((uintptr_t)mem + sizeof(struct scsi_allocated_memory));
SLIST_ADD(&task->mem, mem);
return mem->ptr;
return &mem->buf[0];
}
struct value_string {