You need to sign in or sign up before continuing.
  1. 30 8月, 2013 1 次提交
  2. 27 7月, 2013 3 次提交
    • K
      qapi: Anonymous unions · 69dd62df
      Kevin Wolf 提交于
      The discriminator for anonymous unions is the data type. This allows to
      have a union type that allows both of these:
      
          { 'file': 'my_existing_block_device_id' }
          { 'file': { 'filename': '/tmp/mydisk.qcow2', 'read-only': true } }
      
      Unions like this are specified in the schema with an empty dict as
      discriminator. For this example you could take:
      
          { 'union': 'BlockRef',
            'discriminator': {},
            'data': { 'definition': 'BlockOptions',
                      'reference': 'str' } }
          { 'type': 'ExampleObject',
            'data: { 'file': 'BlockRef' } }
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      69dd62df
    • K
      qapi: Flat unions with arbitrary discriminator · 50f2bdc7
      Kevin Wolf 提交于
      Instead of the rather verbose syntax that distinguishes base and
      subclass fields...
      
        { "type": "file",
          "read-only": true,
          "data": {
              "filename": "test"
          } }
      
      ...we can now have both in the same namespace, allowing a more direct
      mapping of the command line, and moving fields between the common base
      and subclasses without breaking the API:
      
        { "driver": "file",
          "read-only": true,
          "filename": "test" }
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      50f2bdc7
    • K
      qapi-types.py: Implement 'base' for unions · e2503f5e
      Kevin Wolf 提交于
      The new 'base' key in a union definition refers to a struct type, which
      is inlined into the union definition and can represent fields common to
      all kinds.
      
      For example the following schema definition...
      
          { 'type': 'BlockOptionsBase', 'data': { 'read-only': 'bool' } }
      
          { 'union': 'BlockOptions',
            'base': 'BlockOptionsBase',
            'data': {
                'raw': 'BlockOptionsRaw'
                'qcow2': 'BlockOptionsQcow2'
            } }
      
      ...would result in this generated C struct:
      
          struct BlockOptions
          {
              BlockOptionsKind kind;
              union {
                  void *data;
                  BlockOptionsRaw * raw;
                  BlockOptionsQcow2 * qcow2;
              };
              bool read_only;
          };
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      e2503f5e
  3. 30 5月, 2013 1 次提交
    • M
      qapi: pad GenericList value fields to 64 bits · a678e26c
      Michael Roth 提交于
      With the introduction of native list types, we now have types such as
      int64List where the 'value' field is not a pointer, but the actual
      64-bit value.
      
      On 32-bit architectures, this can lead to situations where 'next' field
      offset in GenericList does not correspond to the 'next' field in the
      types that we cast to GenericList when using the visit_next_list()
      interface, causing issues when we attempt to traverse linked list
      structures of these types.
      
      To fix this, pad the 'value' field of GenericList and other
      schema-defined/native *List types out to 64-bits.
      
      This is less memory-efficient for 32-bit architectures, but allows us to
      continue to rely on list-handling interfaces that target GenericList to
      simply visitor implementations.
      
      In the future we can improve efficiency by defaulting to using native C
      array backends to handle list of non-pointer types, which would be more
      memory efficient in itself and allow us to roll back this change.
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
      a678e26c
  4. 23 5月, 2013 1 次提交
  5. 19 12月, 2012 1 次提交
  6. 15 11月, 2012 1 次提交
  7. 26 9月, 2012 1 次提交
  8. 06 9月, 2012 1 次提交
    • A
      qapi: generate list struct and visit_list for enum · b9c4b48d
      Amos Kong 提交于
      Currently, if we define an 'enum' and use it in one command's
      data, list struct for enum could not be generated, but it's
      used in qmp function.
      
      For example: KeyCodesList could not be generated.
      >>> qapi-schema.json:
      { 'enum': 'KeyCodes',
        'data': [ 'shift', 'alt' ... ] }
      { 'command': 'sendkey',
        'data': { 'keys': ['KeyCodes'], '*hold-time': 'int' } }
      
      >>> qmp-command.h:
      void qmp_sendkey(KeyCodesList * keys, bool has_hold_time, int64_t
      hold_time, Error **errp);
      
      This patch lets qapi generate list struct and visit_list for enum.
      Signed-off-by: NAmos Kong <akong@redhat.com>
      Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
      b9c4b48d
  9. 14 8月, 2012 3 次提交
  10. 27 3月, 2012 1 次提交
  11. 12 3月, 2012 1 次提交
  12. 13 1月, 2012 1 次提交
    • A
      Fix qapi code generation fix · 19bf7c87
      Avi Kivity 提交于
      The fixes to qapi code generation had multiple bugs:
      - the Null class used to drop output was missing some methods
      - in some scripts it was never instantiated, leading to a None return,
        which is missing even more methods
      - the --source and --header options were swapped
      
      Luckily, all those bugs were hidden by a makefile bug which caused the
      old behaviour (with the race) to be invoked.
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      19bf7c87
  13. 27 12月, 2011 1 次提交
    • A
      Fix qapi code generation wrt parallel build · 8d3bc517
      Avi Kivity 提交于
      Make's multiple output syntax
      
        x.c x.h: x.template
             gen < x.template
      
      actually invokes the command once for x.c and once for x.h (with differing $@
      in each invocation).  During a parallel build, the two commands may be invoked
      in parallel; this opens up a race, where the second invocation trashes a file
      supposedly produced during the first, and now in use by a dependent command.
      
      The various qapi code generators are susceptible to this; fix by making them
      generate just one file per invocation.
      Signed-off-by: NAvi Kivity <avi@redhat.com>
      Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
      8d3bc517
  14. 15 12月, 2011 1 次提交
  15. 04 10月, 2011 4 次提交
  16. 22 7月, 2011 1 次提交
    • M
      qapi: add qapi-types.py code generator · fb3182ce
      Michael Roth 提交于
      This is the code generator for qapi types. It will generation the
      following files:
      
        $(prefix)qapi-types.h - C types corresponding to types defined in
                                the schema you pass in
        $(prefix)qapi-types.c - Cleanup functions for the above C types
      
      The $(prefix) is used to as a namespace to keep the generated code from
      one schema/code-generation separated from others so code and be
      generated from multiple schemas with clobbering previously created code.
      Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
      Signed-off-by: NLuiz Capitulino <lcapitulino@gmail.com>
      fb3182ce