search for: __nonnull__

Displaying 20 results from an estimated 89 matches for "__nonnull__".

2019 Jan 02
0
[PATCH nbdkit v2 1/2] Annotate internal function parameters with attribute((nonnull)).
...it a/common/bitmap/bitmap.h b/common/bitmap/bitmap.h index 0da650a..553b9d2 100644 --- a/common/bitmap/bitmap.h +++ b/common/bitmap/bitmap.h @@ -65,7 +65,7 @@ struct bitmap { size_t size; /* Size of bitmap in bytes. */ }; -static inline void +static inline void __attribute__((__nonnull__ (1))) bitmap_init (struct bitmap *bm, unsigned blksize, unsigned bpb) { assert (is_power_of_2 (blksize)); @@ -99,10 +99,11 @@ bitmap_free (struct bitmap *bm) /* Resize the bitmap to the virtual disk size in bytes. * Returns -1 on error, setting nbdkit_error. */ -extern int bitmap_resize (...
2019 Jan 02
4
[PATCH nbdkit v2 0/2] Use of attribute(()).
v1 was here: https://www.redhat.com/archives/libguestfs/2019-January/msg00008.html In v2 I have provided two patches: The first patch extends attribute((nonnull)) to most internal functions, but not to the external API. The second patch uses a macro so that attribute((format)) is only used in the public API on GCC or Clang. At least in theory these headers could be used by a C compiler which
2019 Jan 01
3
[PATCH nbdkit] include: Annotate function parameters with attribute((nonnull)).
Should we use attribute((nonnull)) at all? There's a very interesting history of this in libvirt -- try looking at commit eefb881 plus the commits referencing eefb881 -- but it does seem to work for me using recent GCC and Clang. I only did a few functions because annotating them gets old quickly... Rich.
2020 Feb 11
0
[PATCH nbdkit 3/3] server: Remove explicit connection parameter, use TLS instead.
...--- a/server/internal.h +++ b/server/internal.h @@ -154,15 +154,12 @@ enum { SEND_MORE = 1, /* Hint to use MSG_MORE/corking to group send()s */ }; -typedef int (*connection_recv_function) (struct connection *, - void *buf, size_t len) - __attribute__((__nonnull__ (1, 2))); -typedef int (*connection_send_function) (struct connection *, - const void *buf, size_t len, +typedef int (*connection_recv_function) (void *buf, size_t len) + __attribute__((__nonnull__ (1))); +typedef int (*connection_send_function) (const void...
2019 Jan 02
1
Re: [PATCH nbdkit v2 1/2] Annotate internal function parameters with attribute((nonnull)).
...r plugin. */ > -extern int blk_read (struct nbdkit_next_ops *next_ops, void *nxdata, uint64_t blknum, uint8_t *block, int *err); > +extern int blk_read (struct nbdkit_next_ops *next_ops, void *nxdata, > + uint64_t blknum, uint8_t *block, int *err) > + __attribute__((__nonnull__ (1, 2, 4, 5))); nxdata is opaque - which means blk_read() shouldn't be dereferencing it. It may happen to be true that struct backend is set up such that nxdata is currently always non-NULL, but that's an implementation detail, and we are violating layering if we enforce backend behavior b...
2020 Feb 11
4
[PATCH nbdkit v2 0/3] server: Remove explicit connection parameter.
v1 was here: https://www.redhat.com/archives/libguestfs/2020-February/msg00081.html v2 replaces struct connection *conn = GET_CONN; with GET_CONN; which sets conn implicitly and asserts that it is non-NULL. If we actually want to test if conn is non-NULL or behave differently, then you must use threadlocal_get_conn() instead, and some existing uses do that. Rich.
2020 Feb 11
5
[PATCH nbdkit 0/3] server: Remove explicit connection parameter.
The third patch is a large but mechanical change which gets rid of passing around struct connection * entirely within the server, preferring instead to reference the connection through thread-local storage. I hope this is a gateway to simplifying other parts of the code. Rich.
2020 Apr 15
1
Re: [PATCH nbdkit 4/9] common/regions: Use new vector type to store the list of regions.
...ons { > - struct region *regions; > - size_t nr_regions; > -}; > +/* Vector of struct region. */ > +DEFINE_VECTOR_TYPE(regions, struct region); > > -extern void init_regions (struct regions *regions) > +extern void init_regions (regions *regions) > __attribute__((__nonnull__ (1))); This change makes sense (DEFINE_VECTOR_TYPE gives us a typedef, so you lose the explicit 'struct'). > -extern void free_regions (struct regions *regions) > +extern void free_regions (regions *regions) > __attribute__((__nonnull__ (1))); > > /* Return the nu...
2019 Sep 19
0
[nbdkit PATCH 1/4] server: Fix regression for NBD_OPT_INFO before NBD_OPT_GO
...++++++ 6 files changed, 24 insertions(+), 10 deletions(-) diff --git a/server/internal.h b/server/internal.h index c31bb340..da4fae19 100644 --- a/server/internal.h +++ b/server/internal.h @@ -334,9 +334,11 @@ extern int backend_open (struct backend *b, struct connection *conn, __attribute__((__nonnull__ (1, 2))); extern int backend_prepare (struct backend *b, struct connection *conn) __attribute__((__nonnull__ (1, 2))); +extern void backend_close (struct backend *b, struct connection *conn) + __attribute__((__nonnull__ (1, 2))); extern void backend_set_handle (struct backend *b, struct conne...
2012 Nov 29
2
[LLVMdev] problem trying to write an LLVM register-allocation pass
I have a new problem: Register RBP is used in a function foo. (I am not allocating RBP to any virtual register, the instances of RBP in function foo are in the machine code when my register allocator starts.) Function foo calls function bar. Register RBP is not saved across the call, though it is live after the call. Function bar includes a virtual register. The code that I'm using to
2012 Dec 01
0
[LLVMdev] problem trying to write an LLVM register-allocation pass
..._c) __attribute__ ((__nothrow__)); extern int _toupper (int) __attribute__ ((__nothrow__)); extern int _tolower (int) __attribute__ ((__nothrow__)); extern void *memcpy (void *__restrict __dest, __const void *__restrict __src, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))); extern void *memmove (void *__dest, __const void *__src, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2))); extern void *memccpy (void *__restrict __dest, __const void *__restrict __src, int __c, size_t __n) __attribute__ ((__nothrow__)) __a...
2023 Feb 15
1
[libnbd PATCH v3 02/29] generator/C.ml: use space consistently in func. and func.-like macro calls
...1 file changed, 10 insertions(+), 10 deletions(-) > > pr "#ifndef LIBNBD_ATTRIBUTE_NONNULL\n"; > - pr "#if defined(__GNUC__) && LIBNBD_GCC_VERSION >= 120000 /* gcc >= 12.0 */\n"; > - pr "#define LIBNBD_ATTRIBUTE_NONNULL(...) __attribute__((__nonnull__(__VA_ARGS__)))\n"; > + pr "#if defined (__GNUC__) && LIBNBD_GCC_VERSION >= 120000 /* gcc >= 12.0 */\n"; > + pr "#define LIBNBD_ATTRIBUTE_NONNULL(...) __attribute__ ((__nonnull__ (__VA_ARGS__)))\n"; Not only are these lines long in our source, they are...
2019 Sep 19
7
[nbdkit PATCH 0/4] Spec compliance patches
The first one is the nastiest - it is an assertion failure caused by a spec-compliant client and introduced by our security fix that was released in 1.14.1. Eric Blake (4): server: Fix regression for NBD_OPT_INFO before NBD_OPT_GO server: Fix back-to-back SET_META_CONTEXT server: Forbid NUL in export and context names server: Fix OPT_GO on different export than SET_META_CONTEXT
2023 Feb 15
2
[libnbd PATCH v3 02/29] generator/C.ml: use space consistently in func. and func.-like macro calls
..._PATCHLEVEL__)\n"; pr "#endif\n"; pr "\n"; pr "#ifndef LIBNBD_ATTRIBUTE_NONNULL\n"; - pr "#if defined(__GNUC__) && LIBNBD_GCC_VERSION >= 120000 /* gcc >= 12.0 */\n"; - pr "#define LIBNBD_ATTRIBUTE_NONNULL(...) __attribute__((__nonnull__(__VA_ARGS__)))\n"; + pr "#if defined (__GNUC__) && LIBNBD_GCC_VERSION >= 120000 /* gcc >= 12.0 */\n"; + pr "#define LIBNBD_ATTRIBUTE_NONNULL(...) __attribute__ ((__nonnull__ (__VA_ARGS__)))\n"; pr "#else\n"; pr "#define LIBNBD_ATTRIBUTE_...
2020 Apr 15
0
[PATCH nbdkit 4/9] common/regions: Use new vector type to store the list of regions.
...on; }; -/* Array of regions. */ -struct regions { - struct region *regions; - size_t nr_regions; -}; +/* Vector of struct region. */ +DEFINE_VECTOR_TYPE(regions, struct region); -extern void init_regions (struct regions *regions) +extern void init_regions (regions *regions) __attribute__((__nonnull__ (1))); -extern void free_regions (struct regions *regions) +extern void free_regions (regions *regions) __attribute__((__nonnull__ (1))); /* Return the number of regions. */ static inline size_t __attribute__((__nonnull__ (1))) -nr_regions (struct regions *regions) +nr_regions (struct region...
2019 Sep 19
0
[PATCH nbdkit v2 2/4] filters: Implement next_ops .reopen call.
...t_size) (struct backend *, struct connection *conn); int (*can_write) (struct backend *, struct connection *conn); @@ -360,6 +361,9 @@ extern bool backend_valid_range (struct backend *b, struct connection *conn, uint64_t offset, uint32_t count) __attribute__((__nonnull__ (1, 2))); +extern int backend_reopen (struct backend *b, struct connection *conn, + int readonly) + __attribute__((__nonnull__ (1, 2))); extern int64_t backend_get_size (struct backend *b, struct connection *conn) __attribute__((__nonnull__ (1, 2))); extern int bac...
2019 Sep 19
0
[PATCH nbdkit v3 1/3] filters: Implement next_ops .reopen call.
...t_size) (struct backend *, struct connection *conn); int (*can_write) (struct backend *, struct connection *conn); @@ -360,6 +361,9 @@ extern bool backend_valid_range (struct backend *b, struct connection *conn, uint64_t offset, uint32_t count) __attribute__((__nonnull__ (1, 2))); +extern int backend_reopen (struct backend *b, struct connection *conn, + int readonly) + __attribute__((__nonnull__ (1, 2))); extern int64_t backend_get_size (struct backend *b, struct connection *conn) __attribute__((__nonnull__ (1, 2))); extern int bac...
2019 Jun 06
0
[nbdkit PATCH 1/2] server: Add support for corking
...3..cb34323 100644 --- a/server/internal.h +++ b/server/internal.h @@ -145,6 +145,8 @@ typedef int (*connection_recv_function) (struct connection *, typedef int (*connection_send_function) (struct connection *, const void *buf, size_t len) __attribute__((__nonnull__ (1, 2))); +typedef int (*connection_cork_function) (struct connection *, bool) + __attribute__((__nonnull__ (1))); typedef void (*connection_close_function) (struct connection *) __attribute__((__nonnull__ (1))); @@ -180,6 +182,7 @@ struct connection { int sockin, sockout; connection_re...
2019 Aug 30
0
[nbdkit PATCH v2 2/2] server: Remember .open(readonly) status
...f --git a/server/internal.h b/server/internal.h index a55d6406..fb197b9e 100644 --- a/server/internal.h +++ b/server/internal.h @@ -325,6 +325,9 @@ extern void backend_load (struct backend *b, const char *name, extern void backend_unload (struct backend *b, void (*unload) (void)) __attribute__((__nonnull__ (1))); +extern int backend_open (struct backend *b, struct connection *conn, + int readonly) + __attribute__((__nonnull__ (1, 2))); extern void backend_set_handle (struct backend *b, struct connection *conn, void *handle) __attribute__(...
2019 Jun 06
4
[nbdkit PATCH 0/2] Reduce network overhead with corking
Slightly RFC, as I need more time to investigate why Unix sockets appeared to degrade with this patch. But as TCP sockets (over loopback to localhost) and TLS sessions (regardless of underlying Unix or TCP) both showed improvements, this looks like a worthwhile series. Eric Blake (2): server: Add support for corking server: Cork around grouped transmission send()s server/internal.h | 3