search for: compare_free_callbacks

Displaying 5 results from an estimated 5 matches for "compare_free_callbacks".

2019 Aug 12
2
Re: [PATCH libnbd 1/7] api: Add semi-private function for freeing persistent data.
...ee_callbacks[i].ptr = ptr; > + h->free_callbacks[i].cb = cb; > + h->free_callbacks[i].user_data = user_data; > + h->nr_free_callbacks++; > + > + ret = 0; > + out: > + pthread_mutex_unlock (&h->lock); > + return ret; > +} > + > +static int > +compare_free_callbacks (const void *v1, const void *v2) > +{ > + const void *ptr = v1; > + const struct free_callback *cb = v2; > + > + if (ptr < cb->ptr) return -1; > + else if (ptr > cb->ptr) return 1; Again, undefined in C; comparing intptr_t is defined, but direct comparison of unre...
2019 Aug 12
0
Re: [PATCH libnbd 1/7] api: Add semi-private function for freeing persistent data.
...[i].cb = cb; > > + h->free_callbacks[i].user_data = user_data; > > + h->nr_free_callbacks++; > > + > > + ret = 0; > > + out: > > + pthread_mutex_unlock (&h->lock); > > + return ret; > > +} > > + > > +static int > > +compare_free_callbacks (const void *v1, const void *v2) > > +{ > > + const void *ptr = v1; > > + const struct free_callback *cb = v2; > > + > > + if (ptr < cb->ptr) return -1; > > + else if (ptr > cb->ptr) return 1; > > Again, undefined in C; comparing intptr_t i...
2019 Aug 12
0
[PATCH libnbd 1/7] api: Add semi-private function for freeing persistent data.
...llbacks - i) * sizeof (struct free_callback)); + + h->free_callbacks[i].ptr = ptr; + h->free_callbacks[i].cb = cb; + h->free_callbacks[i].user_data = user_data; + h->nr_free_callbacks++; + + ret = 0; + out: + pthread_mutex_unlock (&h->lock); + return ret; +} + +static int +compare_free_callbacks (const void *v1, const void *v2) +{ + const void *ptr = v1; + const struct free_callback *cb = v2; + + if (ptr < cb->ptr) return -1; + else if (ptr > cb->ptr) return 1; + else return 0; +} + +/* Called before the library frees 'ptr', where 'ptr' is something + * tha...
2019 Aug 12
2
Re: [PATCH libnbd 1/7] api: Add semi-private function for freeing persistent data.
...n > flight multiplied by a small constant. And my argument is that we are not in control of that number - a user can write a Python script that deliberately calls nbd.aio_pread 1000 times before ever calling nbd.poll to finally advance the state machine. >>> +static int >>> +compare_free_callbacks (const void *v1, const void *v2) >>> +{ >>> + const void *ptr = v1; >>> + const struct free_callback *cb = v2; >>> + >>> + if (ptr < cb->ptr) return -1; >>> + else if (ptr > cb->ptr) return 1; >> >> Again, undefined i...
2019 Aug 12
14
[PATCH libnbd 0/7] Add free callbacks and remove valid_flag.
As proposed here: https://www.redhat.com/archives/libguestfs/2019-August/msg00130.html I didn't actually read Eric's replies to that yet because I've been concentrating on writing these patches all day. Anyway here they are and I'll look at what Eric said about the proposal next. Rich.