@@ -25,7 +25,6 @@ daxctl/lib/libdaxctl.pc
*.a
ndctl/lib/libndctl.pc
ndctl/ndctl
-ndctl/ndctl-udev
rhel/
sles/ndctl.spec
util/log.lo
@@ -42,9 +42,6 @@ bashcompletiondir = $(BASH_COMPLETION_DIR)
dist_bashcompletion_DATA = contrib/ndctl
endif
-udevrulesdir = $(UDEVDIR)/rules.d
-dist_udevrules_DATA = contrib/80-ndctl.rules
-
noinst_LIBRARIES = libccan.a
libccan_a_SOURCES = \
ccan/str/str.h \
@@ -153,17 +153,8 @@ fi
AC_SUBST([systemd_unitdir])
AM_CONDITIONAL([ENABLE_SYSTEMD_UNITS], [test "x$with_systemd" = "xyes"])
-AC_ARG_WITH([tmpfilesdir],
- [AS_HELP_STRING([--with-tmpfilesdir=DIR], [Directory for temporary runtime files])],
- [tmpfilesdir=$withval],
- [tmpfilesdir="/run"])
-
-UDEVDIR="$(pkg-config udev --variable=udevdir)"
-AC_SUBST([UDEVDIR])
-
my_CFLAGS="\
-D DEF_CONF_FILE='\"${sysconfdir}/ndctl/monitor.conf\"' \
--D DEF_TMPFS_DIR='\"${tmpfilesdir}/ndctl\"' \
-Wall \
-Wchar-subscripts \
-Wformat-security \
@@ -204,7 +195,6 @@ AC_MSG_RESULT([
sysconfdir: ${sysconfdir}
libdir: ${libdir}
includedir: ${includedir}
- tmpfilesdir: ${tmpfilesdir}
compiler: ${CC}
cflags: ${CFLAGS}
deleted file mode 100644
@@ -1,3 +0,0 @@
-# do not edit this file, it will be overwritten on update
-
-ACTION=="add", KERNEL=="nmem*", RUN+="ndctl-udev $kernel"
@@ -110,7 +110,6 @@ make check
%postun -n DAX_LNAME -p /sbin/ldconfig
%define bashcompdir %(pkg-config --variable=completionsdir bash-completion)
-%define udevdir %(pkg-config --variable=udevdir udev)
%files
%defattr(-,root,root)
@@ -120,8 +119,6 @@ make check
%{bashcompdir}/
%{_sysconfdir}/ndctl/monitor.conf
%{_unitdir}/ndctl-monitor.service
-%{_udevrulesdir}/80-ndctl.rules
-%{udevdir}/ndctl-udev
%files -n daxctl
%defattr(-,root,root)
@@ -51,8 +51,3 @@ EXTRA_DIST += $(monitor_config_file)
if ENABLE_SYSTEMD_UNITS
systemd_unit_DATA = ndctl-monitor.service
endif
-
-ndctl_udevdir = $(UDEVDIR)
-ndctl_udev_PROGRAMS = ndctl-udev
-ndctl_udev_SOURCES = ndctl-udev.c
-ndctl_udev_LDADD = lib/libndctl.la
deleted file mode 100644
@@ -1,150 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* Copyright(c) 2018 Intel Corporation. All rights reserved. */
-
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <ndctl/libndctl.h>
-
-/**
- * mkdir_p
- *
- * Copied from util-linux lib/fileutils.c
- */
-static int mkdir_p(const char *path, mode_t mode)
-{
- char *p, *dir;
- int rc = 0;
-
- if (!path || !*path)
- return -EINVAL;
-
- dir = p = strdup(path);
- if (!dir)
- return -ENOMEM;
-
- if (*p == '/')
- p++;
-
- while (p && *p) {
- char *e = strchr(p, '/');
- if (e)
- *e = '\0';
- if (*p) {
- rc = mkdir(dir, mode);
- if (rc && errno != EEXIST)
- break;
- rc = 0;
- }
- if (!e)
- break;
- *e = '/';
- p = e + 1;
- }
-
- free(dir);
- return rc;
-}
-
-static struct ndctl_dimm *find_dimm(struct ndctl_ctx *ctx, const char *devname)
-{
- struct ndctl_bus *bus;
- struct ndctl_dimm *dimm;
-
- ndctl_bus_foreach(ctx, bus) {
- ndctl_dimm_foreach(bus, dimm) {
- if (strcmp(ndctl_dimm_get_devname(dimm), devname) == 0)
- return dimm;
- }
- }
- return NULL;
-}
-
-static void ack_shutdown(struct ndctl_dimm *dimm)
-{
- struct ndctl_cmd *cmd;
-
- cmd = ndctl_dimm_cmd_new_ack_shutdown_count(dimm);
- if (!cmd)
- return;
- ndctl_cmd_submit(cmd);
- ndctl_cmd_unref(cmd);
-}
-
-static void save_unsafe_shutdown_count(struct ndctl_dimm *dimm,
- const char *devname)
-{
- char *path, *usc, count[16];
- unsigned int shutdown;
- struct ndctl_cmd *cmd;
- int fd;
-
- cmd = ndctl_dimm_cmd_new_smart(dimm);
- if (!cmd)
- return;
-
- if (ndctl_cmd_submit(cmd))
- goto unref_cmd;
-
- shutdown = ndctl_cmd_smart_get_shutdown_count(cmd);
- if (shutdown == UINT_MAX)
- goto unref_cmd;
-
- if (asprintf(&path, DEF_TMPFS_DIR "/%s", devname) < 0)
- goto unref_cmd;
-
- if (mkdir_p(path, 0755))
- goto free_path;
-
- if (asprintf(&usc, "%s/usc", path) < 0)
- goto free_path;
-
- fd = open(usc, O_WRONLY | O_CREAT, 0644);
- if (fd < 0)
- goto free_usc;
-
- if (snprintf(count, sizeof(count), "%u\n", shutdown) < 0)
- goto close_fd;
-
- if (write(fd, count, strlen(count)) < 0)
- goto close_fd;
-
- close_fd:
- close(fd);
- free_usc:
- free(usc);
- free_path:
- free(path);
- unref_cmd:
- ndctl_cmd_unref(cmd);
-}
-
-int main(int argc, char *argv[])
-{
- struct ndctl_ctx *ctx;
- struct ndctl_dimm *dimm = NULL;
- const char *devname;
-
- if (argc < 2)
- return EINVAL;
-
- devname = argv[1];
- if (ndctl_new(&ctx))
- return ENOMEM;
-
- dimm = find_dimm(ctx, devname);
- if (!dimm)
- return ENODEV;
-
- ack_shutdown(dimm);
- save_unsafe_shutdown_count(dimm, devname);
-
- ndctl_unref(ctx);
- return 0;
-}
With the introduction of the 'ndctl dirty-dimm' command, environments that choose to implement dirty-shutdown mitigation can use 'dirty-dimm nmemX' and 'list --dimm --health nmemX' to acknowledge and retrieve these details. However, it should be noted that this is not the default. If the platform advertises support for "Memory Controller Flush to NVDIMM Durability on Power Loss Capable" then the default Linux policy is to trust that designation. A platform owner can override the default Linux policy by delaying namespace activation until after 'dirty-dimm' has been completed on all DIMMs that contribute to a given interleave-set. Without coordinating the latch with writes the dirty-shutdown counter could fail to reflect the dirty-state relative to failed write-buffer flush. Cc: Keith Busch <keith.busch@intel.com> Cc: Vishal Verma <vishal.l.verma@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- .gitignore | 1 Makefile.am | 3 - configure.ac | 10 --- contrib/80-ndctl.rules | 3 - ndctl.spec.in | 3 - ndctl/Makefile.am | 5 -- ndctl/ndctl-udev.c | 150 ------------------------------------------------ 7 files changed, 175 deletions(-) delete mode 100644 contrib/80-ndctl.rules delete mode 100644 ndctl/ndctl-udev.c