Lines Matching full:env
116 struct kobj_uevent_env *env = NULL; in kobject_action_args() local
127 env = kzalloc(sizeof(*env), GFP_KERNEL); in kobject_action_args()
128 if (!env) in kobject_action_args()
133 add_uevent_var(env, "SYNTH_UUID=%.*s", UUID_STRING_LEN, buf)) in kobject_action_args()
167 if (add_uevent_var(env, "SYNTH_ARG_%.*s=%.*s", in kobject_action_args()
175 kfree(env); in kobject_action_args()
177 *ret_env = env; in kobject_action_args()
196 struct kobj_uevent_env *env; in kobject_synth_uevent() local
212 count - (action_args - buf), &env); in kobject_synth_uevent()
221 r = kobject_uevent_env(kobj, action, env->envp); in kobject_synth_uevent()
222 kfree(env); in kobject_synth_uevent()
251 static int init_uevent_argv(struct kobj_uevent_env *env, const char *subsystem) in init_uevent_argv() argument
253 int buffer_size = sizeof(env->buf) - env->buflen; in init_uevent_argv()
256 len = strscpy(&env->buf[env->buflen], subsystem, buffer_size); in init_uevent_argv()
263 env->argv[0] = uevent_helper; in init_uevent_argv()
264 env->argv[1] = &env->buf[env->buflen]; in init_uevent_argv()
265 env->argv[2] = NULL; in init_uevent_argv()
267 env->buflen += len + 1; in init_uevent_argv()
278 static struct sk_buff *alloc_uevent_skb(struct kobj_uevent_env *env, in alloc_uevent_skb() argument
289 skb = alloc_skb(len + env->buflen, GFP_KERNEL); in alloc_uevent_skb()
297 skb_put_data(skb, env->buf, env->buflen); in alloc_uevent_skb()
308 static int uevent_net_broadcast_untagged(struct kobj_uevent_env *env, in uevent_net_broadcast_untagged() argument
326 skb = alloc_uevent_skb(env, action_string, devpath); in uevent_net_broadcast_untagged()
344 struct kobj_uevent_env *env, in uevent_net_broadcast_tagged() argument
352 skb = alloc_uevent_skb(env, action_string, devpath); in uevent_net_broadcast_tagged()
383 struct kobj_uevent_env *env, in kobject_uevent_net_broadcast() argument
410 ret = uevent_net_broadcast_untagged(env, action_string, in kobject_uevent_net_broadcast()
413 ret = uevent_net_broadcast_tagged(net->uevent_sock->sk, env, in kobject_uevent_net_broadcast()
420 static void zap_modalias_env(struct kobj_uevent_env *env) in zap_modalias_env() argument
426 for (i = 0; i < env->envp_idx;) { in zap_modalias_env()
427 if (strncmp(env->envp[i], modalias_prefix, in zap_modalias_env()
433 len = strlen(env->envp[i]) + 1; in zap_modalias_env()
435 if (i != env->envp_idx - 1) { in zap_modalias_env()
436 /* @env->envp[] contains pointers to @env->buf[] in zap_modalias_env()
437 * with @env->buflen chars, and we are removing in zap_modalias_env()
438 * variable MODALIAS here pointed by @env->envp[i] in zap_modalias_env()
441 * 0 @env->buf[] @env->buflen in zap_modalias_env()
445 * @env->envp[0] @env->envp[i] @env->envp[i + 1] in zap_modalias_env()
449 * @env->buflen - (@env->envp[i + 1] - @env->envp[0]). in zap_modalias_env()
451 memmove(env->envp[i], env->envp[i + 1], in zap_modalias_env()
452 env->buflen - (env->envp[i + 1] - env->envp[0])); in zap_modalias_env()
454 for (j = i; j < env->envp_idx - 1; j++) in zap_modalias_env()
455 env->envp[j] = env->envp[j + 1] - len; in zap_modalias_env()
458 env->envp_idx--; in zap_modalias_env()
459 env->buflen -= len; in zap_modalias_env()
476 struct kobj_uevent_env *env; in kobject_uevent_env() local
540 env = kzalloc(sizeof(struct kobj_uevent_env), GFP_KERNEL); in kobject_uevent_env()
541 if (!env) in kobject_uevent_env()
552 retval = add_uevent_var(env, "ACTION=%s", action_string); in kobject_uevent_env()
555 retval = add_uevent_var(env, "DEVPATH=%s", devpath); in kobject_uevent_env()
558 retval = add_uevent_var(env, "SUBSYSTEM=%s", subsystem); in kobject_uevent_env()
565 retval = add_uevent_var(env, "%s", envp_ext[i]); in kobject_uevent_env()
573 retval = uevent_ops->uevent(kobj, env); in kobject_uevent_env()
595 zap_modalias_env(env); in kobject_uevent_env()
603 retval = add_uevent_var(env, "SEQNUM=%llu", in kobject_uevent_env()
608 retval = kobject_uevent_net_broadcast(kobj, env, action_string, in kobject_uevent_env()
616 retval = add_uevent_var(env, "HOME=/"); in kobject_uevent_env()
619 retval = add_uevent_var(env, in kobject_uevent_env()
623 retval = init_uevent_argv(env, subsystem); in kobject_uevent_env()
628 info = call_usermodehelper_setup(env->argv[0], env->argv, in kobject_uevent_env()
629 env->envp, GFP_KERNEL, in kobject_uevent_env()
630 NULL, cleanup_uevent_env, env); in kobject_uevent_env()
633 env = NULL; /* freed by cleanup_uevent_env */ in kobject_uevent_env()
640 kfree(env); in kobject_uevent_env()
662 * @env: environment buffer structure
668 int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...) in add_uevent_var() argument
673 if (env->envp_idx >= ARRAY_SIZE(env->envp)) { in add_uevent_var()
679 len = vsnprintf(&env->buf[env->buflen], in add_uevent_var()
680 sizeof(env->buf) - env->buflen, in add_uevent_var()
684 if (len >= (sizeof(env->buf) - env->buflen)) { in add_uevent_var()
689 env->envp[env->envp_idx++] = &env->buf[env->buflen]; in add_uevent_var()
690 env->buflen += len + 1; in add_uevent_var()