summaryrefslogtreecommitdiff
path: root/xpp/zap_debug.c
blob: 59eb0a8a7eca1690e041139596c470bb64afa7cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
 * Written by Oron Peled <oron@actcom.co.il>
 * Copyright (C) 2004-2006, Xorcom
 *
 * All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 */
#include <linux/version.h>

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
#  warning "This module is tested only with 2.6 kernels"
#endif

#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/module.h>
#include <zaptel.h>
#include "zap_debug.h"

static const char rcsid[] = "$Id$";

#define	P_(x)	[ x ] = { .value = x, .name = #x, }
static	struct {
	int value;
	char *name;
} poll_names[] = {
	P_(POLLIN),
	P_(POLLPRI),
	P_(POLLOUT),
	P_(POLLERR),
	P_(POLLHUP),
	P_(POLLNVAL),
	P_(POLLRDNORM),
	P_(POLLRDBAND),
	P_(POLLWRNORM),
	P_(POLLWRBAND),
	P_(POLLMSG),
	P_(POLLREMOVE)
};
#undef	P_

void dump_poll(int print_dbg, const char *msg, int poll)
{
	int	i;

	for(i = 0; i < ARRAY_SIZE(poll_names); i++) {
		if(poll & poll_names[i].value)
			DBG("%s: %s\n", msg, poll_names[i].name);
	}
}


EXPORT_SYMBOL(dump_poll);