Project

General

Profile

Download (1.15 KB) Statistics
| Branch: | Tag: | Revision:
7e8045d8 David Sorber
/**
* Copyright © 2019, Oracle and/or its affiliates. All rights reserved.
*
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl
*
*/
#ifndef INODEMAP_H
#define INODEMAP_H
/* Maintain a set of inodes */

#include <sys/stat.h>
#include <stdint.h>
#include <stdbool.h>

struct inodemap;

// An inodemap is a mapping from pairs (dev_t, ino_t) to values (which
// are void* pointers.)

struct inodemap *mk_inodemap(void);

struct inodemap *inodemap_destroy(struct inodemap *im,
void (*destroy_value_fun)(void*));
// Destroy all the

bool
inodemap_lookup(struct inodemap *im,
dev_t dev,
ino_t inode,
void const **value);
// Effect: If there's a value in the map for (dev,inode) then return
// true and set *value to that value. Else return false.

void
inodemap_insert(struct inodemap *im, dev_t dev, ino_t inode, void *value);
// Effect: Create a map from (dev,inode) to value.
//
// Requires: There was no map from (dev, inode) before.


uint64_t inodemap_hash(dev_t dev, ino_t inode);
// Compute and return a hash of dev and inode.

#endif