2979f435d8
- receive_chunk_data(fd, config) -> Chunk*: shared receive/decompress/deserialize (eliminates ~25 lines of duplication between server.c and multiprocessing.c) - receive_manifest(fd, config, next_status): moved from server.c to file.c, fixes missing 'Deleting files not in manifest...' log in multiprocessing.c - Removes redundant manual free loop in multiprocessing.c manifest handling (array_list_create(free) destructor already handles this) - server.c and multiprocessing.c: remove local chunk/manifest helpers, remove compression.h include (no longer needed)
40 lines
1.2 KiB
C
40 lines
1.2 KiB
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);
|
|
bool file_load_data(File *file);
|
|
File *file_receive(Config *config, int file_descriptor);
|
|
bool file_send_single_calls(File *file, int file_descriptor, bool use_metadata, int compression_level);
|
|
bool file_send_single_calls_no_path(File *file, int file_descriptor, bool use_metadata, int compression_level);
|
|
bool file_send_sendfile(File *file, int file_descriptor, bool use_metadata);
|
|
bool file_send_sendfile_no_path(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);
|
|
bool to_disk(const char *path, const void *data, unsigned long long data_size);
|
|
bool file_save_to_disk(const char *root_directory, File *file);
|
|
File *receive_incremental_check(int fd, Config *config, bool *skipped);
|
|
int receive_manifest(int fd, Config *config, int *next_status);
|
|
|
|
#endif
|