[haiku-development] structs in btrfs.h

  • From: Bharathi Ramana Joshi <joshibharathiramana@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Wed, 20 Mar 2019 11:37:10 +0530

Hi,

I have come to notice that some structs in btrfs.h have get and set methods.

For instance

```
struct btrfs_index {
      btrfs_key key;
      uint64  logical_address;
      uint64  generation;
      uint64 LogicalAddress() const
          { return B_LENDIAN_TO_HOST_INT64(logical_address); }
      uint64 Generation() const
          { return B_LENDIAN_TO_HOST_INT64(generation); }

      void SetLogicalAddress(uint64 address)
          { logical_address = B_HOST_TO_LENDIAN_INT64(address); }
      void SetGeneration(uint64 gen)
          { generation = B_HOST_TO_LENDIAN_INT64(gen); }
  } _PACKED;

```
While some other structs do not. For example
```
       struct btrfs_timespec {
       uint64  seconds;
       uint32  nanoseconds;
   } _PACKED;
```

What is the criteria for having get and set methods?

Thank you
brj

Other related posts: