aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOndrej Kozina <okozina@redhat.com>2023-12-13 15:10:30 +0100
committerOndrej Kozina <okozina@redhat.com>2023-12-13 15:16:02 +0100
commit997ef242a2975b321821219b4d8d72818805ad99 (patch)
tree1c61f42addbf65e4851162254be4b7b9ba050674
parentb869822c8b1efef36be24287498583b0c8b8ed2a (diff)
downloadcryptsetup-997ef242a2975b321821219b4d8d72818805ad99.tar.gz
opal: no need to export internal opal_enabled function.
-rw-r--r--lib/luks2/hw_opal/hw_opal.c49
-rw-r--r--lib/luks2/hw_opal/hw_opal.h1
2 files changed, 22 insertions, 28 deletions
diff --git a/lib/luks2/hw_opal/hw_opal.c b/lib/luks2/hw_opal/hw_opal.c
index 27068d20..18d89e6c 100644
--- a/lib/luks2/hw_opal/hw_opal.c
+++ b/lib/luks2/hw_opal/hw_opal.c
@@ -363,6 +363,28 @@ out:
return r;
}
+static int opal_query_status(struct crypt_device *cd, struct device *dev, unsigned expected)
+{
+ struct opal_status st = { };
+ int fd, r;
+
+ assert(cd);
+ assert(dev);
+
+ fd = device_open(cd, dev, O_RDONLY);
+ if (fd < 0)
+ return -EIO;
+
+ r = opal_ioctl(cd, fd, IOC_OPAL_GET_STATUS, &st);
+
+ return r < 0 ? -EINVAL : (st.flags & expected) ? 1 : 0;
+}
+
+static int opal_enabled(struct crypt_device *cd, struct device *dev)
+{
+ return opal_query_status(cd, dev, OPAL_FL_LOCKING_ENABLED);
+}
+
int opal_setup_ranges(struct crypt_device *cd,
struct device *dev,
const struct volume_key *vk,
@@ -855,33 +877,11 @@ out:
return r;
}
-static int opal_query_status(struct crypt_device *cd, struct device *dev, unsigned expected)
-{
- struct opal_status st = { };
- int fd, r;
-
- assert(cd);
- assert(dev);
-
- fd = device_open(cd, dev, O_RDONLY);
- if (fd < 0)
- return -EIO;
-
- r = opal_ioctl(cd, fd, IOC_OPAL_GET_STATUS, &st);
-
- return r < 0 ? -EINVAL : (st.flags & expected) ? 1 : 0;
-}
-
int opal_supported(struct crypt_device *cd, struct device *dev)
{
return opal_query_status(cd, dev, OPAL_FL_SUPPORTED|OPAL_FL_LOCKING_SUPPORTED);
}
-int opal_enabled(struct crypt_device *cd, struct device *dev)
-{
- return opal_query_status(cd, dev, OPAL_FL_LOCKING_ENABLED);
-}
-
int opal_geometry(struct crypt_device *cd,
struct device *dev,
bool *ret_align,
@@ -959,11 +959,6 @@ int opal_supported(struct crypt_device *cd, struct device *dev)
return -ENOTSUP;
}
-int opal_enabled(struct crypt_device *cd, struct device *dev)
-{
- return -ENOTSUP;
-}
-
int opal_factory_reset(struct crypt_device *cd,
struct device *dev,
const char *password,
diff --git a/lib/luks2/hw_opal/hw_opal.h b/lib/luks2/hw_opal/hw_opal.h
index d4701600..c13dd368 100644
--- a/lib/luks2/hw_opal/hw_opal.h
+++ b/lib/luks2/hw_opal/hw_opal.h
@@ -38,7 +38,6 @@ int opal_unlock(struct crypt_device *cd,
uint32_t segment_number,
const struct volume_key *vk);
int opal_supported(struct crypt_device *cd, struct device *dev);
-int opal_enabled(struct crypt_device *cd, struct device *dev);
int opal_factory_reset(struct crypt_device *cd,
struct device *dev,
const char *password,