ndbhf.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. /* a hash file */
  10. struct Ndbhf
  11. {
  12. Ndbhf *next;
  13. int fd;
  14. uint32_t dbmtime; /* mtime of data base */
  15. int hlen; /* length (in entries) of hash table */
  16. char attr[Ndbalen]; /* attribute hashed */
  17. unsigned char buf[256]; /* hash file buffer */
  18. long off; /* offset of first byte of buffer */
  19. int len; /* length of valid data in buffer */
  20. };
  21. char* _ndbparsetuple(char*, Ndbtuple**);
  22. Ndbtuple* _ndbparseline(char*);
  23. #define ISWHITE(x) ((x) == ' ' || (x) == '\t' || (x) == '\r')
  24. #define EATWHITE(x) while(ISWHITE(*(x)))(x)++
  25. extern Ndbtuple *_ndbtfree;
  26. /* caches */
  27. void _ndbcacheflush(Ndb *db);
  28. int _ndbcachesearch(Ndb *db, Ndbs *s, char *attr, char *val, Ndbtuple **t);
  29. Ndbtuple* _ndbcacheadd(Ndb *db, Ndbs *s, char *attr, char *val, Ndbtuple *t);