]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
include/: Add static initializer for refcounts
authorAndrei Tatar <andrei@unikraft.io>
Mon, 2 Oct 2023 19:02:41 +0000 (21:02 +0200)
committerSimon Kuenzer <simon@unikraft.io>
Tue, 28 Nov 2023 21:26:08 +0000 (22:26 +0100)
Checkpatch-Ignore: SPACING
Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
GitHub-Closes: #1126

include/uk/refcount.h

index 24a8f41c130aff10c094ae4a10f606c6eeb2557b..60ea4b7c85c218e8030255ccafe2bb659c30778d 100644 (file)
@@ -56,6 +56,8 @@ extern "C" {
        } while (0)
 #endif /* CONFIG_LIBUKDEBUG */
 
+#define UK_REFCOUNT_INITIALIZER(val) ((__atomic){ .counter = (val) })
+
 /**
  * Initialize the atomic reference.
  *