mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-01-13 19:44:06 +00:00
The sbuf will be used by DM to send and receive vm_events. Tracked-On: #8547 Signed-off-by: Wu Zhou <wu.zhou@intel.com> Reviewed-by: Jian Jun Chen <jian.jun.chen@intel.com>
40 lines
918 B
C
40 lines
918 B
C
/*
|
|
* Copyright (C) 2018-2023 Intel Corporation.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#ifndef SHARED_BUF_H
|
|
#define SHARED_BUF_H
|
|
|
|
#include <linux/types.h>
|
|
#include "acrn_common.h"
|
|
|
|
|
|
static inline bool sbuf_is_empty(struct shared_buf *sbuf)
|
|
{
|
|
return (sbuf->head == sbuf->tail);
|
|
}
|
|
|
|
static inline void sbuf_clear_flags(struct shared_buf *sbuf, uint64_t flags)
|
|
{
|
|
sbuf->flags &= ~flags;
|
|
}
|
|
|
|
static inline void sbuf_set_flags(struct shared_buf *sbuf, uint64_t flags)
|
|
{
|
|
sbuf->flags = flags;
|
|
}
|
|
|
|
static inline void sbuf_add_flags(struct shared_buf *sbuf, uint64_t flags)
|
|
{
|
|
sbuf->flags |= flags;
|
|
}
|
|
|
|
uint32_t sbuf_get(struct shared_buf *sbuf, uint8_t *data);
|
|
uint32_t sbuf_put(struct shared_buf *sbuf, uint8_t *data, uint32_t max_len);
|
|
int sbuf_clear_buffered(struct shared_buf *sbuf);
|
|
void sbuf_init(struct shared_buf *sbuf, uint32_t total_size, uint32_t ele_size);
|
|
|
|
#endif /* SHARED_BUF_H */
|