Lines Matching refs:swnreg
76 static int cifs_swn_send_register_message(struct cifs_swn_reg *swnreg) in cifs_swn_send_register_message() argument
96 ret = nla_put_u32(skb, CIFS_GENL_ATTR_SWN_REGISTRATION_ID, swnreg->id); in cifs_swn_send_register_message()
100 ret = nla_put_string(skb, CIFS_GENL_ATTR_SWN_NET_NAME, swnreg->net_name); in cifs_swn_send_register_message()
104 ret = nla_put_string(skb, CIFS_GENL_ATTR_SWN_SHARE_NAME, swnreg->share_name); in cifs_swn_send_register_message()
114 if (swnreg->tcon->ses->server->use_swn_dstaddr) in cifs_swn_send_register_message()
115 addr = &swnreg->tcon->ses->server->swn_dstaddr; in cifs_swn_send_register_message()
117 addr = &swnreg->tcon->ses->server->dstaddr; in cifs_swn_send_register_message()
123 if (swnreg->net_name_notify) { in cifs_swn_send_register_message()
129 if (swnreg->share_name_notify) { in cifs_swn_send_register_message()
135 if (swnreg->ip_notify) { in cifs_swn_send_register_message()
141 authtype = cifs_select_sectype(swnreg->tcon->ses->server, swnreg->tcon->ses->sectype); in cifs_swn_send_register_message()
144 ret = cifs_swn_auth_info_krb(swnreg->tcon, skb); in cifs_swn_send_register_message()
152 ret = cifs_swn_auth_info_ntlm(swnreg->tcon, skb); in cifs_swn_send_register_message()
168 swnreg->net_name, swnreg->id); in cifs_swn_send_register_message()
182 static int cifs_swn_send_unregister_message(struct cifs_swn_reg *swnreg) in cifs_swn_send_unregister_message() argument
198 ret = nla_put_u32(skb, CIFS_GENL_ATTR_SWN_REGISTRATION_ID, swnreg->id); in cifs_swn_send_unregister_message()
202 ret = nla_put_string(skb, CIFS_GENL_ATTR_SWN_NET_NAME, swnreg->net_name); in cifs_swn_send_unregister_message()
206 ret = nla_put_string(skb, CIFS_GENL_ATTR_SWN_SHARE_NAME, swnreg->share_name); in cifs_swn_send_unregister_message()
211 &swnreg->tcon->ses->server->dstaddr); in cifs_swn_send_unregister_message()
215 if (swnreg->net_name_notify) { in cifs_swn_send_unregister_message()
221 if (swnreg->share_name_notify) { in cifs_swn_send_unregister_message()
227 if (swnreg->ip_notify) { in cifs_swn_send_unregister_message()
237 swnreg->net_name, swnreg->id); in cifs_swn_send_unregister_message()
254 struct cifs_swn_reg *swnreg; in cifs_find_swn_reg() local
280 idr_for_each_entry(&cifs_swnreg_idr, swnreg, id) { in cifs_find_swn_reg()
281 if (strcasecmp(swnreg->net_name, net_name) != 0 in cifs_find_swn_reg()
282 || strcasecmp(swnreg->share_name, share_name) != 0) { in cifs_find_swn_reg()
286 cifs_dbg(FYI, "Existing swn registration for %s:%s found\n", swnreg->net_name, in cifs_find_swn_reg()
287 swnreg->share_name); in cifs_find_swn_reg()
292 return swnreg; in cifs_find_swn_reg()
374 struct cifs_swn_reg *swnreg = container_of(ref, struct cifs_swn_reg, ref_count); in cifs_swn_reg_release() local
377 ret = cifs_swn_send_unregister_message(swnreg); in cifs_swn_reg_release()
381 idr_remove(&cifs_swnreg_idr, swnreg->id); in cifs_swn_reg_release()
382 kfree(swnreg->net_name); in cifs_swn_reg_release()
383 kfree(swnreg->share_name); in cifs_swn_reg_release()
384 kfree(swnreg); in cifs_swn_reg_release()
387 static void cifs_put_swn_reg(struct cifs_swn_reg *swnreg) in cifs_put_swn_reg() argument
390 kref_put(&swnreg->ref_count, cifs_swn_reg_release); in cifs_put_swn_reg()
394 static int cifs_swn_resource_state_changed(struct cifs_swn_reg *swnreg, const char *name, int state) in cifs_swn_resource_state_changed() argument
399 cifs_signal_cifsd_for_reconnect(swnreg->tcon->ses->server, true); in cifs_swn_resource_state_changed()
403 cifs_signal_cifsd_for_reconnect(swnreg->tcon->ses->server, true); in cifs_swn_resource_state_changed()
509 static int cifs_swn_client_move(struct cifs_swn_reg *swnreg, struct sockaddr_storage *addr) in cifs_swn_client_move() argument
519 return cifs_swn_reconnect(swnreg->tcon, addr); in cifs_swn_client_move()
524 struct cifs_swn_reg *swnreg; in cifs_swn_notify() local
533 swnreg = idr_find(&cifs_swnreg_idr, swnreg_id); in cifs_swn_notify()
535 if (swnreg == NULL) { in cifs_swn_notify()
568 return cifs_swn_resource_state_changed(swnreg, name, state); in cifs_swn_notify()
579 return cifs_swn_client_move(swnreg, &addr); in cifs_swn_notify()
591 struct cifs_swn_reg *swnreg; in cifs_swn_register() local
594 swnreg = cifs_get_swn_reg(tcon); in cifs_swn_register()
595 if (IS_ERR(swnreg)) in cifs_swn_register()
596 return PTR_ERR(swnreg); in cifs_swn_register()
598 ret = cifs_swn_send_register_message(swnreg); in cifs_swn_register()
609 struct cifs_swn_reg *swnreg; in cifs_swn_unregister() local
613 swnreg = cifs_find_swn_reg(tcon); in cifs_swn_unregister()
614 if (IS_ERR(swnreg)) { in cifs_swn_unregister()
616 return PTR_ERR(swnreg); in cifs_swn_unregister()
621 cifs_put_swn_reg(swnreg); in cifs_swn_unregister()
628 struct cifs_swn_reg *swnreg; in cifs_swn_dump() local
636 idr_for_each_entry(&cifs_swnreg_idr, swnreg, id) { in cifs_swn_dump()
638 id, kref_read(&swnreg->ref_count), in cifs_swn_dump()
639 swnreg->net_name, swnreg->net_name_notify ? "(y)" : "(n)", in cifs_swn_dump()
640 swnreg->share_name, swnreg->share_name_notify ? "(y)" : "(n)"); in cifs_swn_dump()
641 switch (swnreg->tcon->ses->server->dstaddr.ss_family) { in cifs_swn_dump()
643 sa = (struct sockaddr_in *) &swnreg->tcon->ses->server->dstaddr; in cifs_swn_dump()
647 sa6 = (struct sockaddr_in6 *) &swnreg->tcon->ses->server->dstaddr; in cifs_swn_dump()
655 seq_printf(m, "%s", swnreg->ip_notify ? "(y)" : "(n)"); in cifs_swn_dump()
663 struct cifs_swn_reg *swnreg; in cifs_swn_check() local
668 idr_for_each_entry(&cifs_swnreg_idr, swnreg, id) { in cifs_swn_check()
669 ret = cifs_swn_send_register_message(swnreg); in cifs_swn_check()