}
}
- /* don't care if we can't open the newly renamed ressource fork
- */
+ /* don't care if we can't open the newly renamed ressource fork */
if (ad_open(adp, dst, ADFLAGS_HF, O_RDWR) == 0) {
ad_setname(adp, newname);
ad_flush( adp );
u_int16_t bshort;
ad_getattr(adp, &bshort);
+
ad_close_metadata( adp);
if ((bshort & htons(ATTRBIT_NORENAME))) {
rc = AFPERR_OLOCK;
#include <netatalk/endian.h>
#include <atalk/bstrlib.h>
+#include <atalk/locking.h>
/* version info */
#define AD_VERSION2 0x00020000
#include <sys/types.h>
#include <inttypes.h>
-#include <atalk/adouble.h>
#include <atalk/lockrpc.gen.h>
#include "event2/event.h"
#include "event2/http.h"
#include "event2/rpc.h"
+struct adouble;
+
extern int rpc_init(const char *addr, unsigned short port);
extern int rpc_lock(struct adouble *, uint32_t eid, int type, off_t off, off_t len, int user);
extern void rpc_unlock(struct adouble *, int user);
* Close a struct adouble freeing all resources
*
* This close the whole thing, regardless of what you pass in adflags!
+ * When open forks are using this struct adouble (ad_refcount>0) the close
+ * request is ignored.
*/
int ad_close( struct adouble *ad, int adflags)
{
int err = 0;
- if (ad->ad_inited == AD_CLOSED) {
- LOG(log_warning, logtype_default, "ad_close: double close");
- return 0;
- }
-
LOG(log_debug, logtype_default, "ad_close(\"%s\", %s)",
cfrombstr(ad->ad_fullpath),
adflags2logstr(adflags));
ad->ad_fullpath = NULL;
}
- ad->ad_inited = AD_CLOSED;
-
return err;
}
#include "event2/event.h"
#include "event2/http.h"
+#include "event2/event_compat.h"
+#include "event2/http_compat.h"
#include "event2/rpc.h"
#include "event2/rpc_struct.h"
EVRPC_MAKE_REQUEST(lock_msg, rpc_pool, lock_req, lock_rep, msg_rep_cb, NULL);
- event_base_dispatch(ev_base);
+// event_base_dispatch(ev_base);
+ event_dispatch();
}
int rpc_lock(struct adouble *ad, uint32_t eid, int type, off_t off, off_t len, int user)
int rpc_init(const char *addr, unsigned short port)
{
EC_INIT;
- struct evhttp_connection *evcon;
+ struct evhttp_connection *evcon;
- EC_NULL_LOG(ev_base = event_base_new());
+// EC_NULL_LOG(ev_base = event_base_new());
event_set_log_callback(ev_log_cb);
- EC_NULL_LOG(rpc_pool = evrpc_pool_new(ev_base));
- EC_NULL_LOG(evcon = evhttp_connection_base_new(NULL, NULL, addr, port));
-
+// EC_NULL_LOG(rpc_pool = evrpc_pool_new(ev_base));
+ EC_NULL_LOG(rpc_pool = evrpc_pool_new(NULL));
+// EC_NULL_LOG(evcon = evhttp_connection_new(addr, port));
+ EC_NULL_LOG(evcon = evhttp_connection_new(addr, port));
evrpc_pool_add_connection(rpc_pool, evcon);
EC_CLEANUP: