diff options
| author | Charles.Forsyth <devnull@localhost> | 2006-12-22 17:07:39 +0000 |
|---|---|---|
| committer | Charles.Forsyth <devnull@localhost> | 2006-12-22 17:07:39 +0000 |
| commit | 37da2899f40661e3e9631e497da8dc59b971cbd0 (patch) | |
| tree | cbc6d4680e347d906f5fa7fca73214418741df72 /liblogfs/path.c | |
| parent | 54bc8ff236ac10b3eaa928fd6bcfc0cdb2ba46ae (diff) | |
20060303a
Diffstat (limited to 'liblogfs/path.c')
| -rw-r--r-- | liblogfs/path.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/liblogfs/path.c b/liblogfs/path.c new file mode 100644 index 00000000..81379e12 --- /dev/null +++ b/liblogfs/path.c @@ -0,0 +1,48 @@ +#include "lib9.h" +#include "logfs.h" +#include "local.h" + +enum { + PATHMOD = 127 +}; + +static int +compare(Path *f, ulong path) +{ + return f->path == path; +} + +static int +allocsize(void *key) +{ + USED(key); + return sizeof(Path); +} + +char * +logfspathmapnew(PathMap **pathmapp) +{ + return logfsmapnew(PATHMOD, logfshashulong, (int (*)(void *, void *))compare, allocsize, nil, pathmapp); +} + +char * +logfspathmapnewentry(PathMap *m, ulong path, Entry *e, Path **pathmapp) +{ + char *errmsg; + errmsg = logfsmapnewentry(m, (void *)path, pathmapp); + if(errmsg) + return errmsg; + if(*pathmapp == nil) + return nil; + (*pathmapp)->path = path; + (*pathmapp)->entry = e; + return nil; +} + +Entry * +logfspathmapfinde(PathMap *m, ulong path) +{ + Path *p; + p = logfspathmapfindentry(m, path); + return p ? p->entry : nil; +} |
