• Brenden Blanco's avatar
    Add update_table API: accepts sscanf style strings and populates a map · 985adf61
    Brenden Blanco authored
    This is the culmination of the previous patches. It adds an api that can
    input map data in a string format, but validating the numbers and
    locations of data fields. The use case is for fuse file input/output. A
    printf api may follow.
    
    Take the table with key/leaf of:
      struct Key { int a; int b; };
      struct Leaf { int a; int b; int c; struct SubLeaf { int x; int y; } s; };
    
    One would input to this table using:
      update_table(table_name, "{1 2}", "{1 2 -3 {9 0xa}}");
    
    The implementation uses a JITed function for each unique type, that is
    invoked to run sscanf on behalf of the caller. The input must have the
    exact right number of arguments. Bit fields are supported, but the
    caller must be aware of the collapse of those bitfields into an aligned
    field, as well as endianness.
    Signed-off-by: default avatarBrenden Blanco <bblanco@plumgrid.com>
    985adf61
__init__.py 12.5 KB