svn commit: r211265 - in projects/ofed/head/sys: dev/hptmv kern sys
Jeff Roberson
jeff at FreeBSD.org
Fri Aug 13 03:15:02 UTC 2010
Author: jeff
Date: Fri Aug 13 03:15:02 2010
New Revision: 211265
URL: http://svn.freebsd.org/changeset/base/211265
Log:
- Change sysctl arg2 to a intptr_t preserving the sign and expanding the
size so it can optionally hold a pointer.
Sponsored by: Isilon Systems, iX Systems, and Panasas.
Modified:
projects/ofed/head/sys/dev/hptmv/hptproc.c
projects/ofed/head/sys/kern/kern_jail.c
projects/ofed/head/sys/kern/kern_sysctl.c
projects/ofed/head/sys/sys/jail.h
projects/ofed/head/sys/sys/sysctl.h
Modified: projects/ofed/head/sys/dev/hptmv/hptproc.c
==============================================================================
--- projects/ofed/head/sys/dev/hptmv/hptproc.c Fri Aug 13 03:14:08 2010 (r211264)
+++ projects/ofed/head/sys/dev/hptmv/hptproc.c Fri Aug 13 03:15:02 2010 (r211265)
@@ -51,8 +51,8 @@ int hpt_rescan_all(void);
static char hptproc_buffer[256];
extern char DRIVER_VERSION[];
-#define FORMAL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, int arg2, \
- struct sysctl_req *req
+#define FORMAL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, \
+ intptr_t arg2, struct sysctl_req *req
#define REAL_HANDLER_ARGS oidp, arg1, arg2, req
typedef struct sysctl_req HPT_GET_INFO;
Modified: projects/ofed/head/sys/kern/kern_jail.c
==============================================================================
--- projects/ofed/head/sys/kern/kern_jail.c Fri Aug 13 03:14:08 2010 (r211264)
+++ projects/ofed/head/sys/kern/kern_jail.c Fri Aug 13 03:15:02 2010 (r211265)
@@ -4166,7 +4166,7 @@ sysctl_jail_param(SYSCTL_HANDLER_ARGS)
i = 0;
return (SYSCTL_OUT(req, &i, sizeof(i)));
case CTLTYPE_STRING:
- snprintf(numbuf, sizeof(numbuf), "%d", arg2);
+ snprintf(numbuf, sizeof(numbuf), "%jd", arg2);
return
(sysctl_handle_string(oidp, numbuf, sizeof(numbuf), req));
case CTLTYPE_STRUCT:
Modified: projects/ofed/head/sys/kern/kern_sysctl.c
==============================================================================
--- projects/ofed/head/sys/kern/kern_sysctl.c Fri Aug 13 03:14:08 2010 (r211264)
+++ projects/ofed/head/sys/kern/kern_sysctl.c Fri Aug 13 03:15:02 2010 (r211265)
@@ -364,6 +364,27 @@ sysctl_remove_oid(struct sysctl_oid *oid
return (error);
}
+int
+sysctl_remove_name(struct sysctl_oid *parent, const char *name,
+ int del, int recurse)
+{
+ struct sysctl_oid *p;
+ int error;
+
+ error = ENOENT;
+ SYSCTL_XLOCK();
+ SLIST_FOREACH(p, SYSCTL_CHILDREN(parent), oid_link) {
+ if (strcmp(p->oid_name, name) == 0) {
+ error = sysctl_remove_oid_locked(p, del, recurse);
+ break;
+ }
+ }
+ SYSCTL_XUNLOCK();
+
+ return (error);
+}
+
+
static int
sysctl_remove_oid_locked(struct sysctl_oid *oidp, int del, int recurse)
{
@@ -417,14 +438,13 @@ sysctl_remove_oid_locked(struct sysctl_o
}
return (0);
}
-
/*
* Create new sysctls at run time.
* clist may point to a valid context initialized with sysctl_ctx_init().
*/
struct sysctl_oid *
sysctl_add_oid(struct sysctl_ctx_list *clist, struct sysctl_oid_list *parent,
- int number, const char *name, int kind, void *arg1, int arg2,
+ int number, const char *name, int kind, void *arg1, intptr_t arg2,
int (*handler)(SYSCTL_HANDLER_ARGS), const char *fmt, const char *descr)
{
struct sysctl_oid *oidp;
@@ -468,6 +488,7 @@ sysctl_add_oid(struct sysctl_ctx_list *c
SYSCTL_CHILDREN_SET(oidp, malloc(sizeof(struct sysctl_oid_list),
M_SYSCTLOID, M_WAITOK));
SLIST_INIT(SYSCTL_CHILDREN(oidp));
+ oidp->oid_arg2 = arg2;
} else {
oidp->oid_arg1 = arg1;
oidp->oid_arg2 = arg2;
Modified: projects/ofed/head/sys/sys/jail.h
==============================================================================
--- projects/ofed/head/sys/sys/jail.h Fri Aug 13 03:14:08 2010 (r211264)
+++ projects/ofed/head/sys/sys/jail.h Fri Aug 13 03:15:02 2010 (r211265)
@@ -379,7 +379,7 @@ int prison_check_af(struct ucred *cred,
int prison_if(struct ucred *cred, struct sockaddr *sa);
char *prison_name(struct prison *, struct prison *);
int prison_priv_check(struct ucred *cred, int priv);
-int sysctl_jail_param(struct sysctl_oid *, void *, int , struct sysctl_req *);
+int sysctl_jail_param(SYSCTL_HANDLER_ARGS);
#endif /* _KERNEL */
#endif /* !_SYS_JAIL_H_ */
Modified: projects/ofed/head/sys/sys/sysctl.h
==============================================================================
--- projects/ofed/head/sys/sys/sysctl.h Fri Aug 13 03:14:08 2010 (r211264)
+++ projects/ofed/head/sys/sys/sysctl.h Fri Aug 13 03:15:02 2010 (r211265)
@@ -114,8 +114,8 @@ struct ctlname {
#define CTL_AUTO_START 0x100
#ifdef _KERNEL
-#define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, int arg2, \
- struct sysctl_req *req
+#define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, \
+ intptr_t arg2, struct sysctl_req *req
/* definitions for sysctl_req 'lock' member */
#define REQ_UNLOCKED 0 /* not locked and not wired */
@@ -158,7 +158,7 @@ struct sysctl_oid {
int oid_number;
u_int oid_kind;
void *oid_arg1;
- int oid_arg2;
+ intptr_t oid_arg2;
const char *oid_name;
int (*oid_handler)(SYSCTL_HANDLER_ARGS);
const char *oid_fmt;
@@ -679,9 +679,11 @@ extern char kern_ident[];
/* Dynamic oid handling */
struct sysctl_oid *sysctl_add_oid(struct sysctl_ctx_list *clist,
struct sysctl_oid_list *parent, int nbr, const char *name,
- int kind, void *arg1, int arg2,
+ int kind, void *arg1, intptr_t arg2,
int (*handler) (SYSCTL_HANDLER_ARGS),
const char *fmt, const char *descr);
+int sysctl_remove_name(struct sysctl_oid *parent, const char *name, int del,
+ int recurse);
void sysctl_rename_oid(struct sysctl_oid *oidp, const char *name);
int sysctl_move_oid(struct sysctl_oid *oidp,
struct sysctl_oid_list *parent);
More information about the svn-src-projects
mailing list