• Jakob Unterwurzacher's avatar
    fuse: improve SETXATTR debug logging · 41df6ec8
    Jakob Unterwurzacher authored
    Set the operationHandlers[op].DecodeIn function and
    add xattr name parsing.
    
    SETXATTR is special because it is the only opcode that
    takes a file name (the xattr name) and a binary blob
    (the xattr value). This was not supported by the
    file name parsing code:
    * setting FileNames = 1 would lump the xattr name
      and value together and truncates the last byte
    * setting FileNames = 2 truncated the last xattr
      value byte.
    
    This was solved by adding a special-case to parse(),
    which seemed less ugly than adding a special-case
    InputDebug(), or leaving the truncation as-is.
    
    Before:
      2018/05/01 16:47:39 Dispatch 6: SETXATTR, NodeId: 3.  12 bytes
    After:
      2018/05/01 16:48:36 Dispatch 6: SETXATTR, NodeId: 3. data: {sz 3 f0} names: [user.foo] 12 bytes
    
    The change only affects debug output as doSetXAttr() does its
    own bytes.SplitN(). The parsed filename *could* also be used in
    doSetXAttr(), but the code seems clearer as-is.
    41df6ec8
opcode.go 20.8 KB