fscache: Implement cache registration
[sfrench/cifs-2.6.git] / include / linux / fscache-cache.h
index d6910a913918f33102024ddfb5e1038ad5b18dab..18cd5c9877bbf64225f8e5008dd2ac98ecc86587 100644 (file)
 
 #include <linux/fscache.h>
 
+enum fscache_cache_trace;
+enum fscache_access_trace;
+
+enum fscache_cache_state {
+       FSCACHE_CACHE_IS_NOT_PRESENT,   /* No cache is present for this name */
+       FSCACHE_CACHE_IS_PREPARING,     /* A cache is preparing to come live */
+       FSCACHE_CACHE_IS_ACTIVE,        /* Attached cache is active and can be used */
+       FSCACHE_CACHE_GOT_IOERROR,      /* Attached cache stopped on I/O error */
+       FSCACHE_CACHE_IS_WITHDRAWN,     /* Attached cache is being withdrawn */
+#define NR__FSCACHE_CACHE_STATE (FSCACHE_CACHE_IS_WITHDRAWN + 1)
+};
+
+/*
+ * Cache cookie.
+ */
+struct fscache_cache {
+       struct list_head        cache_link;     /* Link in cache list */
+       void                    *cache_priv;    /* Private cache data (or NULL) */
+       refcount_t              ref;
+       atomic_t                n_volumes;      /* Number of active volumes; */
+       atomic_t                n_accesses;     /* Number of in-progress accesses on the cache */
+       atomic_t                object_count;   /* no. of live objects in this cache */
+       unsigned int            debug_id;
+       enum fscache_cache_state state;
+       char                    *name;
+};
+
 extern struct workqueue_struct *fscache_wq;
 
+/*
+ * out-of-line cache backend functions
+ */
+extern struct rw_semaphore fscache_addremove_sem;
+extern struct fscache_cache *fscache_acquire_cache(const char *name);
+extern void fscache_relinquish_cache(struct fscache_cache *cache);
+
 #endif /* _LINUX_FSCACHE_CACHE_H */