Subject: afs/include/linux cachefs.h,1.9,1.10

From: [email-masked]
Date: Thu, 24 Apr 2003 13:02:36 +0100

Update of /home/cvs/afs/include/linux
In directory phoenix.infradead.org:/tmp/cvs-serv29171/include/linux

Modified Files:
	cachefs.h 
Log Message:
advanced the netfs API some more
implemented the journalling sync function
now clear ptr2ptr targets for returning things in func prologue
added a missing pointer clearance

Index: cachefs.h
===================================================================
RCS file: /home/cvs/afs/include/linux/cachefs.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- cachefs.h	17 Apr 2003 11:59:03 -0000	1.9
+++ cachefs.h	24 Apr 2003 12:02:33 -0000	1.10
@@ -16,9 +16,9 @@
 #include <linux/list.h>
 #include <linux/pagemap.h>
 
+struct cachefs_cookie;
 struct cachefs_netfs;
 struct cachefs_netfs_operations;
-struct cachefs_object;
 struct cachefs_page;
 
 typedef enum {
@@ -54,55 +54,41 @@
 #define CACHEFS_INDEX_KEYS_IPV6ADDR	4
 
 	/* see if entry matches the specified key
-	 * - container_of(target,...) should be used to find the key data
+	 * - the netfs data from the cookie being used as the target is presented
 	 * - entries that aren't in use will not be presented for matching
 	 */
-	cachefs_match_val_t (*match)(struct cachefs_object *target, const void *entry);
+	cachefs_match_val_t (*match)(void *target_netfs_data, const void *entry);
 
-	/* update entry from key 
-	 * - container_of(source,...) should be used to find the key data
+	/* update entry from key
+	 * - the netfs data from the cookie being used as the source is presented
 	 */
-	void (*update)(struct cachefs_object *source, void *entry);
+	void (*update)(void *source_netfs_data, void *entry);
 };
 
-/*****************************************************************************/
-/*
- * data file or index object
- * - before registration:
- *   - iparent must be filled
- *   - def must be filled in for an index and set to NULL for a file
- * - a file will only appear in one cache
- * - a request to cache a file may or may not be honoured, subject to constraints such as disc
- *   space
- * - indexes files are created on disc just-in-time
- */
-struct cachefs_object
-{
-	struct cachefs_index_def	*idef;		/* index definition */
-	struct cachefs_object		*iparent;	/* index holding this entry */
-	struct list_head		active_inodes;	/* inode(s) backing this file/index */
-	struct rw_semaphore		sem;
-};
+extern void cachefs_acquire_cookie(struct cachefs_cookie *iparent,
+				   struct cachefs_index_def *idef,
+				   void *netfs_data,
+				   struct cachefs_cookie **_cookie);
 
-extern int cachefs_register_object(struct cachefs_object *object);
-extern void cachefs_unregister_object(struct cachefs_object *object, int retire);
+extern void cachefs_relinquish_cookie(struct cachefs_cookie *cookie, int retire);
 
 /*****************************************************************************/
 /*
  * cachefs cached network filesystem type
- * - name, version, ops and primary_index.def must be filled in before registration
+ * - name, version and ops must be filled in before registration
  * - all other fields will be set during registration
  */
 struct cachefs_netfs
 {
 	const char			*name;		/* filesystem def name */
 	unsigned			version;	/* index layout version */
-	struct cachefs_object		primary_index;	/* primary index */
+	struct cachefs_cookie		*primary_index;	/* primary index */
 	struct cachefs_netfs_operations	*ops;		/* operations table */
 	struct list_head		link;		/* internal cachefs list link */
 };
 
-extern int cachefs_register_netfs(struct cachefs_netfs *netfs);
+extern int cachefs_register_netfs(struct cachefs_netfs *netfs,
+				  struct cachefs_index_def *primary_idef);
 extern void cachefs_unregister_netfs(struct cachefs_netfs *netfs);
 
 struct cachefs_netfs_operations
@@ -115,7 +101,7 @@
 	int (*get_page_cookie)(struct page *page, struct cachefs_page **_cookie);
 
 	/* handle journal replaying indicating writeback needed */
-	int (*replay)(struct cachefs_object *object, unsigned page_number);
+	int (*replay)(struct cachefs_cookie *cookie, unsigned page_number);
 	
 };