284bf8f8bc
Feature changes across 15 files: - -a/--archive: enables -c -m -M (no -s, which slows transfers) - -n/--dry-run: scan + print without connecting or transferring - -p <port>: custom SSH port (passed as -p to ssh via execvp) - --exclude <pattern>: glob-based filename filtering in scanner - --delete: sender collects file manifest; receiver deletes unlisted files Protocol: added STATUS_MANIFEST, use_delete field in Config wire format. New utilities: glob_match(), delete_extras() with recursive directory walk. Scanner: accepts exclude patterns; skips matching entries. SSH transport: switched from execlp to execvp for dynamic port arg. Server + multiprocessing: handle STATUS_MANIFEST in both single and multithreaded receive paths. Builds clean, all 7 tests pass.
47 lines
1.4 KiB
C
47 lines
1.4 KiB
C
#ifndef MULTIPROCESSING_H
|
|
#define MULTIPROCESSING_H
|
|
|
|
#include <threads.h>
|
|
|
|
#include "array_list.h"
|
|
#include "config.h"
|
|
#include "file.h"
|
|
#include "queue.h"
|
|
|
|
typedef struct {
|
|
Config *config;
|
|
Queue *queue_scanner;
|
|
mtx_t mutex_scanner;
|
|
cnd_t condition_not_full_scanner;
|
|
cnd_t condition_not_empty_scanner;
|
|
bool scanner_done;
|
|
Queue *queue_loader;
|
|
mtx_t mutex_loader;
|
|
cnd_t condition_not_full_loader;
|
|
cnd_t condition_not_empty_loader;
|
|
bool loader_done;
|
|
ArrayList *manifest;
|
|
} PipelineContextSender;
|
|
|
|
typedef struct PipelineContextReceiver {
|
|
Queue *queue;
|
|
Config *config;
|
|
int file_descriptor;
|
|
mtx_t mutex;
|
|
cnd_t condition_not_full;
|
|
cnd_t condition_not_empty;
|
|
bool receiver_done;
|
|
} PipelineContextReceiver;
|
|
|
|
PipelineContextSender *pipeline_context_sender_create(Config *config,
|
|
Queue *queue_scanner,
|
|
Queue *queue_loader);
|
|
void pipeline_context_sender_destroy(PipelineContextSender *context);
|
|
PipelineContextReceiver *pipeline_context_receiver_create(Config *config,
|
|
Queue *queue_receiver,
|
|
int file_descriptor);
|
|
void pipeline_context_receiver_destroy(PipelineContextReceiver *context);
|
|
int receive_thread(void *pipeline_context);
|
|
int write_thread(void *pipeline_context);
|
|
#endif
|