NDN-DPDK
High-Speed Named Data Networking Forwarder
Loading...
Searching...
No Matches
fd.c File Reference
#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)
#define uthash_free(ptr, sz)
#define HASH_FUNCTION   HASH_FUNCTION_DONOTUSE
#define HASH_KEYCMP(a, b, n)
#define uthash_fatal(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)
#define FdStx_NextUpdate   stx_ino
 Reuse FileServerFd.st.stx_ino field as (TscTime)nextUpdate.
#define HAS_STAT_BIT(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)
FileServerFdFileServerFd_Open (FileServer *p, const PName *name, TscTime now)
 Open file descriptor or increment reference count.
void FileServerFd_Unref (FileServer *p, FileServerFd *entry)
 Decrement file descriptor reference count.
void FileServerFd_Clear (FileServer *p)
 Close all file descriptors.
uint32_t FileServerFd_PrepareMetadata_ (FileServer *p, FileServerFd *entry)
void FileServerFd_WriteMetadata (FileServerFd *entry, struct iovec *iov, int iovcnt)
 Write metadata packet.
bool FileServerFd_GenerateLs (FileServer *p, FileServerFd *entry)
 Populate directory listing.

Variables

FileServerFdFileServer_NotFound = &notFound
 Sentinel value to indicate file not found.

Macro Definition Documentation

◆ APPEND_NNI

#define APPEND_NNI ( type,
bits,
val )
Value:
do { \
struct __rte_packed_begin { \
unaligned_uint32_t tl; \
unaligned_uint##bits##_t v; \
} __rte_packed_end* f = (void*)output; \
f->tl = TlvEncoder_ConstTL3(TtFile##type, sizeof(f->v)); \
f->v = rte_cpu_to_be_##bits((uint##bits##_t)(val)); \
output += sizeof(*f); \
} while (false)
struct __rte_packed_begin vlanhdr __rte_packed_end
#define TlvEncoder_ConstTL3(type, length)
Encode constant TLV-TYPE and TLV-LENGTH to unaligned_uint32_t constant.
Definition tlv-encoder.h:74

◆ FdStx_NextUpdate

#define FdStx_NextUpdate   stx_ino

Reuse FileServerFd.st.stx_ino field as (TscTime)nextUpdate.

◆ HAS_STAT_BIT

#define HAS_STAT_BIT ( bit)
Value:
(likely((FileServerStatxRequired & (bit)) == (bit) || FileServerFd_HasStatBit(entry, (bit))))
@ FileServerStatxRequired
Definition fd.c:50

◆ HASH_BKT_CAPACITY_THRESH

#define HASH_BKT_CAPACITY_THRESH   UINT_MAX

◆ HASH_EXPAND_BUCKETS

#define HASH_EXPAND_BUCKETS ( hh,
tbl,
oomed )
Value:
FdHt_Expand_(tbl)

◆ HASH_FUNCTION

#define HASH_FUNCTION   HASH_FUNCTION_DONOTUSE

◆ HASH_INITIAL_NUM_BUCKETS

#define HASH_INITIAL_NUM_BUCKETS   (p->nFdHtBuckets)

◆ HASH_INITIAL_NUM_BUCKETS_LOG2

#define HASH_INITIAL_NUM_BUCKETS_LOG2   (rte_log2_u32(HASH_INITIAL_NUM_BUCKETS))

◆ HASH_KEYCMP

#define HASH_KEYCMP ( a,
b,
n )
Value:
(!FdHt_Cmp_((const FileServerFd*)(a), (const LName*)(b)))
File descriptor related information in the file server.
Definition fd.h:21
Name in linear buffer.
Definition name.h:11

◆ uthash_fatal

#define uthash_fatal ( msg)
Value:
rte_panic("uthash_fatal %s", msg)

◆ uthash_free

#define uthash_free ( ptr,
sz )
Value:
rte_free((ptr))

◆ uthash_malloc

#define uthash_malloc ( sz)
Value:
rte_malloc("FileServer.uthash", (sz), 0)

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
FileServerStatxRequired 
FileServerStatxOptional 

Function Documentation

◆ FileServerFd_Clear()

void FileServerFd_Clear ( FileServer * p)

Close all file descriptors.

◆ FileServerFd_GenerateLs()

bool FileServerFd_GenerateLs ( FileServer * p,
FileServerFd * entry )

Populate directory listing.

Parameters
entrya valid FileServerFd entry representing a directory.
Postcondition
entry->lsV[:entry->lsL] contains 32=ls payload.
entry->lastSeg and entry->meta FinalBlock reflects entry->lsL size.

◆ FileServerFd_Open()

FileServerFd * FileServerFd_Open ( FileServer * p,
const PName * name,
TscTime now )

Open file descriptor or increment reference count.

Parameters
nameInterest name.
Return values
NULLfilename is invalid or does not match a mount.
FileServer_NotFoundfile does not exist; do not Unref this value.

◆ FileServerFd_PrepareMetadata_()

uint32_t FileServerFd_PrepareMetadata_ ( FileServer * p,
FileServerFd * entry )

◆ FileServerFd_Unref()

void FileServerFd_Unref ( FileServer * p,
FileServerFd * entry )

Decrement file descriptor reference count.

◆ FileServerFd_WriteMetadata()

void FileServerFd_WriteMetadata ( FileServerFd * entry,
struct iovec * iov,
int iovcnt )

Write metadata packet.

Parameters
entrya valid FileServerFd entry.
iovContent iov, must match the length from FileServerFd_PrepareMetadata .

◆ N_LOG_INIT()

N_LOG_INIT ( FileServerFd )

Variable Documentation

◆ FileServer_NotFound

FileServerFd* FileServer_NotFound = &notFound

Sentinel value to indicate file not found.