d36768792a
- Merge io.h/c back into protocol.h/c - Change send_data to take Data* argument - Remove redundant file_load_data from send_chunk - Move compression into file_send_single_calls - Move file_receive from multiprocessing.c to file.c
35 lines
877 B
C
35 lines
877 B
C
#ifndef FILE_H
|
|
#define FILE_H
|
|
|
|
#include "config.h"
|
|
#include "data.h"
|
|
#include <stdbool.h>
|
|
#include <sys/stat.h>
|
|
|
|
typedef struct {
|
|
mode_t mode;
|
|
uid_t uid;
|
|
gid_t gid;
|
|
time_t mtime_sec;
|
|
long mtime_nsec;
|
|
} FileMetadata;
|
|
|
|
typedef struct {
|
|
char *path;
|
|
Data *data;
|
|
FileMetadata *metadata;
|
|
} File;
|
|
|
|
File *file_create(const char *path);
|
|
void file_destroy(void *item);
|
|
void file_load_data(File *file);
|
|
File *file_receive(Config *config, int file_descriptor);
|
|
void file_send_single_calls(File *file, int file_descriptor, bool use_metadata, int compression_level);
|
|
void file_send_sendfile(File *file, int file_descriptor, bool use_metadata);
|
|
size_t file_content_to_buffer(File *file);
|
|
FileMetadata *file_metadata_create(struct stat *stats);
|
|
void file_metadata_destroy(void *metadata);
|
|
void to_disk(const char *path, const void *data, unsigned long long data_size);
|
|
|
|
#endif
|