Staticise some symbols - dedup - deduplicating backup program
 (HTM) git clone git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Tags
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 656a07658e6e3f1d23926afc7fbecad27e82b012
 (DIR) parent 2785164f532c7f95d2468bef65ee309336e4bc93
 (HTM) Author: sin <sin@2f30.org>
       Date:   Thu, 21 Feb 2019 21:07:50 +0000
       
       Staticise some symbols
       
       Diffstat:
         M dedup.c                             |      88 ++++++++++++++++----------------
       
       1 file changed, 44 insertions(+), 44 deletions(-)
       ---
 (DIR) diff --git a/dedup.c b/dedup.c
       @@ -73,24 +73,24 @@ struct extract_args {
                int fd;
        };
        
       -RB_HEAD(cache, cache_entry) cache_head;
       -struct snapshot_hdr snaphdr;
       -int ifd;
       -int sfd;
       -int cfd;
       -int verbose;
       -int cache_dirty;
       -unsigned long long cache_hits;
       -unsigned long long cache_misses;
       +static RB_HEAD(cache, cache_entry) cache_head;
       +static struct snapshot_hdr snaphdr;
       +static int ifd;
       +static int sfd;
       +static int cfd;
       +static int verbose;
       +static int cache_dirty;
       +static unsigned long long cache_hits;
       +static unsigned long long cache_misses;
        char *argv0;
        
       -size_t
       +static size_t
        comp_size(size_t size)
        {
                return LZ4_compressBound(size);
        }
        
       -size_t
       +static size_t
        comp(uint8_t *in, uint8_t *out, size_t insize, size_t outsize)
        {
                int ret;
       @@ -101,7 +101,7 @@ comp(uint8_t *in, uint8_t *out, size_t insize, size_t outsize)
                return ret;
        }
        
       -size_t
       +static size_t
        decomp(uint8_t *in, uint8_t *out, size_t insize, size_t outsize)
        {
                int ret;
       @@ -112,7 +112,7 @@ decomp(uint8_t *in, uint8_t *out, size_t insize, size_t outsize)
                return ret;
        }
        
       -void
       +static void
        print_md(FILE *fp, uint8_t *md, size_t size)
        {
                size_t i;
       @@ -121,7 +121,7 @@ print_md(FILE *fp, uint8_t *md, size_t size)
                        fprintf(fp, "%02x", md[i]);
        }
        
       -void
       +static void
        print_stats(struct stats *st)
        {
                if (st->nr_blks == 0)
       @@ -143,7 +143,7 @@ print_stats(struct stats *st)
                fprintf(stderr, "cache misses: %llu\n", cache_misses);
        }
        
       -int
       +static int
        cache_entry_cmp(struct cache_entry *e1, struct cache_entry *e2)
        {
                int r;
       @@ -155,10 +155,10 @@ cache_entry_cmp(struct cache_entry *e1, struct cache_entry *e2)
                        return -1;
                return 0;
        }
       -RB_PROTOTYPE(cache, cache_entry, e, cache_entry_cmp);
       -RB_GENERATE(cache, cache_entry, e, cache_entry_cmp);
       +static RB_PROTOTYPE(cache, cache_entry, e, cache_entry_cmp);
       +static RB_GENERATE(cache, cache_entry, e, cache_entry_cmp);
        
       -struct cache_entry *
       +static struct cache_entry *
        alloc_cache_entry(void)
        {
                struct cache_entry *ent;
       @@ -169,19 +169,19 @@ alloc_cache_entry(void)
                return ent;
        }
        
       -void
       +static void
        free_cache_entry(struct cache_entry *ent)
        {
                free(ent);
        }
        
       -void
       +static void
        add_cache_entry(struct cache_entry *ent)
        {
                RB_INSERT(cache, &cache_head, ent);
        }
        
       -void
       +static void
        flush_cache(void)
        {
                struct cache_entry *ent;
       @@ -194,7 +194,7 @@ flush_cache(void)
                        xwrite(cfd, &ent->blk_desc, sizeof(ent->blk_desc));
        }
        
       -void
       +static void
        free_cache(void)
        {
                struct cache_entry *ent, *tmp;
       @@ -205,7 +205,7 @@ free_cache(void)
                }
        }
        
       -uint64_t
       +static uint64_t
        cache_nr_entries(void)
        {
                struct stat sb;
       @@ -215,7 +215,7 @@ cache_nr_entries(void)
                return sb.st_size / sizeof(struct blk_desc);
        }
        
       -void
       +static void
        append_snap(struct snapshot *snap)
        {
                /* Update snapshot header */
       @@ -230,7 +230,7 @@ append_snap(struct snapshot *snap)
                xwrite(ifd, snap, snap->size);
        }
        
       -struct snapshot *
       +static struct snapshot *
        alloc_snap(void)
        {
                struct snapshot *snap;
       @@ -241,13 +241,13 @@ alloc_snap(void)
                return snap;
        }
        
       -void
       +static void
        free_snap(struct snapshot *snap)
        {
                free(snap);
        }
        
       -struct snapshot *
       +static struct snapshot *
        grow_snap(struct snapshot *snap, uint64_t nr_blk_descs)
        {
                size_t size;
       @@ -260,7 +260,7 @@ grow_snap(struct snapshot *snap, uint64_t nr_blk_descs)
                return snap;
        }
        
       -uint8_t *
       +static uint8_t *
        alloc_buf(size_t size)
        {
                void *p;
       @@ -271,13 +271,13 @@ alloc_buf(size_t size)
                return p;
        }
        
       -void
       +static void
        free_buf(uint8_t *buf)
        {
                free(buf);
        }
        
       -void
       +static void
        hash_blk(uint8_t *buf, size_t size, uint8_t *md)
        {
                SHA256_CTX ctx;
       @@ -287,7 +287,7 @@ hash_blk(uint8_t *buf, size_t size, uint8_t *md)
                SHA256_Final(md, &ctx);
        }
        
       -void
       +static void
        read_blk(uint8_t *buf, struct blk_desc *blk_desc)
        {
                xlseek(sfd, blk_desc->offset, SEEK_SET);
       @@ -295,7 +295,7 @@ read_blk(uint8_t *buf, struct blk_desc *blk_desc)
                        errx(1, "read: unexpected EOF");
        }
        
       -void
       +static void
        append_blk(uint8_t *buf, struct blk_desc *blk_desc)
        {
                xlseek(sfd, snaphdr.store_size, SEEK_SET);
       @@ -303,7 +303,7 @@ append_blk(uint8_t *buf, struct blk_desc *blk_desc)
                snaphdr.store_size += blk_desc->size;
        }
        
       -int
       +static int
        lookup_blk_desc(uint8_t *md, struct blk_desc *blk_desc)
        {
                struct cache_entry *ent, key;
       @@ -317,7 +317,7 @@ lookup_blk_desc(uint8_t *md, struct blk_desc *blk_desc)
                return -1;
        }
        
       -void
       +static void
        dedup_chunk(struct snapshot *snap, uint8_t *chunkp, size_t chunk_size)
        {
                uint8_t md[MDSIZE];
       @@ -365,7 +365,7 @@ dedup_chunk(struct snapshot *snap, uint8_t *chunkp, size_t chunk_size)
                free(comp_buf);
        }
        
       -void
       +static void
        dedup(int fd, char *msg)
        {
                struct snapshot *snap;
       @@ -407,7 +407,7 @@ dedup(int fd, char *msg)
                free_snap(snap);
        }
        
       -int
       +static int
        extract(struct snapshot *snap, void *arg)
        {
                uint8_t *buf[2];
       @@ -431,7 +431,7 @@ extract(struct snapshot *snap, void *arg)
                return WALK_STOP;
        }
        
       -int
       +static int
        check(struct snapshot *snap, void *arg)
        {
                uint8_t md[MDSIZE];
       @@ -471,7 +471,7 @@ check(struct snapshot *snap, void *arg)
                return WALK_CONTINUE;
        }
        
       -int
       +static int
        list(struct snapshot *snap, void *arg)
        {
                print_md(stdout, snap->md, sizeof(snap->md));
       @@ -482,7 +482,7 @@ list(struct snapshot *snap, void *arg)
                return WALK_CONTINUE;
        }
        
       -int
       +static int
        rebuild_cache(struct snapshot *snap, void *arg)
        {
                uint8_t md[MDSIZE];
       @@ -511,7 +511,7 @@ rebuild_cache(struct snapshot *snap, void *arg)
        }
        
        /* Walk through all snapshots and call fn() on each one */
       -void
       +static void
        walk(int (*fn)(struct snapshot *, void *), void *arg)
        {
                uint64_t i;
       @@ -537,7 +537,7 @@ walk(int (*fn)(struct snapshot *, void *), void *arg)
                }
        }
        
       -void
       +static void
        init_cache(void)
        {
                uint64_t i;
       @@ -553,7 +553,7 @@ init_cache(void)
                }
        }
        
       -void
       +static void
        init(void)
        {
                struct stat sb;
       @@ -599,7 +599,7 @@ init(void)
                        walk(rebuild_cache, NULL);
        }
        
       -void
       +static void
        term(void)
        {
                if (verbose)
       @@ -616,7 +616,7 @@ term(void)
                close(cfd);
        }
        
       -void
       +static void
        usage(void)
        {
                fprintf(stderr, "usage: %s [-clv] [-e id] [-r root] [-m message] [file]\n", argv0);