Lines Matching refs:env
117 struct kobj_uevent_env *env = NULL; in kobject_action_args() local
128 env = kzalloc(sizeof(*env), GFP_KERNEL); in kobject_action_args()
129 if (!env) in kobject_action_args()
134 add_uevent_var(env, "SYNTH_UUID=%.*s", UUID_STRING_LEN, buf)) in kobject_action_args()
168 if (add_uevent_var(env, "SYNTH_ARG_%.*s=%.*s", in kobject_action_args()
176 kfree(env); in kobject_action_args()
178 *ret_env = env; in kobject_action_args()
197 struct kobj_uevent_env *env; in kobject_synth_uevent() local
213 count - (action_args - buf), &env); in kobject_synth_uevent()
222 r = kobject_uevent_env(kobj, action, env->envp); in kobject_synth_uevent()
223 kfree(env); in kobject_synth_uevent()
252 static int init_uevent_argv(struct kobj_uevent_env *env, const char *subsystem) in init_uevent_argv() argument
254 int buffer_size = sizeof(env->buf) - env->buflen; in init_uevent_argv()
257 len = strlcpy(&env->buf[env->buflen], subsystem, buffer_size); in init_uevent_argv()
264 env->argv[0] = uevent_helper; in init_uevent_argv()
265 env->argv[1] = &env->buf[env->buflen]; in init_uevent_argv()
266 env->argv[2] = NULL; in init_uevent_argv()
268 env->buflen += len + 1; in init_uevent_argv()
279 static struct sk_buff *alloc_uevent_skb(struct kobj_uevent_env *env, in alloc_uevent_skb() argument
290 skb = alloc_skb(len + env->buflen, GFP_KERNEL); in alloc_uevent_skb()
298 skb_put_data(skb, env->buf, env->buflen); in alloc_uevent_skb()
309 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()
343 struct kobj_uevent_env *env, in uevent_net_broadcast_tagged() argument
351 skb = alloc_uevent_skb(env, action_string, devpath); in uevent_net_broadcast_tagged()
382 struct kobj_uevent_env *env, in kobject_uevent_net_broadcast() argument
409 ret = uevent_net_broadcast_untagged(env, action_string, in kobject_uevent_net_broadcast()
412 ret = uevent_net_broadcast_tagged(net->uevent_sock->sk, env, in kobject_uevent_net_broadcast()
419 static void zap_modalias_env(struct kobj_uevent_env *env) in zap_modalias_env() argument
425 for (i = 0; i < env->envp_idx;) { in zap_modalias_env()
426 if (strncmp(env->envp[i], modalias_prefix, in zap_modalias_env()
432 len = strlen(env->envp[i]) + 1; in zap_modalias_env()
434 if (i != env->envp_idx - 1) { in zap_modalias_env()
435 memmove(env->envp[i], env->envp[i + 1], in zap_modalias_env()
436 env->buflen - len); in zap_modalias_env()
438 for (j = i; j < env->envp_idx - 1; j++) in zap_modalias_env()
439 env->envp[j] = env->envp[j + 1] - len; in zap_modalias_env()
442 env->envp_idx--; in zap_modalias_env()
443 env->buflen -= len; in zap_modalias_env()
460 struct kobj_uevent_env *env; in kobject_uevent_env() local
524 env = kzalloc(sizeof(struct kobj_uevent_env), GFP_KERNEL); in kobject_uevent_env()
525 if (!env) in kobject_uevent_env()
536 retval = add_uevent_var(env, "ACTION=%s", action_string); in kobject_uevent_env()
539 retval = add_uevent_var(env, "DEVPATH=%s", devpath); in kobject_uevent_env()
542 retval = add_uevent_var(env, "SUBSYSTEM=%s", subsystem); in kobject_uevent_env()
549 retval = add_uevent_var(env, "%s", envp_ext[i]); in kobject_uevent_env()
557 retval = uevent_ops->uevent(kobj, env); in kobject_uevent_env()
579 zap_modalias_env(env); in kobject_uevent_env()
588 retval = add_uevent_var(env, "SEQNUM=%llu", ++uevent_seqnum); in kobject_uevent_env()
593 retval = kobject_uevent_net_broadcast(kobj, env, action_string, in kobject_uevent_env()
602 retval = add_uevent_var(env, "HOME=/"); in kobject_uevent_env()
605 retval = add_uevent_var(env, in kobject_uevent_env()
609 retval = init_uevent_argv(env, subsystem); in kobject_uevent_env()
614 info = call_usermodehelper_setup(env->argv[0], env->argv, in kobject_uevent_env()
615 env->envp, GFP_KERNEL, in kobject_uevent_env()
616 NULL, cleanup_uevent_env, env); in kobject_uevent_env()
619 env = NULL; /* freed by cleanup_uevent_env */ in kobject_uevent_env()
626 kfree(env); in kobject_uevent_env()
654 int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...) in add_uevent_var() argument
659 if (env->envp_idx >= ARRAY_SIZE(env->envp)) { in add_uevent_var()
665 len = vsnprintf(&env->buf[env->buflen], in add_uevent_var()
666 sizeof(env->buf) - env->buflen, in add_uevent_var()
670 if (len >= (sizeof(env->buf) - env->buflen)) { in add_uevent_var()
675 env->envp[env->envp_idx++] = &env->buf[env->buflen]; in add_uevent_var()
676 env->buflen += len + 1; in add_uevent_var()