cell.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* cell.h: 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 _LINUX_AFS_CELL_H
  12. #define _LINUX_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. /*
  19. * entry in the cached cell catalogue
  20. */
  21. struct afs_cache_cell
  22. {
  23. char name[64]; /* cell name (padded with NULs) */
  24. struct in_addr vl_servers[15]; /* cached cell VL servers */
  25. };
  26. /*****************************************************************************/
  27. /*
  28. * AFS cell record
  29. */
  30. struct afs_cell
  31. {
  32. atomic_t usage;
  33. struct list_head link; /* main cell list link */
  34. struct list_head proc_link; /* /proc cell list link */
  35. struct proc_dir_entry *proc_dir; /* /proc dir for this cell */
  36. #ifdef AFS_CACHING_SUPPORT
  37. struct cachefs_cookie *cache; /* caching cookie */
  38. #endif
  39. /* server record management */
  40. rwlock_t sv_lock; /* active server list lock */
  41. struct list_head sv_list; /* active server list */
  42. struct list_head sv_graveyard; /* inactive server list */
  43. spinlock_t sv_gylock; /* inactive server list lock */
  44. /* volume location record management */
  45. struct rw_semaphore vl_sem; /* volume management serialisation semaphore */
  46. struct list_head vl_list; /* cell's active VL record list */
  47. struct list_head vl_graveyard; /* cell's inactive VL record list */
  48. spinlock_t vl_gylock; /* graveyard lock */
  49. unsigned short vl_naddrs; /* number of VL servers in addr list */
  50. unsigned short vl_curr_svix; /* current server index */
  51. struct in_addr vl_addrs[AFS_CELL_MAX_ADDRS]; /* cell VL server addresses */
  52. char name[0]; /* cell name - must go last */
  53. };
  54. extern int afs_cell_init(char *rootcell);
  55. extern int afs_cell_create(const char *name, char *vllist, struct afs_cell **_cell);
  56. extern int afs_cell_lookup(const char *name, unsigned nmsize, struct afs_cell **_cell);
  57. #define afs_get_cell(C) do { atomic_inc(&(C)->usage); } while(0)
  58. extern struct afs_cell *afs_get_cell_maybe(struct afs_cell **_cell);
  59. extern void afs_put_cell(struct afs_cell *cell);
  60. extern void afs_cell_purge(void);
  61. #endif /* _LINUX_AFS_CELL_H */