search for: size_check

Displaying 5 results from an estimated 5 matches for "size_check".

2014 Sep 12
2
[Qemu-devel] [PATCH 1/2] virtio-gpu/2d: add hardware spec include file
...t; 64-bit hosts? > > Yes. > >> Is it worth adding a compile-time assertion about the >> size of the struct to ensure the compiler doesn't add any additional >> padding? > > Makes sense. What is the usual trick to do that? Among others, struct dummy { int size_check : (sizeof(virtgpu_ctrl_hdr) == 24 ? 1 : -1); }; Since bitfields cannot have a negative size, the compiler will forcefully fail compilation if the struct size ever changes. Similar tricks include setting up array bounds that would be negative on failure, or (inside a function body) declaring a swi...
2014 Sep 12
2
[Qemu-devel] [PATCH 1/2] virtio-gpu/2d: add hardware spec include file
...t; 64-bit hosts? > > Yes. > >> Is it worth adding a compile-time assertion about the >> size of the struct to ensure the compiler doesn't add any additional >> padding? > > Makes sense. What is the usual trick to do that? Among others, struct dummy { int size_check : (sizeof(virtgpu_ctrl_hdr) == 24 ? 1 : -1); }; Since bitfields cannot have a negative size, the compiler will forcefully fail compilation if the struct size ever changes. Similar tricks include setting up array bounds that would be negative on failure, or (inside a function body) declaring a swi...
2014 Sep 11
3
[Qemu-devel] [PATCH 1/2] virtio-gpu/2d: add hardware spec include file
On 09/11/2014 09:09 AM, Gerd Hoffmann wrote: > This patch adds the header file with structs and defines for > the virtio based gpu device. Covers 2d operations only. > > Signed-off-by: Gerd Hoffmann <kraxel at redhat.com> > --- > include/hw/virtio/virtgpu_hw.h | 158 +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 158 insertions(+) > create mode 100644
2014 Sep 11
3
[Qemu-devel] [PATCH 1/2] virtio-gpu/2d: add hardware spec include file
On 09/11/2014 09:09 AM, Gerd Hoffmann wrote: > This patch adds the header file with structs and defines for > the virtio based gpu device. Covers 2d operations only. > > Signed-off-by: Gerd Hoffmann <kraxel at redhat.com> > --- > include/hw/virtio/virtgpu_hw.h | 158 +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 158 insertions(+) > create mode 100644
2001 Mar 13
5
is this null block OK?
.../* XXX */ if(freemem) PRESTO_FREE(rd, sizeof(*rd)); write_unlock(&fd->fd_lock); EXIT; return; } static int presto_do_truncate(struct presto_file_set *fset, struct dentry *dentry, loff_t length, loff_t size_check) { struct inode *inode = dentry->d_inode; struct super_operations *op; int error; struct iattr newattrs; ENTRY; /* Not pretty: "inode->i_size" shouldn't really be "loff_t". */ if ((off_t) length < 0)...