Displaying 1 result from an estimated 1 matches for "decl_aligned_buff".
Did you mean:
decl_aligned_buffer
2006 Oct 15
3
open(2) O_DIRECT on smbmount gives EINVAL
...<stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <stdint.h>
#define SECTORSIZE 512
#define ALIGN_NUM(val, mult) (((val) + ((mult) - 1)) & ~(((mult) - 1)))
#define ALIGN_PTR(ptr, mult) (void *)ALIGN_NUM((uintptr_t)(ptr), mult)
#define DECL_ALIGNED_BUFFER(name, size) \
char __##name[(size) + SECTORSIZE]; \
char *name = (char *)ALIGN_PTR(__##name, SECTORSIZE)
#define TEST_FILE "test.txt"
int main(void)
{
int fd;
int len = SECTORSIZE;
DECL_ALIGNED_BUFFER(buf, len);
unlink(TEST_FILE);
errno = 0;
// smb fails here...