]> git.ozlabs.org Git - ccan/log
ccan
10 years agoccan/io: remove IO_IDLE state.
Rusty Russell [Mon, 14 Oct 2013 10:58:36 +0000 (21:28 +1030)]
ccan/io: remove IO_IDLE state.

Use a NULL io pointer instead to indicate an idle connection.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan/io: remove IO_NEXT state.
Rusty Russell [Mon, 14 Oct 2013 10:58:36 +0000 (21:28 +1030)]
ccan/io: remove IO_NEXT state.

It was only used for initial connections which hadn't started I/O.  Now
they are initialized with an io_plan, it can be eliminated.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan/io: initialize connection with an explicit I/O plan.
Rusty Russell [Mon, 14 Oct 2013 10:58:36 +0000 (21:28 +1030)]
ccan/io: initialize connection with an explicit I/O plan.

Rather than going via a callback, which tends to just set up I/O, do
any setup before the call to io_new_conn(), then pass it the io_plan
directly.

The patch shows how much this simplifies our test code.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan/io: generic init function for listening connections.
Rusty Russell [Mon, 14 Oct 2013 10:58:36 +0000 (21:28 +1030)]
ccan/io: generic init function for listening connections.

Instead of assuming they want a connection made from the new fd, hand
the fd to a callback.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan/io: remove conn arg from io_plan constructors.
Rusty Russell [Mon, 14 Oct 2013 10:58:35 +0000 (21:28 +1030)]
ccan/io: remove conn arg from io_plan constructors.

No longer needed.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan/io: pass struct io_plan explicitly.
Rusty Russell [Mon, 14 Oct 2013 10:58:35 +0000 (21:28 +1030)]
ccan/io: pass struct io_plan explicitly.

This simplifies some things: in particular, we can construct an
io_plan without needing the current io_conn.

On the other hand, we need to expose the structure now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan/io: replace backend_set_state with backend_wakeup()
Rusty Russell [Mon, 14 Oct 2013 10:58:35 +0000 (21:28 +1030)]
ccan/io: replace backend_set_state with backend_wakeup()

We only use it in one place: for wakeup.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan/io: make enum io_state namespace-safe.
Rusty Russell [Mon, 14 Oct 2013 10:58:35 +0000 (21:28 +1030)]
ccan/io: make enum io_state namespace-safe.

Ready for exposure.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan/io: use explicit IO callback functions, instead of io_state values.
Rusty Russell [Mon, 14 Oct 2013 10:58:35 +0000 (21:28 +1030)]
ccan/io: use explicit IO callback functions, instead of io_state values.

Explicit callbacks are slower, but more flexible.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan/io: remove next & finish from union.
Rusty Russell [Mon, 14 Oct 2013 10:58:35 +0000 (21:28 +1030)]
ccan/io: remove next & finish from union.

Sure, both listener and conn need them, but for different things
(listener uses them simply to set up conn).  Putting them in the
common union was a mistake.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan/io: put explicit poll flags in the plan.
Rusty Russell [Mon, 14 Oct 2013 10:58:35 +0000 (21:28 +1030)]
ccan/io: put explicit poll flags in the plan.

Weaning off enum io_state, to allow custom ones.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan/io: get rid of io_next(), pass callbacks directly.
Rusty Russell [Mon, 14 Oct 2013 10:58:35 +0000 (21:28 +1030)]
ccan/io: get rid of io_next(), pass callbacks directly.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan/io: rename io_op to io_plan.
Rusty Russell [Mon, 14 Oct 2013 10:58:35 +0000 (21:28 +1030)]
ccan/io: rename io_op to io_plan.

This is a better description, since it's I/O we plan to do next.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan/io: timer support.
Rusty Russell [Mon, 14 Oct 2013 10:58:35 +0000 (21:28 +1030)]
ccan/io: timer support.

Upgrade license, since timer is LGPL.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan/io: check for all idle.
Rusty Russell [Mon, 14 Oct 2013 10:58:35 +0000 (21:28 +1030)]
ccan/io: check for all idle.

It's probably a bug if we're waiting for nothing.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan/io: io_duplex.
Rusty Russell [Mon, 14 Oct 2013 10:58:20 +0000 (21:28 +1030)]
ccan/io: io_duplex.

Cleaner model for I/O, with cost of complexity if you really want bidir.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan/io: benchmarks.
Rusty Russell [Mon, 14 Oct 2013 10:04:35 +0000 (20:34 +1030)]
ccan/io: benchmarks.

More stress test than benchmarks, but provides a beginning.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoccan/io: new module.
Rusty Russell [Mon, 14 Oct 2013 10:04:07 +0000 (20:34 +1030)]
ccan/io: new module.

Designed for async I/O.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agocpuid: ccanlint fixes.
Rusty Russell [Fri, 27 Sep 2013 18:41:59 +0000 (04:11 +0930)]
cpuid: ccanlint fixes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoMerge branch 'cpuid' of https://github.com/decltype/ccan
Rusty Russell [Fri, 27 Sep 2013 18:40:40 +0000 (04:10 +0930)]
Merge branch 'cpuid' of https://github.com/decltype/ccan

10 years agocpuid: parse CPU L1 cache and TLB identifications
Ahmed Samy [Thu, 26 Sep 2013 14:13:12 +0000 (14:13 +0000)]
cpuid: parse CPU L1 cache and TLB identifications

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
10 years agocpuid: use uint32_t instead of int/unsigned
Ahmed Samy [Thu, 26 Sep 2013 13:59:55 +0000 (13:59 +0000)]
cpuid: use uint32_t instead of int/unsigned

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
10 years agocpuid: small fix
Ahmed Samy [Wed, 25 Sep 2013 16:44:20 +0000 (16:44 +0000)]
cpuid: small fix

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
10 years agocpuid: Minor improvements
Ahmed Samy [Wed, 25 Sep 2013 14:46:09 +0000 (14:46 +0000)]
cpuid: Minor improvements

Remove the assembly file that checks if the CPUID instruction is
supported and have it in inline assembly as suggested by Rusty.

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
10 years agonet: Fix potential uninitialized use of variables in net_bind()
David Gibson [Mon, 23 Sep 2013 11:37:01 +0000 (21:37 +1000)]
net: Fix potential uninitialized use of variables in net_bind()

If the list of addrinfos give to net_bind() contains only IPv4 or only
IPv6 addresses, then the ipv4 and ipv6 variables may be used uninitialized.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
10 years agocpuid: only compile source file if x86 cpu
Ahmed Samy [Mon, 23 Sep 2013 22:40:41 +0000 (22:40 +0000)]
cpuid: only compile source file if x86 cpu

Suggested-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
10 years agocpuid: prefix every function with cpuid_
Ahmed Samy [Mon, 23 Sep 2013 08:20:08 +0000 (08:20 +0000)]
cpuid: prefix every function with cpuid_

Also merge extended features and non-extended in 1 function.

Suggested-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
10 years agocpuid: add 2 new functions + some more tests
Ahmed Samy [Sun, 22 Sep 2013 07:42:15 +0000 (07:42 +0000)]
cpuid: add 2 new functions + some more tests

The new functions are:
- get_cpu_type
- get_cpu_type_string

Also add more tests on how one would parse the low-level stuff.

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
10 years agocpuid: add proper documentation
Ahmed Samy [Sat, 21 Sep 2013 10:03:11 +0000 (10:03 +0000)]
cpuid: add proper documentation

Forgot to add this to the main commit, sorry.

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
10 years agocpuid: new module
Ahmed Samy [Sat, 21 Sep 2013 09:45:06 +0000 (09:45 +0000)]
cpuid: new module

This module parses data provided by the cpuid instruction.
It still needs more work, however, it works for most important
stuff.

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
10 years agoMerge branch 'master' of ozlabs.org:ccan
Rusty Russell [Fri, 13 Sep 2013 00:08:40 +0000 (09:38 +0930)]
Merge branch 'master' of ozlabs.org:ccan

10 years agoAdd bitmap module to Makefile.
Rusty Russell [Fri, 13 Sep 2013 00:05:14 +0000 (09:35 +0930)]
Add bitmap module to Makefile.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoMerge https://github.com/dgibson/ccan
Rusty Russell [Fri, 13 Sep 2013 00:01:17 +0000 (09:31 +0930)]
Merge https://github.com/dgibson/ccan

10 years agoheap: add example on empty heap check
Emilio G. Cota [Thu, 12 Sep 2013 16:45:49 +0000 (12:45 -0400)]
heap: add example on empty heap check

Suggested-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Emilio G. Cota <cota@braap.org>
10 years agoheap: new module
Emilio G. Cota [Tue, 10 Sep 2013 00:32:19 +0000 (20:32 -0400)]
heap: new module

Signed-off-by: Emilio G. Cota <cota@braap.org>
10 years agoilog: reformat so webpage doesn't get confused.
Rusty Russell [Mon, 9 Sep 2013 07:23:38 +0000 (16:53 +0930)]
ilog: reformat so webpage doesn't get confused.

The extra spaces make my web formatter think they're literal text, which
looks weird.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoilog: relicense to Public Domain.
Rusty Russell [Mon, 9 Sep 2013 07:21:14 +0000 (16:51 +0930)]
ilog: relicense to Public Domain.

I noted to Timothy in 2011:
   I finally got around to implementing license checking in ccanlint,
   and it shows that your public domain ccan/isaac module uses your LGPL
   ccan/ilog module, which partially defeats the point.

   You and I are the only ones who did anything significant to ilog; I'm
   happy to relicense to PD or whatever else you want.  Or leave it, in
   which case I'll need to document it clearly.

He finally got back to me, and I sent him this patch, to which he replied:

     Ack.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agotal: add tal_resizez for zero-padded expansion.
Rusty Russell [Sun, 8 Sep 2013 06:53:02 +0000 (16:23 +0930)]
tal: add tal_resizez for zero-padded expansion.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoendian: add documentation on endian typedefs.
Rusty Russell [Sun, 8 Sep 2013 04:13:05 +0000 (13:43 +0930)]
endian: add documentation on endian typedefs.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoshort_types: update documentation on be32/le32 etc.
Rusty Russell [Sun, 8 Sep 2013 04:11:35 +0000 (13:41 +0930)]
short_types: update documentation on be32/le32 etc.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoendian/short_types: sparse support.
Rusty Russell [Sun, 8 Sep 2013 04:09:12 +0000 (13:39 +0930)]
endian/short_types: sparse support.

If you're doing endian work, sparse's bitwise annotation is extremely useful.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agobitmap: Add helper macro to statically declare bitmaps
David Gibson [Thu, 5 Sep 2013 14:37:14 +0000 (00:37 +1000)]
bitmap: Add helper macro to statically declare bitmaps

For use as direct locals, or when the size is a constant, inside
structure definitions.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
10 years agobitmap: Rework to assume always multiple of words storage length
David Gibson [Thu, 5 Sep 2013 14:28:36 +0000 (00:28 +1000)]
bitmap: Rework to assume always multiple of words storage length

Handling bitmaps which extend some odd number of bits, and assuring they
don't clobber partially overlapped variables is not worth the bother.

Also avoid namespace pollution.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
10 years agobitmap: Rework types and sizing macros
David Gibson [Thu, 5 Sep 2013 12:40:19 +0000 (22:40 +1000)]
bitmap: Rework types and sizing macros

Go with "words" rather than explicitly referencing longs in the macros

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
10 years agobitmap: Use a typesafe(ish) parameters instead of void *
David Gibson [Wed, 4 Sep 2013 14:16:47 +0000 (00:16 +1000)]
bitmap: Use a typesafe(ish) parameters instead of void *

This also fixes a bug which will hit on platforms where it's not safe to
dereference a (long *) which is not correctly aligned.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
10 years agolist: add list_next and list_prev helpers.
Rusty Russell [Thu, 29 Aug 2013 00:48:47 +0000 (10:18 +0930)]
list: add list_next and list_prev helpers.

Some way towards iterating in the middle of the list.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agobitmap: Add first cut at a bitmap module
David Gibson [Thu, 22 Aug 2013 12:39:02 +0000 (22:39 +1000)]
bitmap: Add first cut at a bitmap module

This adds a module for manipulating bitmaps, based on the API from the
Linux kernel's bitmap.h.  So far it's missing the trickier bits, but is
a little more flexible, allowing bitmaps that don't have to be contained
in an integer number of unsigned longs.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
10 years agoccan: Fix calling memset with zero length parameter
Volker Lendecke [Thu, 11 Jul 2013 12:57:53 +0000 (14:57 +0200)]
ccan: Fix calling memset with zero length parameter

Signed-off-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agotal/path: fix unset vars in error paths.
Rusty Russell [Tue, 11 Jun 2013 05:10:49 +0000 (14:40 +0930)]
tal/path: fix unset vars in error paths.

Compiling with optimization FTW.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agobreakpoint: new module.
Rusty Russell [Mon, 27 May 2013 12:23:55 +0000 (21:53 +0930)]
breakpoint: new module.

Thanks to Jeremy Kerr for the idea!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agoendian: remove unnecessary _CONST postfixes.
Rusty Russell [Mon, 13 May 2013 06:52:53 +0000 (16:22 +0930)]
endian: remove unnecessary _CONST postfixes.

It makes the names longer, whereas the CAPS is probably sufficient.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agoendian: add constant versions.
Rusty Russell [Mon, 8 Apr 2013 07:08:24 +0000 (16:38 +0930)]
endian: add constant versions.

Sometimes you really need a compile-time constant, but there's no generic way
to create a macro which does this and only evaluates its argument once.

Thus we need specific const macros.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agoendian: change license to CC0.
Rusty Russell [Mon, 8 Apr 2013 05:38:08 +0000 (15:08 +0930)]
endian: change license to CC0.

Not worth LGPL for just this header.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotimer: clean up.
Rusty Russell [Fri, 5 Apr 2013 06:33:54 +0000 (17:03 +1030)]
timer: clean up.

Add examples and a documentation fix.
Remove unused cascade function (was used in initial always-step-1-bucket
 version).
Restore timers_dump() to within CCAN_TIMER_DEBUG.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotimer: increase default span to 5.
Rusty Russell [Fri, 5 Apr 2013 06:13:49 +0000 (16:43 +1030)]
timer: increase default span to 5.

There's a sweet spot around 5, without going all the way to 13 (which
would make each level 64/128k large).

TIMER_LEVEL_BITS 2: 100000000 in 5.833399-5.884659(5.85912+/-0.015) (18 levels / 32)
TIMER_LEVEL_BITS 3: 100000000 in 5.267610-5.303589(5.29018+/-0.011) (12-13(12.5+/-0.5) levels / 22)
TIMER_LEVEL_BITS 4: 100000000 in 4.215605-4.417297(4.27771+/-0.062) (9-10(9.1+/-0.3) levels / 16)
TIMER_LEVEL_BITS 5: 100000000 in 3.859340-3.972603(3.90149+/-0.034) (7-8(7.1+/-0.3) levels / 13)
TIMER_LEVEL_BITS 6: 100000000 in 3.976157-4.037230(4.00199+/-0.02) (6 levels / 11)
TIMER_LEVEL_BITS 7: 100000000 in 4.014228-4.082031(4.05024+/-0.022) (5-6(5.4+/-0.49) levels / 10)
TIMER_LEVEL_BITS 8: 100000000 in 3.915615-3.978781(3.94972+/-0.02) (5 levels / 8)
TIMER_LEVEL_BITS 9: 100000000 in 3.859413-4.025842(3.89993+/-0.046) (4-5(4.6+/-0.49) levels / 8)
TIMER_LEVEL_BITS 10: 100000000 in 3.983507-4.170152(4.06743+/-0.055) (4 levels / 7)
TIMER_LEVEL_BITS 11: 100000000 in 3.468756-3.610746(3.52843+/-0.04) (4 levels / 6)
TIMER_LEVEL_BITS 12: 100000000 in 3.274397-3.377530(3.3192+/-0.026) (4 levels / 6)
TIMER_LEVEL_BITS 13: 100000000 in 3.116845-3.178162(3.1398+/-0.017) (3 levels / 5)
TIMER_LEVEL_BITS 14: 100000000 in 3.152599-3.264060(3.20733+/-0.043) (3 levels / 5)
TIMER_LEVEL_BITS 15: 100000000 in 3.186556-3.552432(3.25597+/-0.11) (3 levels / 5)
TIMER_LEVEL_BITS 16: 100000000 in 3.139352-3.485653(3.27263+/-0.11) (3 levels / 4)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotimer: cache the minimal value.
Rusty Russell [Fri, 5 Apr 2013 06:13:48 +0000 (16:43 +1030)]
timer: cache the minimal value.

We spend a lot of time searching for the next timer to expire: by caching
the minimum, we can skip most of this work.  Even if timers are deleted,
the minimum will be a starting point for searching.

The expected-usage benchmark has to be increased by a factor of 100,
otherwise it's now too short.

Before:
$ ./expected-usage
1000000 in 12.701647935

After:
$ ./expected-usage  1000000
1000000 in 0.061095153

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotimers: implementation of lazily-ordered timers.
Rusty Russell [Fri, 5 Apr 2013 06:13:27 +0000 (16:43 +1030)]
timers: implementation of lazily-ordered timers.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agoAdd Henry Eshbaugh's log module to junkcode for the moment.
Rusty Russell [Thu, 4 Apr 2013 23:59:01 +0000 (10:29 +1030)]
Add Henry Eshbaugh's log module to junkcode for the moment.

It's got some useful stuff in it, but doesn't pass ccanlint here.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agoMakefile: don't separate all modules with external dependencies.
Rusty Russell [Mon, 1 Apr 2013 03:22:55 +0000 (13:52 +1030)]
Makefile: don't separate all modules with external dependencies.

Using ccanlint's --deps-fail-ignore, we can just test every module
with "make check".  Still exclude them from the 'libccan.a' build
though.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agonfs: add licenses into generated files.
Rusty Russell [Mon, 1 Apr 2013 03:22:35 +0000 (13:52 +1030)]
nfs: add licenses into generated files.

Otherwise ccanlint complains about missing license comments.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agoccanlint: --deps-fail-ignore.
Rusty Russell [Mon, 1 Apr 2013 02:44:00 +0000 (13:14 +1030)]
ccanlint: --deps-fail-ignore.

Useful for bulk testing modules, where some might not have required
external (non-CCAN) dependencies.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agoogg_to_pcm: fix compilation of example in _info.
Rusty Russell [Mon, 1 Apr 2013 00:00:30 +0000 (10:30 +1030)]
ogg_to_pcm: fix compilation of example in _info.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agoccanlint: don't crash if given bad directory name.
Rusty Russell [Sun, 31 Mar 2013 06:40:50 +0000 (17:10 +1030)]
ccanlint: don't crash if given bad directory name.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agoAdd a set of simple version comparison helpers
Peter Hutterer [Wed, 27 Mar 2013 23:38:48 +0000 (09:38 +1000)]
Add a set of simple version comparison helpers

These version helpers help to compare major.minor style version numbers,
without the need for open-coded and error-prone bitshifting, multiplication,
and similar.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agonet: add server support.
Rusty Russell [Sun, 17 Mar 2013 04:48:10 +0000 (15:18 +1030)]
net: add server support.

Creating a server for IPv4 and IPv6 has similar issues to clients,
with some novel twists.  Slightly different arguments need to be given
to getaddrinfo(), but worse, some platforms (Linux without
/proc/sys/net/ipv6/bindv6only set) automatically bind IPv6 sockets to IPv4
ports as well.

Thus we need a function which can bind (and listen) to one or two fds.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agolist: list_pop
Rusty Russell [Sun, 17 Mar 2013 04:42:14 +0000 (15:12 +1030)]
list: list_pop

list_top + list_del, as suggested by Ben Herrenschmidt.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agolist: list_append_list / list_prepend_list
Rusty Russell [Sun, 17 Mar 2013 04:41:48 +0000 (15:11 +1030)]
list: list_append_list / list_prepend_list

Operations for moving the entire contents of a list.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agoautodata: make note about not being generally useful for shared libraries.
Rusty Russell [Sun, 17 Mar 2013 03:56:31 +0000 (14:26 +1030)]
autodata: make note about not being generally useful for shared libraries.

If you have sections, it might still work for some cases though: on x86
Ubuntu it worked once I changed the section name from autodata to xautodata.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agoiscsi, ttxml: fix warning [-Wunused-but-set-variable]
Tinggong [Fri, 8 Mar 2013 15:11:23 +0000 (23:11 +0800)]
iscsi, ttxml: fix warning [-Wunused-but-set-variable]

hi all,

here is a trival path to fix warning [-Wunused-but-set-variable].

Thanks.
Tinggong

Signed-off-by: Tinggong <wangtinggong@gmail.com>
11 years agofailtest: fix warning [-Wformat]
Tinggong [Fri, 8 Mar 2013 15:09:02 +0000 (23:09 +0800)]
failtest: fix warning [-Wformat]

hi rusty,

here is a trival path to fix warning [-Wformat].

Thanks.
Tinggong

Signed-off-by: Tinggong <wangtinggong@gmail.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agonet: make tests more robust.
Rusty Russell [Thu, 7 Feb 2013 00:42:27 +0000 (11:12 +1030)]
net: make tests more robust.

Andreas Schlick reports failure on systems without IPv6 support (in particular
ones with no IPv6 addresses for localhost).  We should be more robust in
these cases, and also where IPv4 support is missing.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agoforeach: fix overzealous test.
Rusty Russell [Thu, 7 Feb 2013 00:25:01 +0000 (10:55 +1030)]
foreach: fix overzealous test.

Andreas Schlick reported a failure on 64-bit systems; we should simply
test that the number of iterators does not grow on second iteration,
rather than assuming an explicit limit as compilers may vary.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agoMakefile: Add hacks for the nested modules for make check.
Andreas Schlick [Tue, 5 Feb 2013 19:05:35 +0000 (20:05 +0100)]
Makefile: Add hacks for the nested modules for make check.

11 years agoMerge commit 'add31d8'
Rusty Russell [Sat, 2 Feb 2013 04:15:34 +0000 (14:45 +1030)]
Merge commit 'add31d8'

11 years agosparse_bsearch: fixed the no ssize_t defined error.
Riceball LEE [Thu, 24 Jan 2013 01:01:14 +0000 (09:01 +0800)]
sparse_bsearch: fixed the no ssize_t defined error.

11 years agosiphash: Use uint64_t directly, remove typedef
Ulrik Sverdrup [Fri, 25 Jan 2013 19:48:35 +0000 (20:48 +0100)]
siphash: Use uint64_t directly, remove typedef

11 years agosiphash: Simplify helper function W64's signature
Ulrik Sverdrup [Fri, 25 Jan 2013 19:48:35 +0000 (20:48 +0100)]
siphash: Simplify helper function W64's signature

11 years agosiphash: Use ~7 correctly
Ulrik Sverdrup [Fri, 25 Jan 2013 19:48:35 +0000 (20:48 +0100)]
siphash: Use ~7 correctly

7 in ~7 needs to be size_t for it to be correct when len > INT_MAX.

11 years agosiphash: Write siphash_epilogue in nicer style
Ulrik Sverdrup [Mon, 14 Jan 2013 22:11:56 +0000 (23:11 +0100)]
siphash: Write siphash_epilogue in nicer style

11 years agosiphash: Use simple but misalignment-correct implementation of W64
Ulrik Sverdrup [Sun, 13 Jan 2013 15:24:11 +0000 (16:24 +0100)]
siphash: Use simple but misalignment-correct implementation of W64

A simple implementation compiles very well with gcc and clang on ppc and
x86, and will handle any-aligned input.

11 years agosiphash: A keyed hash designed by Aumasson and djb
Ulrik Sverdrup [Sun, 13 Jan 2013 15:24:11 +0000 (16:24 +0100)]
siphash: A keyed hash designed by Aumasson and djb

11 years agoccanlint: fix stack smash.
Rusty Russell [Mon, 14 Jan 2013 07:40:59 +0000 (18:10 +1030)]
ccanlint: fix stack smash.

"engla" on IRC reported that ccanlint on linux/powerpc would loop
infinitely calling dep_failed after all tests are run and the score is
output.

Reproduced, and discovered that cannot_run() takes a container_of(),
except our top node is not a struct ccanlint.  The result was harmless on
x86, but set dep_failed to the return address on powerpc, causing that
to be called repeatedly.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agodgraph: add dgraph_check and CCAN_DGRAPH_DEBUG
Rusty Russell [Mon, 14 Jan 2013 07:35:14 +0000 (18:05 +1030)]
dgraph: add dgraph_check and CCAN_DGRAPH_DEBUG

This is good form for datastructures, so caller can track weird bugs.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agoccanlint: handle when _info doesn't compile.
Rusty Russell [Sat, 12 Jan 2013 05:34:58 +0000 (16:04 +1030)]
ccanlint: handle when _info doesn't compile.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agoMerge branch 'rfc822'
Rusty Russell [Thu, 3 Jan 2013 01:06:59 +0000 (11:36 +1030)]
Merge branch 'rfc822'

11 years agorfc822: switch to ccan/tal. origin/rfc822
Rusty Russell [Thu, 3 Jan 2013 01:06:55 +0000 (11:36 +1030)]
rfc822: switch to ccan/tal.

We use TAL_USE_TALLOC to use libtalloc as the backend: you can test that with
ccanlint --compiler="cc -DTAL_USE_TALLOC".

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotal/str: use tal/talloc backend #ifdef TAL_USE_TALLOC.
Rusty Russell [Thu, 3 Jan 2013 01:06:55 +0000 (11:36 +1030)]
tal/str: use tal/talloc backend #ifdef TAL_USE_TALLOC.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agoccanlint: ignore "unused" non-ccan dependencies.
Rusty Russell [Thu, 3 Jan 2013 01:06:48 +0000 (11:36 +1030)]
ccanlint: ignore "unused" non-ccan dependencies.

We can't really tell if non-ccan dependencies are used, so don't try.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotal/talloc: new module for backending tal onto talloc.
Rusty Russell [Thu, 3 Jan 2013 01:04:22 +0000 (11:34 +1030)]
tal/talloc: new module for backending tal onto talloc.

David Gibson points out that a project may already be using talloc, so
this gives a simple adapter if one module uses tal.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotal: don't automatically register cleanup function.
Rusty Russell [Mon, 17 Dec 2012 03:25:42 +0000 (13:55 +1030)]
tal: don't automatically register cleanup function.

It may interfere with other at_exit() calls, so let them call it manually.
Also, use memset to zero, which really does make valgrind notice any leaks.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agoconfigurator: fix single-arg case.
Rusty Russell [Mon, 17 Dec 2012 03:24:15 +0000 (13:54 +1030)]
configurator: fix single-arg case.

In this case, CCAN_CFLAGS should be "".

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotal: append the length property to the initial allocation.
Rusty Russell [Mon, 17 Dec 2012 03:23:25 +0000 (13:53 +1030)]
tal: append the length property to the initial allocation.

Since we never post-add a length property, we can save some cycles by
allocating it together with the object itself:

Before:
$ ./samba-allocs talloc.dump --tal
Tal time:                6058997-6215211(6102645)ns
Tal_free time:           4791112-4968964(4824814)ns
Single tal_free time:    3173647-3331584(3200183)ns
$ ./samba-allocs talloc.dump --tal-size
Virtual size = 9809920, RSS = 3952640

After:
$ ./samba-allocs talloc.dump --tal
Tal time:                5911994-6043808(5956914)ns
Tal_free time:           4676026-4834598(4719908)ns
Single tal_free time:    2888195-3067365(2922298)ns
$ ./samba-allocs talloc.dump --tal-size
Virtual size = 9809920, RSS = 3948544

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotal: don't always allocate an array in the samba benchmark.
Rusty Russell [Fri, 14 Dec 2012 21:02:06 +0000 (07:32 +1030)]
tal: don't always allocate an array in the samba benchmark.

Since we added the length property, this penalizes us with an extra
alloc.  Unfortunately, we can't tell from the talloc.dump which are
array tallocs and which are single tallocs, but grepping the sources
gives a rate of 1 in 27.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotal: fix skipping tal in samba-allocs benchmark.
Rusty Russell [Fri, 14 Dec 2012 20:57:50 +0000 (07:27 +1030)]
tal: fix skipping tal in samba-allocs benchmark.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotal: fix compilation of speed benchmark.
Rusty Russell [Fri, 14 Dec 2012 20:57:19 +0000 (07:27 +1030)]
tal: fix compilation of speed benchmark.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agorfc822: fix sigaction test, wean off ccan-specific talloc_set_allocator()
Rusty Russell [Fri, 7 Dec 2012 05:56:37 +0000 (16:26 +1030)]
rfc822: fix sigaction test, wean off ccan-specific talloc_set_allocator()

The first ok() line was actually failing, because sigaction returns 0
on success, but because the program exit(0) out the abort handler,
that wasn't being seen.

So remove tap and just abort and assert our way through the test,
which I think is clearer.

We use macros to mug the talloc entry points, since talloc_set_allocator()
is not in mainline talloc.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agorfc822: beef up _info example.
Rusty Russell [Fri, 7 Dec 2012 05:56:37 +0000 (16:26 +1030)]
rfc822: beef up _info example.

Now it's a useful little command line utility, with tests.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agoccanlint: fix --compiler and --cflags options to apply to _info files as well.
Rusty Russell [Fri, 7 Dec 2012 05:56:07 +0000 (16:26 +1030)]
ccanlint: fix --compiler and --cflags options to apply to _info files as well.

We weren't using the compiler and cflags options in tools/compile.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotools: manifest.c should use path_canon.
Rusty Russell [Mon, 3 Dec 2012 11:36:40 +0000 (22:06 +1030)]
tools: manifest.c should use path_canon.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agoccanlint: remove redundant num_lines in struct ccan_file.
Rusty Russell [Mon, 3 Dec 2012 11:36:40 +0000 (22:06 +1030)]
ccanlint: remove redundant num_lines in struct ccan_file.

We can use tal_count.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>