PERFORCE change 121118 for review
Peter Wemm
peter at FreeBSD.org
Thu Jun 7 02:31:36 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=121118
Change 121118 by peter at peter_daintree on 2007/06/07 02:30:32
Add sysctl_rename_oid() (to support the device tree nodes that renumber
themselves during an attach. eg: sio_pci and sio_puc)
Affected files ...
.. //depot/projects/hammer/sys/kern/kern_sysctl.c#30 edit
.. //depot/projects/hammer/sys/sys/sysctl.h#33 edit
Differences ...
==== //depot/projects/hammer/sys/kern/kern_sysctl.c#30 (text+ko) ====
@@ -415,6 +415,25 @@
}
/*
+ * Rename an existing oid.
+ */
+void
+sysctl_rename_oid(struct sysctl_oid *oidp, const char *name)
+{
+ ssize_t len;
+ char *newname;
+ void *oldname;
+
+ oldname = (void *)(uintptr_t)(const void *)oidp->oid_name;
+ len = strlen(name);
+ newname = malloc(len + 1, M_SYSCTLOID, M_WAITOK);
+ bcopy(name, newname, len + 1);
+ newname[len] = '\0';
+ oidp->oid_name = newname;
+ free(oldname, M_SYSCTLOID);
+}
+
+/*
* Reparent an existing oid.
*/
int
==== //depot/projects/hammer/sys/sys/sysctl.h#33 (text+ko) ====
@@ -646,6 +646,7 @@
int kind, void *arg1, int arg2,
int (*handler) (SYSCTL_HANDLER_ARGS),
const char *fmt, const char *descr);
+void sysctl_rename_oid(struct sysctl_oid *oidp, const char *name);
int sysctl_move_oid(struct sysctl_oid *oidp,
struct sysctl_oid_list *parent);
int sysctl_remove_oid(struct sysctl_oid *oidp, int del, int recurse);
More information about the p4-projects
mailing list