NDN-DPDK
High-Speed Named Data Networking Forwarder
Loading...
Searching...
No Matches
mmapfd.h
Go to the documentation of this file.
1#ifndef NDNDPDK_CORE_MMAPFD_H
2#define NDNDPDK_CORE_MMAPFD_H
3
5
6#include "common.h"
7
9typedef struct MmapFd {
10 void* map;
11 size_t size;
12 int fd;
14
20__attribute__((nonnull)) bool
21MmapFd_Open(MmapFd* m, const char* filename, size_t size);
22
28__attribute__((nonnull)) bool
29MmapFd_Close(MmapFd* m, const char* filename, size_t size);
30
35__attribute__((nonnull, returns_nonnull)) __rte_always_inline void*
36MmapFd_At(const MmapFd* m, size_t pos) {
37 return RTE_PTR_ADD(m->map, pos);
38}
39
40#endif // NDNDPDK_CORE_MMAPFD_H
bool MmapFd_Open(MmapFd *m, const char *filename, size_t size)
Create a file with memory map.
Definition mmapfd.c:20
bool MmapFd_Close(MmapFd *m, const char *filename, size_t size)
Close a file with memory map.
Definition mmapfd.c:55
__rte_always_inline void * MmapFd_At(const MmapFd *m, size_t pos)
Access mapped memory region.
Definition mmapfd.h:36
Memory map and file descriptor.
Definition mmapfd.h:9
void * map
Definition mmapfd.h:10
size_t size
Definition mmapfd.h:11
int fd
Definition mmapfd.h:12