No more callers (and I don't think it works anyway).
Signed-off-by: Sage Weil <sage@redhat.com>
return ioctl(fd, BLKDISCARD, range);
}
-bool BlkDev::is_nvme() const
-{
- char vendor[80];
- // nvme has a device/device/vendor property; infer from that. There is
- // probably a better way?
- int r = get_string_property(BLKDEV_PROP_VENDOR, vendor, 80);
- return (r == 0);
-}
-
bool BlkDev::is_rotational() const
{
return get_int_property(BLKDEV_PROP_ROTATIONAL) > 0;
return -EOPNOTSUPP;
}
-bool BlkDev::is_nvme() const
-{
- return false;
-}
-
bool BlkDev::is_rotational() const
{
return false;
return -EOPNOTSUPP;
}
-bool BlkDev::is_nvme() const
-{
- // FreeBSD doesn't have a good way to tell if a device's underlying protocol
- // is NVME, especially since multiple GEOM transforms may be involved. So
- // we'll just guess based on the device name.
- struct fiodgname_arg arg;
- const char *nda = "nda"; //CAM-based attachment
- const char *nvd = "nvd"; //CAM-less attachment
- char devname[PATH_MAX];
-
- arg.buf = devname;
- arg.len = sizeof(devname);
- if (ioctl(fd, FIODGNAME, &arg) < 0)
- return false; //When in doubt, it's probably not NVME
-
- return (strncmp(nvd, devname, strlen(nvd)) == 0 ||
- strncmp(nda, devname, strlen(nda)) == 0);
-}
-
bool BlkDev::is_rotational() const
{
#if __FreeBSD_version >= 1200049
return -EOPNOTSUPP;
}
-bool BlkDev::is_nvme(const char *devname) const
-{
- return false;
-}
-
bool BlkDev::is_rotational(const char *devname) const
{
return false;
int partition(char* partition, size_t max) const;
// from a device (e.g., "sdb")
bool support_discard() const;
- bool is_nvme() const;
bool is_rotational() const;
int get_numa_node(int *node) const;
int dev(char *dev, size_t max) const;
blkdev.serial(buffer, sizeof(buffer));
(*pm)[prefix + "serial"] = buffer;
- if (blkdev.is_nvme())
- (*pm)[prefix + "type"] = "nvme";
} else {
(*pm)[prefix + "access_mode"] = "file";
(*pm)[prefix + "path"] = path;
EXPECT_TRUE(sdb.support_discard());
}
-TEST_F(BlockDevTest, is_nvme)
-{
- // It would be nice to have a positive NVME test too, but I don't have any
- // examples for the canned data.
- EXPECT_FALSE(sda.is_nvme());
- EXPECT_FALSE(sdb.is_nvme());
-}
-
TEST_F(BlockDevTest, is_rotational)
{
EXPECT_FALSE(sda.is_rotational());
discard_support = blkdev.support_discard();
- nvme = blkdev.is_nvme();
-
rotational = blkdev.is_rotational();
if ((ret = blkdev.dev(dev, BUFSIZE)) < 0) {
fprintf(stdout, "Size:\t\t%" PRId64 "\n", size);
fprintf(stdout, "Discard:\t%s\n",
discard_support ? "supported" : "not supported");
- fprintf(stdout, "NVME:\t\t%s\n", nvme ? "yes" : "no");
fprintf(stdout, "Rotational:\t%s\n", rotational ? "yes" : "no");
fprintf(stdout, "Dev:\t\t%s\n", dev);
fprintf(stdout, "Whole disk:\t%s\n", wholedisk);