Displaying 20 results from an estimated 2722 matches for "container_of".
2012 Dec 05
12
[PATCH 1/3] virtio: change to_vp_device to an inlined definition
...+ b/drivers/virtio/virtio_pci.c
@@ -98,11 +98,7 @@ static struct pci_device_id virtio_pci_id_table[] = {
MODULE_DEVICE_TABLE(pci, virtio_pci_id_table);
-/* Convert a generic virtio device to our structure */
-static struct virtio_pci_device *to_vp_device(struct virtio_device *vdev)
-{
- return container_of(vdev, struct virtio_pci_device, vdev);
-}
+#define to_vp_device(_vdev) container_of(_vdev, struct virtio_pci_device, vdev)
/* virtio config->get_features() implementation */
static u32 vp_get_features(struct virtio_device *vdev)
--
1.8.0
2012 Dec 05
12
[PATCH 1/3] virtio: change to_vp_device to an inlined definition
...+ b/drivers/virtio/virtio_pci.c
@@ -98,11 +98,7 @@ static struct pci_device_id virtio_pci_id_table[] = {
MODULE_DEVICE_TABLE(pci, virtio_pci_id_table);
-/* Convert a generic virtio device to our structure */
-static struct virtio_pci_device *to_vp_device(struct virtio_device *vdev)
-{
- return container_of(vdev, struct virtio_pci_device, vdev);
-}
+#define to_vp_device(_vdev) container_of(_vdev, struct virtio_pci_device, vdev)
/* virtio config->get_features() implementation */
static u32 vp_get_features(struct virtio_device *vdev)
--
1.8.0
2023 Apr 10
1
[PATCH] tools/virtio: fix build caused by virtio_ring changes
Fix the build dependency for virtio_test. virtio_ring requires
container_of_const() and struce device.
Signed-off-by: Shunsuke Mie <mie at igel.co.jp>
---
tools/include/linux/container_of.h | 36 ++++++++++++++++++++++++++++++
tools/virtio/linux/compiler.h | 3 +++
tools/virtio/linux/kernel.h | 5 +----
tools/virtio/linux/module.h | 1 +
4 fil...
2019 Aug 30
0
[nbdkit PATCH 1/9] server: Fewer dereferences in filter
Anywhere that we compute 'f = container_of(b)' then use 'f->backend.',
we can instead just use 'b->'. Similarly, during registration, we can
use the 'filename' input rather than our just-copied 'f->filename'.
Signed-off-by: Eric Blake <eblake@redhat.com>
---
server/filters.c | 170 ++++++...
2012 Mar 18
3
vhost question
...t) when there
are frames to deliver.
How can I get my host-side tx kick handler to wake the host-side rx kick
handler to deliver frames to the guest?
Steve
--
static void
handle_rx(struct vhost_work *work)
{
int n;
unsigned out, in;
struct transmission *t;
u16 frames = 0;
struct vhost_poll *p = container_of(work, struct vhost_poll, work);
struct vhost_virtqueue *vq = container_of(p, struct vhost_virtqueue, poll);
struct vhost_node *node = container_of(vq, struct vhost_node,
vqs[WLAN_VQ_RX]);
struct vhost_dev *dev = &node->vdev;
mutex_lock(&vq->mutex);
vhost_disable_notify(dev, vq);
whil...
2012 Mar 18
3
vhost question
...t) when there
are frames to deliver.
How can I get my host-side tx kick handler to wake the host-side rx kick
handler to deliver frames to the guest?
Steve
--
static void
handle_rx(struct vhost_work *work)
{
int n;
unsigned out, in;
struct transmission *t;
u16 frames = 0;
struct vhost_poll *p = container_of(work, struct vhost_poll, work);
struct vhost_virtqueue *vq = container_of(p, struct vhost_virtqueue, poll);
struct vhost_node *node = container_of(vq, struct vhost_node,
vqs[WLAN_VQ_RX]);
struct vhost_dev *dev = &node->vdev;
mutex_lock(&vq->mutex);
vhost_disable_notify(dev, vq);
whil...
2020 Feb 11
1
[nbdkit PATCH] filters: Make nxdata persistent
...data’ in the filter API.
*/
struct b_conn {
struct backend *b;
struct connection *conn;
+ void *handle;
};
/* Note this frees the whole chain. */
@@ -223,26 +225,44 @@ static void *
filter_open (struct backend *b, struct connection *conn, int readonly)
{
struct backend_filter *f = container_of (b, struct backend_filter, backend);
- struct b_conn nxdata = { .b = b->next, .conn = conn };
+ struct b_conn *nxdata = malloc (sizeof *nxdata);
+
+ if (!nxdata) {
+ nbdkit_error ("malloc: %m");
+ return NULL;
+ }
+
+ nxdata->b = b->next;
+ nxdata->conn = conn;
+...
2020 Feb 12
0
[PATCH nbdkit 3/3] server: filters: Remove struct b_h.
...ata, int readonly)
{
- struct b_h *b_h = nxdata;
- return b_h->b->preconnect (b_h->b, readonly);
+ struct backend *b_next = nxdata;
+ return b_next->preconnect (b_next, readonly);
}
static int
filter_preconnect (struct backend *b, int readonly)
{
struct backend_filter *f = container_of (b, struct backend_filter, backend);
- struct b_h nxdata = { .b = b->next };
debug ("%s: preconnect", b->name);
if (f->filter.preconnect)
- return f->filter.preconnect (next_preconnect, &nxdata, readonly);
+ return f->filter.preconnect (next_preconnect,...
2011 Feb 23
7
[PATCH 1/4] staging: hv: Fix the code depending on struct vmbus_driver_context data order
The patch fixed the code depending on the exact order of fields in the
struct vmbus_driver_context, so the unused field drv_ctx can be removed,
and drv_obj doesn't have to be the second field in this structure.
Signed-off-by: Haiyang Zhang <haiyangz at microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys at microsoft.com>
Signed-off-by: Hank Janssen <hjanssen at
2011 Feb 23
7
[PATCH 1/4] staging: hv: Fix the code depending on struct vmbus_driver_context data order
The patch fixed the code depending on the exact order of fields in the
struct vmbus_driver_context, so the unused field drv_ctx can be removed,
and drv_obj doesn't have to be the second field in this structure.
Signed-off-by: Haiyang Zhang <haiyangz at microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys at microsoft.com>
Signed-off-by: Hank Janssen <hjanssen at
2020 Aug 21
0
[PATCH] virtio-blk: Use kobj_to_dev() instead of container_of()
On Fri, Aug 21, 2020 at 09:19:15AM +0800, Tian Tao wrote:
> Use kobj_to_dev() instead of container_of()
>
> Signed-off-by: Tian Tao <tiantao6 at hisilicon.com>
> ---
> drivers/block/virtio_blk.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index 63b213e0..eb367b5 100644
> --- a/...
2018 Jan 17
0
[PATCH 5/9] connections: Allow multiple handles to be stored in the connection object.
...rn void *connection_get_crypto_session (struct connection *conn);
diff --git a/src/plugins.c b/src/plugins.c
index f0fe864..e732587 100644
--- a/src/plugins.c
+++ b/src/plugins.c
@@ -238,7 +238,7 @@ plugin_open (struct backend *b, struct connection *conn, int readonly)
struct backend_plugin *p = container_of (b, struct backend_plugin, backend);
void *handle;
- assert (connection_get_handle (conn) == NULL);
+ assert (connection_get_handle (conn, 0) == NULL);
assert (p->plugin.open != NULL);
debug ("%s: open readonly=%d", p->filename, readonly);
@@ -247,7 +247,7 @@ plugin_o...
2020 Mar 03
1
[PATCH v2] nouveau/hmm: map pages after migration
...;> I guess Ben Skeggs' tree would be appropriate.
>
> Yep
>
>> +static inline struct nouveau_pfnmap_args *
>> +nouveau_pfns_to_args(void *pfns)
>
> don't use static inline inside C files
OK.
>> +{
>> + struct nvif_vmm_pfnmap_v0 *p =
>> + container_of(pfns, struct nvif_vmm_pfnmap_v0, phys);
>> +
>> + return container_of(p, struct nouveau_pfnmap_args, p);
>
> And this should just be
>
> return container_of(pfns, struct nouveau_pfnmap_args, p.phys);
Much simpler, thanks.
>> +static struct nouveau_svmm *
>&g...
2018 Jan 19
0
[nbdkit PATCH v2 08/13] connections: Allow multiple handles to be stored in the connection object.
...rn void *connection_get_crypto_session (struct connection *conn);
diff --git a/src/plugins.c b/src/plugins.c
index 4442a50..137bae3 100644
--- a/src/plugins.c
+++ b/src/plugins.c
@@ -238,7 +238,7 @@ plugin_open (struct backend *b, struct connection *conn, int readonly)
struct backend_plugin *p = container_of (b, struct backend_plugin, backend);
void *handle;
- assert (connection_get_handle (conn) == NULL);
+ assert (connection_get_handle (conn, 0) == NULL);
assert (p->plugin.open != NULL);
debug ("%s: open readonly=%d", p->filename, readonly);
@@ -247,7 +247,7 @@ plugin_ope...
2014 Sep 22
1
[PATCH] virtio: unify config_changed handling
...)d + mic_aligned_desc_size(d);
struct mic_vdev *mvdev = (struct mic_vdev *)ioread64(&dc->vdev);
- struct virtio_driver *drv;
if (ioread8(&dc->config_change) != MIC_VIRTIO_PARAM_CONFIG_CHANGED)
return;
dev_dbg(mdrv->dev, "%s %d\n", __func__, __LINE__);
- drv = container_of(mvdev->vdev.dev.driver,
- struct virtio_driver, driver);
- if (drv->config_changed)
- drv->config_changed(&mvdev->vdev);
+ virtio_config_changed(&mvdev->vdev);
iowrite8(1, &dc->guest_ack);
}
diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_vir...
2014 Sep 22
1
[PATCH] virtio: unify config_changed handling
...)d + mic_aligned_desc_size(d);
struct mic_vdev *mvdev = (struct mic_vdev *)ioread64(&dc->vdev);
- struct virtio_driver *drv;
if (ioread8(&dc->config_change) != MIC_VIRTIO_PARAM_CONFIG_CHANGED)
return;
dev_dbg(mdrv->dev, "%s %d\n", __func__, __LINE__);
- drv = container_of(mvdev->vdev.dev.driver,
- struct virtio_driver, driver);
- if (drv->config_changed)
- drv->config_changed(&mvdev->vdev);
+ virtio_config_changed(&mvdev->vdev);
iowrite8(1, &dc->guest_ack);
}
diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_vir...
2019 Oct 04
6
[nbdkit PATCH 0/5] Another round of retry fixes
I still don't have .prepare/.finalize working cleanly across reopen,
but did find a nasty bug where a botched assertion means we failed to
notice reads beyond EOF in both the xz and retry filter.
Refactoring backend.c will make .finalize work easier.
Eric Blake (5):
xz: Avoid reading beyond EOF
retry: Check size before transactions
tests: Test retry when get_size values change
2018 Jan 17
0
[PATCH 7/9] Implement filters.
...struct with extra fields relating
+ * to this filter.
+ */
+struct backend_filter {
+ struct backend backend;
+ char *filename;
+ void *dl;
+ struct nbdkit_filter filter;
+};
+
+/* Note this frees the whole chain. */
+static void
+filter_free (struct backend *b)
+{
+ struct backend_filter *f = container_of (b, struct backend_filter, backend);
+
+ f->backend.next->free (f->backend.next);
+
+ /* Acquiring this lock prevents any filter callbacks from running
+ * simultaneously.
+ */
+ lock_unload ();
+
+ debug ("%s: unload", f->filename);
+ if (f->filter.unload)
+ f-...
2013 May 03
5
[PATCH 0/5] vhost-scsi cleanup
Asias He (5):
vhost-scsi: Remove unnecessary forward struct vhost_scsi declaration
vhost-scsi: Rename struct vhost_scsi *s to *vs
vhost-scsi: Make func indention more consistent
vhost-scsi: Rename struct tcm_vhost_tpg *tv_tpg to *tpg
vhost-scsi: Rename struct tcm_vhost_cmd *tv_cmd to *cmd
drivers/vhost/scsi.c | 469 +++++++++++++++++++++++++++------------------------
1 file changed,
2013 May 03
5
[PATCH 0/5] vhost-scsi cleanup
Asias He (5):
vhost-scsi: Remove unnecessary forward struct vhost_scsi declaration
vhost-scsi: Rename struct vhost_scsi *s to *vs
vhost-scsi: Make func indention more consistent
vhost-scsi: Rename struct tcm_vhost_tpg *tv_tpg to *tpg
vhost-scsi: Rename struct tcm_vhost_cmd *tv_cmd to *cmd
drivers/vhost/scsi.c | 469 +++++++++++++++++++++++++++------------------------
1 file changed,