Skip to content

DTO API - #23

Open
byrnedj wants to merge 3 commits into
intel:mainfrom
byrnedj:api_testing
Open

byrnedj wants to merge 3 commits into
intel:mainfrom
byrnedj:api_testing

Conversation

@byrnedj

@byrnedj byrnedj commented Sep 12, 2025 •

Copy link
Copy Markdown
Contributor

DTO API

DTO provides drop-in replacements for standard memory operations. Each function
is available in three forms:

  • *_default uses library defaults.
  • *_cfg accepts a struct dto_call_cfg to override per-call behavior.
  • The unsuffixed name derives configuration from a bitwise OR of DTO_API_*
    flags.

Sample usage

/* Use defaults */
dto_memcpy_default(dst, src, sizeof(src));

/* Per-call configuration */
struct dto_call_cfg cfg = {
    .auto_adjust = 0,
    .cache_control = 1,
    .wait_method = WAIT_BUSYPOLL,
    .numa_mode = NA_BUFFER_CENTRIC,
    .overlapping_action = OVERLAPPING_CPU,
};
int diff = dto_memcmp_cfg(dst, src, sizeof(src), &cfg);

/* Flags-based configuration */
dto_memset(dst, 0, sizeof(dst), DTO_API_WAIT_YIELD);

-------

DTO provides drop-in replacements for standard memory operations. Each function
is available in three forms:

- *_default uses library defaults.
- *_cfg accepts a `struct dto_call_cfg` to override per-call behavior.
- The unsuffixed name derives configuration from a bitwise OR of `DTO_API_*`
  flags.

Sample usage
-------------

include <dto.h>

int main(void)
{
    char src[64] = "example";
    char dst[64];

    /* Use defaults */
    dto_memcpy_default(dst, src, sizeof(src));

    /* Per-call configuration */
    struct dto_call_cfg cfg = {
        .auto_adjust = 0,
        .cache_control = 1,
        .wait_method = WAIT_BUSYPOLL,
        .numa_mode = NA_BUFFER_CENTRIC,
        .overlapping_action = OVERLAPPING_CPU,
    };
    int diff = dto_memcmp_cfg(dst, src, sizeof(src), &cfg);

    /* Flags-based configuration */
    dto_memset(dst, 0, sizeof(dst), DTO_API_WAIT_YIELD);

    return diff;
}
@byrnedj
byrnedj requested a review from jsydir September 12, 2025 16:39

@jsydir jsydir left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an extra tab on line 1065 of dto.c

It makes sense to rename function dto_memcpymove to dto_memcpymove_dsa to match dto_memcmp_dsa.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants