* Reparent an existing oid. */
| 894 | * Reparent an existing oid. |
| 895 | */ |
| 896 | int |
| 897 | sysctl_move_oid(struct sysctl_oid *oid, struct sysctl_oid_list *parent) |
| 898 | { |
| 899 | struct sysctl_oid *oidp; |
| 900 | |
| 901 | SYSCTL_WLOCK(); |
| 902 | if (oid->oid_parent == parent) { |
| 903 | SYSCTL_WUNLOCK(); |
| 904 | return (0); |
| 905 | } |
| 906 | oidp = sysctl_find_oidname(oid->oid_name, parent); |
| 907 | if (oidp != NULL) { |
| 908 | SYSCTL_WUNLOCK(); |
| 909 | return (EEXIST); |
| 910 | } |
| 911 | sysctl_unregister_oid(oid); |
| 912 | oid->oid_parent = parent; |
| 913 | oid->oid_number = OID_AUTO; |
| 914 | sysctl_register_oid(oid); |
| 915 | SYSCTL_WUNLOCK(); |
| 916 | return (0); |
| 917 | } |
| 918 | |
| 919 | /* |
| 920 | * Register the kernel's oids on startup. |
nothing calls this directly
no test coverage detected