Size of the DSTORAGE_REQUEST_OPTIONS

Open
#22 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
api

Research direction

Start by locating the DSTORAGE_REQUEST_OPTIONS definition in the DirectStorage API and reproduce its size with MSVC, focusing on the mixed UINT8 and UINT64 bitfields and resulting alignment. Compare the observed layout with the intended ABI and record whether the 16-byte size is designed or needs correction for Rust interoperability.

Written by the indexing model from the issue text.

Description

bug

While porting the DirectStorage API to Rust, we found the following curriosity and would like to as if it's working as designed:

The DSTORAGE_REQUEST_OPTIONS is defines as a bitfield and it seems that the design goal was that all fields are packed into a single unsigned 64 bit integer field.

But the current implementation is not of byte size 8, but of size 16, since MSVC is only packing fields with the same type into the same backing field. Since DSTORAGE_COMPRESSION_FORMAT is an UINT8 and not an UINT64 like the other fields, it will be stored by MSVC into it's own backing field. Allignment and padding then will grow the size of DSTORAGE_REQUEST_SOURCE_TYPE to 16 bytes.

Dominant language
C++
Stars
897
Forks
111
Avg merge
13h 58m
Merged PRs (30d)
12

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/DirectStorage

All issues in microsoft/DirectStorage

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.