Skip to contentSkip to conversation

fault-inject: Declare the second argument of setup_fault_attr() const

PATCH In review Bart Van Assche 2 participants 3 messages Jul 8, 2021 – Jul 29, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fault-inject: Declare the second argument of setup_fault_attr() const

This patch makes it possible to pass a const char * argument to setup_fault_attr() without having to cast away constness.

---
 include/linux/fault-inject.h | 2 +-
 lib/fault-inject.c           | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
include/linux/fault-inject.h +1 -1
index e525f6957c49..afc649f0102b 100644
@@ -42,7 +42,7 @@ struct fault_attr {
 	}
 
 #define DECLARE_FAULT_ATTR(name) struct fault_attr name = FAULT_ATTR_INITIALIZER
-int setup_fault_attr(struct fault_attr *attr, char *str);
+int setup_fault_attr(struct fault_attr *attr, const char *str);
 bool should_fail(struct fault_attr *attr, ssize_t size);
 
 #ifdef CONFIG_FAULT_INJECTION_DEBUG_FS
lib/fault-inject.c +1 -1
index ce12621b4275..45520151b32d 100644
@@ -15,7 +15,7 @@
  * setup_fault_attr() is a helper function for various __setup handlers, so it
  * returns 0 on error, because that is what __setup handlers do.
  */
-int setup_fault_attr(struct fault_attr *attr, char *str)
+int setup_fault_attr(struct fault_attr *attr, const char *str)
 {
 	unsigned long probability;
 	unsigned long interval;
#1 lore raw
Quoted 28 lines · Bart Van Assche

This patch makes it possible to pass a const char * argument to setup_fault_attr() without having to cast away constness.

---
  include/linux/fault-inject.h | 2 +-
  lib/fault-inject.c           | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
include/linux/fault-inject.h +1 -1
index e525f6957c49..afc649f0102b 100644
@@ -42,7 +42,7 @@ struct fault_attr {
  	}
 
  #define DECLARE_FAULT_ATTR(name) struct fault_attr name = FAULT_ATTR_INITIALIZER
-int setup_fault_attr(struct fault_attr *attr, char *str);
+int setup_fault_attr(struct fault_attr *attr, const char *str);
  bool should_fail(struct fault_attr *attr, ssize_t size);
 
  #ifdef CONFIG_FAULT_INJECTION_DEBUG_FS
lib/fault-inject.c +0 -0
index ce12621b4275..45520151b32d 100644

lib/fault-inject.c line 21

Quoted 8 lines
lib/fault-inject.c +1 -1
@@ -15,7 +15,7 @@
   * setup_fault_attr() is a helper function for various __setup handlers, so it
   * returns 0 on error, because that is what __setup handlers do.
   */
-int setup_fault_attr(struct fault_attr *attr, char *str)
+int setup_fault_attr(struct fault_attr *attr, const char *str)
  {
  	unsigned long probability;
  	unsigned long interval;

Hi Akinobu,

Did I send this patch to the right person?

Thanks,

Bart.

maintainer Reviewed-by
#2 lore raw

2021年7月29日(木) 8:05 Bart Van Assche <[email protected]>:

Quoted 41 lines · Bart Van Assche
Quoted 28 lines

This patch makes it possible to pass a const char * argument to setup_fault_attr() without having to cast away constness.

---
  include/linux/fault-inject.h | 2 +-
  lib/fault-inject.c           | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
include/linux/fault-inject.h +1 -1
index e525f6957c49..afc649f0102b 100644
@@ -42,7 +42,7 @@ struct fault_attr {
      }
 
  #define DECLARE_FAULT_ATTR(name) struct fault_attr name = FAULT_ATTR_INITIALIZER
-int setup_fault_attr(struct fault_attr *attr, char *str);
+int setup_fault_attr(struct fault_attr *attr, const char *str);
  bool should_fail(struct fault_attr *attr, ssize_t size);
 
  #ifdef CONFIG_FAULT_INJECTION_DEBUG_FS
lib/fault-inject.c +0 -0
index ce12621b4275..45520151b32d 100644

lib/fault-inject.c line 21

Quoted 8 lines
lib/fault-inject.c +1 -1
@@ -15,7 +15,7 @@
   * setup_fault_attr() is a helper function for various __setup handlers, so it
   * returns 0 on error, because that is what __setup handlers do.
   */
-int setup_fault_attr(struct fault_attr *attr, char *str)
+int setup_fault_attr(struct fault_attr *attr, const char *str)
  {
      unsigned long probability;
      unsigned long interval;

Hi Akinobu,

Quoted 1 line

Did I send this patch to the right person?

The fault injection patches are usually merged through the -mm tree. Could you send this with CCing Andrew?

This patch looks good to me.