cell.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* AFS cell record
  2. *
  3. * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the License, or (at your option) any later version.
  10. */
  11. #ifndef AFS_CELL_H
  12. #define AFS_CELL_H
  13. #include "types.h"
  14. #include "cache.h"
  15. #define AFS_CELL_MAX_ADDRS 15
  16. extern volatile int afs_cells_being_purged; /* T when cells are being purged by rmmod */
  17. /*
  18. * entry in the cached cell catalogue
  19. */
  20. struct afs_cache_cell {
  21. char name[64]; /* cell name (padded with NULs) */
  22. struct in_addr vl_servers[15]; /* cached cell VL servers */
  23. };
  24. /*
  25. * AFS cell record
  26. */
  27. struct afs_cell {
  28. atomic_t usage;
  29. struct list_head link; /* main cell list link */
  30. struct list_head proc_link; /* /proc cell list link */
  31. struct proc_dir_entry *proc_dir; /* /proc dir for this cell */
  32. #ifdef AFS_CACHING_SUPPORT
  33. struct cachefs_cookie *cache; /* caching cookie */
  34. #endif
  35. /* server record management */
  36. rwlock_t sv_lock; /* active server list lock */
  37. struct list_head sv_list; /* active server list */
  38. struct list_head sv_graveyard; /* inactive server list */
  39. spinlock_t sv_gylock; /* inactive server list lock */
  40. /* volume location record management */
  41. struct rw_semaphore vl_sem; /* volume management serialisation semaphore */
  42. struct list_head vl_list; /* cell's active VL record list */
  43. struct list_head vl_graveyard; /* cell's inactive VL record list */
  44. spinlock_t vl_gylock; /* graveyard lock */
  45. unsigned short vl_naddrs; /* number of VL servers in addr list */
  46. unsigned short vl_curr_svix; /* current server index */
  47. struct in_addr vl_addrs[AFS_CELL_MAX_ADDRS]; /* cell VL server addresses */
  48. char name[0]; /* cell name - must go last */
  49. };
  50. extern int afs_cell_init(char *);
  51. extern int afs_cell_create(const char *, char *, struct afs_cell **);
  52. extern int afs_cell_lookup(const char *, unsigned, struct afs_cell **);
  53. #define afs_get_cell(C) do { atomic_inc(&(C)->usage); } while(0)
  54. extern struct afs_cell *afs_get_cell_maybe(struct afs_cell **);
  55. extern void afs_put_cell(struct afs_cell *);
  56. extern void afs_cell_purge(void);
  57. #endif /* AFS_CELL_H */