search for: uintptr

Displaying 20 results from an estimated 25 matches for "uintptr".

Did you mean: intptr
2020 Apr 21
2
[PATCH nbdkit v2] Add the ability to write plugins in golang.
Thanks: Dan Berrangé XXX UNFINISHED: - Is using uintptr for the handle a good idea? Plugins must return something != 0. In other languages we would allow plugins to return an arbitrary object here, but this is not possible in golang because of lack of GC roots. - Default can_* methods are hard to implement. Ideally we would be able to t...
2014 Jan 09
3
[PATCH net-next v2 3/4] virtio-net: auto-tune mergeable rx buffer size for improved performance
...BUFFER_MAX min(MERGEABLE_BUFFER_MIN + (MERGEABLE_BUFFER_ALIGN - 1) * MERGEABLE_BUFFER_ALIGN, PAGE_SIZE) /* Extract buffer length from a mergeable buffer context. */ static u16 get_mergeable_buf_ctx_len(void *ctx) { u16 len = (uintptr_t)ctx & (MERGEABLE_BUFFER_ALIGN - 1); return MERGEABLE_BUFFER_MIN + (len << MERGEABLE_BUFFER_SHIFT); } /* Extract buffer base address from a mergeable buffer context. */ static void *get_mergeable_buf_ctx_base(void *ctx) { return (void *) ((uintptr)ctx & -MERGEABLE_BUF...
2014 Jan 09
3
[PATCH net-next v2 3/4] virtio-net: auto-tune mergeable rx buffer size for improved performance
...BUFFER_MAX min(MERGEABLE_BUFFER_MIN + (MERGEABLE_BUFFER_ALIGN - 1) * MERGEABLE_BUFFER_ALIGN, PAGE_SIZE) /* Extract buffer length from a mergeable buffer context. */ static u16 get_mergeable_buf_ctx_len(void *ctx) { u16 len = (uintptr_t)ctx & (MERGEABLE_BUFFER_ALIGN - 1); return MERGEABLE_BUFFER_MIN + (len << MERGEABLE_BUFFER_SHIFT); } /* Extract buffer base address from a mergeable buffer context. */ static void *get_mergeable_buf_ctx_base(void *ctx) { return (void *) ((uintptr)ctx & -MERGEABLE_BUF...
2020 Apr 21
0
Re: [PATCH nbdkit v2] Add the ability to write plugins in golang.
On Tue, Apr 21, 2020 at 11:44:59AM +0100, Richard W.M. Jones wrote: > Thanks: Dan Berrangé > > XXX UNFINISHED: > > - Is using uintptr for the handle a good idea? Plugins must return > something != 0. In other languages we would allow plugins to > return an arbitrary object here, but this is not possible in golang > because of lack of GC roots. Yeah, this is the bit that looks wierd to me when thinking about t...
2014 Jan 09
0
[PATCH net-next v2 3/4] virtio-net: auto-tune mergeable rx buffer size for improved performance
...BUFFER_MIN + > (MERGEABLE_BUFFER_ALIGN - 1) * > MERGEABLE_BUFFER_ALIGN, PAGE_SIZE) > /* Extract buffer length from a mergeable buffer context. */ > static u16 get_mergeable_buf_ctx_len(void *ctx) { > u16 len = (uintptr_t)ctx & (MERGEABLE_BUFFER_ALIGN - 1); > return MERGEABLE_BUFFER_MIN + (len << MERGEABLE_BUFFER_SHIFT); You can just do len * MERGEABLE_BUFFER_ALIGN too - my compiler seems to be smart enough to see it's same. This way there's no need for MERGEABLE_BUFFER_SHIFT > }...
2014 Jan 09
2
[PATCH net-next v2 3/4] virtio-net: auto-tune mergeable rx buffer size for improved performance
Sorry, forgot to mention - if we want to explore combining the buffer address and truesize into a single void *, we could also exploit the fact that our size ranges from aligned GOOD_PACKET_LEN to PAGE_SIZE, and potentially encode fewer values for truesize (and require a smaller alignment than 256). The prior e-mails discussion of 256 byte alignment with 256 values is just one potential design
2014 Jan 09
2
[PATCH net-next v2 3/4] virtio-net: auto-tune mergeable rx buffer size for improved performance
Sorry, forgot to mention - if we want to explore combining the buffer address and truesize into a single void *, we could also exploit the fact that our size ranges from aligned GOOD_PACKET_LEN to PAGE_SIZE, and potentially encode fewer values for truesize (and require a smaller alignment than 256). The prior e-mails discussion of 256 byte alignment with 256 values is just one potential design
2024 Jul 01
1
[PATCH RESEND 1/2] Permit %L and %l percent escapes in Include
...activep, int flags, int *want_final_pass, int depth) { - char *str, **charptr, *endofnumber, *keyword, *arg, *arg2, *p; + char *str, **charptr, *endofnumber, *keyword, *arg, *arg2, *arg_pre, *p; + char thishost[NI_MAXHOST], shorthost[NI_MAXHOST]; char **cpptr, ***cppptr, fwdarg[256]; u_int i, *uintptr, max_entries = 0; int r, oactive, negated, opcode, *intptr, value, value2, cmdline = 0; @@ -1983,6 +1984,12 @@ parse_pubkey_algos: "command-line option"); goto out; } + + if (gethostname(thishost, sizeof(thishost)) == -1) + fatal("gethostname: %s", strerror(e...
2023 Aug 08
1
[libnbd PATCH v4 05/25] golang: Change logic of copy_uint32_array
...:= unsafe.Slice(C.uint32_t, length) Golang 1.17 was released in Aug 2021 (2 years ago) which is still fairly recent. On the other hand, RHEL 8 has 1.19 for some reason -- RHEL 8 seem to rebasing golang like crazy. So I guess this would be fine. > > - copy(ret, s) > > + addr := uintptr(unsafe.Pointer(entries)) > > + for i := 0; i < int(count); i++ { > > + ptr := (*C.uint32_t)(unsafe.Pointer(addr)) > > + ret[i] = uint32(*ptr) > > + addr += unsafe.Sizeof(*ptr) > > + } > > This loop is worse than the ugly line creati...
2023 Aug 03
2
[libnbd PATCH v4 05/25] golang: Change logic of copy_uint32_array
...\") + } 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] - copy(ret, s) + addr := uintptr(unsafe.Pointer(entries)) + for i := 0; i < int(count); i++ { + ptr := (*C.uint32_t)(unsafe.Pointer(addr)) + ret[i] = uint32(*ptr) + addr += unsafe.Sizeof(*ptr) + } return ret } "; -- 2.41.0
2020 Apr 23
2
Re: [PATCH nbdkit v2] Add the ability to write plugins in golang.
On Tue, Apr 21, 2020 at 05:07:43PM +0100, Daniel P. Berrangé wrote: > On Tue, Apr 21, 2020 at 11:44:59AM +0100, Richard W.M. Jones wrote: > > Thanks: Dan Berrangé > > > > XXX UNFINISHED: > > > > - Is using uintptr for the handle a good idea? Plugins must return > > something != 0. In other languages we would allow plugins to > > return an arbitrary object here, but this is not possible in golang > > because of lack of GC roots. > > Yeah, this is the bit that looks wierd to...
2023 Aug 08
2
[libnbd PATCH v4 05/25] golang: Change logic of copy_uint32_array
...nsafe.Slice() when we require Go 1.17. > - s := (*[1 << 30]uint32)(unsafe.Pointer(entries))[:count:count] Can we require Go 1.17? (current version is 1.20) In Go >= 1.17, we can use something like: s := unsafe.Slice(C.uint32_t, length) > - copy(ret, s) > + addr := uintptr(unsafe.Pointer(entries)) > + for i := 0; i < int(count); i++ { > + ptr := (*C.uint32_t)(unsafe.Pointer(addr)) > + ret[i] = uint32(*ptr) > + addr += unsafe.Sizeof(*ptr) > + } This loop is worse than the ugly line creating a slice. With a slice we can do:...
2023 Nov 13
2
[PATCH v2] Permit %L and %l percent escapes in Include
...activep, int flags, int *want_final_pass, int depth) { - char *str, **charptr, *endofnumber, *keyword, *arg, *arg2, *p; + char *str, **charptr, *endofnumber, *keyword, *arg, *arg2, *arg_pre, *p; + char thishost[NI_MAXHOST], shorthost[NI_MAXHOST]; char **cpptr, ***cppptr, fwdarg[256]; u_int i, *uintptr, uvalue, max_entries = 0; int r, oactive, negated, opcode, *intptr, value, value2, cmdline = 0; @@ -1951,6 +1952,12 @@ parse_pubkey_algos: "command-line option"); goto out; } + + if (gethostname(thishost, sizeof(thishost)) == -1) + fatal("gethostname: %s", st...
2024 Jul 01
1
[PATCH RESEND 1/2] Permit %L and %l percent escapes in Include
...int *want_final_pass, int depth) { >- char *str, **charptr, *endofnumber, *keyword, *arg, *arg2, *p; >+ char *str, **charptr, *endofnumber, *keyword, *arg, *arg2, *arg_pre, *p; >+ char thishost[NI_MAXHOST], shorthost[NI_MAXHOST]; > char **cpptr, ***cppptr, fwdarg[256]; > u_int i, *uintptr, max_entries = 0; > int r, oactive, negated, opcode, *intptr, value, value2, cmdline = 0; @@ - >1983,6 +1984,12 @@ parse_pubkey_algos: > "command-line option"); > goto out; > } >+ >+ if (gethostname(thishost, sizeof(thishost)) == -1) >+ fatal("...
2023 Nov 14
1
[PATCH v3 1/2] Permit %L and %l percent escapes in ssh Include
...activep, int flags, int *want_final_pass, int depth) { - char *str, **charptr, *endofnumber, *keyword, *arg, *arg2, *p; + char *str, **charptr, *endofnumber, *keyword, *arg, *arg2, *arg_pre, *p; + char thishost[NI_MAXHOST], shorthost[NI_MAXHOST]; char **cpptr, ***cppptr, fwdarg[256]; u_int i, *uintptr, uvalue, max_entries = 0; int r, oactive, negated, opcode, *intptr, value, value2, cmdline = 0; @@ -1951,6 +1952,12 @@ parse_pubkey_algos: "command-line option"); goto out; } + + if (gethostname(thishost, sizeof(thishost)) == -1) + fatal("gethostname: %s", st...
2023 Dec 20
2
[PATCH RESEND 0/2] Permit %L and %l percent escapes in Include
Using these escapes, the include directive can be crafted to include differing, host-specific configuration. Ronan Pigott (2): Permit %L and %l percent escapes in ssh Include Permit %L and %l percent escapes in sshd Include readconf.c | 16 +++++++++++++--- servconf.c | 17 ++++++++++++++--- 2 files changed, 27 insertions(+), 6 deletions(-) base-commit:
2024 Jul 01
2
[PATCH RESEND 0/2] Permit %L and %L percent escapes in Include
Using these escapes, the include directive can be crafted to include differing, host-specific configuration. Ronan Pigott (2): Permit %L and %l percent escapes in Include Permit %L and %l percent escapes in server Include readconf.c | 16 +++++++++++++--- servconf.c | 21 ++++++++++++++++----- 2 files changed, 29 insertions(+), 8 deletions(-) base-commit:
2020 Apr 23
0
Re: [PATCH nbdkit v2] Add the ability to write plugins in golang.
...hard W.M. Jones wrote: > On Tue, Apr 21, 2020 at 05:07:43PM +0100, Daniel P. Berrangé wrote: > > On Tue, Apr 21, 2020 at 11:44:59AM +0100, Richard W.M. Jones wrote: > > > Thanks: Dan Berrangé > > > > > > XXX UNFINISHED: > > > > > > - Is using uintptr for the handle a good idea? Plugins must return > > > something != 0. In other languages we would allow plugins to > > > return an arbitrary object here, but this is not possible in golang > > > because of lack of GC roots. > > > > Yeah, this is th...
2015 Jul 06
1
[PATCH RESEND] virtio: Fix typecast of pointer in vring_init()
...gt; > The virtio_ring.h header is used in userspace programs (ie. QEMU), > > > > too. Here we can not assume that sizeof(pointer) is the same as > > > > sizeof(long), e.g. when compiling for Windows, so the typecast in > > > > vring_init() should be done with (uintptr_t) instead of (unsigned long). > > > > > > > > Signed-off-by: Thomas Huth <thuth at redhat.com> > > > > > > This seems to break some userspace too: > > > > > > INSTALL usr/include/linux/ (413 files) > > > CHECK usr/...
2015 Jul 06
1
[PATCH RESEND] virtio: Fix typecast of pointer in vring_init()
...gt; > The virtio_ring.h header is used in userspace programs (ie. QEMU), > > > > too. Here we can not assume that sizeof(pointer) is the same as > > > > sizeof(long), e.g. when compiling for Windows, so the typecast in > > > > vring_init() should be done with (uintptr_t) instead of (unsigned long). > > > > > > > > Signed-off-by: Thomas Huth <thuth at redhat.com> > > > > > > This seems to break some userspace too: > > > > > > INSTALL usr/include/linux/ (413 files) > > > CHECK usr/...