#include "mdadm.h"
#include "md_p.h"
-#include <sys/poll.h>
#include <sys/socket.h>
#include <sys/utsname.h>
#include <sys/wait.h>
#include <sys/resource.h>
#include <sys/vfs.h>
#include <linux/magic.h>
+#include <poll.h>
#include <ctype.h>
#include <dirent.h>
#include <signal.h>
aren't permitted). */
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
-static struct dlm_hooks *dlm_hooks = NULL;
static int is_dlm_hooks_ready = 0;
+
+int dlm_funs_ready(void)
+{
+ return is_dlm_hooks_ready ? 1 : 0;
+}
+
+#ifndef MDASSEMBLE
+static struct dlm_hooks *dlm_hooks = NULL;
struct dlm_lock_resource *dlm_lock_res = NULL;
static int ast_called = 0;
struct dlm_lksb lksb;
};
-int dlm_funs_ready(void)
-{
- return is_dlm_hooks_ready ? 1 : 0;
-}
-
/* Using poll(2) to wait for and dispatch ASTs */
static int poll_for_ast(dlm_lshandle_t ls)
{
dlm_lock_res->ls = dlm_hooks->create_lockspace(cluster_name, O_RDWR);
if (!dlm_lock_res->ls) {
pr_err("%s failed to create lockspace\n", cluster_name);
- goto out;
+ return -ENOMEM;
}
/* Conversions need the lockid in the LKSB */
dlm_lock_res, NULL, NULL);
if (ret) {
pr_err("error %d when get PW mode on lock %s\n", errno, str);
- goto out;
+ dlm_hooks->release_lockspace(cluster_name, dlm_lock_res->ls, 1);
+ return ret;
}
/* Wait for it to complete */
poll_for_ast(dlm_lock_res->ls);
*lockid = dlm_lock_res->lksb.sb_lkid;
- errno = dlm_lock_res->lksb.sb_status;
- if (errno) {
- pr_err("error %d happened in ast with lock %s\n", errno, str);
- goto out;
- }
-
-out:
- return ret;
+ return dlm_lock_res->lksb.sb_status;
}
int cluster_release_dlmlock(int lockid)
out:
return ret;
}
+#else
+int cluster_get_dlmlock(int *lockid)
+{
+ return -1;
+}
+int cluster_release_dlmlock(int lockid)
+{
+ return -1;
+}
+#endif
/*
* Parse a 128 bit uuid in 4 integers
*/
struct superswitch *ss;
struct supertype *st;
- time_t besttime = 0;
+ unsigned int besttime = 0;
int bestsuper = -1;
int i;
dup2(fd, mdfd);
}
+#ifndef MDASSEMBLE
static struct cmap_hooks *cmap_hooks = NULL;
static int is_cmap_hooks_ready = 0;
-#ifndef MDASSEMBLE
void set_cmap_hooks(void)
{
cmap_hooks = xmalloc(sizeof(struct cmap_hooks));