Commit e4165a0f authored by Stephen Hemminger's avatar Stephen Hemminger Committed by Greg Kroah-Hartman

vmbus: constify parameters where possible

Functions that just query state of ring buffer can have parameters
marked const.
Signed-off-by: default avatarStephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6e47dd3e
...@@ -283,13 +283,13 @@ int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info, ...@@ -283,13 +283,13 @@ int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info,
void hv_ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info); void hv_ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info);
int hv_ringbuffer_write(struct vmbus_channel *channel, int hv_ringbuffer_write(struct vmbus_channel *channel,
struct kvec *kv_list, u32 kv_count); const struct kvec *kv_list, u32 kv_count);
int hv_ringbuffer_read(struct vmbus_channel *channel, int hv_ringbuffer_read(struct vmbus_channel *channel,
void *buffer, u32 buflen, u32 *buffer_actual_len, void *buffer, u32 buflen, u32 *buffer_actual_len,
u64 *requestid, bool raw); u64 *requestid, bool raw);
void hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info, void hv_ringbuffer_get_debuginfo(const struct hv_ring_buffer_info *ring_info,
struct hv_ring_buffer_debug_info *debug_info); struct hv_ring_buffer_debug_info *debug_info);
/* /*
......
...@@ -96,11 +96,9 @@ hv_set_next_write_location(struct hv_ring_buffer_info *ring_info, ...@@ -96,11 +96,9 @@ hv_set_next_write_location(struct hv_ring_buffer_info *ring_info,
/* Get the next read location for the specified ring buffer. */ /* Get the next read location for the specified ring buffer. */
static inline u32 static inline u32
hv_get_next_read_location(struct hv_ring_buffer_info *ring_info) hv_get_next_read_location(const struct hv_ring_buffer_info *ring_info)
{ {
u32 next = ring_info->ring_buffer->read_index; return ring_info->ring_buffer->read_index;
return next;
} }
/* /*
...@@ -108,7 +106,7 @@ hv_get_next_read_location(struct hv_ring_buffer_info *ring_info) ...@@ -108,7 +106,7 @@ hv_get_next_read_location(struct hv_ring_buffer_info *ring_info)
* This allows the caller to skip. * This allows the caller to skip.
*/ */
static inline u32 static inline u32
hv_get_next_readlocation_withoffset(struct hv_ring_buffer_info *ring_info, hv_get_next_readlocation_withoffset(const struct hv_ring_buffer_info *ring_info,
u32 offset) u32 offset)
{ {
u32 next = ring_info->ring_buffer->read_index; u32 next = ring_info->ring_buffer->read_index;
...@@ -130,7 +128,7 @@ hv_set_next_read_location(struct hv_ring_buffer_info *ring_info, ...@@ -130,7 +128,7 @@ hv_set_next_read_location(struct hv_ring_buffer_info *ring_info,
/* Get the size of the ring buffer. */ /* Get the size of the ring buffer. */
static inline u32 static inline u32
hv_get_ring_buffersize(struct hv_ring_buffer_info *ring_info) hv_get_ring_buffersize(const struct hv_ring_buffer_info *ring_info)
{ {
return ring_info->ring_datasize; return ring_info->ring_datasize;
} }
...@@ -147,7 +145,7 @@ hv_get_ring_bufferindices(struct hv_ring_buffer_info *ring_info) ...@@ -147,7 +145,7 @@ hv_get_ring_bufferindices(struct hv_ring_buffer_info *ring_info)
* Assume there is enough room. Handles wrap-around in src case only!! * Assume there is enough room. Handles wrap-around in src case only!!
*/ */
static u32 hv_copyfrom_ringbuffer( static u32 hv_copyfrom_ringbuffer(
struct hv_ring_buffer_info *ring_info, const struct hv_ring_buffer_info *ring_info,
void *dest, void *dest,
u32 destlen, u32 destlen,
u32 start_read_offset) u32 start_read_offset)
...@@ -171,7 +169,7 @@ static u32 hv_copyfrom_ringbuffer( ...@@ -171,7 +169,7 @@ static u32 hv_copyfrom_ringbuffer(
static u32 hv_copyto_ringbuffer( static u32 hv_copyto_ringbuffer(
struct hv_ring_buffer_info *ring_info, struct hv_ring_buffer_info *ring_info,
u32 start_write_offset, u32 start_write_offset,
void *src, const void *src,
u32 srclen) u32 srclen)
{ {
void *ring_buffer = hv_get_ring_buffer(ring_info); void *ring_buffer = hv_get_ring_buffer(ring_info);
...@@ -186,7 +184,7 @@ static u32 hv_copyto_ringbuffer( ...@@ -186,7 +184,7 @@ static u32 hv_copyto_ringbuffer(
} }
/* Get various debug metrics for the specified ring buffer. */ /* Get various debug metrics for the specified ring buffer. */
void hv_ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info, void hv_ringbuffer_get_debuginfo(const struct hv_ring_buffer_info *ring_info,
struct hv_ring_buffer_debug_info *debug_info) struct hv_ring_buffer_debug_info *debug_info)
{ {
u32 bytes_avail_towrite; u32 bytes_avail_towrite;
...@@ -264,7 +262,7 @@ void hv_ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info) ...@@ -264,7 +262,7 @@ void hv_ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info)
/* Write to the ring buffer. */ /* Write to the ring buffer. */
int hv_ringbuffer_write(struct vmbus_channel *channel, int hv_ringbuffer_write(struct vmbus_channel *channel,
struct kvec *kv_list, u32 kv_count) const struct kvec *kv_list, u32 kv_count)
{ {
int i = 0; int i = 0;
u32 bytes_avail_towrite; u32 bytes_avail_towrite;
......
...@@ -138,7 +138,7 @@ struct hv_ring_buffer_info { ...@@ -138,7 +138,7 @@ struct hv_ring_buffer_info {
* for the specified ring buffer * for the specified ring buffer
*/ */
static inline void static inline void
hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi, hv_get_ringbuffer_availbytes(const struct hv_ring_buffer_info *rbi,
u32 *read, u32 *write) u32 *read, u32 *write)
{ {
u32 read_loc, write_loc, dsize; u32 read_loc, write_loc, dsize;
...@@ -153,7 +153,7 @@ hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi, ...@@ -153,7 +153,7 @@ hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
*read = dsize - *write; *read = dsize - *write;
} }
static inline u32 hv_get_bytes_to_read(struct hv_ring_buffer_info *rbi) static inline u32 hv_get_bytes_to_read(const struct hv_ring_buffer_info *rbi)
{ {
u32 read_loc, write_loc, dsize, read; u32 read_loc, write_loc, dsize, read;
...@@ -167,7 +167,7 @@ static inline u32 hv_get_bytes_to_read(struct hv_ring_buffer_info *rbi) ...@@ -167,7 +167,7 @@ static inline u32 hv_get_bytes_to_read(struct hv_ring_buffer_info *rbi)
return read; return read;
} }
static inline u32 hv_get_bytes_to_write(struct hv_ring_buffer_info *rbi) static inline u32 hv_get_bytes_to_write(const struct hv_ring_buffer_info *rbi)
{ {
u32 read_loc, write_loc, dsize, write; u32 read_loc, write_loc, dsize, write;
...@@ -1448,9 +1448,9 @@ void vmbus_set_event(struct vmbus_channel *channel); ...@@ -1448,9 +1448,9 @@ void vmbus_set_event(struct vmbus_channel *channel);
/* Get the start of the ring buffer. */ /* Get the start of the ring buffer. */
static inline void * static inline void *
hv_get_ring_buffer(struct hv_ring_buffer_info *ring_info) hv_get_ring_buffer(const struct hv_ring_buffer_info *ring_info)
{ {
return (void *)ring_info->ring_buffer->buffer; return ring_info->ring_buffer->buffer;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment