Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148280119
D6708.id17345.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
7 KB
Referenced Files
None
Subscribers
None
D6708.id17345.diff
View Options
Index: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
===================================================================
--- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
+++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c
@@ -40,23 +40,29 @@
* Internal functions
*/
-typedef void (*vmbus_msg_handler)(hv_vmbus_channel_msg_header *msg);
+typedef void (*vmbus_msg_handler)(const hv_vmbus_channel_msg_header *msg);
typedef struct hv_vmbus_channel_msg_table_entry {
hv_vmbus_channel_msg_type messageType;
-
vmbus_msg_handler messageHandler;
} hv_vmbus_channel_msg_table_entry;
-static void vmbus_channel_on_offer(hv_vmbus_channel_msg_header* hdr);
-static void vmbus_channel_on_offer_internal(void* context);
-static void vmbus_channel_on_open_result(hv_vmbus_channel_msg_header* hdr);
-static void vmbus_channel_on_offer_rescind(hv_vmbus_channel_msg_header* hdr);
-static void vmbus_channel_on_offer_rescind_internal(void* context);
-static void vmbus_channel_on_gpadl_created(hv_vmbus_channel_msg_header* hdr);
-static void vmbus_channel_on_gpadl_torndown(hv_vmbus_channel_msg_header* hdr);
-static void vmbus_channel_on_offers_delivered(hv_vmbus_channel_msg_header* hdr);
-static void vmbus_channel_on_version_response(hv_vmbus_channel_msg_header* hdr);
+static void vmbus_channel_on_offer_internal(void *context);
+static void vmbus_channel_on_offer_rescind_internal(void *context);
+
+static void vmbus_channel_on_offer(const hv_vmbus_channel_msg_header *hdr);
+static void vmbus_channel_on_open_result(
+ const hv_vmbus_channel_msg_header *hdr);
+static void vmbus_channel_on_offer_rescind(
+ const hv_vmbus_channel_msg_header *hdr);
+static void vmbus_channel_on_gpadl_created(
+ const hv_vmbus_channel_msg_header *hdr);
+static void vmbus_channel_on_gpadl_torndown(
+ const hv_vmbus_channel_msg_header *hdr);
+static void vmbus_channel_on_offers_delivered(
+ const hv_vmbus_channel_msg_header *hdr);
+static void vmbus_channel_on_version_response(
+ const hv_vmbus_channel_msg_header *hdr);
/**
* Channel message dispatch table
@@ -392,12 +398,12 @@
* object to process the offer synchronously
*/
static void
-vmbus_channel_on_offer(hv_vmbus_channel_msg_header* hdr)
+vmbus_channel_on_offer(const hv_vmbus_channel_msg_header *hdr)
{
- hv_vmbus_channel_offer_channel* offer;
- hv_vmbus_channel_offer_channel* copied;
+ const hv_vmbus_channel_offer_channel *offer;
+ hv_vmbus_channel_offer_channel *copied;
- offer = (hv_vmbus_channel_offer_channel*) hdr;
+ offer = (const hv_vmbus_channel_offer_channel *)hdr;
// copy offer data
copied = malloc(sizeof(*copied), M_DEVBUF, M_NOWAIT);
@@ -470,12 +476,12 @@
* synchronously
*/
static void
-vmbus_channel_on_offer_rescind(hv_vmbus_channel_msg_header* hdr)
+vmbus_channel_on_offer_rescind(const hv_vmbus_channel_msg_header *hdr)
{
- hv_vmbus_channel_rescind_offer* rescind;
+ const hv_vmbus_channel_rescind_offer *rescind;
hv_vmbus_channel* channel;
- rescind = (hv_vmbus_channel_rescind_offer*) hdr;
+ rescind = (const hv_vmbus_channel_rescind_offer *)hdr;
channel = hv_vmbus_g_connection.channels[rescind->child_rel_id];
if (channel == NULL)
@@ -502,7 +508,8 @@
* @brief Invoked when all offers have been delivered.
*/
static void
-vmbus_channel_on_offers_delivered(hv_vmbus_channel_msg_header* hdr)
+vmbus_channel_on_offers_delivered(
+ const hv_vmbus_channel_msg_header *hdr __unused)
{
mtx_lock(&vmbus_chwait_lock);
@@ -519,14 +526,14 @@
* response and signal the requesting thread.
*/
static void
-vmbus_channel_on_open_result(hv_vmbus_channel_msg_header* hdr)
+vmbus_channel_on_open_result(const hv_vmbus_channel_msg_header *hdr)
{
- hv_vmbus_channel_open_result* result;
+ const hv_vmbus_channel_open_result *result;
hv_vmbus_channel_msg_info* msg_info;
hv_vmbus_channel_msg_header* requestHeader;
hv_vmbus_channel_open_channel* openMsg;
- result = (hv_vmbus_channel_open_result*) hdr;
+ result = (const hv_vmbus_channel_open_result *)hdr;
/*
* Find the open msg, copy the result and signal/unblock the wait event
@@ -561,14 +568,14 @@
* response and signal the requesting thread.
*/
static void
-vmbus_channel_on_gpadl_created(hv_vmbus_channel_msg_header* hdr)
+vmbus_channel_on_gpadl_created(const hv_vmbus_channel_msg_header *hdr)
{
- hv_vmbus_channel_gpadl_created* gpadl_created;
+ const hv_vmbus_channel_gpadl_created *gpadl_created;
hv_vmbus_channel_msg_info* msg_info;
hv_vmbus_channel_msg_header* request_header;
hv_vmbus_channel_gpadl_header* gpadl_header;
- gpadl_created = (hv_vmbus_channel_gpadl_created*) hdr;
+ gpadl_created = (const hv_vmbus_channel_gpadl_created *)hdr;
/* Find the establish msg, copy the result and signal/unblock
* the wait event
@@ -603,14 +610,14 @@
* response and signal the requesting thread
*/
static void
-vmbus_channel_on_gpadl_torndown(hv_vmbus_channel_msg_header* hdr)
+vmbus_channel_on_gpadl_torndown(const hv_vmbus_channel_msg_header *hdr)
{
- hv_vmbus_channel_gpadl_torndown* gpadl_torndown;
+ const hv_vmbus_channel_gpadl_torndown *gpadl_torndown;
hv_vmbus_channel_msg_info* msg_info;
hv_vmbus_channel_msg_header* requestHeader;
hv_vmbus_channel_gpadl_teardown* gpadlTeardown;
- gpadl_torndown = (hv_vmbus_channel_gpadl_torndown*)hdr;
+ gpadl_torndown = (const hv_vmbus_channel_gpadl_torndown *)hdr;
/*
* Find the open msg, copy the result and signal/unblock the
@@ -648,14 +655,14 @@
* response and signal the requesting thread.
*/
static void
-vmbus_channel_on_version_response(hv_vmbus_channel_msg_header* hdr)
+vmbus_channel_on_version_response(const hv_vmbus_channel_msg_header *hdr)
{
hv_vmbus_channel_msg_info* msg_info;
hv_vmbus_channel_msg_header* requestHeader;
hv_vmbus_channel_initiate_contact* initiate;
- hv_vmbus_channel_version_response* versionResponse;
+ const hv_vmbus_channel_version_response *versionResponse;
- versionResponse = (hv_vmbus_channel_version_response*)hdr;
+ versionResponse = (const hv_vmbus_channel_version_response *)hdr;
mtx_lock(&hv_vmbus_g_connection.channel_msg_lock);
TAILQ_FOREACH(msg_info, &hv_vmbus_g_connection.channel_msg_anchor,
@@ -841,14 +848,13 @@
}
void
-vmbus_chan_msgproc(struct vmbus_softc *sc, volatile struct vmbus_message *msg)
+vmbus_chan_msgproc(struct vmbus_softc *sc, const struct vmbus_message *msg)
{
const hv_vmbus_channel_msg_table_entry *entry;
- hv_vmbus_channel_msg_header *hdr;
+ const hv_vmbus_channel_msg_header *hdr;
hv_vmbus_channel_msg_type msg_type;
- /* XXX: update messageHandler interface */
- hdr = __DEVOLATILE(hv_vmbus_channel_msg_header *, msg->msg_data);
+ hdr = (const hv_vmbus_channel_msg_header *)msg->msg_data;
msg_type = hdr->message_type;
if (msg_type >= HV_CHANNEL_MESSAGE_COUNT) {
Index: head/sys/dev/hyperv/vmbus/vmbus.c
===================================================================
--- head/sys/dev/hyperv/vmbus/vmbus.c
+++ head/sys/dev/hyperv/vmbus/vmbus.c
@@ -86,7 +86,8 @@
break;
} else if (msg->msg_type == VMBUS_MSGTYPE_CHANNEL) {
/* Channel message */
- vmbus_chan_msgproc(sc, msg);
+ vmbus_chan_msgproc(sc,
+ __DEVOLATILE(const struct vmbus_message *, msg));
}
msg->msg_type = VMBUS_MSGTYPE_NONE;
Index: head/sys/dev/hyperv/vmbus/vmbus_var.h
===================================================================
--- head/sys/dev/hyperv/vmbus/vmbus_var.h
+++ head/sys/dev/hyperv/vmbus/vmbus_var.h
@@ -102,7 +102,6 @@
void vmbus_et_intr(struct trapframe *);
-void vmbus_chan_msgproc(struct vmbus_softc *,
- volatile struct vmbus_message *);
+void vmbus_chan_msgproc(struct vmbus_softc *, const struct vmbus_message *);
#endif /* !_VMBUS_VAR_H_ */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 17, 11:36 PM (31 m, 26 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29859634
Default Alt Text
D6708.id17345.diff (7 KB)
Attached To
Mode
D6708: hyperv/vmbus: Constify channel message
Attached
Detach File
Event Timeline
Log In to Comment