fsautoproc
Basic file transformation automation management utility
Loading...
Searching...
No Matches
xx.c File Reference

xxHash64 file hashing function implementation. More...

#include "xx.h"
#include <assert.h>
#include <stdio.h>
#include "xxHash/xxhash.h"
#include "fs.h"
Include dependency graph for xx.c:

Functions

static uint64_t xxhash (uint8_t *b, FILE *f)
 Computes the xxHash64 hash of the data read from the given file using a buffer for reading. The file is read in chunks until EOF.
 
static uint64_t xxhashfp (uint8_t *b, const char *fp)
 Computes the xxHash64 hash of the file located at the given filepath. The file is opened, read in chunks until EOF, and then closed.
 
uint64_t xxupdate (const struct xxreq_s *req)
 Processes a file hash request. If the file's last modified time or size differ from the previous stat info pst, the file is re-hashed and the current hash value is returned. Otherwise the previous pxx hash value is returned indicating no change.
 

Detailed Description

xxHash64 file hashing function implementation.

Function Documentation

◆ xxhash()

static uint64_t xxhash ( uint8_t *  b,
FILE *  f 
)
static

Computes the xxHash64 hash of the data read from the given file using a buffer for reading. The file is read in chunks until EOF.

Parameters
bBuffer for reading file data. Must not be NULL.
fFILE object to read data from. Must not be NULL. The file should be opened in binary mode and positioned at the start of the data.
Returns
Hash value of the file data, or 0 if an error occurred.
Here is the caller graph for this function:

◆ xxhashfp()

static uint64_t xxhashfp ( uint8_t *  b,
const char *  fp 
)
static

Computes the xxHash64 hash of the file located at the given filepath. The file is opened, read in chunks until EOF, and then closed.

Parameters
bBuffer for reading file data. Must not be NULL.
fpThe filepath of the file to hash. Must not be NULL.
Returns
The hash value of the file, or 0 if an error occurred (e.g. file could not be opened).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xxupdate()

uint64_t xxupdate ( const struct xxreq_s req)

Processes a file hash request. If the file's last modified time or size differ from the previous stat info pst, the file is re-hashed and the current hash value is returned. Otherwise the previous pxx hash value is returned indicating no change.

Parameters
reqThe file hash request structure containing the filepath, previous and current stat info, and previous hash value (if known).
Returns
0 if an error occurred, otherwise the current hash value.
Here is the call graph for this function:
Here is the caller graph for this function: