diff mbox series

[LEDE-DEV,fstools] libfstools: add "const" to char pointer arguments in mount_move()

Message ID 20180416123012.16778-1-zajec5@gmail.com
State Accepted
Headers show
Series [LEDE-DEV,fstools] libfstools: add "const" to char pointer arguments in mount_move() | expand

Commit Message

Rafał Miłecki April 16, 2018, 12:30 p.m. UTC
From: Rafał Miłecki <rafal@milecki.pl>

That function never modifies these strings so it can/should use consts.
It makes it a bit more flexible as now callers can also pass consts.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 libfstools/libfstools.h | 2 +-
 libfstools/mount.c      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

John Crispin April 16, 2018, 1:20 p.m. UTC | #1
On 16/04/18 14:30, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
>
> That function never modifies these strings so it can/should use consts.
> It makes it a bit more flexible as now callers can also pass consts.
>
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>

> ---
>   libfstools/libfstools.h | 2 +-
>   libfstools/mount.c      | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libfstools/libfstools.h b/libfstools/libfstools.h
> index 0398c96..f27307a 100644
> --- a/libfstools/libfstools.h
> +++ b/libfstools/libfstools.h
> @@ -43,7 +43,7 @@ extern int mount_extroot(void);
>   extern int mount_snapshot(struct volume *v);
>   extern int mount_overlay(struct volume *v);
>   
> -extern int mount_move(char *oldroot, char *newroot, char *dir);
> +extern int mount_move(const char *oldroot, const char *newroot, const char *dir);
>   extern int pivot(char *new, char *old);
>   extern int fopivot(char *rw_root, char *ro_root);
>   extern int ramoverlay(void);
> diff --git a/libfstools/mount.c b/libfstools/mount.c
> index 4dc6e3a..c7f2789 100644
> --- a/libfstools/mount.c
> +++ b/libfstools/mount.c
> @@ -32,7 +32,7 @@ extern int pivot_root(const char *new_root, const char *put_old);
>    * @newroot: new directory for the mount point
>    */
>   int
> -mount_move(char *oldroot, char *newroot, char *dir)
> +mount_move(const char *oldroot, const char *newroot, const char *dir)
>   {
>   #ifndef MS_MOVE
>   #define MS_MOVE	(1 << 13)
diff mbox series

Patch

diff --git a/libfstools/libfstools.h b/libfstools/libfstools.h
index 0398c96..f27307a 100644
--- a/libfstools/libfstools.h
+++ b/libfstools/libfstools.h
@@ -43,7 +43,7 @@  extern int mount_extroot(void);
 extern int mount_snapshot(struct volume *v);
 extern int mount_overlay(struct volume *v);
 
-extern int mount_move(char *oldroot, char *newroot, char *dir);
+extern int mount_move(const char *oldroot, const char *newroot, const char *dir);
 extern int pivot(char *new, char *old);
 extern int fopivot(char *rw_root, char *ro_root);
 extern int ramoverlay(void);
diff --git a/libfstools/mount.c b/libfstools/mount.c
index 4dc6e3a..c7f2789 100644
--- a/libfstools/mount.c
+++ b/libfstools/mount.c
@@ -32,7 +32,7 @@  extern int pivot_root(const char *new_root, const char *put_old);
  * @newroot: new directory for the mount point
  */
 int
-mount_move(char *oldroot, char *newroot, char *dir)
+mount_move(const char *oldroot, const char *newroot, const char *dir)
 {
 #ifndef MS_MOVE
 #define MS_MOVE	(1 << 13)