Displaying 6 results from an estimated 6 matches for "copy_uint32_array".
2023 Aug 03
2
[libnbd PATCH v4 05/25] golang: Change logic of copy_uint32_array
Commit 6725fa0e12 changed copy_uint32_array() to utilize a Go hack for
accessing a C array as a Go slice in order to potentially benefit from
any optimizations in Go's copy() for bulk transfer of memory over
naive one-at-a-time iteration. But that commit also acknowledged that
no benchmark timings were performed, which would have been u...
2023 Aug 08
1
[libnbd PATCH v4 05/25] golang: Change logic of copy_uint32_array
On Tue, Aug 08, 2023 at 02:36:12PM +0300, Nir Soffer wrote:
> On Thu, Aug 3, 2023 at 4:57?AM Eric Blake <eblake at redhat.com> wrote:
> > func copy_uint32_array(entries *C.uint32_t, count C.size_t) []uint32 {
> > + if (uint64(count) > 64*1024*1024) {
> > + panic(\"violation of state machine guarantee\")
>
> This is unwanted in a library, it means the entire application will crash
> because of a bug in the librar...
2023 Aug 08
2
[libnbd PATCH v4 05/25] golang: Change logic of copy_uint32_array
On Thu, Aug 3, 2023 at 4:57?AM Eric Blake <eblake at redhat.com> wrote:
>
> Commit 6725fa0e12 changed copy_uint32_array() to utilize a Go hack for
> accessing a C array as a Go slice in order to potentially benefit from
> any optimizations in Go's copy() for bulk transfer of memory over
> naive one-at-a-time iteration. But that commit also acknowledged that
> no benchmark timings were performed, whi...
2023 Aug 11
2
[libnbd PATCH] golang: Bump minimum Go version to 1.17
...lang/configure/test.go | 11 +++++++++++
golang/go.mod | 4 ++--
5 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/generator/GoLang.ml b/generator/GoLang.ml
index 73df5254..55ff1b8a 100644
--- a/generator/GoLang.ml
+++ b/generator/GoLang.ml
@@ -517,10 +517,10 @@ let
func copy_uint32_array(entries *C.uint32_t, count C.size_t) []uint32 {
ret := make([]uint32, int(count))
- // See https://github.com/golang/go/wiki/cgo#turning-c-arrays-into-go-slices
- // TODO: Use unsafe.Slice() when we require Go 1.17.
- s := (*[1 << 30]uint32)(unsafe.Pointer(entries))[:count:count...
2020 Mar 24
1
[PATCH libnbd v3] Add Go language bindings (golang) (RHBZ#1814538).
This feature is roughly finished now, although it needs a few more
tests and some examples.
It's pretty much up to par with all the other bindings, but it lacks a
completely safe AIO buffer. It won't stop you from freeing the buffer
too early) because golang's GC inexplicably lacks a way to declare a
root from C. I can probably do it with a global variable and ref
counting on the
2020 Mar 25
3
[PATCH libnbd v4] Add Go language bindings (golang) (RHBZ#1814538).
Now runs a complete set of tests, notably including the AIO test.
File descriptors are passed in and out as plain ints (instead of
*os.File) for a couple of reasons: (1) We have to pass the plain int
to syscall.Select. (2) Turning an fd into an os.File causes golang to
set the blocking flag which is deeply unhelpful.
Rich.