[PATCH v2] ndctl: add unit test for presence of PCOMMIT
by Ross Zwisler
Fail our BAT test if run on systems without proper PCOMMIT support.
PCOMMIT is required on non-ADR x86 systems that want to use the PMEM
API.
Signed-off-by: Ross Zwisler <ross.zwisler(a)linux.intel.com>
---
Makefile.am | 10 ++++++---
builtin-bat.c | 6 ++++++
lib/test-pcommit.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
test-pcommit.h | 4 ++++
4 files changed, 80 insertions(+), 3 deletions(-)
create mode 100644 lib/test-pcommit.c
create mode 100644 test-pcommit.h
diff --git a/Makefile.am b/Makefile.am
index 8b07408..e5b4b49 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -77,7 +77,8 @@ endif
if ENABLE_DESTRUCTIVE
ndctl_SOURCES += lib/blk_namespaces.c \
- lib/pmem_namespaces.c
+ lib/pmem_namespaces.c \
+ lib/test-pcommit.c
ndctl_SOURCES += builtin-bat.c
endif
@@ -115,13 +116,16 @@ TESTS = lib/test-libndctl lib/test-dpa-alloc lib/test-parent-uuid
check_PROGRAMS = lib/test-libndctl lib/test-dpa-alloc lib/test-parent-uuid
if ENABLE_DESTRUCTIVE
-TESTS += lib/test-blk-ns lib/test-pmem-ns
-check_PROGRAMS += lib/test-blk-ns lib/test-pmem-ns
+TESTS += lib/test-blk-ns lib/test-pmem-ns lib/test-pcommit
+check_PROGRAMS += lib/test-blk-ns lib/test-pmem-ns lib/test-pcommit
endif
lib_test_libndctl_SOURCES = lib/test-libndctl.c lib/test-core.c
lib_test_libndctl_LDADD = lib/libndctl.la $(UUID_LIBS) $(KMOD_LIBS)
+lib_test_pcommit_SOURCES = lib/test-pcommit.c
+lib_test_pcommit_LDADD = lib/libndctl.la $(KMOD_LIBS)
+
lib_test_blk_ns_SOURCES = lib/blk_namespaces.c
lib_test_blk_ns_LDADD = lib/libndctl.la $(KMOD_LIBS)
diff --git a/builtin-bat.c b/builtin-bat.c
index 4c6ee64..e79a55d 100644
--- a/builtin-bat.c
+++ b/builtin-bat.c
@@ -1,5 +1,6 @@
#include <stdio.h>
#include <syslog.h>
+#include <test-pcommit.h>
#include <test-blk-namespaces.h>
#include <test-pmem-namespaces.h>
#include <util/parse-options.h>
@@ -25,6 +26,11 @@ int cmd_bat(int argc, const char **argv)
if (argc)
usage_with_options(u, options);
+ rc = test_pcommit();
+ fprintf(stderr, "test_pcommit: %s\n", rc ? "FAIL" : "PASS");
+ if (rc)
+ return rc;
+
rc = test_blk_namespaces(loglevel);
fprintf(stderr, "test_blk_namespaces: %s\n", rc ? "FAIL" : "PASS");
if (rc)
diff --git a/lib/test-pcommit.c b/lib/test-pcommit.c
new file mode 100644
index 0000000..f40052f
--- /dev/null
+++ b/lib/test-pcommit.c
@@ -0,0 +1,63 @@
+/*
+ * test-pcommit: Make sure PCOMMIT is supported by the platform.
+ *
+ * Copyright (c) 2015, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU Lesser General Public License,
+ * version 2.1, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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.
+ */
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <test-pcommit.h>
+
+#define err(msg)\
+ fprintf(stderr, "%s:%d: %s (%s)\n", __func__, __LINE__, msg, strerror(errno))
+
+int test_pcommit(void)
+{
+ const char *pcommit = "pcommit";
+ const char *flags = "flags";
+ const int buffer_size = 1024;
+
+ char buffer[buffer_size];
+ FILE *cpuinfo;
+ char *token;
+
+ cpuinfo = fopen("/proc/cpuinfo", "r");
+ if (!cpuinfo) {
+ err("open");
+ return EBADF;
+ }
+
+ while (fgets(buffer, buffer_size, cpuinfo)) {
+ token = strtok(buffer, " :");
+
+ if (token &&
+ strncmp(token, flags, strlen(flags)) != 0)
+ continue;
+
+ while (token != NULL) {
+ token = strtok(NULL, " ");
+ if (token &&
+ strncmp(token, pcommit, strlen(pcommit)) == 0) {
+ fclose(cpuinfo);
+ return 0;
+ }
+ }
+ }
+
+ fclose(cpuinfo);
+ return ENOTSUP;
+}
+
+int __attribute__((weak)) main(int argc, char *argv[])
+{
+ return test_pcommit();
+}
diff --git a/test-pcommit.h b/test-pcommit.h
new file mode 100644
index 0000000..27e788d
--- /dev/null
+++ b/test-pcommit.h
@@ -0,0 +1,4 @@
+#ifndef __TEST_PCOMMIT__
+#define __TEST_PCOMMIT__
+int test_pcommit(void);
+#endif
--
2.1.0
5 years, 4 months
[PATCH] ndctl: fix "skip" reporting when nfit_test modules are missing
by Dan Williams
If the kernel headers report the kernel version is capable of running
the tests, but the nfit_test infrastructure is not found, don't report
"PASS". Add ndctl_test_skip() as an explicit skip for reasons outside
of incompatible kernel version.
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
lib/test-core.c | 7 +++++++
lib/test-core.h | 2 ++
lib/test-dpa-alloc.c | 1 +
lib/test-libndctl.c | 1 +
lib/test-parent-uuid.c | 1 +
5 files changed, 12 insertions(+)
diff --git a/lib/test-core.c b/lib/test-core.c
index 932c2dd246f5..4733e0fb424e 100644
--- a/lib/test-core.c
+++ b/lib/test-core.c
@@ -62,6 +62,13 @@ int __ndctl_test_attempt(struct ndctl_test *test, unsigned int kver,
return 0;
}
+void __ndctl_test_skip(struct ndctl_test *test, const char *caller, int line)
+{
+ test->skip++;
+ test->attempt = test->skip;
+ fprintf(stderr, "%s: explicit skip %s:%d\n", __func__, caller, line);
+}
+
int ndctl_test_get_attempted(struct ndctl_test *test)
{
return test->attempt;
diff --git a/lib/test-core.h b/lib/test-core.h
index 7f13bc28441b..9129871be43e 100644
--- a/lib/test-core.h
+++ b/lib/test-core.h
@@ -6,3 +6,5 @@ int ndctl_test_get_attempted(struct ndctl_test *test);
int __ndctl_test_attempt(struct ndctl_test *test, unsigned int kver,
const char *caller, int line);
#define ndctl_test_attempt(t, v) __ndctl_test_attempt(t, v, __func__, __LINE__)
+void __ndctl_test_skip(struct ndctl_test *test, const char *caller, int line);
+#define ndctl_test_skip(t) __ndctl_test_skip(t, __func__, __LINE__)
diff --git a/lib/test-dpa-alloc.c b/lib/test-dpa-alloc.c
index 1eb278dcaf7e..dab3b882757e 100644
--- a/lib/test-dpa-alloc.c
+++ b/lib/test-dpa-alloc.c
@@ -319,6 +319,7 @@ int test_dpa_alloc(int loglevel, struct ndctl_test *test)
NULL, NULL, NULL, NULL);
if (err < 0) {
result = 77;
+ ndctl_test_skip(test);
fprintf(stderr, "%s unavailable skipping tests\n",
NFIT_TEST_MODULE);
goto err_module;
diff --git a/lib/test-libndctl.c b/lib/test-libndctl.c
index 54511994098c..b7c85371ee07 100644
--- a/lib/test-libndctl.c
+++ b/lib/test-libndctl.c
@@ -1583,6 +1583,7 @@ int test_libndctl(int loglevel, struct ndctl_test *test)
NULL, NULL, NULL, NULL);
if (err < 0) {
result = 77;
+ ndctl_test_skip(test);
fprintf(stderr, "%s unavailable skipping tests\n",
NFIT_TEST_MODULE);
goto err_module;
diff --git a/lib/test-parent-uuid.c b/lib/test-parent-uuid.c
index ed0e7f88863b..4f48717ca0f7 100644
--- a/lib/test-parent-uuid.c
+++ b/lib/test-parent-uuid.c
@@ -249,6 +249,7 @@ int test_parent_uuid(int loglevel, struct ndctl_test *test)
NULL, NULL, NULL, NULL);
if (err < 0) {
result = 77;
+ ndctl_test_skip(test);
fprintf(stderr, "%s unavailable skipping tests\n",
NFIT_TEST_MODULE);
goto err_module;
5 years, 4 months
[PATCH] ndctl: drop ndctl.h dependency in blk+pmem acceptance tests
by Dan Williams
They were not properly checking for HAVE_NDCTL_H and they can use the
string name for the region type rather than the type number.
Cc: Ross Zwisler <ross.zwisler(a)linux.intel.com>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
lib/blk_namespaces.c | 3 +--
lib/pmem_namespaces.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/lib/blk_namespaces.c b/lib/blk_namespaces.c
index c3fee58f793b..1bea7bdb07b0 100644
--- a/lib/blk_namespaces.c
+++ b/lib/blk_namespaces.c
@@ -15,7 +15,6 @@
#include <errno.h>
#include <fcntl.h>
#include <linux/fs.h>
-#include <linux/ndctl.h>
#include <ndctl/libndctl.h>
#include <stdio.h>
#include <stdlib.h>
@@ -249,7 +248,7 @@ int test_blk_namespaces(int log_level)
/* create our config */
ndctl_region_foreach(bus, region)
- if (ndctl_region_get_nstype(region) == ND_DEVICE_NAMESPACE_BLK) {
+ if (strcmp(ndctl_region_get_type_name(region), "blk") == 0) {
blk_region = region;
break;
}
diff --git a/lib/pmem_namespaces.c b/lib/pmem_namespaces.c
index 127e3bee79d8..28b582026677 100644
--- a/lib/pmem_namespaces.c
+++ b/lib/pmem_namespaces.c
@@ -15,7 +15,6 @@
#include <errno.h>
#include <fcntl.h>
#include <linux/fs.h>
-#include <linux/ndctl.h>
#include <ndctl/libndctl.h>
#include <stdio.h>
#include <stdlib.h>
@@ -209,7 +208,7 @@ int test_pmem_namespaces(int log_level)
/* create our config */
ndctl_region_foreach(bus, region)
- if (ndctl_region_get_nstype(region) == ND_DEVICE_NAMESPACE_PMEM) {
+ if (strcmp(ndctl_region_get_type_name(region), "pmem") == 0) {
pmem_region = region;
break;
}
5 years, 4 months
[PATCH] ndctl: add unit test for presence of PCOMMIT
by Ross Zwisler
Fail our BAT test if run on systems without proper PCOMMIT support.
PCOMMIT is required on non-ADR x86 systems that want to use the PMEM
API.
Signed-off-by: Ross Zwisler <ross.zwisler(a)linux.intel.com>
---
Makefile.am | 10 ++++---
builtin-bat.c | 6 +++++
lib/test-pcommit.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
test-pcommit.h | 4 +++
4 files changed, 94 insertions(+), 3 deletions(-)
create mode 100644 lib/test-pcommit.c
create mode 100644 test-pcommit.h
diff --git a/Makefile.am b/Makefile.am
index 8b07408..e5b4b49 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -77,7 +77,8 @@ endif
if ENABLE_DESTRUCTIVE
ndctl_SOURCES += lib/blk_namespaces.c \
- lib/pmem_namespaces.c
+ lib/pmem_namespaces.c \
+ lib/test-pcommit.c
ndctl_SOURCES += builtin-bat.c
endif
@@ -115,13 +116,16 @@ TESTS = lib/test-libndctl lib/test-dpa-alloc lib/test-parent-uuid
check_PROGRAMS = lib/test-libndctl lib/test-dpa-alloc lib/test-parent-uuid
if ENABLE_DESTRUCTIVE
-TESTS += lib/test-blk-ns lib/test-pmem-ns
-check_PROGRAMS += lib/test-blk-ns lib/test-pmem-ns
+TESTS += lib/test-blk-ns lib/test-pmem-ns lib/test-pcommit
+check_PROGRAMS += lib/test-blk-ns lib/test-pmem-ns lib/test-pcommit
endif
lib_test_libndctl_SOURCES = lib/test-libndctl.c lib/test-core.c
lib_test_libndctl_LDADD = lib/libndctl.la $(UUID_LIBS) $(KMOD_LIBS)
+lib_test_pcommit_SOURCES = lib/test-pcommit.c
+lib_test_pcommit_LDADD = lib/libndctl.la $(KMOD_LIBS)
+
lib_test_blk_ns_SOURCES = lib/blk_namespaces.c
lib_test_blk_ns_LDADD = lib/libndctl.la $(KMOD_LIBS)
diff --git a/builtin-bat.c b/builtin-bat.c
index 4c6ee64..88ea0b5 100644
--- a/builtin-bat.c
+++ b/builtin-bat.c
@@ -1,5 +1,6 @@
#include <stdio.h>
#include <syslog.h>
+#include <test-pcommit.h>
#include <test-blk-namespaces.h>
#include <test-pmem-namespaces.h>
#include <util/parse-options.h>
@@ -25,6 +26,11 @@ int cmd_bat(int argc, const char **argv)
if (argc)
usage_with_options(u, options);
+ rc = test_pcommit(loglevel);
+ fprintf(stderr, "test_pcommit: %s\n", rc ? "FAIL" : "PASS");
+ if (rc)
+ return rc;
+
rc = test_blk_namespaces(loglevel);
fprintf(stderr, "test_blk_namespaces: %s\n", rc ? "FAIL" : "PASS");
if (rc)
diff --git a/lib/test-pcommit.c b/lib/test-pcommit.c
new file mode 100644
index 0000000..be45ca2
--- /dev/null
+++ b/lib/test-pcommit.c
@@ -0,0 +1,77 @@
+/*
+ * test-pcommit: Make sure PCOMMIT is supported by the platform.
+ *
+ * Copyright (c) 2015, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU Lesser General Public License,
+ * version 2.1, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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.
+ */
+#include <errno.h>
+#include <fcntl.h>
+#include <linux/fs.h>
+#include <linux/ndctl.h>
+#include <ndctl/libndctl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <syslog.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <uuid/uuid.h>
+#include <test-pcommit.h>
+
+#define err(msg)\
+ fprintf(stderr, "%s:%d: %s (%s)\n", __func__, __LINE__, msg, strerror(errno))
+
+static const char *comm = "test-pcommit";
+
+int test_pcommit(int log_level)
+{
+ const char *pcommit = "pcommit";
+ const char *flags = "flags";
+ const int buffer_size = 1024;
+
+ char buffer[buffer_size];
+ FILE *cpuinfo;
+ char *token;
+
+ cpuinfo = fopen("/proc/cpuinfo", "r");
+ if (!cpuinfo) {
+ err("open");
+ return EBADF;
+ }
+
+ while (fgets(buffer, buffer_size, cpuinfo)) {
+ token = strtok(buffer, " :");
+
+ if (token &&
+ strncmp(token, flags, strlen(flags)) != 0)
+ continue;
+
+ while (token != NULL) {
+ token = strtok(NULL, " ");
+ if (token &&
+ strncmp(token, pcommit, strlen(pcommit)) == 0) {
+ fclose(cpuinfo);
+ return 0;
+ }
+ }
+ }
+
+ fclose(cpuinfo);
+ return ENOTSUP;
+}
+
+int __attribute__((weak)) main(int argc, char *argv[])
+{
+ comm = argv[0];
+ return test_pcommit(LOG_DEBUG);
+}
diff --git a/test-pcommit.h b/test-pcommit.h
new file mode 100644
index 0000000..9cf6bc9
--- /dev/null
+++ b/test-pcommit.h
@@ -0,0 +1,4 @@
+#ifndef __TEST_PCOMMIT__
+#define __TEST_PCOMMIT__
+int test_pcommit(int loglevel);
+#endif
--
2.1.0
5 years, 4 months
[PATCH] ndctl: drop ndctl.h dependency in test-parent-uuid
by Dan Williams
...to eliminate these warnings when falling back to the local ndctl.h.
In file included from lib/test-parent-uuid.c:36:0:
./ndctl.h: In function ‘nvdimm_bus_cmd_name’:
./ndctl.h:127:2: warning: implicit declaration of function ‘ARRAY_SIZE’ [-Wimplicit-function-declaration]
if (cmd < ARRAY_SIZE(names) && names[cmd])
^
./ndctl.h:127:2: warning: nested extern declaration of ‘ARRAY_SIZE’ [-Wnested-externs]
./ndctl.h:127:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (cmd < ARRAY_SIZE(names) && names[cmd])
^
./ndctl.h: In function ‘nvdimm_cmd_name’:
./ndctl.h:146:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (cmd < ARRAY_SIZE(names) && names[cmd])
^
Cc: Vishal Verma <vishal.l.verma(a)intel.com>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
lib/test-parent-uuid.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/lib/test-parent-uuid.c b/lib/test-parent-uuid.c
index a9d7eb1ec2dc..ed0e7f88863b 100644
--- a/lib/test-parent-uuid.c
+++ b/lib/test-parent-uuid.c
@@ -30,13 +30,6 @@
#include <ndctl/libndctl.h>
-#ifdef HAVE_NDCTL_H
-#include <linux/ndctl.h>
-#else
-#include <ndctl.h>
-#endif
-
-
static const char *NFIT_TEST_MODULE = "nfit_test";
static const char *PROVIDER = "nfit_test.0";
@@ -149,7 +142,7 @@ static int do_test(struct ndctl_ctx *ctx)
}
ndctl_region_foreach(bus, region)
- if (ndctl_region_get_nstype(region) == ND_DEVICE_NAMESPACE_BLK) {
+ if (strcmp(ndctl_region_get_type_name(region), "blk") == 0) {
blk_region = region;
break;
}
5 years, 4 months
[PATCH] ndctl: sles spec file updates
by Dan Williams
Include copyright header, license files as %doc
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
contrib/Makefile | 5 +++--
contrib/genspec.c | 2 +-
contrib/ndctl.spec.in | 38 +++++++++++++++++++++-----------------
contrib/sles/header | 18 ++++++++++++++++++
4 files changed, 43 insertions(+), 20 deletions(-)
create mode 100644 contrib/sles/header
diff --git a/contrib/Makefile b/contrib/Makefile
index 958281765b9b..766e186d0389 100644
--- a/contrib/Makefile
+++ b/contrib/Makefile
@@ -7,6 +7,7 @@ PROG=genspec
SPEC_IN=ndctl.spec.in
RHEL_SPEC=rhel/$(SPEC_IN:.in=)
SLES_SPEC=sles/$(SPEC_IN:.in=)
+SLES_IN=sles/header
COMMIT_ID=git log --pretty=format:"%h" -n 1
all: $(RHEL_SPEC) $(SLES_SPEC)
@@ -15,9 +16,9 @@ $(RHEL_SPEC) : $(SPEC_IN) $(PROG)
@mkdir -p rhel
cat $(SPEC_IN) | $(dir $(PROG))$(PROG) `$(COMMIT_ID)` rhel > $@
-$(SLES_SPEC) : $(SPEC_IN) $(PROG)
+$(SLES_SPEC) : $(SLES_IN) $(SPEC_IN) $(PROG)
@mkdir -p sles
- cat $(SPEC_IN) | $(dir $(PROG))$(PROG) `$(COMMIT_ID)` sles > $@
+ cat $(SLES_IN) $(SPEC_IN) | $(dir $(PROG))$(PROG) `$(COMMIT_ID)` sles > $@
$(PROG) : $(OBJS) Makefile
$(CC) $(LDFLAGS) $(OBJS) -o $@
diff --git a/contrib/genspec.c b/contrib/genspec.c
index b3e85da3c9ff..829f648f0a2f 100644
--- a/contrib/genspec.c
+++ b/contrib/genspec.c
@@ -42,7 +42,7 @@ int main(int argc, char **argv)
else if (strncmp("%define dname", buf, 12) == 0)
fprintf(stdout, "%%define dname %s\n", dname[os]);
else if (strncmp("%license", buf, 8) == 0 && !license[os])
- /* skip */;
+ fprintf(stdout, "%%doc %s", &buf[8]);
else if (strncmp("echo \"\" > version", buf, 17) == 0)
fprintf(stdout, "echo \"%s\" > version\n", VERSION);
else
diff --git a/contrib/ndctl.spec.in b/contrib/ndctl.spec.in
index 61fa525d1e87..3d0687ebdc47 100644
--- a/contrib/ndctl.spec.in
+++ b/contrib/ndctl.spec.in
@@ -7,22 +7,18 @@ Version:
Release: 1%{?dist}
Summary: Manage "libnvdimm" subsystem devices (Non-volatile Memory)
License: GPL-2.0
-URL: https://github.com/pmem/ndctl
-
-%if %{defined gitcommit}
+Group: Hardware/Other
+Url: https://github.com/pmem/ndctl
# Snapshot tarball can be created using: ./make-git-shapshot.sh [gitcommit]
Source0: %{name}-git%{gitcommit}.tar.xz
-%else
-Source0: https://github.com/pmem/ndctl/archive/%{name}-%{version}.tar.gz
-%endif
-
-BuildRequires: libtool
-BuildRequires: autoconf
-BuildRequires: automake
-BuildRequires: pkgconfig
-BuildRequires: pkgconfig(libudev)
-BuildRequires: pkgconfig(uuid)
-BuildRequires: pkgconfig(libkmod)
+
+BuildRequires: autoconf
+BuildRequires: automake
+BuildRequires: libtool
+BuildRequires: pkgconfig
+BuildRequires: pkgconfig(libkmod)
+BuildRequires: pkgconfig(libudev)
+BuildRequires: pkgconfig(uuid)
%description
Utility library for managing the "libnvdimm" subsystem. The "libnvdimm"
@@ -34,6 +30,7 @@ Firmware Interface Table).
%package -n %dname
Summary: Development files for libndctl
License: LGPL-2.1+
+Group: Development/Libraries/Other
Requires: %{lname}%{?_isa} = %{version}-%{release}
%description -n %dname
@@ -44,10 +41,10 @@ developing applications that use %{name}.
%package -n %lname
Summary: Management library for "libnvdimm" subsystem devices (Non-volatile Memory)
License: LGPL-2.1+
+Group: System/Libraries
%description -n %lname
-Libraries for %{name}
-
+Libraries for %{name}.
%prep
%setup -q %{?gitcommit:-n %{name}-git%{gitcommit}}
@@ -58,31 +55,38 @@ echo "" > version
%configure --disable-static
make %{?_smp_mflags}
-
%install
%make_install
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
+%check
+make check
%post -n %lname -p /sbin/ldconfig
%postun -n %lname -p /sbin/ldconfig
%files
+%defattr(-,root,root)
%license licenses/GPLv2 licenses/BSD-MIT licenses/CC0
%{_bindir}/ndctl
%files -n %lname
+%defattr(-,root,root)
%doc README.md
%license COPYING licenses/BSD-MIT licenses/CC0
%{_libdir}/libndctl.so.*
%files -n %dname
+%defattr(-,root,root)
%license COPYING
%{_includedir}/ndctl/
%{_libdir}/libndctl.so
%{_libdir}/pkgconfig/libndctl.pc
%changelog
+* Wed Sep 09 2015 dan.j.williams(a)intel.com
+- Stop emitting git commit info by default
+
* Mon Aug 03 2015 dan.j.williams(a)intel.com
- Initial rpm release
diff --git a/contrib/sles/header b/contrib/sles/header
new file mode 100644
index 000000000000..18efb453f705
--- /dev/null
+++ b/contrib/sles/header
@@ -0,0 +1,18 @@
+#
+# spec file for package ndctl
+#
+# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 Intel Corporation
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+# Please submit bugfixes or comments via http://bugs.opensuse.org/
+#
+
5 years, 4 months
[PATCH] ndctl: fix btt visibility in ndctl_namespace_enable()
by Dan Williams
We were refreshing the btt list at the end of ndctl_namespace_enable(),
but that's too late for the call to ndctl_namespace_get_btt() that is
used to determine whether the namespace was claimed by a btt. Move the
call to region_refresh_children() earlier in the routine.
Reported-by: Nicholas Moulin <nicholas.w.moulin(a)intel.com>
Tested-by: Nicholas Moulin <nicholas.w.moulin(a)intel.com>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
lib/libndctl.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/lib/libndctl.c b/lib/libndctl.c
index 0e0d935e89fa..50cfbf7fe176 100644
--- a/lib/libndctl.c
+++ b/lib/libndctl.c
@@ -3146,14 +3146,19 @@ NDCTL_EXPORT int ndctl_namespace_enable(struct ndctl_namespace *ndns)
rc = ndctl_bind(ctx, ndns->module, devname);
+ /*
+ * Rescan now as successfully enabling a namespace device leads
+ * to a new one being created, and potentially btts being attached
+ */
+ region_refresh_children(region);
+
if (!ndctl_namespace_is_enabled(ndns)) {
struct ndctl_btt *btt = ndctl_namespace_get_btt(ndns);
if (btt && ndctl_btt_is_enabled(btt)) {
dbg(ctx, "%s: enabled via %s\n", devname,
ndctl_btt_get_devname(btt));
- rc = 1;
- goto out;
+ return 1;
}
err(ctx, "%s: failed to enable\n", devname);
return rc ? rc : -ENXIO;
@@ -3161,12 +3166,6 @@ NDCTL_EXPORT int ndctl_namespace_enable(struct ndctl_namespace *ndns)
rc = 0;
dbg(ctx, "%s: enabled\n", devname);
- /*
- * Rescan now as successfully enabling a namespace device leads
- * to a new one being created, and potentially btts being attached
- */
- out:
- region_refresh_children(region);
return rc;
}
5 years, 4 months
Beat bad competition with negative SEO
by Un-Rank it
Is your competition annoying you with bad SEO tactics?
Fight back with negative SEO
Negative SEO attack Services. Deindex bad competitors from
Google. It works with any Website, video, blog, product or service.
For Full Details please read the attached .html file
Unsubscribe option is available on the footer of our website
5 years, 4 months
[PATCH v2 0/4] ndctl updates for kernel v4.2
by Dan Williams
Changes since v1 [1]: (note patches from v1 that were not updated are
still pending, just not re-sent)
1/ Toshi noticed that the unit test was missing the update to the flag
names, now fixed up.
2/ "ndctl version" is now more reliable in that it uses a version number
autogenerated from annotated tags and commit ids rather than a static
number in configure.ac.
3/ ndctl_region_disable_invalidate() handles destroying the btt and
disabling the namespace in one step. This will be useful when
mapped-pmem support is added as the same interface will tear down both
BTT and PFN-device instances.
4/ Update the v47 release patch to specify the version in the
git-version-gen script.
[1]: https://lists.01.org/pipermail/linux-nvdimm/2015-September/002096.html
---
Dan Williams (4):
ndctl: update dimm flag names
ndctl: version from git and annotated tags
ndctl: introduce ndctl_namespace_disable_invalidate()
ndctl: release v47
Makefile.am | 21 ++++++++----
README.md | 2 +
autogen.sh | 1 +
builtin-test.c | 40 +++++++++++++++++------
builtin-xable-namespace.c | 2 +
configure.ac | 5 ++-
contrib/genspec.c | 4 ++
contrib/ndctl.spec.in | 8 ++---
git-version-gen | 47 ++++++++++++++++++++++++++
lib/blk_namespaces.c | 4 +-
lib/libndctl-private.h | 5 +--
lib/libndctl.c | 30 ++++++++++++-----
lib/libndctl.sym | 1 +
lib/ndctl/libndctl.h | 6 +--
lib/pmem_namespaces.c | 4 +-
lib/test-core.c | 73 +++++++++++++++++++++++++++++++++++++++++
lib/test-core.h | 8 +++++
lib/test-dpa-alloc.c | 35 ++++++++++++++------
lib/test-libndctl.c | 80 ++++++++++++++++++++++++++++-----------------
lib/test-parent-uuid.c | 32 +++++++++++++-----
ndctl.c | 4 +-
nfit.h | 2 +
test-dpa-alloc.h | 3 +-
test-libndctl.h | 3 +-
test-parent-uuid.h | 3 +-
25 files changed, 321 insertions(+), 102 deletions(-)
create mode 100755 git-version-gen
create mode 100644 lib/test-core.c
create mode 100644 lib/test-core.h
5 years, 4 months