ccan
6 years agoRevert "io: closing one side of a duplex connection closes both."
Rusty Russell [Thu, 14 Nov 2013 07:43:31 +0000 (18:13 +1030)]
Revert "io: closing one side of a duplex connection closes both."

This reverts commit 490b63852f281f0d72eb6f6dfa5e0dce36bcbe0d.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Conflicts:
ccan/io/io.c

6 years agocpuid: Introduce cpuid_write_info
Ahmed Samy [Thu, 28 Nov 2013 15:20:23 +0000 (17:20 +0200)]
cpuid: Introduce cpuid_write_info

This function writes CPU information to a file.

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
6 years agocpuid: documentation fix
Ahmed Samy [Tue, 26 Nov 2013 17:47:26 +0000 (19:47 +0200)]
cpuid: documentation fix

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
6 years agoMerge branch 'master' of ozlabs.org:ccan
Rusty Russell [Thu, 14 Nov 2013 02:29:41 +0000 (12:59 +1030)]
Merge branch 'master' of ozlabs.org:ccan

6 years agoio: add io_is_idle().
Rusty Russell [Thu, 14 Nov 2013 02:29:21 +0000 (12:59 +1030)]
io: add io_is_idle().

Turns out to be useful for complex cases.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years agoio: handle duplex corner cases.
Rusty Russell [Thu, 14 Nov 2013 02:23:57 +0000 (12:53 +1030)]
io: handle duplex corner cases.

Especially where we have just done a read and spin off a duplex to do a read
as well.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years agocpuid: remove un-needed bit shifting
Ahmed Samy [Wed, 13 Nov 2013 13:09:13 +0000 (15:09 +0200)]
cpuid: remove un-needed bit shifting

eax/ebx/ecx/edx are 32-bit registers, and we need 8 bits from most
significand bits so there is no need to mask out 0xFF.

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
6 years agoMerge branch 'master' of ozlabs.org:ccan
Rusty Russell [Tue, 12 Nov 2013 10:12:01 +0000 (20:42 +1030)]
Merge branch 'master' of ozlabs.org:ccan

6 years agoio: closing one side of a duplex connection closes both.
Rusty Russell [Tue, 12 Nov 2013 10:11:06 +0000 (20:41 +1030)]
io: closing one side of a duplex connection closes both.

Otherwise, it's a PITA to close a duplexed connection.  If necessary we
can introduce a half-close to de-deplex later.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years agocpuid: parse L1 cache information for AMD.
Ahmed Samy [Mon, 11 Nov 2013 16:21:31 +0000 (18:21 +0200)]
cpuid: parse L1 cache information for AMD.

Also take out additional feature information from processor information
and feature bits since they can be tested using cpuid_test_feature() and
cpuid_has_feature()

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
6 years agocpuid: small fix for non x86-cpus
Ahmed Samy [Mon, 11 Nov 2013 16:05:14 +0000 (18:05 +0200)]
cpuid: small fix for non x86-cpus

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
6 years agoMerge branch 'master' of ozlabs.org:ccan
Rusty Russell [Sat, 9 Nov 2013 10:17:20 +0000 (20:47 +1030)]
Merge branch 'master' of ozlabs.org:ccan

6 years agolist: fix list_prev and list_next on const lists.
Rusty Russell [Sat, 9 Nov 2013 10:16:58 +0000 (20:46 +1030)]
list: fix list_prev and list_next on const lists.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years agocpuid: prefix cpuid_t enums with CPUID_* instead of CPU_*
Ahmed Samy [Fri, 8 Nov 2013 12:52:04 +0000 (14:52 +0200)]
cpuid: prefix cpuid_t enums with CPUID_* instead of CPU_*

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
6 years agocpuid: drop support for testing extended features
Ahmed Samy [Thu, 7 Nov 2013 17:29:07 +0000 (19:29 +0200)]
cpuid: drop support for testing extended features

For now, we will just test for normal features, later on it'll be added
back.

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
6 years agocpuid: fix for MSVC in cpuid_is_supported()
Ahmed Samy [Thu, 7 Nov 2013 17:17:16 +0000 (19:17 +0200)]
cpuid: fix for MSVC in cpuid_is_supported()

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
6 years agocpuid: parse additional feature information for pCPU_PROCINFO_AND_FEATUREBITS
Ahmed Samy [Thu, 7 Nov 2013 17:14:17 +0000 (19:14 +0200)]
cpuid: parse additional feature information for pCPU_PROCINFO_AND_FEATUREBITS

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
6 years agocpuid: better parser for processor info
Ahmed Samy [Thu, 7 Nov 2013 17:06:16 +0000 (19:06 +0200)]
cpuid: better parser for processor info

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
6 years agoio: fix port clash in test.
Rusty Russell [Tue, 29 Oct 2013 10:42:57 +0000 (21:12 +1030)]
io: fix port clash in test.

Both run-set_alloc and run-15-timeout used the same port, so they sometimes
got stuck when running in parallel.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years agodaemonize / daemon_with_notify: ignore Ubuntu 13.10 brain death.
Rusty Russell [Tue, 29 Oct 2013 10:31:32 +0000 (21:01 +1030)]
daemonize / daemon_with_notify: ignore Ubuntu 13.10 brain death.

Apparently init --user adopts orphans.  To quote the author
Stewart Smith:

  As much as one can be happy in Ubuntu breaking something that has been
  true for what must be approaching 40 years, yep, I'm happy for you to
  make the changes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years agotime: to/from sec conversions.
Rusty Russell [Mon, 28 Oct 2013 11:27:16 +0000 (21:57 +1030)]
time: to/from sec conversions.

Trivial, but they make coding easier and more predictable.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years agoMerge branch 'master' of ozlabs.org:ccan
Rusty Russell [Mon, 28 Oct 2013 11:20:58 +0000 (21:50 +1030)]
Merge branch 'master' of ozlabs.org:ccan

6 years agocpuid: Use __asm for MSVC
Ahmed Samy [Fri, 25 Oct 2013 14:02:10 +0000 (16:02 +0200)]
cpuid: Use __asm for MSVC

MSVC only supports inline assembly and does not support the keyword
volatile for assembly.

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
6 years agocpuid: use a sprintf-like function to get cputype as a string
Ahmed Samy [Wed, 23 Oct 2013 15:39:25 +0000 (17:39 +0200)]
cpuid: use a sprintf-like function to get cputype as a string

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
6 years agocpuid: avoid unions in parsing data
Ahmed Samy [Mon, 21 Oct 2013 11:45:19 +0000 (13:45 +0200)]
cpuid: avoid unions in parsing data

This is a much more cleaner way to do it and _should_ be easier for people
to use.

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
6 years agocpuid: apply the 32-bit fix
Ahmed Samy [Mon, 21 Oct 2013 10:24:36 +0000 (12:24 +0200)]
cpuid: apply the 32-bit fix

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
6 years agoio: add io_conn_fd()
Rusty Russell [Mon, 21 Oct 2013 05:33:58 +0000 (16:03 +1030)]
io: add io_conn_fd()

Useful for getsockname().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years agoio: io_set_alloc()
Rusty Russell [Mon, 21 Oct 2013 05:10:02 +0000 (15:40 +1030)]
io: io_set_alloc()

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years agoccan/io: make union more generic.
Rusty Russell [Wed, 16 Oct 2013 09:20:12 +0000 (19:50 +1030)]
ccan/io: make union more generic.

I really wanted an array of bytes in there, so make it more flexible.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years agoMerge branch 'master' of ozlabs.org:ccan
Ahmed Samy [Mon, 14 Oct 2013 23:45:27 +0000 (01:45 +0200)]
Merge branch 'master' of ozlabs.org:ccan

6 years agoMerge branch 'io'
Rusty Russell [Mon, 14 Oct 2013 11:03:51 +0000 (21:33 +1030)]
Merge branch 'io'

6 years agoccan/io: add examples.
Rusty Russell [Mon, 14 Oct 2013 11:03:07 +0000 (21:33 +1030)]
ccan/io: add examples.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years agoccan/io: io_connect()
Rusty Russell [Mon, 14 Oct 2013 11:03:07 +0000 (21:33 +1030)]
ccan/io: io_connect()

Not a perfect solution (we'd ideally want to go to another plan
immediately, but that would involve a malloc).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years agoccan/io: flatten debug callchain further.
Rusty Russell [Mon, 14 Oct 2013 11:03:07 +0000 (21:33 +1030)]
ccan/io: flatten debug callchain further.

Don't call through io_loop, but have it pass the connection back
and call manually.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years agoccan/io: flatten debug callchain.
Rusty Russell [Mon, 14 Oct 2013 11:03:07 +0000 (21:33 +1030)]
ccan/io: flatten debug callchain.

Don't call from the plan-construction function, call after it returns.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years agoccan/io: update and improve documentation.
Rusty Russell [Mon, 14 Oct 2013 11:03:07 +0000 (21:33 +1030)]
ccan/io: update and improve documentation.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years agoccan/io: save errno on io_close, for finish functions.
Rusty Russell [Mon, 14 Oct 2013 11:03:07 +0000 (21:33 +1030)]
ccan/io: save errno on io_close, for finish functions.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years agoccan/io: handle errors on poll()
Rusty Russell [Mon, 14 Oct 2013 11:02:58 +0000 (21:32 +1030)]
ccan/io: handle errors on poll()

Without this, closing an fd results in a spin...

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years agoccan/io: io_close_cb()
Rusty Russell [Mon, 14 Oct 2013 11:02:57 +0000 (21:32 +1030)]
ccan/io: io_close_cb()

Overloading io_close() as a callback is ugly: create an explicit
io_close_cb().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years agoccan/io: simplify I/O callbacks.
Rusty Russell [Mon, 14 Oct 2013 11:01:18 +0000 (21:31 +1030)]
ccan/io: simplify I/O callbacks.

Use a -1 for error codes.  This makes it easier to write your own io funcs.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years agoccan/io: io_set_finish()
Rusty Russell [Mon, 14 Oct 2013 11:01:16 +0000 (21:31 +1030)]
ccan/io: io_set_finish()

Rather than insisting on supplying them on every call to io_new_conn().
Also, this way it can be changed on a connection.

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

And rename debug_io_plan() to io_plan_debug() so it can be exposed.

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

Debugging an async library is a pain: it's nice to force it into a
linear call chain to try to track problems.

Ugly code, though.

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

In particular, make sure that idle connections don't get closed.

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

Have it set the plan itself, rather than passing it back.

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

Pass fd and plan explicitly, so they don't need to know the definition
of struct io_conn, and return a bool instead of an enum.

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

Use a NULL next pointer instead to indicate a closing connection.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 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>
6 years agocpuid: minor fixes
Ahmed Samy [Fri, 11 Oct 2013 11:10:07 +0000 (13:10 +0200)]
cpuid: minor fixes

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
6 years agocpuid: cache processor brand string
Ahmed Samy [Fri, 11 Oct 2013 11:09:19 +0000 (13:09 +0200)]
cpuid: cache processor brand string

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
6 years agocpuid: remove the static func has_feature
Ahmed Samy [Fri, 11 Oct 2013 11:08:48 +0000 (13:08 +0200)]
cpuid: remove the static func has_feature

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
6 years agocpuid: fix build on 64-bit systems
Ahmed Samy [Fri, 11 Oct 2013 11:05:03 +0000 (13:05 +0200)]
cpuid: fix build on 64-bit systems

Some instructions needed to use their correct prefix and correct
registers, such as "eax -> rax" and "pushl -> pushq"

Reported-by: Emilio G. Cota <cota@braap.org>
Tested-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
7 years agonet: add async operation helpers.
Rusty Russell [Wed, 2 Oct 2013 08:23:37 +0000 (17:53 +0930)]
net: add async operation helpers.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years agonet: fix leak in test.
Rusty Russell [Wed, 2 Oct 2013 08:23:26 +0000 (17:53 +0930)]
net: fix leak in test.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years agoopt: add allocator setting.
Rusty Russell [Wed, 2 Oct 2013 06:29:48 +0000 (15:59 +0930)]
opt: add allocator setting.

Good for tal usage.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 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>
7 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

7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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

7 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>
7 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

7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>