Source-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: [elad-kernelauth] src/sys
YAMAMOTO Takashi wrote:
> its name doesn't imply anything about its usage.
> generally, exporting more symbols is a bad idea, esp. when
> its name is too generic like this.
>
> i think it's better to make it static and
> move process_authorize to kern_auth.c.
See attached diff, it:
- changes builtin_{generic,process} to
kauth_builtin_scope_{generic,process}, and makes them static.
- remove extern for the above two from kauth.h.
- moves process_authorize() from kern_proc.c to kern_auth.c.
Is this okay?
-e.
--
Elad Efrat
Index: kern/kern_auth.c
===================================================================
RCS file: /cvsroot/src/sys/kern/Attic/kern_auth.c,v
retrieving revision 1.1.2.7
diff -u -p -r1.1.2.7 kern_auth.c
--- kern/kern_auth.c 8 Mar 2006 19:18:35 -0000 1.1.2.7
+++ kern/kern_auth.c 8 Mar 2006 20:12:46 -0000
@@ -94,8 +94,8 @@ SIMPLEQ_HEAD(, kauth_scope) scope_list;
struct simplelock scopes_lock;
/* Built-in scopes: generic, process. */
-kauth_scope_t builtin_generic;
-kauth_scope_t builtin_process;
+static kauth_scope_t kauth_builtin_scope_generic;
+static kauth_scope_t kauth_builtin_scope_process;
/* Allocate new, empty kauth credentials. */
kauth_cred_t
@@ -672,14 +672,12 @@ kauth_init(void)
simple_lock_init(&scopes_lock);
/* Register generic scope. */
- builtin_generic = kauth_register_scope(KAUTH_SCOPE_GENERIC,
- kauth_authorize_cb_generic,
- NULL);
+ kauth_builtin_scope_generic = kauth_register_scope(KAUTH_SCOPE_GENERIC,
+ kauth_authorize_cb_generic, NULL);
/* Register process scope. */
- builtin_process = kauth_register_scope(KAUTH_SCOPE_PROCESS,
- kauth_authorize_cb_process,
- NULL);
+ kauth_builtin_scope_process = kauth_register_scope(KAUTH_SCOPE_PROCESS,
+ kauth_authorize_cb_process, NULL);
}
/*
@@ -829,8 +827,8 @@ kauth_authorize_cb_generic(kauth_cred_t
int
generic_authorize(kauth_cred_t cred, kauth_action_t action, void *arg0)
{
- return (kauth_authorize_action(builtin_generic, cred, action, arg0,
- NULL, NULL, NULL));
+ return (kauth_authorize_action(kauth_builtin_scope_generic, cred,
+ action, arg0, NULL, NULL, NULL));
}
/*
@@ -885,3 +883,14 @@ kauth_authorize_cb_process(kauth_cred_t
return (error);
}
+
+/*
+ * Process scope authorization wrapper.
+ */
+int
+process_authorize(kauth_cred_t cred, kauth_action_t action, struct proc *p,
+ void *arg1, void *arg2, void *arg3)
+{
+ return (kauth_authorize_action(kauth_builtin_scope_process, cred,
+ action, p, arg1, arg2, arg3));
+}
Index: kern/kern_proc.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_proc.c,v
retrieving revision 1.86.4.1
diff -u -p -r1.86.4.1 kern_proc.c
--- kern/kern_proc.c 8 Mar 2006 00:53:40 -0000 1.86.4.1
+++ kern/kern_proc.c 8 Mar 2006 20:12:51 -0000
@@ -1248,15 +1248,3 @@ proc_vmspace_getref(struct proc *p, stru
return 0;
}
-
-/*
- * Process scope authorization wrapper.
- */
-int
-process_authorize(kauth_cred_t cred, kauth_action_t action, struct proc *p,
- void *arg1, void *arg2, void *arg3)
-{
- return (kauth_authorize_action(builtin_process, cred, action, p, arg1,
- arg2, arg3));
-}
-
Index: sys/kauth.h
===================================================================
RCS file: /cvsroot/src/sys/sys/Attic/kauth.h,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 kauth.h
--- sys/kauth.h 8 Mar 2006 17:31:56 -0000 1.1.2.4
+++ sys/kauth.h 8 Mar 2006 20:12:51 -0000
@@ -78,10 +78,6 @@ typedef int (*kauth_scope_callback_t)(ka
#define NOCRED ((kauth_cred_t)-1) /* no credential available */
#define FSCRED ((kauth_cred_t)-2) /* filesystem credential */
-/* Globals. */
-extern kauth_scope_t builtin_generic;
-extern kauth_scope_t builtin_process;
-
/*
* Prototypes.
*/
Home |
Main Index |
Thread Index |
Old Index