| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 02608be commit 8b82528
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -47,9 +47,6 @@ struct kernel_param_ops { | |||
| 47 | 47 | void (*free)(void *arg); | |
| 48 | 48 | }; | |
| 49 | 49 | ||
| 50 | - /* Flag bits for kernel_param.flags */ | ||
| 51 | - #define KPARAM_ISBOOL 2 | ||
| 52 | - | ||
| 53 | 50 | struct kernel_param { | |
| 54 | 51 | const char *name; | |
| 55 | 52 | const struct kernel_param_ops *ops; | |
@@ -131,8 +128,7 @@ struct kparam_array | |||
| 131 | 128 | * The ops can have NULL set or get functions. | |
| 132 | 129 | */ | |
| 133 | 130 | #define module_param_cb(name, ops, arg, perm) \ | |
| 134 | - __module_param_call(MODULE_PARAM_PREFIX, \ | ||
| 135 | - name, ops, arg, __same_type((arg), bool *), perm) | ||
| 131 | + __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm) | ||
| 136 | 132 | ||
| 137 | 133 | /* On alpha, ia64 and ppc64 relocations to global data cannot go into | |
| 138 | 134 | read-only sections (which is part of respective UNIX ABI on these | |
@@ -146,7 +142,7 @@ struct kparam_array | |||
| 146 | 142 | ||
| 147 | 143 | /* This is the fundamental function for registering boot/module | |
| 148 | 144 | parameters. */ | |
| 149 | - #define __module_param_call(prefix, name, ops, arg, isbool, perm) \ | ||
| 145 | + #define __module_param_call(prefix, name, ops, arg, perm) \ | ||
| 150 | 146 | /* Default value instead of permissions? */ \ | |
| 151 | 147 | static int __param_perm_check_##name __attribute__((unused)) = \ | |
| 152 | 148 | BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \ | |
@@ -155,16 +151,14 @@ struct kparam_array | |||
| 155 | 151 | static struct kernel_param __moduleparam_const __param_##name \ | |
| 156 | 152 | __used \ | |
| 157 | 153 | __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ | |
| 158 | - = { __param_str_##name, ops, perm, isbool ? KPARAM_ISBOOL : 0, \ | ||
| 159 | - { arg } } | ||
| 154 | + = { __param_str_##name, ops, perm, 0, { arg } } | ||
| 160 | 155 | ||
| 161 | 156 | /* Obsolete - use module_param_cb() */ | |
| 162 | 157 | #define module_param_call(name, set, get, arg, perm) \ | |
| 163 | 158 | static struct kernel_param_ops __param_ops_##name = \ | |
| 164 | 159 | { (void *)set, (void *)get }; \ | |
| 165 | 160 | __module_param_call(MODULE_PARAM_PREFIX, \ | |
| 166 | 161 | name, &__param_ops_##name, arg, \ | |
| 167 | - __same_type(arg, bool *), \ | ||
| 168 | 162 | (perm) + sizeof(__check_old_set_param(set))*0) | |
| 169 | 163 | ||
| 170 | 164 | /* We don't get oldget: it's often a new-style param_get_uint, etc. */ | |
@@ -245,8 +239,7 @@ static inline void __kernel_param_unlock(void) | |||
| 245 | 239 | */ | |
| 246 | 240 | #define core_param(name, var, type, perm) \ | |
| 247 | 241 | param_check_##type(name, &(var)); \ | |
| 248 | - __module_param_call("", name, ¶m_ops_##type, \ | ||
| 249 | - &var, __same_type(var, bool), perm) | ||
| 242 | + __module_param_call("", name, ¶m_ops_##type, &var, perm) | ||
| 250 | 243 | #endif /* !MODULE */ | |
| 251 | 244 | ||
| 252 | 245 | /** | |
@@ -264,7 +257,7 @@ static inline void __kernel_param_unlock(void) | |||
| 264 | 257 | = { len, string }; \ | |
| 265 | 258 | __module_param_call(MODULE_PARAM_PREFIX, name, \ | |
| 266 | 259 | ¶m_ops_string, \ | |
| 267 | - .str = &__param_string_##name, 0, perm); \ | ||
| 260 | + .str = &__param_string_##name, perm); \ | ||
| 268 | 261 | __MODULE_PARM_TYPE(name, "string") | |
| 269 | 262 | ||
| 270 | 263 | /** | |
@@ -403,7 +396,7 @@ extern int param_set_bint(const char *val, const struct kernel_param *kp); | |||
| 403 | 396 | __module_param_call(MODULE_PARAM_PREFIX, name, \ | |
| 404 | 397 | ¶m_array_ops, \ | |
| 405 | 398 | .arr = &__param_arr_##name, \ | |
| 406 | - __same_type(array[0], bool), perm); \ | ||
| 399 | + perm); \ | ||
| 407 | 400 | __MODULE_PARM_TYPE(name, "array of " #type) | |
| 408 | 401 | ||
| 409 | 402 | extern struct kernel_param_ops param_array_ops; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -297,35 +297,18 @@ EXPORT_SYMBOL(param_ops_charp); | |||
| 297 | 297 | /* Actually could be a bool or an int, for historical reasons. */ | |
| 298 | 298 | int param_set_bool(const char *val, const struct kernel_param *kp) | |
| 299 | 299 | { | |
| 300 | - bool v; | ||
| 301 | - int ret; | ||
| 302 | - | ||
| 303 | 300 | /* No equals means "set"... */ | |
| 304 | 301 | if (!val) val = "1"; | |
| 305 | 302 | ||
| 306 | 303 | /* One of =[yYnN01] */ | |
| 307 | - ret = strtobool(val, &v); | ||
| 308 | - if (ret) | ||
| 309 | - return ret; | ||
| 310 | - | ||
| 311 | - if (kp->flags & KPARAM_ISBOOL) | ||
| 312 | - *(bool *)kp->arg = v; | ||
| 313 | - else | ||
| 314 | - *(int *)kp->arg = v; | ||
| 315 | - return 0; | ||
| 304 | + return strtobool(val, kp->arg); | ||
| 316 | 305 | } | |
| 317 | 306 | EXPORT_SYMBOL(param_set_bool); | |
| 318 | 307 | ||
| 319 | 308 | int param_get_bool(char *buffer, const struct kernel_param *kp) | |
| 320 | 309 | { | |
| 321 | - bool val; | ||
| 322 | - if (kp->flags & KPARAM_ISBOOL) | ||
| 323 | - val = *(bool *)kp->arg; | ||
| 324 | - else | ||
| 325 | - val = *(int *)kp->arg; | ||
| 326 | - | ||
| 327 | 310 | /* Y and N chosen as being relatively non-coder friendly */ | |
| 328 | - return sprintf(buffer, "%c", val ? 'Y' : 'N'); | ||
| 311 | + return sprintf(buffer, "%c", *(bool *)kp->arg ? 'Y' : 'N'); | ||
| 329 | 312 | } | |
| 330 | 313 | EXPORT_SYMBOL(param_get_bool); | |
| 331 | 314 | ||
@@ -343,7 +326,6 @@ int param_set_invbool(const char *val, const struct kernel_param *kp) | |||
| 343 | 326 | struct kernel_param dummy; | |
| 344 | 327 | ||
| 345 | 328 | dummy.arg = &boolval; | |
| 346 | - dummy.flags = KPARAM_ISBOOL; | ||
| 347 | 329 | ret = param_set_bool(val, &dummy); | |
| 348 | 330 | if (ret == 0) | |
| 349 | 331 | *(bool *)kp->arg = !boolval; | |
@@ -372,7 +354,6 @@ int param_set_bint(const char *val, const struct kernel_param *kp) | |||
| 372 | 354 | /* Match bool exactly, by re-using it. */ | |
| 373 | 355 | boolkp = *kp; | |
| 374 | 356 | boolkp.arg = &v; | |
| 375 | - boolkp.flags |= KPARAM_ISBOOL; | ||
| 376 | 357 | ||
| 377 | 358 | ret = param_set_bool(val, &boolkp); | |
| 378 | 359 | if (ret == 0) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments