]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
api: don't keep one copy of the mount table per .c file
authorLennart Poettering <lennart@poettering.net>
Wed, 24 Mar 2010 20:04:36 +0000 (21:04 +0100)
committerDhaval Giani <dhaval.giani@gmail.com>
Fri, 26 Mar 2010 11:56:44 +0000 (12:56 +0100)
The mount table variables need to be declared in the header file and
defined in the .c file. If we don't do that every .o file will end up
with its own copy of those variables.

Signed-off-by: Lennart Poettering <lennart@poettering.net>
Acked-by: Dhaval Giani <dhaval.giani@gmail.com>
Signed-off-by: Dhaval Giani <dhaval.giani@gmail.com>
src/api.c
src/libcgroup-internal.h

index 41f6d3e200c2b74eb394e78404f1bb76237ed792..605137b914e748c2ebbb2a1371546ef111afe78d 100644 (file)
--- a/src/api.c
+++ b/src/api.c
@@ -83,6 +83,9 @@ static pthread_rwlock_t rl_lock = PTHREAD_RWLOCK_INITIALIZER;
 /* Namespace */
 __thread char *cg_namespace_table[CG_CONTROLLER_MAX];
 
+pthread_rwlock_t cg_mount_table_lock = PTHREAD_RWLOCK_INITIALIZER;
+struct cg_mount_table_s cg_mount_table[CG_CONTROLLER_MAX];
+
 const char const *cgroup_strerror_codes[] = {
        "Cgroup is not compiled in",
        "Cgroup is not mounted",
index 722bc65d63225009fa92e8c775c92c27d2a264ff..d9838e9cd31723d736beb37af3e7923a8b3b4e72 100644 (file)
@@ -143,8 +143,8 @@ struct cgroup *create_cgroup_from_name_value_pairs(const char *name,
 /*
  * Main mounting structures
  */
-struct cg_mount_table_s cg_mount_table[CG_CONTROLLER_MAX];
-static pthread_rwlock_t cg_mount_table_lock = PTHREAD_RWLOCK_INITIALIZER;
+extern struct cg_mount_table_s cg_mount_table[CG_CONTROLLER_MAX];
+extern pthread_rwlock_t cg_mount_table_lock;
 
 /*
  * config related structures