]> git.sur5r.net Git - openldap/blob - servers/slapd/back-ldbm/entry.c
ITS#2368 - fix deleting key from range IDL
[openldap] / servers / slapd / back-ldbm / entry.c
1 /* entry.c - ldbm backend entry_release routine */
2 /* $OpenLDAP$ */
3 /*
4  * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
5  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
6  */
7
8 #include "portable.h"
9
10 #include <stdio.h>
11
12 #include <ac/socket.h>
13 #include <ac/string.h>
14
15 #include "slap.h"
16 #include "back-ldbm.h"
17 #include "proto-back-ldbm.h"
18
19
20 int
21 ldbm_back_entry_release_rw(
22         Backend *be,
23         Connection *conn,
24         Operation *op,
25         Entry   *e,
26         int     rw
27 )
28 {
29         struct ldbminfo *li = (struct ldbminfo *) be->be_private;
30
31         if ( slapMode == SLAP_SERVER_MODE ) {
32                 /* free entry and reader or writer lock */
33                 cache_return_entry_rw( &li->li_cache, e, rw ); 
34                 if( rw ) {
35                         ldap_pvt_thread_rdwr_wunlock( &li->li_giant_rwlock );
36                 } else {
37                         ldap_pvt_thread_rdwr_runlock( &li->li_giant_rwlock );
38                 }
39
40         } else {
41                 entry_free( e );
42         }
43
44         return 0;
45 }