aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/irda/irqueue.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/net/irda/irqueue.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/net/irda/irqueue.h')
-rw-r--r--include/net/irda/irqueue.h96
1 files changed, 96 insertions, 0 deletions
diff --git a/include/net/irda/irqueue.h b/include/net/irda/irqueue.h
new file mode 100644
index 000000000000..335b0ace9665
--- /dev/null
+++ b/include/net/irda/irqueue.h
@@ -0,0 +1,96 @@
1/*********************************************************************
2 *
3 * Filename: irqueue.h
4 * Version: 0.3
5 * Description: General queue implementation
6 * Status: Experimental.
7 * Author: Dag Brattli <dagb@cs.uit.no>
8 * Created at: Tue Jun 9 13:26:50 1998
9 * Modified at: Thu Oct 7 13:25:16 1999
10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 *
12 * Copyright (C) 1998-1999, Aage Kvalnes <aage@cs.uit.no>
13 * Copyright (c) 1998, Dag Brattli
14 * All Rights Reserved.
15 *
16 * This code is taken from the Vortex Operating System written by Aage
17 * Kvalnes and has been ported to Linux and Linux/IR by Dag Brattli
18 *
19 * This program is free software; you can redistribute it and/or
20 * modify it under the terms of the GNU General Public License as
21 * published by the Free Software Foundation; either version 2 of
22 * the License, or (at your option) any later version.
23 *
24 * Neither Dag Brattli nor University of Tromsų admit liability nor
25 * provide warranty for any of this software. This material is
26 * provided "AS-IS" and at no charge.
27 *
28 ********************************************************************/
29
30#include <linux/types.h>
31#include <linux/spinlock.h>
32
33#ifndef IRDA_QUEUE_H
34#define IRDA_QUEUE_H
35
36#define NAME_SIZE 32
37
38/*
39 * Hash types (some flags can be xored)
40 * See comments in irqueue.c for which one to use...
41 */
42#define HB_NOLOCK 0 /* No concurent access prevention */
43#define HB_LOCK 1 /* Prevent concurent write with global lock */
44
45/*
46 * Hash defines
47 */
48#define HASHBIN_SIZE 8
49#define HASHBIN_MASK 0x7
50
51#ifndef IRDA_ALIGN
52#define IRDA_ALIGN __attribute__((aligned))
53#endif
54
55#define Q_NULL { NULL, NULL, "", 0 }
56
57typedef void (*FREE_FUNC)(void *arg);
58
59struct irda_queue {
60 struct irda_queue *q_next;
61 struct irda_queue *q_prev;
62
63 char q_name[NAME_SIZE];
64 long q_hash; /* Must be able to cast a (void *) */
65};
66typedef struct irda_queue irda_queue_t;
67
68typedef struct hashbin_t {
69 __u32 magic;
70 int hb_type;
71 int hb_size;
72 spinlock_t hb_spinlock; /* HB_LOCK - Can be used by the user */
73
74 irda_queue_t* hb_queue[HASHBIN_SIZE] IRDA_ALIGN;
75
76 irda_queue_t* hb_current;
77} hashbin_t;
78
79hashbin_t *hashbin_new(int type);
80int hashbin_delete(hashbin_t* hashbin, FREE_FUNC func);
81int hashbin_clear(hashbin_t* hashbin, FREE_FUNC free_func);
82void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv,
83 const char* name);
84void* hashbin_remove(hashbin_t* hashbin, long hashv, const char* name);
85void* hashbin_remove_first(hashbin_t *hashbin);
86void* hashbin_remove_this( hashbin_t* hashbin, irda_queue_t* entry);
87void* hashbin_find(hashbin_t* hashbin, long hashv, const char* name);
88void* hashbin_lock_find(hashbin_t* hashbin, long hashv, const char* name);
89void* hashbin_find_next(hashbin_t* hashbin, long hashv, const char* name,
90 void ** pnext);
91irda_queue_t *hashbin_get_first(hashbin_t *hashbin);
92irda_queue_t *hashbin_get_next(hashbin_t *hashbin);
93
94#define HASHBIN_GET_SIZE(hashbin) hashbin->hb_size
95
96#endif