netatalk 4.5.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
speedtest_local_vfs.c File Reference
`#include "speedtest_local_vfs.h"`
`#include <errno.h>`
`#include <fcntl.h>`
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <unistd.h>`
`#include <sys/stat.h>`
`#include "afpcmd.h"`

## Macros
#define | O_DIRECT 040000

## Functions
static int | local_chdir (uint16_t vol, int did)
| Change to directory in Local VFS heap.
uint16_t | local_openvol (CONN *conn, char *vol)
| Open directory as volume in Local mode.
unsigned int | local_closevol (CONN *conn, uint16_t vol)
| Close volume and cleanup heaps.
unsigned int | local_createdir (CONN *conn, uint16_t vol, int did, char *name)
| Create directory via mkdir() and add to heap.
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().
unsigned int | local_delete (CONN *conn, uint16_t vol, int did, char *name)
| Delete file/directory via unlink()/rmdir().
unsigned int | local_createfile (CONN *conn, uint16_t vol, char type, int did, char *name)
| Create file via open().
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.
unsigned int | local_writeheader (DSI *dsi, uint16_t fork, int offset, int size, char *data, char whence)
| Write data via lseek() + write() syscalls.
unsigned int | local_writefooter (DSI *dsi, uint16_t fork, int offset, int size, char *data, char whence)
| No-op write footer (AFP compatibility).
unsigned int | local_flushfork (CONN *conn, uint16_t fork)
| Flush file data to disk via fsync().
unsigned int | local_closefork (CONN *conn, uint16_t fork)
| Close file descriptor.
unsigned int | local_setforkparam (CONN *conn, uint16_t fork, uint16_t bitmap, off_t size)
| Set file size via ftruncate().
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().
unsigned int | local_read (CONN *conn, uint16_t fork, long long offset, int size, char *data)
| Read data from file via lseek() + read().
unsigned int | local_readheader (DSI *dsi, uint16_t fork, int offset, int size, char *data)
| No-op read header (AFP compatibility).
unsigned int | local_readfooter (DSI *dsi, uint16_t fork, int offset, int size, char *data)
| Read data footer via lseek() + read().
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).

## Variables
char * | Dir_heap [MAXVOL][MAXDIR]
char * | Vol_heap [MAXVOL]
int | Local_VFS_Quiet = 0
int | Local_VFS_Direct = 1
struct vfs | local_VFS

## Macro Definition Documentation

## ◆ O_DIRECT

#define O_DIRECT 040000

## Function Documentation

## ◆ local_chdir()

int local_chdir | ( | uint16_t | vol,
|  | int | did )
| static

Change to directory in Local VFS heap.

## ◆ local_closefork()

unsigned int local_closefork | ( | CONN * | conn,
|  | uint16_t | fork )

Close file descriptor.

## ◆ local_closevol()

unsigned int local_closevol | ( | CONN * | conn,
|  | uint16_t | vol )

Close volume and cleanup heaps.

## ◆ 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).

## ◆ local_createdir()

unsigned int local_createdir | ( | CONN * | conn,
|  | uint16_t | vol,
|  | int | did,
|  | char * | name )

Create directory via mkdir() and add to heap.

## ◆ local_createfile()

unsigned int local_createfile | ( | CONN * | conn,
|  | uint16_t | vol,
|  | char | type,
|  | int | did,
|  | char * | name )

Create file via open().

## ◆ local_delete()

unsigned int local_delete | ( | CONN * | conn,
|  | uint16_t | vol,
|  | int | did,
|  | char * | name )

Delete file/directory via unlink()/rmdir().

## ◆ local_flushfork()

unsigned int local_flushfork | ( | CONN * | conn,
|  | uint16_t | fork )

Flush file data to disk via fsync().

## ◆ 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().

## ◆ 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.

## ◆ local_openvol()

uint16_t local_openvol | ( | CONN * | conn,
|  | char * | vol )

Open directory as volume in Local mode.

## ◆ 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().

## ◆ local_readfooter()

unsigned int local_readfooter | ( | DSI * | dsi,
|  | uint16_t | fork,
|  | int | offset,
|  | int | size,
|  | char * | data )

Read data footer via lseek() + read().

## ◆ local_readheader()

unsigned int local_readheader | ( | DSI * | dsi,
|  | uint16_t | fork,
|  | int | offset,
|  | int | size,
|  | char * | data )

No-op read header (AFP compatibility).

## ◆ local_setforkparam()

unsigned int local_setforkparam | ( | CONN * | conn,
|  | uint16_t | fork,
|  | uint16_t | bitmap,
|  | off_t | size )

Set file size via ftruncate().

## ◆ 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().

## ◆ 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).

## ◆ 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.

## Variable Documentation

## ◆ Dir_heap

char* Dir_heap[MAXVOL][MAXDIR]

## ◆ local_VFS

struct vfs local_VFS

Initial value:
= {
local_getfiledirparams,
local_createdir,
local_createfile,
local_openfork,
local_writeheader,
local_writefooter,
local_flushfork,
local_closefork,
local_delete,
local_setforkparam,
local_write,
local_read,
local_readheader,
local_readfooter,
local_copyfile,
local_openvol,
local_closevol
}
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
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
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

## ◆ Local_VFS_Direct

int Local_VFS_Direct = 1

## ◆ Local_VFS_Quiet

int Local_VFS_Quiet = 0

## ◆ Vol_heap

char* Vol_heap[MAXVOL]