libzfs: constify zfs_strip_partition(), zfs_strip_path()

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13413
This commit is contained in:
наб
2022-05-03 19:56:12 +02:00
committed by Brian Behlendorf
parent ca3b105cd9
commit 5ac80603bd
5 changed files with 17 additions and 14 deletions
@@ -40,7 +40,7 @@
* Note: The caller must free the returned string.
*/
char *
zfs_strip_partition(char *dev)
zfs_strip_partition(const char *dev)
{
return (strdup(dev));
}
@@ -56,8 +56,8 @@ zfs_append_partition(char *path, size_t max_len)
* On FreeBSD we only want to remove "/dev/" from the beginning of
* paths if present.
*/
char *
zfs_strip_path(char *path)
const char *
zfs_strip_path(const char *path)
{
if (strncmp(path, _PATH_DEV, sizeof (_PATH_DEV) - 1) == 0)
return (path + sizeof (_PATH_DEV) - 1);
+4 -4
View File
@@ -81,7 +81,7 @@ zfs_append_partition(char *path, size_t max_len)
* caller must free the returned string
*/
char *
zfs_strip_partition(char *path)
zfs_strip_partition(const char *path)
{
char *tmp = strdup(path);
char *part = NULL, *d = NULL;
@@ -117,7 +117,7 @@ zfs_strip_partition(char *path)
* Returned string must be freed.
*/
static char *
zfs_strip_partition_path(char *path)
zfs_strip_partition_path(const char *path)
{
char *newpath = strdup(path);
char *sd_offset;
@@ -148,8 +148,8 @@ zfs_strip_partition_path(char *path)
/*
* Strip the unwanted portion of a device path.
*/
char *
zfs_strip_path(char *path)
const char *
zfs_strip_path(const char *path)
{
return (strrchr(path, '/') + 1);
}