[Pvfs2-cvs] commit by nlmills in pvfs2/src/client/sysint: capcache.c

CVS commit program cvs at parl.clemson.edu
Thu Jul 10 14:54:48 EDT 2008


Update of /anoncvs/pvfs2/src/client/sysint
In directory parlweb1:/tmp/cvs-serv20722/src/client/sysint

Modified Files:
      Tag: cu-security-branch
	capcache.c 
Log Message:
finished capcache insert function


Index: capcache.c
===================================================================
RCS file: /anoncvs/pvfs2/src/client/sysint/Attic/capcache.c,v
diff -p -u -r1.1.2.2 -r1.1.2.3
--- capcache.c	9 Jul 2008 18:53:37 -0000	1.1.2.2
+++ capcache.c	10 Jul 2008 18:54:48 -0000	1.1.2.3
@@ -171,8 +171,9 @@ int PINT_capcache_insert(PVFS_object_ref
 {
     int ret = -PVFS_EINVAL;
     struct capcache_payload *payload;
+    struct timeval expiration;
     struct PINT_tcache_entry *entry;
-    int status;
+    int tmp;
 
     payload = (struct capcache_payload*)malloc(
                                               sizeof(struct capcache_payload));
@@ -191,14 +192,29 @@ int PINT_capcache_insert(PVFS_object_ref
         return -PVFS_ENOMEM;
     }
 
+    /* TODO: find a better way to convert */
+    expiration.tv_sec = capability->timeout;
+    expiration.tv_usec = 0;
+
     gen_mutex_lock(&capcache_mutex);
 
-    /* TODO: check for old entry and replace */
-    /* TODO: insert new entry */
+    ret = PINT_tcache_lookup(capcache, objref, &entry, &tmp);
+    if (!ret)
+    {
+        PINT_tcache_delete(capcache, entry);
+    }
+
+    ret = PINT_tcache_insert_entry_ex(capcache, objref, payload, 
+                                      &expiration, &tmp);
 
     gen_mutex_unlock(&capcache_mutex);
 
-    return 0;
+    if (ret < 0)
+    {
+        free_payload(payload);
+    }
+
+    return ret;
 }
 
 static int compare_key_entry(void *key, struct qhash_head *link)



More information about the Pvfs2-cvs mailing list