From: Nils Carlson Date: Mon, 11 Oct 2010 14:10:30 +0000 (+0200) Subject: Introduce a new communication protocol for UST v5 X-Git-Tag: v0.8~3 X-Git-Url: http://git.liburcu.org/?a=commitdiff_plain;h=72098143aa5d995802b411e152b89ad252dd37ca;hp=72098143aa5d995802b411e152b89ad252dd37ca;p=ust.git Introduce a new communication protocol for UST v5 Changes since v4: More scanning fixes in ustctl Changes since v3: Fix minor bugs in ustctl Changes since v2: Fix packing of the socket path and ustcmd handling of socket path Changes since v1: Update after comments from David Goulet, fix some style issues, a bug in GET_SOCK_PATH and add a fixme for posterity. This is once again a bit of a code-dump. The principal of this patch is to get rid of most string parsing in UST and most dynamic heap memory allocation by libust. A secondary goal has been to introduce a command-response model so all commands receive responses with a result code. This has been achived through the following steps. 1. Create standardised message containers as structs ending in a char array. The char array is used to pack strings into while pointers in the struct point positions relative the data segment in the struct. Unpacking the struct upon reception is a simple matter of adding to the pointers the position in memory of the char array. 2. Keeping a char array permanently allocated in libust that is used to receive incoming data, avoiding allocation. This array is large enough to receive any of the pre-defined message structs. 3. Replacing all string matching for commands with enum based switch statements. This will scale better over time. 4. All commands now receive responses containing a result as a negative errno. Libustcmd now returns -1 and sets errno according to these. Eventually these will need to be documented in manpages with what each errno implies. Ustctl needs to check these in turn and give meaningfull feedback. 5. Cleaning up tracectl.c quite a bit separating out control functions and message handling. 6. Move channel marker scanning from tracectl out to ustctl. Fifth is a pain Signed-off-by: Nils Carlson Acked-by: David Goulet ---