netatalk: speedtest_local_vfs.h Source File

netatalk 4.5.1
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
speedtest_local_vfs.h
Go to the documentation of this file.
1#ifndef SPEEDTEST_LOCAL_VFS_H
2#define SPEEDTEST_LOCAL_VFS_H
3
4#include <stdint.h>
5#include <sys/types.h> /* for off_t */
6#include "afpclient.h"
7#include "dsi.h" /* for DSI type */
8
9/* Local VFS directory/volume tracking */
10#define MAXDIR 32
11#define MAXVOL 3
12
13/* Heap management - exposed for size sweep cleanup in speedtest.c */
14extern char *Dir_heap[MAXVOL][MAXDIR];
15extern char *Vol_heap[MAXVOL];
16
17/* Configuration - must be set by caller before using Local VFS */
18extern int Local_VFS_Quiet; /* Suppress verbose output */
19extern int Local_VFS_Direct; /* Enable O_DIRECT flag */
20
21/* Local VFS function declarations */
22uint16_t local_openvol(CONN *conn, char *vol);
23unsigned int local_closevol(CONN *conn, uint16_t vol);
24unsigned int local_getfiledirparams(CONN *conn, uint16_t vol, int did,
25 char *name, uint16_t f_bitmap, uint16_t d_bitmap);
26unsigned int local_createdir(CONN *conn, uint16_t vol, int did, char *name);
27unsigned int local_createfile(CONN *conn, uint16_t vol, char type, int did,
28 char *name);
29uint16_t local_openfork(CONN *conn, uint16_t vol, int type, uint16_t bitmap,
30 int did, char *name, int access);
31unsigned int local_writeheader(DSI *dsi, uint16_t fork, int offset, int size,
32 char *data, char whence);
33unsigned int local_writefooter(DSI *dsi, uint16_t fork, int offset, int size,
34 char *data, char whence);
35unsigned int local_flushfork(CONN *conn, uint16_t fork);
36unsigned int local_closefork(CONN *conn, uint16_t fork);
37unsigned int local_delete(CONN *conn, uint16_t vol, int did, char *name);
38unsigned int local_setforkparam(CONN *conn, uint16_t fork, uint16_t bitmap,
39 off_t size);
40unsigned int local_write(CONN *conn, uint16_t fork, long long offset, int size,
41 char *data, char whence);
42unsigned int local_read(CONN *conn, uint16_t fork, long long offset, int size,
43 char *data);
44unsigned int local_readheader(DSI *dsi, uint16_t fork, int offset, int size,
45 char *data);
46unsigned int local_readfooter(DSI *dsi, uint16_t fork, int offset, int size,
47 char *data);
48unsigned int local_copyfile(struct CONN *conn, uint16_t svol, int sdid,
49 uint16_t dvol, int ddid, char *src, char *buf, char *dst);
50
51/* VFS function pointer structure */
52 struct vfs {
53 unsigned int (*getfiledirparams)(CONN *, uint16_t, int, char *, uint16_t,
54 uint16_t);
55 unsigned int (*createdir)(CONN *, uint16_t, int, char *);
56 unsigned int (*createfile)(CONN *, uint16_t, char, int, char *);
57 uint16_t (*openfork)(CONN *, uint16_t, int, uint16_t, int, char *, int);
58 unsigned int (*writeheader)(DSI *, uint16_t, int, int, char *, char);
59 unsigned int (*writefooter)(DSI *, uint16_t, int, int, char *, char);
60 unsigned int (*flushfork)(CONN *, uint16_t);
61 unsigned int (*closefork)(CONN *, uint16_t);
62 unsigned int (*delete)(CONN *, uint16_t, int, char *);
63 unsigned int (*setforkparam)(CONN *, uint16_t, uint16_t, off_t);
64 unsigned int (*write)(CONN *, uint16_t, long long, int, char *, char);
65 unsigned int (*read)(CONN *, uint16_t, long long, int, char *);
66 unsigned int (*readheader)(DSI *, uint16_t, int, int, char *);
67 unsigned int (*readfooter)(DSI *, uint16_t, int, int, char *);
68 unsigned int (*copyfile)(CONN *, uint16_t, int, uint16_t, int, char *, char *,
69 char *);
70 uint16_t (*openvol)(CONN *, char *);
71 unsigned int (*closevol)(CONN *conn, uint16_t vol);
72};
73
74/* VFS structure - populated with local functions */
75extern struct vfs local_VFS;
76
77#endif /* SPEEDTEST_LOCAL_VFS_H */
dsi
static DSI * dsi
Definition afparg.c:39
afpclient.h
buf
static char buf[MAXPATHLEN+1]
Definition afppasswd.c:113
data
#define data
Definition hash.c:38
did
cnid_t did
Definition nad_cp.c:93
type
static enum op type
Definition nad_cp.c:96
Local_VFS_Direct
int Local_VFS_Direct
Definition speedtest_local_vfs.c:42
local_VFS
struct vfs local_VFS
Definition speedtest_local_vfs.c:501
Dir_heap
char * Dir_heap[MAXVOL][MAXDIR]
Definition speedtest_local_vfs.c:39
Local_VFS_Quiet
int Local_VFS_Quiet
Definition speedtest_local_vfs.c:41
Vol_heap
char * Vol_heap[MAXVOL]
Definition speedtest_local_vfs.c:40
local_writefooter
unsigned int local_writefooter(DSI *dsi, uint16_t fork, int offset, int size, char *data, char whence)
No-op write footer (AFP compatibility).
Definition speedtest_local_vfs.c:339
local_delete
unsigned int local_delete(CONN *conn, uint16_t vol, int did, char *name)
Delete file/directory via unlink()/rmdir().
Definition speedtest_local_vfs.c:214
MAXDIR
#define MAXDIR
Definition speedtest_local_vfs.h:10
local_createfile
unsigned int local_createfile(CONN *conn, uint16_t vol, char type, int did, char *name)
Create file via open().
Definition speedtest_local_vfs.c:245
local_closefork
unsigned int local_closefork(CONN *conn, uint16_t fork)
Close file descriptor.
Definition speedtest_local_vfs.c:372
local_openvol
uint16_t local_openvol(CONN *conn, char *vol)
Open directory as volume in Local mode.
Definition speedtest_local_vfs.c:73
local_copyfile
unsigned int local_copyfile(struct CONN *conn, uint16_t svol, int sdid, uint16_t dvol, int ddid, char *src, char *buf, char *dst)
Copy file operation (not implemented, returns error).
Definition speedtest_local_vfs.c:493
local_write
unsigned int local_write(CONN *conn, uint16_t fork, long long offset, int size, char *data, char whence)
Write data to file via lseek() + write().
Definition speedtest_local_vfs.c:408
local_flushfork
unsigned int local_flushfork(CONN *conn, uint16_t fork)
Flush file data to disk via fsync().
Definition speedtest_local_vfs.c:355
local_getfiledirparams
unsigned int local_getfiledirparams(CONN *conn, uint16_t vol, int did, char *name, uint16_t f_bitmap, uint16_t d_bitmap)
Check file/directory existence via stat().
Definition speedtest_local_vfs.c:191
local_writeheader
unsigned int local_writeheader(DSI *dsi, uint16_t fork, int offset, int size, char *data, char whence)
Write data via lseek() + write() syscalls.
Definition speedtest_local_vfs.c:315
MAXVOL
#define MAXVOL
Definition speedtest_local_vfs.h:11
local_read
unsigned int local_read(CONN *conn, uint16_t fork, long long offset, int size, char *data)
Read data from file via lseek() + read().
Definition speedtest_local_vfs.c:432
local_setforkparam
unsigned int local_setforkparam(CONN *conn, uint16_t fork, uint16_t bitmap, off_t size)
Set file size via ftruncate().
Definition speedtest_local_vfs.c:389
local_closevol
unsigned int local_closevol(CONN *conn, uint16_t vol)
Close volume and cleanup heaps.
Definition speedtest_local_vfs.c:110
local_createdir
unsigned int local_createdir(CONN *conn, uint16_t vol, int did, char *name)
Create directory via mkdir() and add to heap.
Definition speedtest_local_vfs.c:137
local_readheader
unsigned int local_readheader(DSI *dsi, uint16_t fork, int offset, int size, char *data)
No-op read header (AFP compatibility).
Definition speedtest_local_vfs.c:455
local_openfork
uint16_t local_openfork(CONN *conn, uint16_t vol, int type, uint16_t bitmap, int did, char *name, int access)
Open file fork and return file descriptor as fork handle.
Definition speedtest_local_vfs.c:277
local_readfooter
unsigned int local_readfooter(DSI *dsi, uint16_t fork, int offset, int size, char *data)
Read data footer via lseek() + read().
Definition speedtest_local_vfs.c:470
CONN
Definition afpclient.h:176
DSI
Definition include/atalk/dsi.h:58
vfs
Definition speedtest_local_vfs.h:52
vfs::closefork
unsigned int(* closefork)(CONN *, uint16_t)
Definition speedtest_local_vfs.h:61
vfs::readheader
unsigned int(* readheader)(DSI *, uint16_t, int, int, char *)
Definition speedtest_local_vfs.h:66
vfs::writefooter
unsigned int(* writefooter)(DSI *, uint16_t, int, int, char *, char)
Definition speedtest_local_vfs.h:59
vfs::flushfork
unsigned int(* flushfork)(CONN *, uint16_t)
Definition speedtest_local_vfs.h:60
vfs::closevol
unsigned int(* closevol)(CONN *conn, uint16_t vol)
Definition speedtest_local_vfs.h:71
vfs::read
unsigned int(* read)(CONN *, uint16_t, long long, int, char *)
Definition speedtest_local_vfs.h:65
vfs::copyfile
unsigned int(* copyfile)(CONN *, uint16_t, int, uint16_t, int, char *, char *, char *)
Definition speedtest_local_vfs.h:68
vfs::writeheader
unsigned int(* writeheader)(DSI *, uint16_t, int, int, char *, char)
Definition speedtest_local_vfs.h:58
vfs::setforkparam
unsigned int(* setforkparam)(CONN *, uint16_t, uint16_t, off_t)
Definition speedtest_local_vfs.h:63
vfs::openfork
uint16_t(* openfork)(CONN *, uint16_t, int, uint16_t, int, char *, int)
Definition speedtest_local_vfs.h:57
vfs::readfooter
unsigned int(* readfooter)(DSI *, uint16_t, int, int, char *)
Definition speedtest_local_vfs.h:67
vfs::getfiledirparams
unsigned int(* getfiledirparams)(CONN *, uint16_t, int, char *, uint16_t, uint16_t)
Definition speedtest_local_vfs.h:53
vfs::openvol
uint16_t(* openvol)(CONN *, char *)
Definition speedtest_local_vfs.h:70
vfs::createfile
unsigned int(* createfile)(CONN *, uint16_t, char, int, char *)
Definition speedtest_local_vfs.h:56
vfs::write
unsigned int(* write)(CONN *, uint16_t, long long, int, char *, char)
Definition speedtest_local_vfs.h:64
vfs::createdir
unsigned int(* createdir)(CONN *, uint16_t, int, char *)
Definition speedtest_local_vfs.h:55
vol
Definition include/atalk/volume.h:33
dsi.h
DSI (Data Stream Interface) protocol definitions for the test-suite.