Rename lxc_lock.h to lock.h

Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
---
 src/lxc/Makefile.am |    4 +-
 src/lxc/lock.c      |   88 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/lxc/lock.h      |   30 +++++++++++++++++
 src/lxc/lxc.h       |    2 -
 src/lxc/lxc_lock.c  |   88 ----------------------------------------------------
 src/lxc/lxc_lock.h  |   30 -----------------
 6 files changed, 121 insertions(+), 121 deletions(-)

Index: lxc/src/lxc/lock.h
===================================================================
--- /dev/null
+++ lxc/src/lxc/lock.h
@@ -0,0 +1,30 @@
+/*
+ * lxc: linux Container library
+ *
+ * (C) Copyright IBM Corp. 2007, 2008
+ *
+ * Authors:
+ * Daniel Lezcano <dlezcano at fr.ibm.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#ifndef _lock_h
+#define _lock_h
+
+extern int lxc_get_lock(const char *name);
+
+extern void lxc_put_lock(int lock);
+
+#endif
Index: lxc/src/lxc/lxc_lock.h
===================================================================
--- lxc.orig/src/lxc/lxc_lock.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * lxc: linux Container library
- *
- * (C) Copyright IBM Corp. 2007, 2008
- *
- * Authors:
- * Daniel Lezcano <dlezcano at fr.ibm.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-#ifndef _lock_h
-#define _lock_h
-
-extern int lxc_get_lock(const char *name);
-
-extern void lxc_put_lock(int lock);
-
-#endif
Index: lxc/src/lxc/lxc.h
===================================================================
--- lxc.orig/src/lxc/lxc.h
+++ lxc/src/lxc/lxc.h
@@ -37,7 +37,7 @@ extern "C" {
 #include <lxc/lxc_list.h>
 #include <lxc/lxc_conf.h>
 #include <lxc/lxc_log.h>
-#include <lxc/lxc_lock.h>
+#include <lxc/lock.h>
 #include <lxc/namespace.h>
 #include <lxc/utils.h>
 #include <lxc/error.h>
Index: lxc/src/lxc/Makefile.am
===================================================================
--- lxc.orig/src/lxc/Makefile.am
+++ lxc/src/lxc/Makefile.am
@@ -7,11 +7,11 @@ pkginclude_HEADERS = \
 		monitor.h \
 		utils.h \
 		namespace.h \
+		lock.h \
 		lxc.h \
 		lxc_cgroup.h \
 		lxc_conf.h \
 		lxc_list.h \
-		lxc_lock.h \
 		lxc_log.h \
 		lxc_state.h
 
@@ -32,7 +32,7 @@ liblxc_la_SOURCES = \
 	cgroup.c cgroup.h \
 	lxc.h \
 	lxc_utils.h \
-	lxc_lock.c lxc_lock.h \
+	lock.c lock.h \
 	namespace.h \
 	lxc_conf.c lxc_conf.h \
 	lxc_list.h \
Index: lxc/src/lxc/lock.c
===================================================================
--- /dev/null
+++ lxc/src/lxc/lock.c
@@ -0,0 +1,88 @@
+/*
+ * lxc: linux Container library
+ *
+ * (C) Copyright IBM Corp. 2007, 2008
+ *
+ * Authors:
+ * Daniel Lezcano <dlezcano at fr.ibm.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#undef _GNU_SOURCE
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/file.h>
+#include <sys/param.h>
+
+#include "error.h"
+#include <lxc/lxc.h>
+
+int lxc_get_lock(const char *name)
+{
+	char lock[MAXPATHLEN];
+	int fd, ret;
+
+	snprintf(lock, MAXPATHLEN, LXCPATH "/%s", name);
+
+	/* need to check access because of cap_dac_override */
+	if (access(lock, R_OK |W_OK | X_OK)) {
+		ret = errno;
+		goto out_err;
+	}
+
+	fd = open(lock, O_RDONLY|O_DIRECTORY, S_IRUSR|S_IWUSR);
+	if (fd < 0) {
+		ret = errno;
+		goto out_err;
+	}
+
+        fcntl(fd, F_SETFD, FD_CLOEXEC);
+
+	if (flock(fd, LOCK_EX|LOCK_NB)) {
+		ret = errno;
+		close(fd);
+		goto out_err;
+	}
+
+	ret = fd;
+out:
+	return ret;
+
+out_err:
+	switch (ret) {
+	case EWOULDBLOCK:
+		ret = -LXC_ERROR_EBUSY;
+		goto out;
+	case ENOENT:
+		ret = -LXC_ERROR_ENOENT;
+		goto out;
+	case EACCES:
+		ret = -LXC_ERROR_EACCES;
+		goto out;
+	default:
+		ret = -LXC_ERROR_LOCK;
+		goto out;
+	}
+}
+
+void lxc_put_lock(int lock)
+{
+	flock(lock, LOCK_UN);
+	close(lock);
+}
Index: lxc/src/lxc/lxc_lock.c
===================================================================
--- lxc.orig/src/lxc/lxc_lock.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * lxc: linux Container library
- *
- * (C) Copyright IBM Corp. 2007, 2008
- *
- * Authors:
- * Daniel Lezcano <dlezcano at fr.ibm.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#define _GNU_SOURCE
-#include <stdio.h>
-#undef _GNU_SOURCE
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/file.h>
-#include <sys/param.h>
-
-#include "error.h"
-#include <lxc/lxc.h>
-
-int lxc_get_lock(const char *name)
-{
-	char lock[MAXPATHLEN];
-	int fd, ret;
-
-	snprintf(lock, MAXPATHLEN, LXCPATH "/%s", name);
-
-	/* need to check access because of cap_dac_override */
-	if (access(lock, R_OK |W_OK | X_OK)) {
-		ret = errno;
-		goto out_err;
-	}
-
-	fd = open(lock, O_RDONLY|O_DIRECTORY, S_IRUSR|S_IWUSR);
-	if (fd < 0) {
-		ret = errno;
-		goto out_err;
-	}
-
-        fcntl(fd, F_SETFD, FD_CLOEXEC);
-
-	if (flock(fd, LOCK_EX|LOCK_NB)) {
-		ret = errno;
-		close(fd);
-		goto out_err;
-	}
-
-	ret = fd;
-out:
-	return ret;
-
-out_err:
-	switch (ret) {
-	case EWOULDBLOCK:
-		ret = -LXC_ERROR_EBUSY;
-		goto out;
-	case ENOENT:
-		ret = -LXC_ERROR_ENOENT;
-		goto out;
-	case EACCES:
-		ret = -LXC_ERROR_EACCES;
-		goto out;
-	default:
-		ret = -LXC_ERROR_LOCK;
-		goto out;
-	}
-}
-
-void lxc_put_lock(int lock)
-{
-	flock(lock, LOCK_UN);
-	close(lock);
-}



