3#ifndef FSAUTOPROC_INDEX_H
4#define FSAUTOPROC_INDEX_H
22#define INDEXBUCKETS 4096
28#define INDEXBUCKETSMASK 0xFFF
Filesystem walk and stat functions.
int indexread(struct index_s *idx, FILE *s)
Reads a file stream and deserializes the contents into a map of individual file nodes.
Definition index.c:80
struct inode_s ** indexlist(const struct index_s *idx)
Flattens the index map into an unsorted array of nodes. The list is dynamically allocated and must be...
Definition index.c:136
int indexwrite(struct index_s *idx, FILE *s)
Flattens the index map into a sorted array of nodes (by filepath). The list is then written to the fi...
Definition index.c:59
#define INDEXBUCKETS
The fixed number of buckets in the index map.
Definition index.h:22
struct inode_s * indexput(struct index_s *idx, struct inode_s node)
Copies the node and inserts it into the index mapping. The copy is by assignment, so pointers within ...
Definition index.c:111
struct inode_s * indexfind(const struct index_s *idx, const char *fp)
Searches the index for a node with a matching filepath.
Definition index.c:38
void indexfree(struct index_s *idx)
Frees all nodes in the index map.
Definition index.c:132
Stat structure for storing the last modified time and file size.
Definition fs.h:33
Index map structure for storing file nodes.
Definition index.h:32
long size
Number of sum nodes in the index.
Definition index.h:34
struct inode_s * buckets[INDEXBUCKETS]
Array of index buckets.
Definition index.h:33
Individual file node in the index map.
Definition index.h:12
struct fsstat_s st
File stat info structure.
Definition index.h:14
struct inode_s * next
Next node in the index map.
Definition index.h:15
char * fp
File path (string duplicated)
Definition index.h:13