scsi-lowlevel: make scsi_get_uint16/32() global and add scsi_set_uint16/32()
This is a preparation to use the (un)marshalling functions anywhere in the library. Signed-off-by: Bernhard Kohl <bernhard.kohl@gmx.net>
This commit is contained in:
committed by
Ronnie Sahlberg
parent
032594f099
commit
7e4b33dd31
@@ -724,6 +724,11 @@ EXTERN struct scsi_task *scsi_cdb_report_supported_opcodes(int report_timeouts,
|
|||||||
|
|
||||||
void *scsi_malloc(struct scsi_task *task, size_t size);
|
void *scsi_malloc(struct scsi_task *task, size_t size);
|
||||||
|
|
||||||
|
inline uint32_t scsi_get_uint32(const unsigned char *c);
|
||||||
|
inline uint16_t scsi_get_uint16(const unsigned char *c);
|
||||||
|
inline void scsi_set_uint32(unsigned char *c, uint32_t val);
|
||||||
|
inline void scsi_set_uint16(unsigned char *c, uint16_t val);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -160,18 +160,30 @@ scsi_sense_ascq_str(int ascq)
|
|||||||
return value_string_find(ascqs, ascq);
|
return value_string_find(ascqs, ascq);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t
|
inline uint32_t
|
||||||
scsi_get_uint32(unsigned char *c)
|
scsi_get_uint32(const unsigned char *c)
|
||||||
{
|
{
|
||||||
return ntohl(*(uint32_t *)c);
|
return ntohl(*(uint32_t *)c);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint16_t
|
inline uint16_t
|
||||||
scsi_get_uint16(unsigned char *c)
|
scsi_get_uint16(const unsigned char *c)
|
||||||
{
|
{
|
||||||
return ntohs(*(uint16_t *)c);
|
return ntohs(*(uint16_t *)c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void
|
||||||
|
scsi_set_uint32(unsigned char *c, uint32_t val)
|
||||||
|
{
|
||||||
|
*(uint32_t *)c = htonl(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void
|
||||||
|
scsi_set_uint16(unsigned char *c, uint16_t val)
|
||||||
|
{
|
||||||
|
*(uint16_t *)c = htons(val);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TESTUNITREADY
|
* TESTUNITREADY
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user