|
|
e76f14 |
From 18c35c397d37144d4ec0e2815dc6333977397b91 Mon Sep 17 00:00:00 2001
|
|
|
e76f14 |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
e76f14 |
Date: Thu, 2 Jun 2016 14:50:44 +0100
|
|
|
e76f14 |
Subject: [PATCH] mllib: Add bindings for makedev(3), major(3) and minor(3).
|
|
|
e76f14 |
|
|
|
e76f14 |
(cherry picked from commit dd2ce98d242c0598a3bd484110f8cb0f9e88ec54)
|
|
|
e76f14 |
---
|
|
|
e76f14 |
mllib/Makefile.am | 3 +++
|
|
|
e76f14 |
mllib/dev_t-c.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
e76f14 |
mllib/dev_t.ml | 21 +++++++++++++++++++++
|
|
|
e76f14 |
mllib/dev_t.mli | 28 ++++++++++++++++++++++++++++
|
|
|
e76f14 |
po/POTFILES | 1 +
|
|
|
e76f14 |
po/POTFILES-ml | 1 +
|
|
|
e76f14 |
6 files changed, 106 insertions(+)
|
|
|
e76f14 |
create mode 100644 mllib/dev_t-c.c
|
|
|
e76f14 |
create mode 100644 mllib/dev_t.ml
|
|
|
e76f14 |
create mode 100644 mllib/dev_t.mli
|
|
|
e76f14 |
|
|
|
e76f14 |
diff --git a/mllib/Makefile.am b/mllib/Makefile.am
|
|
|
e76f14 |
index fc4dd95..e44abed 100644
|
|
|
e76f14 |
--- a/mllib/Makefile.am
|
|
|
e76f14 |
+++ b/mllib/Makefile.am
|
|
|
e76f14 |
@@ -29,6 +29,7 @@ CLEANFILES = *~ *.annot *.cmi *.cmo *.cmx *.cmxa *.o
|
|
|
e76f14 |
SOURCES_MLI = \
|
|
|
e76f14 |
common_utils.mli \
|
|
|
e76f14 |
curl.mli \
|
|
|
e76f14 |
+ dev_t.mli \
|
|
|
e76f14 |
fsync.mli \
|
|
|
e76f14 |
JSON.mli \
|
|
|
e76f14 |
mkdtemp.mli \
|
|
|
e76f14 |
@@ -41,6 +42,7 @@ SOURCES_ML = \
|
|
|
e76f14 |
guestfs_config.ml \
|
|
|
e76f14 |
libdir.ml \
|
|
|
e76f14 |
common_gettext.ml \
|
|
|
e76f14 |
+ dev_t.ml \
|
|
|
e76f14 |
common_utils.ml \
|
|
|
e76f14 |
fsync.ml \
|
|
|
e76f14 |
progress.ml \
|
|
|
e76f14 |
@@ -54,6 +56,7 @@ SOURCES_ML = \
|
|
|
e76f14 |
SOURCES_C = \
|
|
|
e76f14 |
../fish/progress.c \
|
|
|
e76f14 |
../fish/uri.c \
|
|
|
e76f14 |
+ dev_t-c.c \
|
|
|
e76f14 |
fsync-c.c \
|
|
|
e76f14 |
mkdtemp-c.c \
|
|
|
e76f14 |
progress-c.c \
|
|
|
e76f14 |
diff --git a/mllib/dev_t-c.c b/mllib/dev_t-c.c
|
|
|
e76f14 |
new file mode 100644
|
|
|
e76f14 |
index 0000000..036b60d
|
|
|
e76f14 |
--- /dev/null
|
|
|
e76f14 |
+++ b/mllib/dev_t-c.c
|
|
|
e76f14 |
@@ -0,0 +1,52 @@
|
|
|
e76f14 |
+/* libguestfs OCaml tools common code
|
|
|
e76f14 |
+ * Copyright (C) 2016 Red Hat Inc.
|
|
|
e76f14 |
+ *
|
|
|
e76f14 |
+ * This program is free software; you can redistribute it and/or modify
|
|
|
e76f14 |
+ * it under the terms of the GNU General Public License as published by
|
|
|
e76f14 |
+ * the Free Software Foundation; either version 2 of the License, or
|
|
|
e76f14 |
+ * (at your option) any later version.
|
|
|
e76f14 |
+ *
|
|
|
e76f14 |
+ * This program is distributed in the hope that it will be useful,
|
|
|
e76f14 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
e76f14 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
e76f14 |
+ * GNU General Public License for more details.
|
|
|
e76f14 |
+ *
|
|
|
e76f14 |
+ * You should have received a copy of the GNU General Public License
|
|
|
e76f14 |
+ * along with this program; if not, write to the Free Software
|
|
|
e76f14 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
e76f14 |
+ */
|
|
|
e76f14 |
+
|
|
|
e76f14 |
+#include <config.h>
|
|
|
e76f14 |
+
|
|
|
e76f14 |
+#include <stdio.h>
|
|
|
e76f14 |
+#include <stdlib.h>
|
|
|
e76f14 |
+#include <sys/types.h>
|
|
|
e76f14 |
+
|
|
|
e76f14 |
+#include <caml/mlvalues.h>
|
|
|
e76f14 |
+
|
|
|
e76f14 |
+/* OCaml doesn't bind the dev_t calls makedev, major and minor. */
|
|
|
e76f14 |
+
|
|
|
e76f14 |
+extern value guestfs_int_mllib_dev_t_makedev (value majv, value minv);
|
|
|
e76f14 |
+extern value guestfs_int_mllib_dev_t_major (value devv);
|
|
|
e76f14 |
+extern value guestfs_int_mllib_dev_t_minor (value devv);
|
|
|
e76f14 |
+
|
|
|
e76f14 |
+/* NB: This is a "noalloc" call. */
|
|
|
e76f14 |
+value
|
|
|
e76f14 |
+guestfs_int_mllib_dev_t_makedev (value majv, value minv)
|
|
|
e76f14 |
+{
|
|
|
e76f14 |
+ return Val_int (makedev (Int_val (majv), Int_val (minv)));
|
|
|
e76f14 |
+}
|
|
|
e76f14 |
+
|
|
|
e76f14 |
+/* NB: This is a "noalloc" call. */
|
|
|
e76f14 |
+value
|
|
|
e76f14 |
+guestfs_int_mllib_dev_t_major (value devv)
|
|
|
e76f14 |
+{
|
|
|
e76f14 |
+ return Val_int (major (Int_val (devv)));
|
|
|
e76f14 |
+}
|
|
|
e76f14 |
+
|
|
|
e76f14 |
+/* NB: This is a "noalloc" call. */
|
|
|
e76f14 |
+value
|
|
|
e76f14 |
+guestfs_int_mllib_dev_t_minor (value devv)
|
|
|
e76f14 |
+{
|
|
|
e76f14 |
+ return Val_int (minor (Int_val (devv)));
|
|
|
e76f14 |
+}
|
|
|
e76f14 |
diff --git a/mllib/dev_t.ml b/mllib/dev_t.ml
|
|
|
e76f14 |
new file mode 100644
|
|
|
e76f14 |
index 0000000..143954a
|
|
|
e76f14 |
--- /dev/null
|
|
|
e76f14 |
+++ b/mllib/dev_t.ml
|
|
|
e76f14 |
@@ -0,0 +1,21 @@
|
|
|
e76f14 |
+(* libguestfs OCaml tools common code
|
|
|
e76f14 |
+ * Copyright (C) 2016 Red Hat Inc.
|
|
|
e76f14 |
+ *
|
|
|
e76f14 |
+ * This program is free software; you can redistribute it and/or modify
|
|
|
e76f14 |
+ * it under the terms of the GNU General Public License as published by
|
|
|
e76f14 |
+ * the Free Software Foundation; either version 2 of the License, or
|
|
|
e76f14 |
+ * (at your option) any later version.
|
|
|
e76f14 |
+ *
|
|
|
e76f14 |
+ * This program is distributed in the hope that it will be useful,
|
|
|
e76f14 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
e76f14 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
e76f14 |
+ * GNU General Public License for more details.
|
|
|
e76f14 |
+ *
|
|
|
e76f14 |
+ * You should have received a copy of the GNU General Public License along
|
|
|
e76f14 |
+ * with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
e76f14 |
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
e76f14 |
+ *)
|
|
|
e76f14 |
+
|
|
|
e76f14 |
+external makedev : int -> int -> int = "guestfs_int_mllib_dev_t_makedev" "noalloc"
|
|
|
e76f14 |
+external major : int -> int = "guestfs_int_mllib_dev_t_major" "noalloc"
|
|
|
e76f14 |
+external minor : int -> int = "guestfs_int_mllib_dev_t_minor" "noalloc"
|
|
|
e76f14 |
diff --git a/mllib/dev_t.mli b/mllib/dev_t.mli
|
|
|
e76f14 |
new file mode 100644
|
|
|
e76f14 |
index 0000000..340ead0
|
|
|
e76f14 |
--- /dev/null
|
|
|
e76f14 |
+++ b/mllib/dev_t.mli
|
|
|
e76f14 |
@@ -0,0 +1,28 @@
|
|
|
e76f14 |
+(* virt-resize
|
|
|
e76f14 |
+ * Copyright (C) 2016 Red Hat Inc.
|
|
|
e76f14 |
+ *
|
|
|
e76f14 |
+ * This program is free software; you can redistribute it and/or modify
|
|
|
e76f14 |
+ * it under the terms of the GNU General Public License as published by
|
|
|
e76f14 |
+ * the Free Software Foundation; either version 2 of the License, or
|
|
|
e76f14 |
+ * (at your option) any later version.
|
|
|
e76f14 |
+ *
|
|
|
e76f14 |
+ * This program is distributed in the hope that it will be useful,
|
|
|
e76f14 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
e76f14 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
e76f14 |
+ * GNU General Public License for more details.
|
|
|
e76f14 |
+ *
|
|
|
e76f14 |
+ * You should have received a copy of the GNU General Public License along
|
|
|
e76f14 |
+ * with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
e76f14 |
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
e76f14 |
+ *)
|
|
|
e76f14 |
+
|
|
|
e76f14 |
+(** Bindings for [dev_t] related functions [makedev], [major] and [minor]. *)
|
|
|
e76f14 |
+
|
|
|
e76f14 |
+val makedev : int -> int -> int
|
|
|
e76f14 |
+(** makedev(3) *)
|
|
|
e76f14 |
+
|
|
|
e76f14 |
+val major : int -> int
|
|
|
e76f14 |
+(** major(3) *)
|
|
|
e76f14 |
+
|
|
|
e76f14 |
+val minor : int -> int
|
|
|
e76f14 |
+(** minor(3) *)
|
|
|
e76f14 |
diff --git a/po/POTFILES b/po/POTFILES
|
|
|
e76f14 |
index ebee244..1252d8b 100644
|
|
|
e76f14 |
--- a/po/POTFILES
|
|
|
e76f14 |
+++ b/po/POTFILES
|
|
|
e76f14 |
@@ -261,6 +261,7 @@ inspector/inspector.c
|
|
|
e76f14 |
java/com_redhat_et_libguestfs_GuestFS.c
|
|
|
e76f14 |
lua/lua-guestfs.c
|
|
|
e76f14 |
make-fs/make-fs.c
|
|
|
e76f14 |
+mllib/dev_t-c.c
|
|
|
e76f14 |
mllib/dummy.c
|
|
|
e76f14 |
mllib/fsync-c.c
|
|
|
e76f14 |
mllib/mkdtemp-c.c
|
|
|
e76f14 |
diff --git a/po/POTFILES-ml b/po/POTFILES-ml
|
|
|
e76f14 |
index b7f3cc2..2b9bba1 100644
|
|
|
e76f14 |
--- a/po/POTFILES-ml
|
|
|
e76f14 |
+++ b/po/POTFILES-ml
|
|
|
e76f14 |
@@ -43,6 +43,7 @@ mllib/common_gettext.ml
|
|
|
e76f14 |
mllib/common_utils.ml
|
|
|
e76f14 |
mllib/common_utils_tests.ml
|
|
|
e76f14 |
mllib/curl.ml
|
|
|
e76f14 |
+mllib/dev_t.ml
|
|
|
e76f14 |
mllib/fsync.ml
|
|
|
e76f14 |
mllib/guestfs_config.ml
|
|
|
e76f14 |
mllib/libdir.ml
|
|
|
e76f14 |
--
|
|
|
aa0300 |
2.7.4
|
|
|
e76f14 |
|