]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - include/linux/hyperv.h
Drivers: hv: vmbus: Export the vmbus_set_event() API
[linux.git] / include / linux / hyperv.h
index aa0fadce9308c3d03a090e84dced8fdde2afe5fa..40fd608475f7c85595e355f08afef966e2603d6f 100644 (file)
@@ -151,6 +151,33 @@ hv_get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi,
        *read = dsize - *write;
 }
 
+static inline u32 hv_get_bytes_to_read(struct hv_ring_buffer_info *rbi)
+{
+       u32 read_loc, write_loc, dsize, read;
+
+       dsize = rbi->ring_datasize;
+       read_loc = rbi->ring_buffer->read_index;
+       write_loc = READ_ONCE(rbi->ring_buffer->write_index);
+
+       read = write_loc >= read_loc ? (write_loc - read_loc) :
+               (dsize - read_loc) + write_loc;
+
+       return read;
+}
+
+static inline u32 hv_get_bytes_to_write(struct hv_ring_buffer_info *rbi)
+{
+       u32 read_loc, write_loc, dsize, write;
+
+       dsize = rbi->ring_datasize;
+       read_loc = READ_ONCE(rbi->ring_buffer->read_index);
+       write_loc = rbi->ring_buffer->write_index;
+
+       write = write_loc >= read_loc ? dsize - (write_loc - read_loc) :
+               read_loc - write_loc;
+       return write;
+}
+
 /*
  * VMBUS version is 32 bit entity broken up into
  * two 16 bit quantities: major_number. minor_number.
@@ -1338,4 +1365,5 @@ extern __u32 vmbus_proto_version;
 
 int vmbus_send_tl_connect_request(const uuid_le *shv_guest_servie_id,
                                  const uuid_le *shv_host_servie_id);
+void vmbus_set_event(struct vmbus_channel *channel);
 #endif /* _HYPERV_H */