forked from zrlio/urdma
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The rdma-core 18 build depends on many more kernel headers than rdma-core 17. Fix the CCAN includes from the rdma-core 18 headers because the directory structure in rdma-core was modified, whereas we keep a more vanilla layout. Add all of the userspace ABI kernel headers to the source tree so we can build against the newer rdma-core version. The updated build has been tested on my local system against rdma-core 17 and 18 and appears to work correctly. Signed-off-by: Patrick MacArthur <[email protected]>
- Loading branch information
1 parent
c57ca7c
commit 8567e98
Showing
12 changed files
with
2,250 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ config.h* | |
config.log | ||
config.status | ||
configure | ||
include/kernel-abi | ||
libtool | ||
Makefile | ||
/Makefile.in | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/usr/bin/env python | ||
# Copied from rdma-core 18.2 | ||
"""This script transforms the structs inside the kernel ABI headers into a define | ||
of an anonymous struct. | ||
eg | ||
struct abc {int foo;}; | ||
becomes | ||
#define _STRUCT_abc struct {int foo;}; | ||
This allows the exact same struct to be included in the provider wrapper struct: | ||
struct abc_resp { | ||
struct ibv_abc ibv_resp; | ||
_STRUCT_abc; | ||
}; | ||
Which duplicates the struct layout and naming we have historically used, but | ||
sources the data directly from the kernel headers instead of manually copying.""" | ||
import re; | ||
import functools; | ||
import sys; | ||
|
||
def in_struct(ln,FO,nesting=0): | ||
"""Copy a top level structure over to the #define output, keeping track of | ||
nested structures.""" | ||
if nesting == 0: | ||
if re.match(r"(}.*);",ln): | ||
FO.write(ln[:-1] + "\n\n"); | ||
return find_struct; | ||
|
||
FO.write(ln + " \\\n"); | ||
|
||
if ln == "struct {" or ln == "union {": | ||
return functools.partial(in_struct,nesting=nesting+1); | ||
|
||
if re.match(r"}.*;",ln): | ||
return functools.partial(in_struct,nesting=nesting-1); | ||
return functools.partial(in_struct,nesting=nesting); | ||
|
||
def find_struct(ln,FO): | ||
"""Look for the start of a top level structure""" | ||
if ln.startswith("struct ") or ln.startswith("union "): | ||
g = re.match(r"(struct|union)\s+(\S+)\s+{",ln); | ||
FO.write("#define _STRUCT_%s %s { \\\n"%(g.group(2),g.group(1))); | ||
return in_struct; | ||
return find_struct; | ||
|
||
with open(sys.argv[1]) as FI: | ||
with open(sys.argv[2],"w") as FO: | ||
state = find_struct; | ||
for ln in FI: | ||
# Drop obvious comments | ||
ln = ln.strip(); | ||
ln = re.sub(r"/\*.*\*/","",ln); | ||
ln = re.sub(r"//.*$","",ln); | ||
state = state(ln,FO); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.