Use kref implementation from kcompat
authorJan Blunck <jblunck@suse.de>
Wed, 10 Jun 2009 18:07:19 +0000 (20:07 +0200)
committerPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Fri, 12 Jun 2009 17:22:38 +0000 (13:22 -0400)
The kref implementation from kcompat has LGPL license.

Signed-off-by: Jan Blunck <jblunck@suse.de>
libust/Makefile.am
libust/channels.h
libust/relay.c
libust/relay.h
share/kref.c [deleted file]
share/kref.h [deleted file]
ustd/Makefile.am

index 0faa8c01aeffac0e342d818f9db12c942a1b222f..1bc6110e9780c906990704baeb0cc9a6b01f64e0 100644 (file)
@@ -2,6 +2,6 @@ INCLUDES = -I$(top_builddir)/share -I$(top_builddir)/libustcomm \
        $(KCOMPAT_CFLAGS) $(URCU_CFLAGS)
 
 lib_LTLIBRARIES = libust.la
-libust_la_SOURCES = marker.c marker.h tracepoint.c tracepoint.h immediate.h channels.c channels.h marker-control.c marker-control.h relay.c relay.h tracer.c tracer.h tracercore.c tracercore.h serialize.c tracectl.c $(top_builddir)/libustcomm/ustcomm.c $(top_builddir)/share/kref.c $(top_builddir)/share/usterr.c
+libust_la_SOURCES = marker.c marker.h tracepoint.c tracepoint.h immediate.h channels.c channels.h marker-control.c marker-control.h relay.c relay.h tracer.c tracer.h tracercore.c tracercore.h serialize.c tracectl.c $(top_builddir)/libustcomm/ustcomm.c $(top_builddir)/share/usterr.c $(top_builddir)/share/usterr.h
 libust_la_LDFLAGS = -no-undefined -version-info 0:0:0
 libust_la_LIBADD = $(URCU_LIBS) -lpthread
index 4eb512d4e79ab29e5973973f656492dfa90d562b..d96e25b279b5e41f8b132e1e3b307f6e4fdda381 100644 (file)
@@ -13,7 +13,7 @@
 #include <errno.h>
 
 #include "kernelcompat.h"
-#include "kref.h"
+#include <kcompat/kref.h>
 
 #define EVENTS_PER_CHANNEL     65536
 
index 530a4960fb45dfe945a7e55abbc1116aa7817efc..4c57424a5ba9392f14b0a93b0bf980c6fb712694 100644 (file)
@@ -29,7 +29,7 @@
 //#include "list.h"
 #include "relay.h"
 #include "channels.h"
-#include "kref.h"
+#include <kcompat/kref.h>
 #include "tracer.h"
 #include "tracercore.h"
 #include "usterr.h"
index 3df1275375ce12d2c528a7f63db67ff84d2b827e..cb5c43847d273f6fa3c19232416b8b5f28b5524a 100644 (file)
@@ -22,7 +22,7 @@
 //ust// #include <linux/mm.h>
 //ust// #include <linux/ltt-core.h>
 #include <assert.h>
-#include "kref.h"
+#include <kcompat/kref.h>
 //#include "list.h"
 #include "channels.h"
 #include "buffer.h"
diff --git a/share/kref.c b/share/kref.c
deleted file mode 100644 (file)
index f036df8..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * kref.c - library routines for handling generic reference counted objects
- *
- * Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
- * Copyright (C) 2004 IBM Corp.
- *
- * based on lib/kobject.c which was:
- * Copyright (C) 2002-2003 Patrick Mochel <mochel@osdl.org>
- *
- * This file is released under the GPLv2.
- *
- */
-
-//#include "<kernelcompat.h>"
-#include <kref.h>
-//ust// #include <linux/module.h>
-#include "usterr.h"
-#include "compiler.h"
-
-/**
- * kref_set - initialize object and set refcount to requested number.
- * @kref: object in question.
- * @num: initial reference counter
- */
-void kref_set(struct kref *kref, int num)
-{
-       atomic_set(&kref->refcount, num);
-       smp_mb();
-}
-
-/**
- * kref_init - initialize object.
- * @kref: object in question.
- */
-void kref_init(struct kref *kref)
-{
-       kref_set(kref, 1);
-}
-
-/**
- * kref_get - increment refcount for object.
- * @kref: object.
- */
-void kref_get(struct kref *kref)
-{
-       WARN_ON(!atomic_read(&kref->refcount));
-       atomic_inc(&kref->refcount);
-       smp_mb__after_atomic_inc();
-}
-
-/**
- * kref_put - decrement refcount for object.
- * @kref: object.
- * @release: pointer to the function that will clean up the object when the
- *          last reference to the object is released.
- *          This pointer is required, and it is not acceptable to pass kfree
- *          in as this function.
- *
- * Decrement the refcount, and if 0, call release().
- * Return 1 if the object was removed, otherwise return 0.  Beware, if this
- * function returns 0, you still can not count on the kref from remaining in
- * memory.  Only use the return value if you want to see if the kref is now
- * gone, not present.
- */
-int kref_put(struct kref *kref, void (*release)(struct kref *kref))
-{
-       WARN_ON(release == NULL);
-//ust//        WARN_ON(release == (void (*)(struct kref *))kfree);
-
-       if (atomic_dec_and_test(&kref->refcount)) {
-               release(kref);
-               return 1;
-       }
-       return 0;
-}
-
-//ust// EXPORT_SYMBOL(kref_set);
-//ust// EXPORT_SYMBOL(kref_init);
-//ust// EXPORT_SYMBOL(kref_get);
-//ust// EXPORT_SYMBOL(kref_put);
diff --git a/share/kref.h b/share/kref.h
deleted file mode 100644 (file)
index ffb488c..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * kref.h - library routines for handling generic reference counted objects
- *
- * Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
- * Copyright (C) 2004 IBM Corp.
- *
- * based on kobject.h which was:
- * Copyright (C) 2002-2003 Patrick Mochel <mochel@osdl.org>
- * Copyright (C) 2002-2003 Open Source Development Labs
- *
- * This file is released under the GPLv2.
- *
- */
-
-#ifndef _KREF_H_
-#define _KREF_H_
-
-//ust// #include <linux/types.h>
-//ust// #include <asm/atomic.h>
-#include <kernelcompat.h>
-
-struct kref {
-       atomic_t refcount;
-};
-
-void kref_set(struct kref *kref, int num);
-void kref_init(struct kref *kref);
-void kref_get(struct kref *kref);
-int kref_put(struct kref *kref, void (*release) (struct kref *kref));
-
-#endif /* _KREF_H_ */
index 72f40a86fdb1b9652b252d8946dc5f9139905b9a..af6d306ceb6559fdcaacef0b5b924a83df8ad4f5 100644 (file)
@@ -2,5 +2,5 @@ INCLUDES = -I$(top_builddir)/share -I$(top_builddir)/libust \
         -I$(top_builddir)/libustcomm $(KCOMPAT_CFLAGS)
 
 bin_PROGRAMS = ustd
-ustd_SOURCES = lowlevel.c localerr.h ustd.c ustd.h $(top_builddir)/libustcomm/ustcomm.c $(top_builddir)/libustcomm/ustcomm.h $(top_builddir)/share/kref.c
+ustd_SOURCES = lowlevel.c localerr.h ustd.c ustd.h $(top_builddir)/libustcomm/ustcomm.c $(top_builddir)/libustcomm/ustcomm.h
 ustd_LDFLAGS = -lpthread
This page took 0.04346 seconds and 4 git commands to generate.