mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
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:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user