root/tools/testing/nvdimm/dimm_devs.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. security_show

   1 // SPDX-License-Identifier: GPL-2.0
   2 /* Copyright Intel Corp. 2018 */
   3 #include <linux/init.h>
   4 #include <linux/module.h>
   5 #include <linux/moduleparam.h>
   6 #include <linux/nd.h>
   7 #include "pmem.h"
   8 #include "pfn.h"
   9 #include "nd.h"
  10 #include "nd-core.h"
  11 
  12 ssize_t security_show(struct device *dev,
  13                 struct device_attribute *attr, char *buf)
  14 {
  15         struct nvdimm *nvdimm = to_nvdimm(dev);
  16 
  17         /*
  18          * For the test version we need to poll the "hardware" in order
  19          * to get the updated status for unlock testing.
  20          */
  21         nvdimm->sec.flags = nvdimm_security_flags(nvdimm, NVDIMM_USER);
  22 
  23         if (test_bit(NVDIMM_SECURITY_DISABLED, &nvdimm->sec.flags))
  24                 return sprintf(buf, "disabled\n");
  25         if (test_bit(NVDIMM_SECURITY_UNLOCKED, &nvdimm->sec.flags))
  26                 return sprintf(buf, "unlocked\n");
  27         if (test_bit(NVDIMM_SECURITY_LOCKED, &nvdimm->sec.flags))
  28                 return sprintf(buf, "locked\n");
  29         return -ENOTTY;
  30 }

/* [<][>][^][v][top][bottom][index][help] */