]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
Miscellaneous changes, some coding style fixes and refactoring of code.
authorBalbir Singh <balbir@linux.vnet.ibm.com>
Thu, 10 Apr 2008 11:56:33 +0000 (11:56 +0000)
committerBalbir Singh <balbir@linux.vnet.ibm.com>
Thu, 10 Apr 2008 11:56:33 +0000 (11:56 +0000)
Also added a install/uninstall target

Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/branches/balbir@9 4f4bb910-9a46-0410-90c8-c897d4f1cd53

Makefile
libcg.h

index ec2142b2542cc359ccd8b21256e409f8e60c7c34..9c175fa51d3602577df2a9e6abf33a36fe065694 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -16,6 +16,7 @@ INC=-I.
 CFLAGS=-g -O2 -Wextra $(DEBUG)  $(INC) 
 LIBS= -lcg
 LDFLAGS= -L .
+INSTALLPREFIX=
 
 all: cgconfig libcg.so
 
@@ -31,5 +32,13 @@ lex.yy.c: lex.l
 libcg.so: api.c libcg.h
        $(CXX) $(CFLAGS) -shared -fPIC -o $@ api.c
 
+install: libcg.so
+       \cp libcg.h $(INSTALLPREFIX)/usr/include
+       \cp libcg.so $(INSTALLPREFIX)/usr/lib
+
+uninstall: libcg.so
+       \rm $(INSTALLPREFIX)/usr/include/libcg.h
+       \rm $(INSTALLPREFIX)/usr/lib/libcg.so
+
 clean:
        \rm -f y.tab.c y.tab.h lex.yy.c y.output cgconfig libcg.so
diff --git a/libcg.h b/libcg.h
index b600a28697cb22d5a6f21949c8bdf0f5899e1f56..3c4db67518ac13d42dc660a4f53b4383433b2d0c 100644 (file)
--- a/libcg.h
+++ b/libcg.h
@@ -148,12 +148,14 @@ struct control_value {
        char *value;
 };
 
-struct cgroup{
+struct controller {
        char *name;
-       struct {
-               char *name;
-               struct control_value *values[CG_NV_MAX];
-       } *controller[CG_CONTROLLER_MAX];
+       struct control_value *values[CG_NV_MAX];
+};
+
+struct cgroup {
+       char *name;
+       struct controller *controller[CG_CONTROLLER_MAX];
        uid_t tasks_uid;
        gid_t tasks_gid;
        uid_t control_uid;