balloon: align val in virtio_balloon_stat

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major
    • virtio 1.0 csprd03
    • Affects Version/s: None
    • None
    • Hide

      let's add padding so val can be
      naturally aligned to 8 bytes.

      Show
      let's add padding so val can be naturally aligned to 8 bytes.

      we have:
      struct virtio_balloon_stat

      { #define VIRTIO_BALLOON_S_SWAP_IN 0 #define VIRTIO_BALLOON_S_SWAP_OUT 1 #define VIRTIO_BALLOON_S_MAJFLT 2 #define VIRTIO_BALLOON_S_MINFLT 3 #define VIRTIO_BALLOON_S_MEMFREE 4 #define VIRTIO_BALLOON_S_MEMTOT 5 u16 tag; u64 val; }

      _attribute_((packed));

      val is 8 bytes but aligned at a 2 byte boundary.
      this is ugly and unusual, and requires implementations
      to use packed structures for access, which is error-prone.

            Assignee:
            Unassigned
            Reporter:
            Michael Tsirkin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: