mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-01-04 23:24:56 +00:00
HV:change the return type of sbuf_get and sbuf_put
Because of the return type inconsistent,change the sbuf return type to uint32_t to fix it,and make the pre-condition to check the parameter whether is NULL. V1->V2: 1.add () to bool expression 2.add pre-assumption to sbuf_get and sbuf_put Tracked-On: #861 Signed-off-by: Huihuang Shi <huihuang.shi@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -82,14 +82,10 @@ void sbuf_free(struct shared_buf *sbuf)
|
||||
free(sbuf);
|
||||
}
|
||||
|
||||
int sbuf_get(struct shared_buf *sbuf, uint8_t *data)
|
||||
uint32_t sbuf_get(struct shared_buf *sbuf, uint8_t *data)
|
||||
{
|
||||
const void *from;
|
||||
|
||||
if ((sbuf == NULL) || (data == NULL)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (sbuf_is_empty(sbuf)) {
|
||||
/* no data available */
|
||||
return 0;
|
||||
@@ -122,16 +118,12 @@ int sbuf_get(struct shared_buf *sbuf, uint8_t *data)
|
||||
* negative: failed.
|
||||
*/
|
||||
|
||||
int sbuf_put(struct shared_buf *sbuf, uint8_t *data)
|
||||
uint32_t sbuf_put(struct shared_buf *sbuf, uint8_t *data)
|
||||
{
|
||||
void *to;
|
||||
uint32_t next_tail;
|
||||
bool trigger_overwrite = false;
|
||||
|
||||
if ((sbuf == NULL) || (data == NULL)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
next_tail = sbuf_next_ptr(sbuf->tail, sbuf->ele_size, sbuf->size);
|
||||
/* if this write would trigger overrun */
|
||||
if (next_tail == sbuf->head) {
|
||||
|
||||
Reference in New Issue
Block a user