search for: offsetof

Displaying 20 results from an estimated 1238 matches for "offsetof".

Did you mean: offset
2013 May 29
0
[PATCH RFC] virtio-pci: new config layout: using memory BAR
On Wed, May 29, 2013 at 02:01:18PM +0930, Rusty Russell wrote: > Anthony Liguori <aliguori at us.ibm.com> writes: > > "Michael S. Tsirkin" <mst at redhat.com> writes: > >> + case offsetof(struct virtio_pci_common_cfg, device_feature_select): > >> + return proxy->device_feature_select; > > > > Oh dear no... Please use defines like the rest of QEMU. > > It is pretty ugly. > > Yet the structure definitions are descriptive, capturing layout,...
2014 Dec 30
0
[PATCH RFC v2 6/7] virtio_pci: macros for PCI layout offsets.
...e int virtio_pci_find_capability(struct pci_dev *dev, u8 cfg_type, return 0; } +/* This is part of the ABI. Don't screw with it. */ +static inline void check_offsets(void) +{ + /* Note: disk space was harmed in compilation of this function. */ + BUILD_BUG_ON(VIRTIO_PCI_CAP_VNDR != + offsetof(struct virtio_pci_cap, cap_vndr)); + BUILD_BUG_ON(VIRTIO_PCI_CAP_NEXT != + offsetof(struct virtio_pci_cap, cap_next)); + BUILD_BUG_ON(VIRTIO_PCI_CAP_LEN != + offsetof(struct virtio_pci_cap, cap_len)); + BUILD_BUG_ON(VIRTIO_PCI_CAP_TYPE_AND_BAR != + offsetof(struct virtio_pci_cap,...
2014 Dec 30
0
[PATCH RFC v2 6/7] virtio_pci: macros for PCI layout offsets.
...e int virtio_pci_find_capability(struct pci_dev *dev, u8 cfg_type, return 0; } +/* This is part of the ABI. Don't screw with it. */ +static inline void check_offsets(void) +{ + /* Note: disk space was harmed in compilation of this function. */ + BUILD_BUG_ON(VIRTIO_PCI_CAP_VNDR != + offsetof(struct virtio_pci_cap, cap_vndr)); + BUILD_BUG_ON(VIRTIO_PCI_CAP_NEXT != + offsetof(struct virtio_pci_cap, cap_next)); + BUILD_BUG_ON(VIRTIO_PCI_CAP_LEN != + offsetof(struct virtio_pci_cap, cap_len)); + BUILD_BUG_ON(VIRTIO_PCI_CAP_TYPE_AND_BAR != + offsetof(struct virtio_pci_cap,...
2013 May 29
6
[PATCH RFC] virtio-pci: new config layout: using memory BAR
Anthony Liguori <aliguori at us.ibm.com> writes: > "Michael S. Tsirkin" <mst at redhat.com> writes: >> + case offsetof(struct virtio_pci_common_cfg, device_feature_select): >> + return proxy->device_feature_select; > > Oh dear no... Please use defines like the rest of QEMU. It is pretty ugly. Yet the structure definitions are descriptive, capturing layout, size and endianness in natural a f...
2013 May 29
6
[PATCH RFC] virtio-pci: new config layout: using memory BAR
Anthony Liguori <aliguori at us.ibm.com> writes: > "Michael S. Tsirkin" <mst at redhat.com> writes: >> + case offsetof(struct virtio_pci_common_cfg, device_feature_select): >> + return proxy->device_feature_select; > > Oh dear no... Please use defines like the rest of QEMU. It is pretty ugly. Yet the structure definitions are descriptive, capturing layout, size and endianness in natural a f...
2013 May 28
3
[PATCH RFC] virtio-pci: new config layout: using memory BAR
...} } +static uint64_t virtio_pci_config_common_read(void *opaque, hwaddr addr, + unsigned size) +{ + VirtIOPCIProxy *proxy = opaque; + VirtIODevice *vdev = proxy->vdev; + + uint64_t low = 0xffffffffull; + + switch (addr) { + case offsetof(struct virtio_pci_common_cfg, device_feature_select): + return proxy->device_feature_select; + case offsetof(struct virtio_pci_common_cfg, device_feature): + /* TODO: 64-bit features */ + return proxy->device_feature_select ? 0 : proxy->host_features; + case offsetof(st...
2013 May 28
3
[PATCH RFC] virtio-pci: new config layout: using memory BAR
...} } +static uint64_t virtio_pci_config_common_read(void *opaque, hwaddr addr, + unsigned size) +{ + VirtIOPCIProxy *proxy = opaque; + VirtIODevice *vdev = proxy->vdev; + + uint64_t low = 0xffffffffull; + + switch (addr) { + case offsetof(struct virtio_pci_common_cfg, device_feature_select): + return proxy->device_feature_select; + case offsetof(struct virtio_pci_common_cfg, device_feature): + /* TODO: 64-bit features */ + return proxy->device_feature_select ? 0 : proxy->host_features; + case offsetof(st...
2012 Feb 13
0
[PATCH 05/14] arm: implement exception and hypercall entries.
...bj-y += irq.o obj-y += arch_domain.o diff -r 28a6038da99f xen/arch/arm/xen/asm-offsets.c --- a/xen/arch/arm/xen/asm-offsets.c Fri Feb 03 17:28:34 2012 +0900 +++ b/xen/arch/arm/xen/asm-offsets.c Fri Feb 03 17:47:16 2012 +0900 @@ -34,6 +34,67 @@ int main(void) { + DEFINE(OFFSET_SOFTIRQ_PENDING, offsetof(struct irq_cpustat, __softirq_pending)); + DEFINE(OFFSET_LOCAL_IRQ_COUNT, offsetof(struct irq_cpustat, __local_irq_count)); + DEFINE(OFFSET_NMI_COUNT, offsetof(struct irq_cpustat, __nmi_count)); + DEFINE(SIZE_IRQ_CPU_STAT, sizeof(struct irq_cpustat)); + BLANK(); + DEFINE(OFFSET_VCPU_INFO, offse...
2011 Aug 06
0
help recover from unmountable btrfs
...->start, (unsigned long long)parent_transid, (unsigned long long)btrfs_header_generation(eb)); + fprintf(stderr, "dd if=(fd %i) bs=1c skip=%llu count=8 | od -t x1:\n%02x %02x %02x %02x %02x %02x %02x %02x\n", + eb->fd, + (unsigned long long)eb->dev_bytenr + + offsetof (struct btrfs_header, generation), + (__u8)eb->data[offsetof (struct btrfs_header, generation)], + (__u8)eb->data[offsetof (struct btrfs_header, generation) + 1], + (__u8)eb->data[offsetof (struct btrfs_header, generation) + 2], + (__u8)eb->data[offsetof (struct btrfs_header, genera...
2013 May 28
0
[PATCH RFC] virtio-pci: new config layout: using memory BAR
...g_common_read(void *opaque, hwaddr addr, > + unsigned size) > +{ > + VirtIOPCIProxy *proxy = opaque; > + VirtIODevice *vdev = proxy->vdev; > + > + uint64_t low = 0xffffffffull; > + > + switch (addr) { > + case offsetof(struct virtio_pci_common_cfg, device_feature_select): > + return proxy->device_feature_select; Oh dear no... Please use defines like the rest of QEMU. >From a QEMU pov, take a look at: https://github.com/aliguori/qemu/commit/587c35c1a3fe90f6af0f97927047ef4d3182a659 And: https:...
2013 May 30
5
[PATCH RFC] virtio-pci: new config layout: using memory BAR
Anthony Liguori <aliguori at us.ibm.com> writes: > Rusty Russell <rusty at rustcorp.com.au> writes: > >> Anthony Liguori <aliguori at us.ibm.com> writes: >>> "Michael S. Tsirkin" <mst at redhat.com> writes: >>>> + case offsetof(struct virtio_pci_common_cfg, device_feature_select): >>>> + return proxy->device_feature_select; >>> >>> Oh dear no... Please use defines like the rest of QEMU. >> >> It is pretty ugly. > > I think beauty is in the eye of the beholder here...
2013 May 30
5
[PATCH RFC] virtio-pci: new config layout: using memory BAR
Anthony Liguori <aliguori at us.ibm.com> writes: > Rusty Russell <rusty at rustcorp.com.au> writes: > >> Anthony Liguori <aliguori at us.ibm.com> writes: >>> "Michael S. Tsirkin" <mst at redhat.com> writes: >>>> + case offsetof(struct virtio_pci_common_cfg, device_feature_select): >>>> + return proxy->device_feature_select; >>> >>> Oh dear no... Please use defines like the rest of QEMU. >> >> It is pretty ugly. > > I think beauty is in the eye of the beholder here...
2013 May 29
3
[PATCH RFC] virtio-pci: new config layout: using memory BAR
Paolo Bonzini <pbonzini at redhat.com> writes: > Il 28/05/2013 19:32, Michael S. Tsirkin ha scritto: >>>> > > + >>>> > > + switch (addr) { >>>> > > + case offsetof(struct virtio_pci_common_cfg, device_feature_select): >>>> > > + return proxy->device_feature_select; >>> > >>> > Oh dear no... Please use defines like the rest of QEMU. >> Any good reason not to use offsetof? > > I'm not sure it...
2016 Aug 30
4
[PATCH v2 2/2] vfio: add virtio pci quirk
...u8 cfg_type) Does inlining this really make sense? > +{ > + int pos; > + > + for (pos = pci_find_capability(dev, PCI_CAP_ID_VNDR); > + pos > 0; > + pos = pci_find_next_capability(dev, pos, PCI_CAP_ID_VNDR)) { > + u8 type; > + pci_read_config_byte(dev, pos + offsetof(struct virtio_pci_cap, > + cfg_type), > + &type); > + > + if (type != cfg_type) > + continue; > + > + /* Ignore structures with reserved BAR values */ > + if (type != VIRTIO_PCI_CAP_PCI_CFG) { > + u8 bar; > + > + pci_read_config_byte(dev,...
2016 Aug 30
4
[PATCH v2 2/2] vfio: add virtio pci quirk
...u8 cfg_type) Does inlining this really make sense? > +{ > + int pos; > + > + for (pos = pci_find_capability(dev, PCI_CAP_ID_VNDR); > + pos > 0; > + pos = pci_find_next_capability(dev, pos, PCI_CAP_ID_VNDR)) { > + u8 type; > + pci_read_config_byte(dev, pos + offsetof(struct virtio_pci_cap, > + cfg_type), > + &type); > + > + if (type != cfg_type) > + continue; > + > + /* Ignore structures with reserved BAR values */ > + if (type != VIRTIO_PCI_CAP_PCI_CFG) { > + u8 bar; > + > + pci_read_config_byte(dev,...
2016 Apr 18
1
[PATCH RFC 3/3] vfio: add virtio pci quirk
...we come up with something unique to avoid confusion? > +{ > + int pos; > + > + for (pos = pci_find_capability(dev, PCI_CAP_ID_VNDR); > + pos > 0; > + pos = pci_find_next_capability(dev, pos, PCI_CAP_ID_VNDR)) { > + u8 type; > + pci_read_config_byte(dev, pos + offsetof(struct virtio_pci_cap, > + cfg_type), > + &type); > + > + if (type != cfg_type) > + continue; > + > + /* Ignore structures with reserved BAR values */ > + if (type != VIRTIO_PCI_CAP_PCI_CFG) { > + u8 bar; > + > + pci_read_config_byte(dev,...
2016 Apr 18
1
[PATCH RFC 3/3] vfio: add virtio pci quirk
...we come up with something unique to avoid confusion? > +{ > + int pos; > + > + for (pos = pci_find_capability(dev, PCI_CAP_ID_VNDR); > + pos > 0; > + pos = pci_find_next_capability(dev, pos, PCI_CAP_ID_VNDR)) { > + u8 type; > + pci_read_config_byte(dev, pos + offsetof(struct virtio_pci_cap, > + cfg_type), > + &type); > + > + if (type != cfg_type) > + continue; > + > + /* Ignore structures with reserved BAR values */ > + if (type != VIRTIO_PCI_CAP_PCI_CFG) { > + u8 bar; > + > + pci_read_config_byte(dev,...
2004 Feb 12
1
Fwd: Re: Bugfix: offsetof in klibc
--- Greg KH <greg@kroah.com> wrote: > From: Greg KH <greg@kroah.com> > To: Kay Sievers <kay.sievers@vrfy.org> > CC: Hannes Reinecke <hare@suse.de>, linux-hotplug-devel@lists.sourceforge.net > Subject: Re: Bugfix: offsetof in klibc > Date: Thu, 12 Feb 2004 15:52:43 -0800 > > On Fri, Feb 13, 2004 at 12:20:55AM +0100, Kay Sievers wrote: > > On Thu, Feb 12, 2004 at 02:52:07PM -0800, Greg KH wrote: > > > On Tue, Feb 03, 2004 at 01:12:35PM +0100, Hannes Reinecke wrote: > > > > Hi all,...
2016 Aug 30
2
[PATCH v2 2/2] vfio: add virtio pci quirk
...; > + int pos; > > > + > > > + for (pos = pci_find_capability(dev, PCI_CAP_ID_VNDR); > > > + pos > 0; > > > + pos = pci_find_next_capability(dev, pos, PCI_CAP_ID_VNDR)) { > > > + u8 type; > > > + pci_read_config_byte(dev, pos + offsetof(struct virtio_pci_cap, > > > + cfg_type), > > > + &type); > > > + > > > + if (type != cfg_type) > > > + continue; > > > + > > > + /* Ignore structures with reserved BAR values */ > > > + if (type != VIRT...
2016 Aug 30
2
[PATCH v2 2/2] vfio: add virtio pci quirk
...; > + int pos; > > > + > > > + for (pos = pci_find_capability(dev, PCI_CAP_ID_VNDR); > > > + pos > 0; > > > + pos = pci_find_next_capability(dev, pos, PCI_CAP_ID_VNDR)) { > > > + u8 type; > > > + pci_read_config_byte(dev, pos + offsetof(struct virtio_pci_cap, > > > + cfg_type), > > > + &type); > > > + > > > + if (type != cfg_type) > > > + continue; > > > + > > > + /* Ignore structures with reserved BAR values */ > > > + if (type != VIRT...