|
NDN-DPDK
High-Speed Named Data Networking Forwarder
|
#include "fd.h"#include "../core/logger.h"#include "../ndni/tlv-encoder.h"#include "an.h"#include "naming.h"#include "server.h"#include <dirent.h>#include <sys/syscall.h>#include <unistd.h>#include "../vendor/uthash.h"Macros | |
| #define | uthash_malloc(sz) rte_malloc("FileServer.uthash", (sz), 0) |
| #define | uthash_free(ptr, sz) rte_free((ptr)) |
| #define | HASH_FUNCTION HASH_FUNCTION_DONOTUSE |
| #define | HASH_KEYCMP(a, b, n) (!FdHt_Cmp_((const FileServerFd*)(a), (const LName*)(b))) |
| #define | uthash_fatal(msg) rte_panic("uthash_fatal %s", msg) |
| #define | HASH_INITIAL_NUM_BUCKETS (p->nFdHtBuckets) |
| #define | HASH_INITIAL_NUM_BUCKETS_LOG2 (rte_log2_u32(HASH_INITIAL_NUM_BUCKETS)) |
| #define | HASH_BKT_CAPACITY_THRESH UINT_MAX |
| #define | HASH_EXPAND_BUCKETS(hh, tbl, oomed) FdHt_Expand_(tbl) |
| #define | FdStx_NextUpdate stx_ino |
| Reuse FileServerFd.st.stx_ino field as (TscTime)nextUpdate. More... | |
| #define | HAS_STAT_BIT(bit) (likely((FileServerStatxRequired & (bit)) == (bit) || FileServerFd_HasStatBit(entry, (bit)))) |
| #define | APPEND_NNI(type, bits, val) |
Enumerations | |
| enum | { FileServerStatxRequired = STATX_TYPE | STATX_MODE | STATX_MTIME | STATX_SIZE , FileServerStatxOptional = STATX_ATIME | STATX_CTIME | STATX_BTIME } |
Functions | |
| N_LOG_INIT (FileServerFd) | |
| FileServerFd * | FileServerFd_Open (FileServer *p, const PName *name, TscTime now) |
| Open file descriptor or increment reference count. More... | |
| void | FileServerFd_Unref (FileServer *p, FileServerFd *entry) |
| Decrement file descriptor reference count. More... | |
| void | FileServerFd_Clear (FileServer *p) |
| Close all file descriptors. More... | |
| uint32_t | FileServerFd_PrepareMetadata_ (FileServer *p, FileServerFd *entry) |
| void | FileServerFd_WriteMetadata (FileServerFd *entry, struct iovec *iov, int iovcnt) |
| Write metadata packet. More... | |
| bool | FileServerFd_GenerateLs (FileServer *p, FileServerFd *entry) |
| Populate directory listing. More... | |
Variables | |
| FileServerFd * | FileServer_NotFound = ¬Found |
| Sentinel value to indicate file not found. More... | |
| #define APPEND_NNI | ( | type, | |
| bits, | |||
| val | |||
| ) |
| #define FdStx_NextUpdate stx_ino |
Reuse FileServerFd.st.stx_ino field as (TscTime)nextUpdate.
| #define HAS_STAT_BIT | ( | bit | ) | (likely((FileServerStatxRequired & (bit)) == (bit) || FileServerFd_HasStatBit(entry, (bit)))) |
| #define HASH_BKT_CAPACITY_THRESH UINT_MAX |
| #define HASH_EXPAND_BUCKETS | ( | hh, | |
| tbl, | |||
| oomed | |||
| ) | FdHt_Expand_(tbl) |
| #define HASH_FUNCTION HASH_FUNCTION_DONOTUSE |
| #define HASH_INITIAL_NUM_BUCKETS (p->nFdHtBuckets) |
| #define HASH_INITIAL_NUM_BUCKETS_LOG2 (rte_log2_u32(HASH_INITIAL_NUM_BUCKETS)) |
| #define HASH_KEYCMP | ( | a, | |
| b, | |||
| n | |||
| ) | (!FdHt_Cmp_((const FileServerFd*)(a), (const LName*)(b))) |
| #define uthash_fatal | ( | msg | ) | rte_panic("uthash_fatal %s", msg) |
| #define uthash_free | ( | ptr, | |
| sz | |||
| ) | rte_free((ptr)) |
| #define uthash_malloc | ( | sz | ) | rte_malloc("FileServer.uthash", (sz), 0) |
| void FileServerFd_Clear | ( | FileServer * | p | ) |
Close all file descriptors.
| bool FileServerFd_GenerateLs | ( | FileServer * | p, |
| FileServerFd * | entry | ||
| ) |
Populate directory listing.
| entry | a valid FileServerFd entry representing a directory. |
entry->lsV[:entry->lsL] contains 32=ls payload. entry->lastSeg and entry->meta FinalBlock reflects entry->lsL size. | FileServerFd* FileServerFd_Open | ( | FileServer * | p, |
| const PName * | name, | ||
| TscTime | now | ||
| ) |
Open file descriptor or increment reference count.
| name | Interest name. |
| NULL | filename is invalid or does not match a mount. |
| FileServer_NotFound | file does not exist; do not Unref this value. |
| uint32_t FileServerFd_PrepareMetadata_ | ( | FileServer * | p, |
| FileServerFd * | entry | ||
| ) |
| void FileServerFd_Unref | ( | FileServer * | p, |
| FileServerFd * | entry | ||
| ) |
Decrement file descriptor reference count.
| void FileServerFd_WriteMetadata | ( | FileServerFd * | entry, |
| struct iovec * | iov, | ||
| int | iovcnt | ||
| ) |
Write metadata packet.
| entry | a valid FileServerFd entry. |
| iov | Content iov, must match the length from FileServerFd_PrepareMetadata . |
| N_LOG_INIT | ( | FileServerFd | ) |
| FileServerFd* FileServer_NotFound = ¬Found |
Sentinel value to indicate file not found.