Displaying 20 results from an estimated 277 matches for "user_data".
2019 Jul 16
1
[libnbd PATCH] generator: Prefer closure opaque after function pointer in C
...ator/generator b/generator/generator
index fab7281..485a76a 100755
--- a/generator/generator
+++ b/generator/generator
@@ -3173,7 +3173,7 @@ let rec c_name_of_arg = function
| BytesPersistIn (n, len) -> [n; len]
| BytesPersistOut (n, len) -> [n; len]
| Closure (_, closures) ->
- "user_data" :: List.map (fun { cbname } -> cbname) closures
+ List.map (fun { cbname } -> cbname) closures @ ["user_data"]
| Flags n -> [n]
| Int n -> [n]
| Int64 n -> [n]
@@ -3211,12 +3211,13 @@ let rec print_c_arg_list ?(handle = false) ?(user_data = false) args =
|...
2006 Jul 29
3
Validating two models
Hi,
I have a model Account wich "has_one" model called UserData. Both models
use validation.
# Model contains user name, email etc.
class Account < ActiveRecord::Base
has_one :user_data, :foreign_key => "user_id"
validates_presence_of :email
end
# Model contains firstname, lastname etc.
class UserData < ActiveRecord::Base
set_table_name("user_data")
validates_length_of :firstname, :lastname, :maximum => 10
end
I save the model in the Account...
2019 Aug 14
4
[PATCH libnbd 0/2] Use free callback to dereference NBD.Buffer.
In this patch series we use the newly introduced free callback
on the completion function to dererence the OCaml NBD.Buffer.
I will make the same kind of change for Python later in a
separate series.
The completion function is always called at the C level, even
if the OCaml program didn't use the optional argument. That's
because the free callback doesn't run otherwise.
There is a
2019 Aug 14
4
[libnbd PATCH 0/2] Fix test 505
Rich found that I had been using bogus logic, but it was hidden by
other bugs in our language bindings until recently.
Eric Blake (2):
python: Fix test 505
ocaml: Fix test 505
python/t/505-aio-pread-callback.py | 14 +++++++-------
.../test_505_aio_pread_structured_callback.ml | 14 +++++++-------
2 files changed, 14 insertions(+), 14 deletions(-)
--
2.20.1
2019 Aug 03
1
[PATCH libnbd] generator: Generate typedefs automatically for Closure arguments.
For example nbd_set_debug takes a callback function. Previously this
was defined explicitly inside the function parameters. This commit
defines a new public typedef:
typedef int (*nbd_debug_callback) (unsigned valid_flag, void *user_data,
const char *context, const char *msg);
and then uses the typedef like this:
extern int nbd_set_debug_callback (struct nbd_handle *h,
nbd_debug_callback debug_callback,
void *debug_cal...
2019 Jul 16
2
[PATCH libnbd] generator: Swap parameters of nbd_add_close_callback.
The API changes from:
int nbd_add_close_callback (struct nbd_handle *h,
nbd_close_callback cb,
void *user_data);
to:
int nbd_add_close_callback (struct nbd_handle *h,
void *user_data,
nbd_close_callback cb);
The second way is consistent with how other callbacks work throughout
the API (ie. having the user_data passed first).
---
generator/gen...
2007 Dec 12
2
possible bug in eager loading
Hello,
@users = User.find(:all, :include => {:user_data =>
:user_data_field}, :order => "username = ''someone-oHC15RC7JGTNLxjTenLetw@public.gmane.org'' desc",
:limit => 50)
This produces:
User Load IDs For Limited Eager Loading (74.648762) SELECT * FROM
(SELECT DISTINCT ON (users.id) users.id, username AS alias...
2019 Aug 14
2
Re: [PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
On 8/13/19 5:36 PM, Richard W.M. Jones wrote:
> The definition of functions that take a callback is changed so that
> the callback and user_data are combined into a single structure, eg:
>
> int64_t nbd_aio_pread (struct nbd_handle *h,
> void *buf, size_t count, uint64_t offset,
> - int (*completion_callback) (/*..*/), void *user_data,
> + nbd_completion_callback completion_callback,
>...
2019 Aug 13
0
[PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
The definition of functions that take a callback is changed so that
the callback and user_data are combined into a single structure, eg:
int64_t nbd_aio_pread (struct nbd_handle *h,
void *buf, size_t count, uint64_t offset,
- int (*completion_callback) (/*..*/), void *user_data,
+ nbd_completion_callback completion_callback,
uint32_t flags);
Se...
2019 Aug 13
8
[PATCH libnbd 0/4] Add free function to callbacks.
Patches 1 & 2 are rather complex, but the end result is that we pass
closures + user_data + free function in single struct parameters as I
described previously in this email:
https://www.redhat.com/archives/libguestfs/2019-August/msg00210.html
Patch 3 adds a convenient FREE_CALLBACK macro which seems a worthwhile
simplification if you buy into 1 & 2.
Patch 4 adds another macro wh...
2019 Jul 16
2
[PATCH libnbd] generator: Define new Closure type
** INCOMPLETE **
This is the generator change as discussed on the list already.
The Python and OCaml bindings are not yet done.
It passes all [C only] tests and valgrind.
Note that nbd_add_close_callback is inconsistent with other closure
types because it passes the user_data parameter after the function.
(This is not caused by the current patch, it was already
inconsistent). We decided that nbd_add_close_callback should be
manually generated and not automatically generated because it should
only be called from C, or perhaps more accurately it is only _needed_
from C (...
2019 Aug 15
13
[PATCH libnbd v2 00/10] Callbacks and OCaml and Python persistent buffers.
This is a combination of these two earlier series:
https://www.redhat.com/archives/libguestfs/2019-August/msg00235.html
https://www.redhat.com/archives/libguestfs/2019-August/msg00240.html
plus changes to allow .callback = NULL / .free != NULL, and to reduce
the complexity of freeing callbacks.
Although it's rather long there's nothing complex here. We might
consider squashing some
2019 Aug 14
0
Re: [PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
On Tue, Aug 13, 2019 at 10:06:06PM -0500, Eric Blake wrote:
> On 8/13/19 5:36 PM, Richard W.M. Jones wrote:
> > The definition of functions that take a callback is changed so that
> > the callback and user_data are combined into a single structure, eg:
> >
> > int64_t nbd_aio_pread (struct nbd_handle *h,
> > void *buf, size_t count, uint64_t offset,
> > - int (*completion_callback) (/*..*/), void *user_data,
> > + nbd_completion_callback com...
2019 Aug 14
5
[PATCH libnbd 0/3] Use free callback to hold ref to AIO buffer.
Basically the same as this patch series, but for Python:
https://www.redhat.com/archives/libguestfs/2019-August/msg00235.html
plus adding the 590 asynch test at the end.
Rich.
2019 Jul 16
2
[PATCH libnbd v2] generator: Define new Closure type
As before, but this one has working Python bindings. OCaml still TBD.
Rich.
2019 Jul 24
0
[PATCH libnbd 1/3] generator: Change Closure so it describes single callbacks.
In preparation for closure lifetimes, split up the Closure so it no
longer describes a list of closures, but a single callback.
This changes the API because functions which take 2 or more closures
now pass a separate user_data for each one.
---
docs/libnbd.pod | 3 +-
examples/strict-structured-reads.c | 2 +-
generator/generator | 760 ++++++++++++----------------
generator/states-reply-simple.c | 2 +-
generator/states-reply-structured.c | 8 +-
lib/internal.h...
2019 Aug 13
0
[PATCH libnbd 2/4] api: Add free function and remove valid_flag parameter.
...with freeing closures in language
bindings:
* The valid_flag is removed (mostly reverting
commit 2d9b98e96772e282d51dafac07f16387dadc8afa).
* An extra ‘free’ parameter is added to all callback structures. This
is called by the library whenever the closure won't be called again
(so the user_data can be freed). This is analogous to valid_flag ==
LIBNBD_CALLBACK_FREE in old code.
* Language bindings are updated to deal with these changes.
---
TODO | 2 -
docs/libnbd.pod | 72 +++++----------
examples/glib-main-loop.c | 14...
2019 Jul 24
6
[PATCH libnbd 0/3] Implement closure lifetimes.
This implements most of what I wrote here:
https://www.redhat.com/archives/libguestfs/2019-July/msg00213.html
2019 Jul 16
1
Re: [PATCH libnbd v2] generator: Define new Closure type instead of callbacks.
On 7/16/19 6:04 AM, Richard W.M. Jones wrote:
> A Closure is a list of (usually one, but can be more) closures. In C
> there is also a singe ‘void *user_data’ parameter which is passed by
> the caller into the function and through as the first parameter of
> each callback invocation.
>
> By grouping the previously separate Opaque and Callback* parameters
> together we can avoid the awkward situation where we have to scan
> through the...
2019 Jul 16
0
[PATCH libnbd v2] generator: Define new Closure type instead of callbacks.
A Closure is a list of (usually one, but can be more) closures. In C
there is also a singe ‘void *user_data’ parameter which is passed by
the caller into the function and through as the first parameter of
each callback invocation.
By grouping the previously separate Opaque and Callback* parameters
together we can avoid the awkward situation where we have to scan
through the argument list to try to match...