I changed the request struct to break the 32 bits reserved for the
request type into two. The first part of this is used for the flags
(such as FUA), and the second part for the command type. Previously
we'd masked the top two bytes, thus ignoring any flags.
```
In file included from src/server/bitset.h:4:0,
from src/server/mirror.h:8,
from src/server/flexnbd.h:5,
from src/server/serve.h:8,
from src/server/serve.c:1:
src/server/serve.c: In function 'tryjoin_client_thread':
src/server/serve.c:258:6: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
(uint64_t)status);
^
```
This was listed as a bug, and was immediatelly picked the static
analyzer anyway, this is very likely the cause for the
migration-cancel-crash bug.
Signed-off-by: Michel Pollet <buserror@gmail.com>
We were calculating the wrong number of words per byte in the first
place, and then passing the number of *words* to malloc, which expects
the number of *bytes*.
Fix both errors
This commit beefs up the Makefile to do the build, instead of the
Rakefile.
It also removes from the Rakefile the dependency on rake_utils, which
should mean it's ok to build in a schroot.
The files are reorganised to make the Makefile rules more tractable,
although the reorganisation reveals a problem with our current code
organisation.
The problem is that the proxy-specific code transitively depends on the
server code via flexnbd.h, which has a circular dependency on the server
and client structs. This should be broken in a future commit by
separating the flexnbd struct into a shared config struct and
server-specific parts, so that the server code can be moved into
src/server to more accurately show the functional dependencies.