netatalk  4.6.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
megatron.c File Reference
#include <errno.h>
#include <fcntl.h>
#include <pwd.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
#include <atalk/adouble.h>
#include <atalk/cnid.h>
#include <atalk/netatalk_conf.h>
#include <atalk/util.h>
#include <atalk/volume.h>
#include <netatalk/endian.h>
#include "nad.h"
#include "hqx.h"
#include "macbin.h"
#include "megatron.h"
#include "nad_adouble.h"

Data Structures

struct  archive_mode

Functions

static void usage_archive (FILE *out)
static int parse_archive_mode (const char *name)
static int mode_writes_metadata (int module)
static int mode_reads_metadata (int module)
static int mode_creates_volume_file (int module, int flags)
static int from_open (int un, char *file, struct FHeader *fh, int flags)
static ssize_t from_read (int un, int fork, char *buf, size_t len)
static int from_close (int un)
static int to_open (int to, char *file, struct FHeader *fh, int flags)
static ssize_t to_write (int to, int fork, size_t bufc)
static int to_close (int to, int keepflag)
static const char * created_file_path (int module)
static int update_created_file_cnid (const struct nad_volume *volume, const char *path)
static void print_header_date (const char *label, uint32_t ad_date, int available)
static void print_header (const struct FHeader *fh)
static int nad_archive_convert (char *path, int module, const char *newname, int flags, const struct nad_volume *volume)
static void close_metadata_volume (struct nad_volume *volume)
static int validate_volume_metadata (const char *volpath, const struct vol *vol)
static void set_fallback_volume (struct nad_volume *volume, int flags)
static int resolve_metadata_volume (AFPObj *obj, int module, const char *path, int flags, struct nad_volume *volume)
static int arg_is_option_with_value (const char *arg)
static int arg_is_flag_option (const char *arg)
static int set_newname (char *newname, size_t newname_len, const char *name)
static int option_after_file (const char *arg)
int nad_archive (int argc, char **argv, AFPObj *obj)

Variables

char * forkname [] = { "data", "resource" }
static char forkbuf [8192]
static const struct archive_mode archive_modes []
static struct vol fallback_volume

Function Documentation

◆ arg_is_flag_option()

int arg_is_flag_option ( const char * arg)
static

◆ arg_is_option_with_value()

int arg_is_option_with_value ( const char * arg)
static

◆ close_metadata_volume()

void close_metadata_volume ( struct nad_volume * volume)
static

◆ created_file_path()

const char * created_file_path ( int module)
static

◆ from_close()

int from_close ( int un)
static

◆ from_open()

int from_open ( int un,
char * file,
struct FHeader * fh,
int flags )
static

◆ from_read()

ssize_t from_read ( int un,
int fork,
char * buf,
size_t len )
static

◆ mode_creates_volume_file()

int mode_creates_volume_file ( int module,
int flags )
static

◆ mode_reads_metadata()

int mode_reads_metadata ( int module)
static

◆ mode_writes_metadata()

int mode_writes_metadata ( int module)
static

◆ nad_archive()

int nad_archive ( int argc,
char ** argv,
AFPObj * obj )

◆ nad_archive_convert()

int nad_archive_convert ( char * path,
int module,
const char * newname,
int flags,
const struct nad_volume * volume )
static

◆ option_after_file()

int option_after_file ( const char * arg)
static

◆ parse_archive_mode()

int parse_archive_mode ( const char * name)
static

◆ print_header()

void print_header ( const struct FHeader * fh)
static

◆ print_header_date()

void print_header_date ( const char * label,
uint32_t ad_date,
int available )
static

◆ resolve_metadata_volume()

int resolve_metadata_volume ( AFPObj * obj,
int module,
const char * path,
int flags,
struct nad_volume * volume )
static

◆ set_fallback_volume()

void set_fallback_volume ( struct nad_volume * volume,
int flags )
static

◆ set_newname()

int set_newname ( char * newname,
size_t newname_len,
const char * name )
static

◆ to_close()

int to_close ( int to,
int keepflag )
static

◆ to_open()

int to_open ( int to,
char * file,
struct FHeader * fh,
int flags )
static

◆ to_write()

ssize_t to_write ( int to,
int fork,
size_t bufc )
static

◆ update_created_file_cnid()

int update_created_file_cnid ( const struct nad_volume * volume,
const char * path )
static

◆ usage_archive()

void usage_archive ( FILE * out)
static

◆ validate_volume_metadata()

int validate_volume_metadata ( const char * volpath,
const struct vol * vol )
static

Variable Documentation

◆ archive_modes

const struct archive_mode archive_modes[]
static
Initial value:
= {
{ "unhex", HEX2NAD },
{ "unbin", BIN2NAD },
{ "bin", NAD2BIN },
{ "hex", NAD2HEX },
}
#define HEX2NAD
Definition megatron.h:26
#define BIN2NAD
Definition megatron.h:27
#define NAD2BIN
Definition megatron.h:28
#define NAD2HEX
Definition megatron.h:29

◆ fallback_volume

struct vol fallback_volume
static

◆ forkbuf

char forkbuf[8192]
static

◆ forkname

char* forkname[] = { "data", "resource" }