fsautoproc
Basic file transformation automation management utility
|
Differential file search implementation. More...
#include "deng.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "fs.h"
#include "index.h"
#include "log.h"
#include "sl.h"
Data Structures | |
struct | deng_state_s |
Search state context provided to the diff engine as user data which is passed to the file event hook functions. More... | |
Macros | |
#define | SL_IMPL |
#define | invokehook(mach, name, arg) |
Invokes a file event hook function if it is not NULL. | |
#define | notifyhook(mach, type) |
Invokes the notify hook function if it is not NULL. | |
Functions | |
static int | stagepre (const char *fp, void *udata) |
Processes a file before the command execution stage to ensure all files are indexed. This function may trigger new (NEW), modified (MOD), and unmodified (NOP) events for each file in the directory tree. | |
static int | stagepost (const char *fp, void *udata) |
Processes a file after the command execution stage to ensure all files are indexed. This function may trigger new (NEW) and modified (MOD) events for each file in the directory tree. | |
static int | dqpush (const char *fp, void *udata) |
Pushes a directory path onto the directory queue for processing. | |
static int | execstage (struct deng_state_s *mach, const char *sd, fswalkfn_t filefn) |
Resets the directory queue to the initial search path, and invokes the filefn function for each file in the directory tree, recursively. | |
static int | checkremoved (struct deng_state_s *mach) |
Compares the current file system state with a previous index to determine which files were removed. This function may trigger deleted (DEL) events for each file in the previous index that is not present in the current index. | |
int | dengsearch (const char *sd, deng_filter_t filter, const struct deng_hooks_s *hooks, const struct index_s *old, struct index_s *new) |
Recursively scans directory sd and compares the file system state with a previously saved index. Any new, modified, deleted, or unmodified files are reported to the caller via the provided hooks structure, hooks . The index state new is then updated with the current file system state. | |
Differential file search implementation.
#define invokehook | ( | mach, | |
name, | |||
arg ) |
Invokes a file event hook function if it is not NULL.
mach | The diff engine state context |
name | The member of the hook function to invoke |
arg | The argument to pass to the hook function |
#define notifyhook | ( | mach, | |
type ) |
Invokes the notify hook function if it is not NULL.
mach | The diff engine state context |
type | The notification type to pass to the hook |
#define SL_IMPL |
|
static |
Compares the current file system state with a previous index to determine which files were removed. This function may trigger deleted (DEL) events for each file in the previous index that is not present in the current index.
int dengsearch | ( | const char * | sd, |
deng_filter_t | filter, | ||
const struct deng_hooks_s * | hooks, | ||
const struct index_s * | old, | ||
struct index_s * | new ) |
Recursively scans directory sd
and compares the file system state with a previously saved index. Any new, modified, deleted, or unmodified files are reported to the caller via the provided hooks structure, hooks
. The index state new
is then updated with the current file system state.
sd | The directory to scan for conditionally ignoring files |
filter | The file filter function |
hooks | The file event hook functions |
old | The previous index state |
new | The current index state |
|
static |
Pushes a directory path onto the directory queue for processing.
fp | The directory path to push |
udata | The diff engine state context |
|
static |
Resets the directory queue to the initial search path, and invokes the filefn
function for each file in the directory tree, recursively.
mach | The diff engine state context |
sd | The initial search directory path |
filefn | The function to invoke for each file in the directory tree |
|
static |
Processes a file after the command execution stage to ensure all files are indexed. This function may trigger new (NEW) and modified (MOD) events for each file in the directory tree.
fp | The file path to process |
udata | The diff engine state context |
|
static |
Processes a file before the command execution stage to ensure all files are indexed. This function may trigger new (NEW), modified (MOD), and unmodified (NOP) events for each file in the directory tree.
fp | The file path to process |
udata | The diff engine state context |