Update to Muen sinfo variant resource API
authorReto Buerki <reet@codelabs.ch>
Wed, 5 Dec 2018 12:31:51 +0000 (13:31 +0100)
committerReto Buerki <reet@codelabs.ch>
Mon, 28 Jan 2019 14:58:48 +0000 (15:58 +0100)
common.c
common.h

index e461b53..11070b5 100644 (file)
--- a/common.c
+++ b/common.c
@@ -55,18 +55,19 @@ int muenblk_init_channel(
                error = -EINVAL;
                goto err_out;
        }
-       if (!chan->channel_info.address) {
+       if (!chan->channel_info->data.mem.address) {
                ERROR("Failed to retrieve channel information\n");
                error = -EINVAL;
                goto err_out;
        }
-       if (chan->channel_info.size < sizeof(struct muenblk_event)) {
-               ERROR("Channel size of %llu bytes too small, minimum is %lu\n", chan->channel_info.size, sizeof(struct muenblk_event));
+       if (chan->channel_info->data.mem.size < sizeof(struct muenblk_event)) {
+               ERROR("Channel size of %llu bytes too small, minimum is %lu\n", chan->channel_info->data.mem.size, sizeof(struct muenblk_event));
                error = -EINVAL;
                goto err_out;
        }
 
-       if (writer && !chan->channel_info.writable) {
+       if (writer && !(chan->channel_info->data.mem.flags
+                               & MEM_CHANNEL_FLAG)) {
                ERROR("Channel is not writeable\n");
                error = -EPERM;
                goto err_out;
@@ -84,13 +85,13 @@ int muenblk_init_channel(
 
        chan->channel_element_size = sizeof(struct muenblk_event);
        chan->channel_queue_size =
-               (chan->channel_info.size
+               (chan->channel_info->data.mem.size
                 - sizeof(struct muchannel_header))
                / chan->channel_element_size;
 
        chan->channel_data = ioremap_cache(
-                       chan->channel_info.address,
-                       chan->channel_info.size);
+                       chan->channel_info->data.mem.address,
+                       chan->channel_info->data.mem.size);
        if (!chan->channel_data) {
                ERROR("Failed to allocate channel memory\n");
                error = -ENOMEM;
@@ -103,7 +104,7 @@ int muenblk_init_channel(
                                chan->channel_data,
                                chan->channel_protocol,
                                chan->channel_element_size,
-                               chan->channel_info.size,
+                               chan->channel_info->data.mem.size,
                                epoch);
        } else
                muen_channel_init_reader(&chan->reader, chan->channel_protocol);
@@ -245,18 +246,20 @@ int muenblk_init_shm(struct muenblk_device *dev, bool server)
        int error = 0;
 
        BUG_ON(!dev);
-
-       if (!muen_get_channel_info(dev->req.channel_name,
-                               &dev->req.channel_info)) {
+       dev->req.channel_info = (struct muen_resource_type *)
+               muen_get_resource(dev->req.channel_name, MUEN_RES_MEMORY);
+       if (!dev->req.channel_info) {
                ERROR("Failed to determine shm request channel\n");
                return -EINVAL;
        }
-       if (!muen_get_channel_info(dev->resp.channel_name,
-                               &dev->resp.channel_info)) {
+       dev->resp.channel_info = (struct muen_resource_type *)
+               muen_get_resource(dev->resp.channel_name, MUEN_RES_MEMORY);
+       if (!dev->resp.channel_info) {
                ERROR("Failed to determine shm response channel\n");
                return -EINVAL;
        }
-       if (dev->resp.channel_info.size != dev->req.channel_info.size) {
+       if (dev->resp.channel_info->data.mem.size
+                       != dev->req.channel_info->data.mem.size) {
                ERROR("Request and response channel sizes differ, must be of same size");
                return -EINVAL;
        }
index 35bf5b8..1184a2a 100644 (file)
--- a/common.h
+++ b/common.h
@@ -49,7 +49,7 @@ struct muenblk_priv_data;
 
 struct muenblk_device_channel {
        char                            channel_name[64];
-       struct muen_channel_info        channel_info;
+       struct muen_resource_type       *channel_info;
 
        struct muchannel                *channel_data;
        struct muchannel_reader         reader;