You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(6) |
Sep
(2) |
Oct
(43) |
Nov
(4) |
Dec
(12) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(78) |
Feb
(97) |
Mar
(29) |
Apr
(2) |
May
(22) |
Jun
(38) |
Jul
(11) |
Aug
(27) |
Sep
(40) |
Oct
(2) |
Nov
(17) |
Dec
(8) |
| 2002 |
Jan
|
Feb
(2) |
Mar
(1) |
Apr
(480) |
May
(456) |
Jun
(12) |
Jul
|
Aug
(1) |
Sep
|
Oct
(18) |
Nov
(3) |
Dec
(6) |
| 2003 |
Jan
|
Feb
(18) |
Mar
(1) |
Apr
|
May
(6) |
Jun
(147) |
Jul
(7) |
Aug
(3) |
Sep
(235) |
Oct
(10) |
Nov
(2) |
Dec
(1) |
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Uns L. <uns...@us...> - 2003-08-02 23:44:51
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel In directory sc8-pr-cvs1:/tmp/cvs-serv7102 Modified Files: setup.c Log Message: When CONFIG_FB is enabled, set a dummy console before cons_init so that VT's will be allocated. This is commented out for now since it causes problems. Index: setup.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/setup.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- setup.c 9 Apr 2002 13:50:55 -0000 1.18 +++ setup.c 2 Aug 2003 23:44:46 -0000 1.19 @@ -16,6 +16,7 @@ #include <linux/string.h> #include <linux/delay.h> #include <linux/seq_file.h> +#include <linux/console.h> #include <asm/rpb.h> #include <asm/page.h> @@ -176,6 +177,12 @@ #ifdef __SMP__ setup_smp(); +#endif + +#ifdef CONFIG_FB + /* we need a dummy console up at cons_init time, otherwise there'll be + no VT's allocated for the real fbdev console to later take over */ + /* conswitchp = &dummy_con; */ #endif } |
|
From: Uns L. <uns...@us...> - 2003-08-01 23:16:55
|
Update of /cvsroot/linux-vax/kernel-2.4/include/asm-vax/mm In directory sc8-pr-cvs1:/tmp/cvs-serv5151 Modified Files: pgtable.h Log Message: Increased SPT_MAX_IOMAP to 2 megs, so we'll have room to map a 1 meg framebuffer aperture Index: pgtable.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/include/asm-vax/mm/pgtable.h,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- pgtable.h 31 Jul 2003 19:31:50 -0000 1.18 +++ pgtable.h 1 Aug 2003 23:16:52 -0000 1.19 @@ -43,7 +43,7 @@ * of IOMAP entries in the SPT, we could use get_free_page() to * alloc a real page of RAM and hijack its SPTE. */ -#define SPT_MAX_IOMAP 1024 +#define SPT_MAX_IOMAP 2048 #define SPT_MAX_VMALLOC 4096 /* entries is (1024 * 1024) >> PAGELET_SIZE */ #define SPT_HWPTES_IOMAP (SPT_MAX_IOMAP<<1) |
|
From: Uns L. <uns...@us...> - 2003-07-31 19:37:58
|
Update of /cvsroot/linux-vax/kernel-2.4/include/asm-vax
In directory sc8-pr-cvs1:/tmp/cvs-serv22939
Modified Files:
keyboard.h
Log Message:
Put in stubs so we can compile VT support without a keyboard driver
Index: keyboard.h
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/include/asm-vax/keyboard.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- keyboard.h 17 Jan 2001 16:18:52 -0000 1.1
+++ keyboard.h 31 Jul 2003 19:37:55 -0000 1.2
@@ -18,22 +18,14 @@
#define KEYBOARD_IRQ 1
#define DISABLE_KBD_DURING_INTERRUPTS 0
-extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode);
-extern int pckbd_getkeycode(unsigned int scancode);
-extern int pckbd_translate(unsigned char scancode, unsigned char *keycode,
- char raw_mode);
-extern char pckbd_unexpected_up(unsigned char keycode);
-extern void pckbd_leds(unsigned char leds);
-extern void pckbd_init_hw(void);
-extern unsigned char pckbd_sysrq_xlate[128];
-
-#define kbd_setkeycode pckbd_setkeycode
-#define kbd_getkeycode pckbd_getkeycode
-#define kbd_translate pckbd_translate
-#define kbd_unexpected_up pckbd_unexpected_up
-#define kbd_leds pckbd_leds
-#define kbd_init_hw pckbd_init_hw
-#define kbd_sysrq_xlate pckbd_sysrq_xlate
+int kbd_setkeycode(unsigned int scancode, unsigned int keycode) {return 0;}
+int kbd_getkeycode(unsigned int scancode) {return 0;}
+int kbd_translate(unsigned char scancode, unsigned char *keycode,
+ char raw_mode) {return 0;}
+char kbd_unexpected_up(unsigned char keycode) {return 0;}
+void kbd_leds(unsigned char leds) {}
+void kbd_init_hw(void) {}
+unsigned char pckbd_sysrq_xlate[128];
#define INIT_KBD
|
|
From: Uns L. <uns...@us...> - 2003-07-31 19:36:45
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/video In directory sc8-pr-cvs1:/tmp/cvs-serv22720 Modified Files: Makefile Log Message: Actually compile vmonofb when CONFIG_FB_VMONO is set Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/video/Makefile,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Makefile 10 Jun 2003 01:47:01 -0000 1.3 +++ Makefile 31 Jul 2003 19:36:42 -0000 1.4 @@ -85,6 +85,7 @@ obj-$(CONFIG_FB_PMAGB_B) += pmagb-b-fb.o obj-$(CONFIG_FB_MAXINE) += maxinefb.o obj-$(CONFIG_FB_TX3912) += tx3912fb.o +obj-$(CONFIG_FB_VMONO) += vmonofb.o fbgen.o subdir-$(CONFIG_FB_MATROX) += matrox |
|
From: Uns L. <uns...@us...> - 2003-07-31 19:35:27
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/char In directory sc8-pr-cvs1:/tmp/cvs-serv22289 Modified Files: vt.c Log Message: We don't seem to have sys_ioperm, so disable the KDADDIO etc ioctls Index: vt.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/vt.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- vt.c 11 Apr 2002 13:30:59 -0000 1.2 +++ vt.c 31 Jul 2003 19:35:24 -0000 1.3 @@ -481,7 +481,7 @@ ucval = keyboard_type; goto setchar; -#if !defined(__alpha__) && !defined(__ia64__) && !defined(__mips__) && !defined(__arm__) && !defined(__sh__) +#if !defined(__alpha__) && !defined(__ia64__) && !defined(__mips__) && !defined(__arm__) && !defined(__sh__) && !defined(__vax__) /* * These cannot be implemented on any machine that implements * ioperm() in user level (such as Alpha PCs). |
|
From: Uns L. <uns...@us...> - 2003-07-31 19:33:50
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/char In directory sc8-pr-cvs1:/tmp/cvs-serv22171 Modified Files: Makefile Log Message: Stop VAX builds from trying to compile in a peecee keyboard driver Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/Makefile,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Makefile 10 Jun 2003 01:46:20 -0000 1.5 +++ Makefile 31 Jul 2003 19:33:47 -0000 1.6 @@ -100,6 +100,10 @@ endif endif +ifeq ($(ARCH),vax) + KEYBD = +endif + ifeq ($(CONFIG_DECSTATION),y) KEYMAP = KEYBD = |
|
From: Uns L. <uns...@us...> - 2003-07-31 19:31:53
|
Update of /cvsroot/linux-vax/kernel-2.4/include/asm-vax/mm In directory sc8-pr-cvs1:/tmp/cvs-serv21918 Modified Files: pgtable.h Log Message: Add io_remap_page_range #define. Uh, I think this is right. Some archs have this #define, others have a real io_remap_page_range. I think a real io_remap_page_range is only necessary where there is an I/O address space that doesn't line up with the physical address space. Index: pgtable.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/include/asm-vax/mm/pgtable.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- pgtable.h 10 Jun 2003 01:14:27 -0000 1.17 +++ pgtable.h 31 Jul 2003 19:31:50 -0000 1.18 @@ -188,6 +188,8 @@ #define PageSkip(page) (0) #define kern_addr_valid(addr) (1) +#define io_remap_page_range remap_page_range + /* * No page table caches to initialise */ |
|
From: Uns L. <uns...@us...> - 2003-07-31 19:19:00
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/vax In directory sc8-pr-cvs1:/tmp/cvs-serv19819 Modified Files: config.in Log Message: Enable CONFIG_VT and framebuffer options Index: config.in =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/config.in,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- config.in 12 Feb 2003 02:37:32 -0000 1.16 +++ config.in 31 Jul 2003 19:18:57 -0000 1.17 @@ -154,10 +154,11 @@ comment 'VAX Character devices' # Virtual terminals not supported yet -# bool 'Virtual terminal' CONFIG_VT -define_bool CONFIG_VT n +bool 'Virtual terminal' CONFIG_VT +#define_bool CONFIG_VT n if [ "$CONFIG_VT" = "y" ]; then bool 'Support for console on virtual terminal' CONFIG_VT_CONSOLE + source drivers/video/Config.in fi tristate 'Standard/generic (dumb) serial support' CONFIG_SERIAL if [ "$CONFIG_SERIAL" = "y" ]; then |
|
From: Uns L. <uns...@us...> - 2003-07-29 21:59:28
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/char
In directory sc8-pr-cvs1:/tmp/cvs-serv31853
Modified Files:
sc26c94.c
Log Message:
Fixed sc26c94_write_io. Before, it could only set bits, not clear them.
Index: sc26c94.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/sc26c94.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- sc26c94.c 3 Jun 2002 02:52:42 -0000 1.4
+++ sc26c94.c 29 Jul 2003 18:21:01 -0000 1.5
@@ -233,16 +233,21 @@
{
int opr_reg = (channum < SC26C94_PORT_C) ? SC26C94_REG_OPRab : SC26C94_REG_OPRcd;
int opr;
+ u8 mask;
unsigned long flags;
- val = val ? 0 : io_bits[ionum & 3];
+ mask = io_bits[ionum & 3];
if((channum & 1) != 0)
- val <<= 2;
+ mask <<= 2;
+
+ val = val ? 0 : mask;
save_flags(flags);
cli();
opr = quart->readreg(quart, opr_reg);
- quart->writereg(quart, opr_reg, opr | val);
+ opr &= ~mask;
+ opr |= val;
+ quart->writereg(quart, opr_reg, opr);
restore_flags(flags);
}
|
|
From: Dave A. <ai...@us...> - 2003-06-10 03:13:30
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/scsi/aacraid In directory sc8-pr-cvs1:/tmp/cvs-serv13727/aacraid Log Message: Directory /cvsroot/linux-vax/kernel-2.4/drivers/scsi/aacraid added to the repository |
|
From: Dave A. <ai...@us...> - 2003-06-10 03:08:17
|
Update of /cvsroot/linux-vax/kernel-2.4/net/ipv6/netfilter
In directory sc8-pr-cvs1:/tmp/cvs-serv14646/net/ipv6/netfilter
Added Files:
ip6_queue.c
Log Message:
DA: additional files from 2.4.1[78] kernels..
--- NEW FILE ---
/*
* This is a module which is used for queueing IPv6 packets and
* communicating with userspace via netlink.
*
* (C) 2001 Fernando Anton, this code is GPL.
* IPv64 Project - Work based in IPv64 draft by Arturo Azcorra.
* Universidad Carlos III de Madrid - Leganes (Madrid) - Spain
* Universidad Politecnica de Alcala de Henares - Alcala de H. (Madrid) - Spain
* email: fa...@it...
*
* 2001-11-06: First try. Working with ip_queue.c for IPv4 and trying
* to adapt it to IPv6
* HEAVILY based in ipqueue.c by James Morris. It's just
* a little modified version of it, so he's nearly the
* real coder of this.
* Few changes needed, mainly the hard_routing code and
* the netlink socket protocol (we're NETLINK_IP6_FW).
*
*/
#include <linux/module.h>
#include <linux/skbuff.h>
#include <linux/init.h>
#include <linux/ipv6.h>
#include <linux/notifier.h>
#include <linux/netdevice.h>
#include <linux/netfilter.h>
#include <linux/netlink.h>
#include <linux/spinlock.h>
#include <linux/rtnetlink.h>
#include <linux/sysctl.h>
#include <linux/proc_fs.h>
#include <net/sock.h>
#include <net/ipv6.h>
#include <net/ip6_route.h>
/* We're still usign the following structs. No need to change them: */
/* ipq_packet_msg */
/* ipq_mode_msg */
/* ipq_verdict_msg */
/* ipq_peer_msg */
#include <linux/netfilter_ipv4/ip_queue.h>
#include <linux/netfilter_ipv4/ip_tables.h>
#include <linux/netfilter_ipv6/ip6_tables.h>
#define IPQ_QMAX_DEFAULT 1024
#define IPQ_PROC_FS_NAME "ip6_queue"
#define NET_IPQ_QMAX 2088
#define NET_IPQ_QMAX_NAME "ip6_queue_maxlen"
typedef struct ip6q_rt_info {
struct in6_addr daddr;
struct in6_addr saddr;
} ip6q_rt_info_t;
typedef struct ip6q_queue_element {
struct list_head list; /* Links element into queue */
int verdict; /* Current verdict */
struct nf_info *info; /* Extra info from netfilter */
struct sk_buff *skb; /* Packet inside */
ip6q_rt_info_t rt_info; /* May need post-mangle routing */
} ip6q_queue_element_t;
typedef int (*ip6q_send_cb_t)(ip6q_queue_element_t *e);
typedef struct ip6q_peer {
pid_t pid; /* PID of userland peer */
unsigned char died; /* We think the peer died */
unsigned char copy_mode; /* Copy packet as well as metadata? */
size_t copy_range; /* Range past metadata to copy */
ip6q_send_cb_t send; /* Callback for sending data to peer */
} ip6q_peer_t;
typedef struct ip6q_queue {
int len; /* Current queue len */
int *maxlen; /* Maximum queue len, via sysctl */
unsigned char flushing; /* If queue is being flushed */
unsigned char terminate; /* If the queue is being terminated */
struct list_head list; /* Head of packet queue */
spinlock_t lock; /* Queue spinlock */
ip6q_peer_t peer; /* Userland peer */
} ip6q_queue_t;
/****************************************************************************
*
* Packet queue
*
****************************************************************************/
/* Dequeue a packet if matched by cmp, or the next available if cmp is NULL */
static ip6q_queue_element_t *
ip6q_dequeue(ip6q_queue_t *q,
int (*cmp)(ip6q_queue_element_t *, unsigned long),
unsigned long data)
{
struct list_head *i;
spin_lock_bh(&q->lock);
for (i = q->list.prev; i != &q->list; i = i->prev) {
ip6q_queue_element_t *e = (ip6q_queue_element_t *)i;
if (!cmp || cmp(e, data)) {
list_del(&e->list);
q->len--;
spin_unlock_bh(&q->lock);
return e;
}
}
spin_unlock_bh(&q->lock);
return NULL;
}
/* Flush all packets */
static void ip6q_flush(ip6q_queue_t *q)
{
ip6q_queue_element_t *e;
spin_lock_bh(&q->lock);
q->flushing = 1;
spin_unlock_bh(&q->lock);
while ((e = ip6q_dequeue(q, NULL, 0))) {
e->verdict = NF_DROP;
nf_reinject(e->skb, e->info, e->verdict);
kfree(e);
}
spin_lock_bh(&q->lock);
q->flushing = 0;
spin_unlock_bh(&q->lock);
}
static ip6q_queue_t *ip6q_create_queue(nf_queue_outfn_t outfn,
ip6q_send_cb_t send_cb,
int *errp, int *sysctl_qmax)
{
int status;
ip6q_queue_t *q;
*errp = 0;
q = kmalloc(sizeof(ip6q_queue_t), GFP_KERNEL);
if (q == NULL) {
*errp = -ENOMEM;
return NULL;
}
q->peer.pid = 0;
q->peer.died = 0;
q->peer.copy_mode = IPQ_COPY_NONE;
q->peer.copy_range = 0;
q->peer.send = send_cb;
q->len = 0;
q->maxlen = sysctl_qmax;
q->flushing = 0;
q->terminate = 0;
INIT_LIST_HEAD(&q->list);
spin_lock_init(&q->lock);
status = nf_register_queue_handler(PF_INET6, outfn, q);
if (status < 0) {
*errp = -EBUSY;
kfree(q);
return NULL;
}
return q;
}
static int ip6q_enqueue(ip6q_queue_t *q,
struct sk_buff *skb, struct nf_info *info)
{
ip6q_queue_element_t *e;
int status;
e = kmalloc(sizeof(*e), GFP_ATOMIC);
if (e == NULL) {
printk(KERN_ERR "ip6_queue: OOM in enqueue\n");
return -ENOMEM;
}
e->verdict = NF_DROP;
e->info = info;
e->skb = skb;
if (e->info->hook == NF_IP_LOCAL_OUT) {
struct ipv6hdr *iph = skb->nh.ipv6h;
e->rt_info.daddr = iph->daddr;
e->rt_info.saddr = iph->saddr;
}
spin_lock_bh(&q->lock);
if (q->len >= *q->maxlen) {
spin_unlock_bh(&q->lock);
if (net_ratelimit())
printk(KERN_WARNING "ip6_queue: full at %d entries, "
"dropping packet(s).\n", q->len);
goto free_drop;
}
if (q->flushing || q->peer.copy_mode == IPQ_COPY_NONE
|| q->peer.pid == 0 || q->peer.died || q->terminate) {
spin_unlock_bh(&q->lock);
goto free_drop;
}
status = q->peer.send(e);
if (status > 0) {
list_add(&e->list, &q->list);
q->len++;
spin_unlock_bh(&q->lock);
return status;
}
spin_unlock_bh(&q->lock);
if (status == -ECONNREFUSED) {
printk(KERN_INFO "ip6_queue: peer %d died, "
"resetting state and flushing queue\n", q->peer.pid);
q->peer.died = 1;
q->peer.pid = 0;
q->peer.copy_mode = IPQ_COPY_NONE;
q->peer.copy_range = 0;
ip6q_flush(q);
}
free_drop:
kfree(e);
return -EBUSY;
}
static void ip6q_destroy_queue(ip6q_queue_t *q)
{
nf_unregister_queue_handler(PF_INET6);
spin_lock_bh(&q->lock);
q->terminate = 1;
spin_unlock_bh(&q->lock);
ip6q_flush(q);
kfree(q);
}
/*
* Taken from net/ipv6/ip6_output.c
*
* We should use the one there, but is defined static
* so we put this just here and let the things as
* they are now.
*
* If that one is modified, this one should be modified too.
*/
static int route6_me_harder(struct sk_buff *skb)
{
struct ipv6hdr *iph = skb->nh.ipv6h;
struct dst_entry *dst;
struct flowi fl;
fl.proto = iph->nexthdr;
fl.fl6_dst = &iph->daddr;
fl.fl6_src = &iph->saddr;
fl.oif = skb->sk ? skb->sk->bound_dev_if : 0;
fl.fl6_flowlabel = 0;
fl.uli_u.ports.dport = 0;
fl.uli_u.ports.sport = 0;
dst = ip6_route_output(skb->sk, &fl);
if (dst->error) {
if (net_ratelimit())
printk(KERN_DEBUG "route6_me_harder: No more route.\n");
return -EINVAL;
}
/* Drop old route. */
dst_release(skb->dst);
skb->dst = dst;
return 0;
}
static int ip6q_mangle_ipv6(ipq_verdict_msg_t *v, ip6q_queue_element_t *e)
{
int diff;
struct ipv6hdr *user_iph = (struct ipv6hdr *)v->payload;
if (v->data_len < sizeof(*user_iph))
return 0;
diff = v->data_len - e->skb->len;
if (diff < 0)
skb_trim(e->skb, v->data_len);
else if (diff > 0) {
if (v->data_len > 0xFFFF)
return -EINVAL;
if (diff > skb_tailroom(e->skb)) {
struct sk_buff *newskb;
newskb = skb_copy_expand(e->skb,
skb_headroom(e->skb),
diff,
GFP_ATOMIC);
if (newskb == NULL) {
printk(KERN_WARNING "ip6_queue: OOM "
"in mangle, dropping packet\n");
return -ENOMEM;
}
if (e->skb->sk)
skb_set_owner_w(newskb, e->skb->sk);
kfree_skb(e->skb);
e->skb = newskb;
}
skb_put(e->skb, diff);
}
memcpy(e->skb->data, v->payload, v->data_len);
e->skb->nfcache |= NFC_ALTERED;
/*
* Extra routing may needed on local out, as the QUEUE target never
* returns control to the table.
* Not a nice way to cmp, but works
*/
if (e->info->hook == NF_IP_LOCAL_OUT) {
struct ipv6hdr *iph = e->skb->nh.ipv6h;
if (!( iph->daddr.in6_u.u6_addr32[0] == e->rt_info.daddr.in6_u.u6_addr32[0]
&& iph->daddr.in6_u.u6_addr32[1] == e->rt_info.daddr.in6_u.u6_addr32[1]
&& iph->daddr.in6_u.u6_addr32[2] == e->rt_info.daddr.in6_u.u6_addr32[2]
&& iph->daddr.in6_u.u6_addr32[3] == e->rt_info.daddr.in6_u.u6_addr32[3]
&& iph->saddr.in6_u.u6_addr32[0] == e->rt_info.saddr.in6_u.u6_addr32[0]
&& iph->saddr.in6_u.u6_addr32[1] == e->rt_info.saddr.in6_u.u6_addr32[1]
&& iph->saddr.in6_u.u6_addr32[2] == e->rt_info.saddr.in6_u.u6_addr32[2]
&& iph->saddr.in6_u.u6_addr32[3] == e->rt_info.saddr.in6_u.u6_addr32[3]))
return route6_me_harder(e->skb);
}
return 0;
}
static inline int id_cmp(ip6q_queue_element_t *e, unsigned long id)
{
return (id == (unsigned long )e);
}
static int ip6q_set_verdict(ip6q_queue_t *q,
ipq_verdict_msg_t *v, unsigned int len)
{
ip6q_queue_element_t *e;
if (v->value > NF_MAX_VERDICT)
return -EINVAL;
e = ip6q_dequeue(q, id_cmp, v->id);
if (e == NULL)
return -ENOENT;
else {
e->verdict = v->value;
if (v->data_len && v->data_len == len)
if (ip6q_mangle_ipv6(v, e) < 0)
e->verdict = NF_DROP;
nf_reinject(e->skb, e->info, e->verdict);
kfree(e);
return 0;
}
}
static int ip6q_receive_peer(ip6q_queue_t* q, ipq_peer_msg_t *m,
unsigned char type, unsigned int len)
{
int status = 0;
int busy;
spin_lock_bh(&q->lock);
busy = (q->terminate || q->flushing);
spin_unlock_bh(&q->lock);
if (busy)
return -EBUSY;
if (len < sizeof(ipq_peer_msg_t))
return -EINVAL;
switch (type) {
case IPQM_MODE:
switch (m->msg.mode.value) {
case IPQ_COPY_META:
q->peer.copy_mode = IPQ_COPY_META;
q->peer.copy_range = 0;
break;
case IPQ_COPY_PACKET:
q->peer.copy_mode = IPQ_COPY_PACKET;
q->peer.copy_range = m->msg.mode.range;
if (q->peer.copy_range > 0xFFFF)
q->peer.copy_range = 0xFFFF;
break;
default:
status = -EINVAL;
}
break;
case IPQM_VERDICT:
if (m->msg.verdict.value > NF_MAX_VERDICT)
status = -EINVAL;
else
status = ip6q_set_verdict(q,
&m->msg.verdict,
len - sizeof(*m));
break;
default:
status = -EINVAL;
}
return status;
}
static inline int dev_cmp(ip6q_queue_element_t *e, unsigned long ifindex)
{
if (e->info->indev)
if (e->info->indev->ifindex == ifindex)
return 1;
if (e->info->outdev)
if (e->info->outdev->ifindex == ifindex)
return 1;
return 0;
}
/* Drop any queued packets associated with device ifindex */
static void ip6q_dev_drop(ip6q_queue_t *q, int ifindex)
{
ip6q_queue_element_t *e;
while ((e = ip6q_dequeue(q, dev_cmp, ifindex))) {
e->verdict = NF_DROP;
nf_reinject(e->skb, e->info, e->verdict);
kfree(e);
}
}
/****************************************************************************
*
* Netfilter interface
*
****************************************************************************/
/*
* Packets arrive here from netfilter for queuing to userspace.
* All of them must be fed back via nf_reinject() or Alexey will kill Rusty.
*/
static int netfilter6_receive(struct sk_buff *skb,
struct nf_info *info, void *data)
{
return ip6q_enqueue((ip6q_queue_t *)data, skb, info);
}
/****************************************************************************
*
* Netlink interface.
*
****************************************************************************/
static struct sock *nfnl = NULL;
/* This is not a static one, so we should not repeat its name */
ip6q_queue_t *nlq6 = NULL;
static struct sk_buff *netlink_build_message(ip6q_queue_element_t *e, int *errp)
{
unsigned char *old_tail;
size_t size = 0;
size_t data_len = 0;
struct sk_buff *skb;
ipq_packet_msg_t *pm;
struct nlmsghdr *nlh;
switch (nlq6->peer.copy_mode) {
size_t copy_range;
case IPQ_COPY_META:
size = NLMSG_SPACE(sizeof(*pm));
data_len = 0;
break;
case IPQ_COPY_PACKET:
copy_range = nlq6->peer.copy_range;
if (copy_range == 0 || copy_range > e->skb->len)
data_len = e->skb->len;
else
data_len = copy_range;
size = NLMSG_SPACE(sizeof(*pm) + data_len);
break;
case IPQ_COPY_NONE:
default:
*errp = -EINVAL;
return NULL;
}
skb = alloc_skb(size, GFP_ATOMIC);
if (!skb)
goto nlmsg_failure;
old_tail = skb->tail;
nlh = NLMSG_PUT(skb, 0, 0, IPQM_PACKET, size - sizeof(*nlh));
pm = NLMSG_DATA(nlh);
memset(pm, 0, sizeof(*pm));
pm->packet_id = (unsigned long )e;
pm->data_len = data_len;
pm->timestamp_sec = e->skb->stamp.tv_sec;
pm->timestamp_usec = e->skb->stamp.tv_usec;
pm->mark = e->skb->nfmark;
pm->hook = e->info->hook;
if (e->info->indev) strcpy(pm->indev_name, e->info->indev->name);
else pm->indev_name[0] = '\0';
if (e->info->outdev) strcpy(pm->outdev_name, e->info->outdev->name);
else pm->outdev_name[0] = '\0';
pm->hw_protocol = e->skb->protocol;
if (e->info->indev && e->skb->dev) {
pm->hw_type = e->skb->dev->type;
if (e->skb->dev->hard_header_parse)
pm->hw_addrlen =
e->skb->dev->hard_header_parse(e->skb,
pm->hw_addr);
}
if (data_len)
memcpy(pm->payload, e->skb->data, data_len);
nlh->nlmsg_len = skb->tail - old_tail;
NETLINK_CB(skb).dst_groups = 0;
return skb;
nlmsg_failure:
if (skb)
kfree_skb(skb);
*errp = 0;
printk(KERN_ERR "ip6_queue: error creating netlink message\n");
return NULL;
}
static int netlink_send_peer(ip6q_queue_element_t *e)
{
int status = 0;
struct sk_buff *skb;
skb = netlink_build_message(e, &status);
if (skb == NULL)
return status;
return netlink_unicast(nfnl, skb, nlq6->peer.pid, MSG_DONTWAIT);
}
#define RCV_SKB_FAIL(err) do { netlink_ack(skb, nlh, (err)); return; } while (0);
static __inline__ void netlink_receive_user_skb(struct sk_buff *skb)
{
int status, type;
struct nlmsghdr *nlh;
if (skb->len < sizeof(struct nlmsghdr))
return;
nlh = (struct nlmsghdr *)skb->data;
if (nlh->nlmsg_len < sizeof(struct nlmsghdr)
|| skb->len < nlh->nlmsg_len)
return;
if(nlh->nlmsg_pid <= 0
|| !(nlh->nlmsg_flags & NLM_F_REQUEST)
|| nlh->nlmsg_flags & NLM_F_MULTI)
RCV_SKB_FAIL(-EINVAL);
if (nlh->nlmsg_flags & MSG_TRUNC)
RCV_SKB_FAIL(-ECOMM);
type = nlh->nlmsg_type;
if (type < NLMSG_NOOP || type >= IPQM_MAX)
RCV_SKB_FAIL(-EINVAL);
if (type <= IPQM_BASE)
return;
if(!cap_raised(NETLINK_CB(skb).eff_cap, CAP_NET_ADMIN))
RCV_SKB_FAIL(-EPERM);
if (nlq6->peer.pid && !nlq6->peer.died
&& (nlq6->peer.pid != nlh->nlmsg_pid)) {
printk(KERN_WARNING "ip6_queue: peer pid changed from %d to "
"%d, flushing queue\n", nlq6->peer.pid, nlh->nlmsg_pid);
ip6q_flush(nlq6);
}
nlq6->peer.pid = nlh->nlmsg_pid;
nlq6->peer.died = 0;
status = ip6q_receive_peer(nlq6, NLMSG_DATA(nlh),
type, skb->len - NLMSG_LENGTH(0));
if (status < 0)
RCV_SKB_FAIL(status);
if (nlh->nlmsg_flags & NLM_F_ACK)
netlink_ack(skb, nlh, 0);
return;
}
/* Note: we are only dealing with single part messages at the moment. */
static void netlink_receive_user_sk(struct sock *sk, int len)
{
do {
struct sk_buff *skb;
if (rtnl_shlock_nowait())
return;
while ((skb = skb_dequeue(&sk->receive_queue)) != NULL) {
netlink_receive_user_skb(skb);
kfree_skb(skb);
}
up(&rtnl_sem);
} while (nfnl && nfnl->receive_queue.qlen);
}
/****************************************************************************
*
* System events
*
****************************************************************************/
static int receive_event(struct notifier_block *this,
unsigned long event, void *ptr)
{
struct net_device *dev = ptr;
/* Drop any packets associated with the downed device */
if (event == NETDEV_DOWN)
ip6q_dev_drop(nlq6, dev->ifindex);
return NOTIFY_DONE;
}
struct notifier_block ip6q_dev_notifier = {
receive_event,
NULL,
0
};
/****************************************************************************
*
* Sysctl - queue tuning.
*
****************************************************************************/
static int sysctl_maxlen = IPQ_QMAX_DEFAULT;
static struct ctl_table_header *ip6q_sysctl_header;
static ctl_table ip6q_table[] = {
{ NET_IPQ_QMAX, NET_IPQ_QMAX_NAME, &sysctl_maxlen,
sizeof(sysctl_maxlen), 0644, NULL, proc_dointvec },
{ 0 }
};
static ctl_table ip6q_dir_table[] = {
{NET_IPV6, "ipv6", NULL, 0, 0555, ip6q_table, 0, 0, 0, 0, 0},
{ 0 }
};
static ctl_table ip6q_root_table[] = {
{CTL_NET, "net", NULL, 0, 0555, ip6q_dir_table, 0, 0, 0, 0, 0},
{ 0 }
};
/****************************************************************************
*
* Procfs - debugging info.
*
****************************************************************************/
static int ip6q_get_info(char *buffer, char **start, off_t offset, int length)
{
int len;
spin_lock_bh(&nlq6->lock);
len = sprintf(buffer,
"Peer pid : %d\n"
"Peer died : %d\n"
"Peer copy mode : %d\n"
"Peer copy range : %Zu\n"
"Queue length : %d\n"
"Queue max. length : %d\n"
"Queue flushing : %d\n"
"Queue terminate : %d\n",
nlq6->peer.pid,
nlq6->peer.died,
nlq6->peer.copy_mode,
nlq6->peer.copy_range,
nlq6->len,
*nlq6->maxlen,
nlq6->flushing,
nlq6->terminate);
spin_unlock_bh(&nlq6->lock);
*start = buffer + offset;
len -= offset;
if (len > length)
len = length;
else if (len < 0)
len = 0;
return len;
}
/****************************************************************************
*
* Module stuff.
*
****************************************************************************/
static int __init init(void)
{
int status = 0;
struct proc_dir_entry *proc;
/* We must create the NETLINK_IP6_FW protocol service */
nfnl = netlink_kernel_create(NETLINK_IP6_FW, netlink_receive_user_sk);
if (nfnl == NULL) {
printk(KERN_ERR "ip6_queue: initialisation failed: unable to "
"create kernel netlink socket\n");
return -ENOMEM;
}
nlq6 = ip6q_create_queue(netfilter6_receive,
netlink_send_peer, &status, &sysctl_maxlen);
if (nlq6 == NULL) {
printk(KERN_ERR "ip6_queue: initialisation failed: unable to "
"create queue\n");
sock_release(nfnl->socket);
return status;
}
/* The file will be /proc/net/ip6_queue */
proc = proc_net_create(IPQ_PROC_FS_NAME, 0, ip6q_get_info);
if (proc) proc->owner = THIS_MODULE;
else {
ip6q_destroy_queue(nlq6);
sock_release(nfnl->socket);
return -ENOMEM;
}
register_netdevice_notifier(&ip6q_dev_notifier);
ip6q_sysctl_header = register_sysctl_table(ip6q_root_table, 0);
return status;
}
static void __exit fini(void)
{
unregister_sysctl_table(ip6q_sysctl_header);
proc_net_remove(IPQ_PROC_FS_NAME);
unregister_netdevice_notifier(&ip6q_dev_notifier);
ip6q_destroy_queue(nlq6);
sock_release(nfnl->socket);
}
MODULE_DESCRIPTION("IPv6 packet queue handler");
MODULE_LICENSE("GPL");
module_init(init);
module_exit(fini);
|
|
From: Dave A. <ai...@us...> - 2003-06-10 03:08:17
|
Update of /cvsroot/linux-vax/kernel-2.4/net/ipv4/netfilter
In directory sc8-pr-cvs1:/tmp/cvs-serv14646/net/ipv4/netfilter
Added Files:
ipt_ULOG.c ipt_ah.c ipt_esp.c
Log Message:
DA: additional files from 2.4.1[78] kernels..
--- NEW FILE ---
/*
* netfilter module for userspace packet logging daemons
*
* (C) 2000-2002 by Harald Welte <la...@gn...>
*
* 2000/09/22 ulog-cprange feature added
* 2001/01/04 in-kernel queue as proposed by Sebastian Zander
* <za...@fo...>
* 2001/01/30 per-rule nlgroup conflicts with global queue.
* nlgroup now global (sysctl)
* 2001/04/19 ulog-queue reworked, now fixed buffer size specified at
* module loadtime -HW
*
* Released under the terms of the GPL
*
* This module accepts two parameters:
*
* nlbufsiz:
* The parameter specifies how big the buffer for each netlink multicast
* group is. e.g. If you say nlbufsiz=8192, up to eight kb of packets will
* get accumulated in the kernel until they are sent to userspace. It is
* NOT possible to allocate more than 128kB, and it is strongly discouraged,
* because atomically allocating 128kB inside the network rx softirq is not
* reliable. Please also keep in mind that this buffer size is allocated for
* each nlgroup you are using, so the total kernel memory usage increases
* by that factor.
*
* flushtimeout:
* Specify, after how many clock ticks (intel: 100 per second) the queue
* should be flushed even if it is not full yet.
*
* ipt_ULOG.c,v 1.15 2002/01/18 21:33:19 laforge Exp
*/
#include <linux/module.h>
#include <linux/version.h>
#include <linux/config.h>
#include <linux/spinlock.h>
#include <linux/socket.h>
#include <linux/skbuff.h>
#include <linux/kernel.h>
#include <linux/timer.h>
#include <linux/netlink.h>
#include <linux/netdevice.h>
#include <linux/mm.h>
#include <linux/socket.h>
#include <linux/netfilter_ipv4/ip_tables.h>
#include <linux/netfilter_ipv4/ipt_ULOG.h>
#include <linux/netfilter_ipv4/lockhelp.h>
#include <net/sock.h>
MODULE_LICENSE("GPL");
#define ULOG_NL_EVENT 111 /* Harald's favorite number */
#define ULOG_MAXNLGROUPS 32 /* numer of nlgroups */
#if 0
#define DEBUGP(format, args...) printk(__FILE__ ":" __FUNCTION__ ":" \
format, ## args)
#else
#define DEBUGP(format, args...)
#endif
#define PRINTR(format, args...) do { if (net_ratelimit()) printk(format, ## args); } while (0);
MODULE_AUTHOR("Harald Welte <la...@gn...>");
MODULE_DESCRIPTION("IP tables userspace logging module");
static unsigned int nlbufsiz = 4096;
MODULE_PARM(nlbufsiz, "i");
MODULE_PARM_DESC(nlbufsiz, "netlink buffer size");
static unsigned int flushtimeout = 10 * HZ;
MODULE_PARM(flushtimeout, "i");
MODULE_PARM_DESC(flushtimeout, "buffer flush timeout");
/* global data structures */
typedef struct {
unsigned int qlen; /* number of nlmsgs' in the skb */
struct nlmsghdr *lastnlh; /* netlink header of last msg in skb */
struct sk_buff *skb; /* the pre-allocated skb */
struct timer_list timer; /* the timer function */
} ulog_buff_t;
static ulog_buff_t ulog_buffers[ULOG_MAXNLGROUPS]; /* array of buffers */
static struct sock *nflognl; /* our socket */
static size_t qlen; /* current length of multipart-nlmsg */
DECLARE_LOCK(ulog_lock); /* spinlock */
/* send one ulog_buff_t to userspace */
static void ulog_send(unsigned int nlgroup)
{
ulog_buff_t *ub = &ulog_buffers[nlgroup];
if (timer_pending(&ub->timer)) {
DEBUGP("ipt_ULOG: ulog_send: timer was pending, deleting\n");
del_timer(&ub->timer);
}
/* last nlmsg needs NLMSG_DONE */
if (ub->qlen > 1)
ub->lastnlh->nlmsg_type = NLMSG_DONE;
NETLINK_CB(ub->skb).dst_groups = nlgroup;
DEBUGP("ipt_ULOG: throwing %d packets to netlink mask %u\n",
ub->qlen, nlgroup);
netlink_broadcast(nflognl, ub->skb, 0, nlgroup, GFP_ATOMIC);
ub->qlen = 0;
ub->skb = NULL;
ub->lastnlh = NULL;
}
/* timer function to flush queue in ULOG_FLUSH_INTERVAL time */
static void ulog_timer(unsigned long data)
{
DEBUGP("ipt_ULOG: timer function called, calling ulog_send\n");
/* lock to protect against somebody modifying our structure
* from ipt_ulog_target at the same time */
LOCK_BH(&ulog_lock);
ulog_send(data);
UNLOCK_BH(&ulog_lock);
}
static void nflog_rcv(struct sock *sk, int len)
{
printk("ipt_ULOG:nflog_rcv() did receive netlink message ?!?\n");
}
struct sk_buff *ulog_alloc_skb(unsigned int size)
{
struct sk_buff *skb;
/* alloc skb which should be big enough for a whole
* multipart message. WARNING: has to be <= 131000
* due to slab allocator restrictions */
skb = alloc_skb(nlbufsiz, GFP_ATOMIC);
if (!skb) {
PRINTR("ipt_ULOG: can't alloc whole buffer %ub!\n",
nlbufsiz);
/* try to allocate only as much as we need for
* current packet */
skb = alloc_skb(size, GFP_ATOMIC);
if (!skb)
PRINTR("ipt_ULOG: can't even allocate %ub\n", size);
}
return skb;
}
static unsigned int ipt_ulog_target(struct sk_buff **pskb,
unsigned int hooknum,
const struct net_device *in,
const struct net_device *out,
const void *targinfo, void *userinfo)
{
ulog_buff_t *ub;
ulog_packet_msg_t *pm;
size_t size, copy_len;
struct nlmsghdr *nlh;
struct ipt_ulog_info *loginfo = (struct ipt_ulog_info *) targinfo;
/* calculate the size of the skb needed */
if ((loginfo->copy_range == 0) ||
(loginfo->copy_range > (*pskb)->len)) {
copy_len = (*pskb)->len;
} else {
copy_len = loginfo->copy_range;
}
size = NLMSG_SPACE(sizeof(*pm) + copy_len);
ub = &ulog_buffers[loginfo->nl_group];
LOCK_BH(&ulog_lock);
if (!ub->skb) {
if (!(ub->skb = ulog_alloc_skb(size)))
goto alloc_failure;
} else if (ub->qlen >= loginfo->qthreshold ||
size > skb_tailroom(ub->skb)) {
/* either the queue len is too high or we don't have
* enough room in nlskb left. send it to userspace. */
ulog_send(loginfo->nl_group);
if (!(ub->skb = ulog_alloc_skb(size)))
goto alloc_failure;
}
DEBUGP("ipt_ULOG: qlen %d, qthreshold %d\n", ub->qlen,
loginfo->qthreshold);
/* NLMSG_PUT contains a hidden goto nlmsg_failure !!! */
nlh = NLMSG_PUT(ub->skb, 0, ub->qlen, ULOG_NL_EVENT,
size - sizeof(*nlh));
ub->qlen++;
pm = NLMSG_DATA(nlh);
/* copy hook, prefix, timestamp, payload, etc. */
pm->data_len = copy_len;
pm->timestamp_sec = (*pskb)->stamp.tv_sec;
pm->timestamp_usec = (*pskb)->stamp.tv_usec;
pm->mark = (*pskb)->nfmark;
pm->hook = hooknum;
if (loginfo->prefix[0] != '\0')
strncpy(pm->prefix, loginfo->prefix, sizeof(pm->prefix));
else
*(pm->prefix) = '\0';
if (in && in->hard_header_len > 0
&& (*pskb)->mac.raw != (void *) (*pskb)->nh.iph
&& in->hard_header_len <= ULOG_MAC_LEN) {
memcpy(pm->mac, (*pskb)->mac.raw, in->hard_header_len);
pm->mac_len = in->hard_header_len;
}
if (in)
strncpy(pm->indev_name, in->name, sizeof(pm->indev_name));
else
pm->indev_name[0] = '\0';
if (out)
strncpy(pm->outdev_name, out->name, sizeof(pm->outdev_name));
else
pm->outdev_name[0] = '\0';
if (copy_len)
memcpy(pm->payload, (*pskb)->data, copy_len);
/* check if we are building multi-part messages */
if (ub->qlen > 1) {
ub->lastnlh->nlmsg_flags |= NLM_F_MULTI;
}
/* if threshold is reached, send message to userspace */
if (qlen >= loginfo->qthreshold) {
if (loginfo->qthreshold > 1)
nlh->nlmsg_type = NLMSG_DONE;
}
ub->lastnlh = nlh;
/* if timer isn't already running, start it */
if (!timer_pending(&ub->timer)) {
ub->timer.expires = jiffies + flushtimeout;
add_timer(&ub->timer);
}
UNLOCK_BH(&ulog_lock);
return IPT_CONTINUE;
nlmsg_failure:
PRINTR("ipt_ULOG: error during NLMSG_PUT\n");
alloc_failure:
PRINTR("ipt_ULOG: Error building netlink message\n");
UNLOCK_BH(&ulog_lock);
return IPT_CONTINUE;
}
static int ipt_ulog_checkentry(const char *tablename,
const struct ipt_entry *e,
void *targinfo,
unsigned int targinfosize,
unsigned int hookmask)
{
struct ipt_ulog_info *loginfo = (struct ipt_ulog_info *) targinfo;
if (targinfosize != IPT_ALIGN(sizeof(struct ipt_ulog_info))) {
DEBUGP("ipt_ULOG: targinfosize %u != 0\n", targinfosize);
return 0;
}
if (loginfo->prefix[sizeof(loginfo->prefix) - 1] != '\0') {
DEBUGP("ipt_ULOG: prefix term %i\n",
loginfo->prefix[sizeof(loginfo->prefix) - 1]);
return 0;
}
if (loginfo->qthreshold > ULOG_MAX_QLEN) {
DEBUGP("ipt_ULOG: queue threshold %i > MAX_QLEN\n",
loginfo->qthreshold);
return 0;
}
return 1;
}
static struct ipt_target ipt_ulog_reg =
{ {NULL, NULL}, "ULOG", ipt_ulog_target, ipt_ulog_checkentry, NULL,
THIS_MODULE
};
static int __init init(void)
{
int i;
DEBUGP("ipt_ULOG: init module\n");
if (nlbufsiz >= 128*1024) {
printk("Netlink buffer has to be <= 128kB\n");
return -EINVAL;
}
/* initialize ulog_buffers */
for (i = 0; i < ULOG_MAXNLGROUPS; i++) {
memset(&ulog_buffers[i], 0, sizeof(ulog_buff_t));
init_timer(&ulog_buffers[i].timer);
ulog_buffers[i].timer.function = ulog_timer;
ulog_buffers[i].timer.data = i;
}
nflognl = netlink_kernel_create(NETLINK_NFLOG, nflog_rcv);
if (!nflognl)
return -ENOMEM;
if (ipt_register_target(&ipt_ulog_reg) != 0) {
sock_release(nflognl->socket);
return -EINVAL;
}
return 0;
}
static void __exit fini(void)
{
DEBUGP("ipt_ULOG: cleanup_module\n");
ipt_unregister_target(&ipt_ulog_reg);
sock_release(nflognl->socket);
}
module_init(init);
module_exit(fini);
--- NEW FILE ---
/* Kernel module to match AH parameters. */
#include <linux/module.h>
#include <linux/skbuff.h>
#include <linux/netfilter_ipv4/ipt_ah.h>
#include <linux/netfilter_ipv4/ip_tables.h>
EXPORT_NO_SYMBOLS;
MODULE_LICENSE("GPL");
#ifdef DEBUG_CONNTRACK
#define duprintf(format, args...) printk(format , ## args)
#else
#define duprintf(format, args...)
#endif
struct ahhdr {
__u32 spi;
};
/* Returns 1 if the spi is matched by the range, 0 otherwise */
static inline int
spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, int invert)
{
int r=0;
duprintf("ah spi_match:%c 0x%x <= 0x%x <= 0x%x",invert? '!':' ',
min,spi,max);
r=(spi >= min && spi <= max) ^ invert;
duprintf(" result %s\n",r? "PASS" : "FAILED");
return r;
}
static int
match(const struct sk_buff *skb,
const struct net_device *in,
const struct net_device *out,
const void *matchinfo,
int offset,
const void *hdr,
u_int16_t datalen,
int *hotdrop)
{
const struct ahhdr *ah = hdr;
const struct ipt_ah *ahinfo = matchinfo;
if (offset == 0 && datalen < sizeof(struct ahhdr)) {
/* We've been asked to examine this packet, and we
can't. Hence, no choice but to drop. */
duprintf("Dropping evil AH tinygram.\n");
*hotdrop = 1;
return 0;
}
/* Must not be a fragment. */
return !offset
&& spi_match(ahinfo->spis[0], ahinfo->spis[1],
ntohl(ah->spi),
!!(ahinfo->invflags & IPT_AH_INV_SPI));
}
/* Called when user tries to insert an entry of this type. */
static int
checkentry(const char *tablename,
const struct ipt_ip *ip,
void *matchinfo,
unsigned int matchinfosize,
unsigned int hook_mask)
{
const struct ipt_ah *ahinfo = matchinfo;
/* Must specify proto == AH, and no unknown invflags */
if (ip->proto != IPPROTO_AH || (ip->invflags & IPT_INV_PROTO)) {
duprintf("ipt_ah: Protocol %u != %u\n", ip->proto,
IPPROTO_AH);
return 0;
}
if (matchinfosize != IPT_ALIGN(sizeof(struct ipt_ah))) {
duprintf("ipt_ah: matchsize %u != %u\n",
matchinfosize, IPT_ALIGN(sizeof(struct ipt_ah)));
return 0;
}
if (ahinfo->invflags & ~IPT_AH_INV_MASK) {
duprintf("ipt_ah: unknown flags %X\n",
ahinfo->invflags);
return 0;
}
return 1;
}
static struct ipt_match ah_match
= { { NULL, NULL }, "ah", &match, &checkentry, NULL, THIS_MODULE };
int __init init(void)
{
return ipt_register_match(&ah_match);
}
void __exit cleanup(void)
{
ipt_unregister_match(&ah_match);
}
module_init(init);
module_exit(cleanup);
--- NEW FILE ---
/* Kernel module to match ESP parameters. */
#include <linux/module.h>
#include <linux/skbuff.h>
#include <linux/netfilter_ipv4/ipt_esp.h>
#include <linux/netfilter_ipv4/ip_tables.h>
EXPORT_NO_SYMBOLS;
MODULE_LICENSE("GPL");
#ifdef DEBUG_CONNTRACK
#define duprintf(format, args...) printk(format , ## args)
#else
#define duprintf(format, args...)
#endif
struct esphdr {
__u32 spi;
};
/* Returns 1 if the spi is matched by the range, 0 otherwise */
static inline int
spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, int invert)
{
int r=0;
duprintf("esp spi_match:%c 0x%x <= 0x%x <= 0x%x",invert? '!':' ',
min,spi,max);
r=(spi >= min && spi <= max) ^ invert;
duprintf(" result %s\n",r? "PASS" : "FAILED");
return r;
}
static int
match(const struct sk_buff *skb,
const struct net_device *in,
const struct net_device *out,
const void *matchinfo,
int offset,
const void *hdr,
u_int16_t datalen,
int *hotdrop)
{
const struct esphdr *esp = hdr;
const struct ipt_esp *espinfo = matchinfo;
if (offset == 0 && datalen < sizeof(struct esphdr)) {
/* We've been asked to examine this packet, and we
can't. Hence, no choice but to drop. */
duprintf("Dropping evil ESP tinygram.\n");
*hotdrop = 1;
return 0;
}
/* Must not be a fragment. */
return !offset
&& spi_match(espinfo->spis[0], espinfo->spis[1],
ntohl(esp->spi),
!!(espinfo->invflags & IPT_ESP_INV_SPI));
}
/* Called when user tries to insert an entry of this type. */
static int
checkentry(const char *tablename,
const struct ipt_ip *ip,
void *matchinfo,
unsigned int matchinfosize,
unsigned int hook_mask)
{
const struct ipt_esp *espinfo = matchinfo;
/* Must specify proto == ESP, and no unknown invflags */
if (ip->proto != IPPROTO_ESP || (ip->invflags & IPT_INV_PROTO)) {
duprintf("ipt_esp: Protocol %u != %u\n", ip->proto,
IPPROTO_ESP);
return 0;
}
if (matchinfosize != IPT_ALIGN(sizeof(struct ipt_esp))) {
duprintf("ipt_esp: matchsize %u != %u\n",
matchinfosize, IPT_ALIGN(sizeof(struct ipt_esp)));
return 0;
}
if (espinfo->invflags & ~IPT_ESP_INV_MASK) {
duprintf("ipt_esp: unknown flags %X\n",
espinfo->invflags);
return 0;
}
return 1;
}
static struct ipt_match esp_match
= { { NULL, NULL }, "esp", &match, &checkentry, NULL, THIS_MODULE };
static int __init init(void)
{
return ipt_register_match(&esp_match);
}
static void __exit cleanup(void)
{
ipt_unregister_match(&esp_match);
}
module_init(init);
module_exit(cleanup);
|
|
From: Dave A. <ai...@us...> - 2003-06-10 03:08:17
|
Update of /cvsroot/linux-vax/kernel-2.4/net/ipv4
In directory sc8-pr-cvs1:/tmp/cvs-serv14646/net/ipv4
Added Files:
tcp_diag.c
Log Message:
DA: additional files from 2.4.1[78] kernels..
--- NEW FILE ---
/*
* tcp_diag.c Module for monitoring TCP sockets.
*
* Version: $Id: tcp_diag.c,v 1.1 2003/06/10 03:08:13 airlied Exp $
*
* Authors: Alexey Kuznetsov, <ku...@ms...>
*
* 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.
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/random.h>
#include <linux/cache.h>
#include <linux/init.h>
#include <net/icmp.h>
#include <net/tcp.h>
#include <net/ipv6.h>
#include <net/inet_common.h>
#include <linux/inet.h>
#include <linux/stddef.h>
#include <linux/tcp_diag.h>
static struct sock *tcpnl;
#define TCPDIAG_PUT(skb, attrtype, attrlen) \
({ int rtalen = RTA_LENGTH(attrlen); \
struct rtattr *rta; \
if (skb_tailroom(skb) < RTA_ALIGN(rtalen)) goto nlmsg_failure; \
rta = (void*)__skb_put(skb, RTA_ALIGN(rtalen)); \
rta->rta_type = attrtype; \
rta->rta_len = rtalen; \
RTA_DATA(rta); })
static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk,
int ext, u32 pid, u32 seq)
{
struct tcp_opt *tp = &sk->tp_pinfo.af_tcp;
struct tcpdiagmsg *r;
struct nlmsghdr *nlh;
struct tcp_info *info = NULL;
struct tcpdiag_meminfo *minfo = NULL;
unsigned char *b = skb->tail;
nlh = NLMSG_PUT(skb, pid, seq, TCPDIAG_GETSOCK, sizeof(*r));
r = NLMSG_DATA(nlh);
if (sk->state != TCP_TIME_WAIT) {
if (ext & (1<<(TCPDIAG_MEMINFO-1)))
minfo = TCPDIAG_PUT(skb, TCPDIAG_MEMINFO, sizeof(*minfo));
if (ext & (1<<(TCPDIAG_INFO-1)))
info = TCPDIAG_PUT(skb, TCPDIAG_INFO, sizeof(*info));
}
r->tcpdiag_family = sk->family;
r->tcpdiag_state = sk->state;
r->tcpdiag_timer = 0;
r->tcpdiag_retrans = 0;
r->id.tcpdiag_sport = sk->sport;
r->id.tcpdiag_dport = sk->dport;
r->id.tcpdiag_src[0] = sk->rcv_saddr;
r->id.tcpdiag_dst[0] = sk->daddr;
r->id.tcpdiag_if = sk->bound_dev_if;
*((struct sock **)&r->id.tcpdiag_cookie) = sk;
if (r->tcpdiag_state == TCP_TIME_WAIT) {
struct tcp_tw_bucket *tw = (struct tcp_tw_bucket*)sk;
long tmo = tw->ttd - jiffies;
if (tmo < 0)
tmo = 0;
r->tcpdiag_state = tw->substate;
r->tcpdiag_timer = 3;
r->tcpdiag_expires = (tmo*1000+HZ-1)/HZ;
r->tcpdiag_rqueue = 0;
r->tcpdiag_wqueue = 0;
r->tcpdiag_uid = 0;
r->tcpdiag_inode = 0;
#ifdef CONFIG_IPV6
if (r->tcpdiag_family == AF_INET6) {
memcpy(r->id.tcpdiag_src, &tw->v6_rcv_saddr, 16);
memcpy(r->id.tcpdiag_dst, &tw->v6_daddr, 16);
}
#endif
nlh->nlmsg_len = skb->tail - b;
return skb->len;
}
#ifdef CONFIG_IPV6
if (r->tcpdiag_family == AF_INET6) {
memcpy(r->id.tcpdiag_src, &sk->net_pinfo.af_inet6.rcv_saddr, 16);
memcpy(r->id.tcpdiag_dst, &sk->net_pinfo.af_inet6.daddr, 16);
}
#endif
#define EXPIRES_IN_MS(tmo) ((tmo-jiffies)*1000+HZ-1)/HZ
if (tp->pending == TCP_TIME_RETRANS) {
r->tcpdiag_timer = 1;
r->tcpdiag_retrans = tp->retransmits;
r->tcpdiag_expires = EXPIRES_IN_MS(tp->timeout);
} else if (tp->pending == TCP_TIME_PROBE0) {
r->tcpdiag_timer = 4;
r->tcpdiag_retrans = tp->probes_out;
r->tcpdiag_expires = EXPIRES_IN_MS(tp->timeout);
} else if (timer_pending(&sk->timer)) {
r->tcpdiag_timer = 2;
r->tcpdiag_retrans = tp->probes_out;
r->tcpdiag_expires = EXPIRES_IN_MS(sk->timer.expires);
} else {
r->tcpdiag_timer = 0;
r->tcpdiag_expires = 0;
}
#undef EXPIRES_IN_MS
r->tcpdiag_rqueue = tp->rcv_nxt - tp->copied_seq;
r->tcpdiag_wqueue = tp->write_seq - tp->snd_una;
r->tcpdiag_uid = sock_i_uid(sk);
r->tcpdiag_inode = sock_i_ino(sk);
if (minfo) {
minfo->tcpdiag_rmem = atomic_read(&sk->rmem_alloc);
minfo->tcpdiag_wmem = sk->wmem_queued;
minfo->tcpdiag_fmem = sk->forward_alloc;
minfo->tcpdiag_tmem = atomic_read(&sk->wmem_alloc);
}
if (info) {
u32 now = tcp_time_stamp;
info->tcpi_state = sk->state;
info->tcpi_ca_state = tp->ca_state;
info->tcpi_retransmits = tp->retransmits;
info->tcpi_probes = tp->probes_out;
info->tcpi_backoff = tp->backoff;
info->tcpi_options = 0;
if (tp->tstamp_ok)
info->tcpi_options |= TCPI_OPT_TIMESTAMPS;
if (tp->sack_ok)
info->tcpi_options |= TCPI_OPT_SACK;
if (tp->wscale_ok) {
info->tcpi_options |= TCPI_OPT_WSCALE;
info->tcpi_snd_wscale = tp->snd_wscale;
info->tcpi_rcv_wscale = tp->rcv_wscale;
} else {
info->tcpi_snd_wscale = 0;
info->tcpi_rcv_wscale = 0;
}
#ifdef CONFIG_INET_ECN
if (tp->ecn_flags&TCP_ECN_OK)
info->tcpi_options |= TCPI_OPT_ECN;
#endif
info->tcpi_rto = (1000000*tp->rto)/HZ;
info->tcpi_ato = (1000000*tp->ack.ato)/HZ;
info->tcpi_snd_mss = tp->mss_cache;
info->tcpi_rcv_mss = tp->ack.rcv_mss;
info->tcpi_unacked = tp->packets_out;
info->tcpi_sacked = tp->sacked_out;
info->tcpi_lost = tp->lost_out;
info->tcpi_retrans = tp->retrans_out;
info->tcpi_fackets = tp->fackets_out;
info->tcpi_last_data_sent = ((now - tp->lsndtime)*1000)/HZ;
info->tcpi_last_ack_sent = 0;
info->tcpi_last_data_recv = ((now - tp->ack.lrcvtime)*1000)/HZ;
info->tcpi_last_ack_recv = ((now - tp->rcv_tstamp)*1000)/HZ;
info->tcpi_pmtu = tp->pmtu_cookie;
info->tcpi_rcv_ssthresh = tp->rcv_ssthresh;
info->tcpi_rtt = ((1000000*tp->srtt)/HZ)>>3;
info->tcpi_rttvar = ((1000000*tp->mdev)/HZ)>>2;
info->tcpi_snd_ssthresh = tp->snd_ssthresh;
info->tcpi_snd_cwnd = tp->snd_cwnd;
info->tcpi_advmss = tp->advmss;
info->tcpi_reordering = tp->reordering;
}
nlh->nlmsg_len = skb->tail - b;
return skb->len;
nlmsg_failure:
skb_trim(skb, b - skb->data);
return -1;
}
extern struct sock *tcp_v4_lookup(u32 saddr, u16 sport, u32 daddr, u16 dport, int dif);
#ifdef CONFIG_IPV6
extern struct sock *tcp_v6_lookup(struct in6_addr *saddr, u16 sport,
struct in6_addr *daddr, u16 dport,
int dif);
#endif
static int tcpdiag_get_exact(struct sk_buff *in_skb, struct nlmsghdr *nlh)
{
int err;
struct sock *sk;
struct tcpdiagreq *req = NLMSG_DATA(nlh);
struct sk_buff *rep;
if (req->tcpdiag_family == AF_INET) {
sk = tcp_v4_lookup(req->id.tcpdiag_dst[0], req->id.tcpdiag_dport,
req->id.tcpdiag_src[0], req->id.tcpdiag_sport,
req->id.tcpdiag_if);
}
#ifdef CONFIG_IPV6
else if (req->tcpdiag_family == AF_INET6) {
sk = tcp_v6_lookup((struct in6_addr*)req->id.tcpdiag_dst, req->id.tcpdiag_dport,
(struct in6_addr*)req->id.tcpdiag_src, req->id.tcpdiag_sport,
req->id.tcpdiag_if);
}
#endif
else {
return -EINVAL;
}
if (sk == NULL)
return -ENOENT;
err = -ESTALE;
if ((req->id.tcpdiag_cookie[0] != TCPDIAG_NOCOOKIE ||
req->id.tcpdiag_cookie[1] != TCPDIAG_NOCOOKIE) &&
sk != *((struct sock **)&req->id.tcpdiag_cookie[0]))
goto out;
err = -ENOMEM;
rep = alloc_skb(NLMSG_SPACE(sizeof(struct tcpdiagmsg)+
sizeof(struct tcpdiag_meminfo)+
sizeof(struct tcp_info)+64), GFP_KERNEL);
if (!rep)
goto out;
if (tcpdiag_fill(rep, sk, req->tcpdiag_ext,
NETLINK_CB(in_skb).pid,
nlh->nlmsg_seq) <= 0)
BUG();
err = netlink_unicast(tcpnl, rep, NETLINK_CB(in_skb).pid, MSG_DONTWAIT);
if (err > 0)
err = 0;
out:
if (sk) {
if (sk->state == TCP_TIME_WAIT)
tcp_tw_put((struct tcp_tw_bucket*)sk);
else
sock_put(sk);
}
return err;
}
int bitstring_match(u32 *a1, u32 *a2, int bits)
{
int words = bits >> 5;
bits &= 0x1f;
if (words) {
if (memcmp(a1, a2, words << 2))
return 0;
}
if (bits) {
__u32 w1, w2;
__u32 mask;
w1 = a1[words];
w2 = a2[words];
mask = htonl((0xffffffff) << (32 - bits));
if ((w1 ^ w2) & mask)
return 0;
}
return 1;
}
int tcpdiag_bc_run(char *bc, int len, struct sock *sk)
{
while (len > 0) {
int yes = 1;
struct tcpdiag_bc_op *op = (struct tcpdiag_bc_op*)bc;
switch (op->code) {
case TCPDIAG_BC_NOP:
break;
case TCPDIAG_BC_JMP:
yes = 0;
break;
case TCPDIAG_BC_S_GE:
yes = (sk->num >= op[1].no);
break;
case TCPDIAG_BC_S_LE:
yes = (sk->num <= op[1].no);
break;
case TCPDIAG_BC_D_GE:
yes = (ntohs(sk->dport) >= op[1].no);
break;
case TCPDIAG_BC_D_LE:
yes = (ntohs(sk->dport) <= op[1].no);
break;
case TCPDIAG_BC_AUTO:
yes = !(sk->userlocks&SOCK_BINDPORT_LOCK);
break;
case TCPDIAG_BC_S_COND:
case TCPDIAG_BC_D_COND:
{
struct tcpdiag_hostcond *cond = (struct tcpdiag_hostcond*)(op+1);
u32 *addr;
if (cond->port != -1 &&
cond->port != (op->code == TCPDIAG_BC_S_COND ? sk->num : ntohs(sk->dport))) {
yes = 0;
break;
}
if (cond->prefix_len == 0)
break;
#ifdef CONFIG_IPV6
if (sk->family == AF_INET6) {
if (op->code == TCPDIAG_BC_S_COND)
addr = (u32*)&sk->net_pinfo.af_inet6.rcv_saddr;
else
addr = (u32*)&sk->net_pinfo.af_inet6.daddr;
} else
#endif
{
if (op->code == TCPDIAG_BC_S_COND)
addr = &sk->rcv_saddr;
else
addr = &sk->daddr;
}
if (bitstring_match(addr, cond->addr, cond->prefix_len))
break;
if (sk->family == AF_INET6 && cond->family == AF_INET) {
if (addr[0] == 0 && addr[1] == 0 &&
addr[2] == __constant_htonl(0xffff) &&
bitstring_match(addr+3, cond->addr, cond->prefix_len))
break;
}
yes = 0;
break;
}
}
if (yes) {
len -= op->yes;
bc += op->yes;
} else {
len -= op->no;
bc += op->no;
}
}
return (len == 0);
}
int valid_cc(char *bc, int len, int cc)
{
while (len >= 0) {
struct tcpdiag_bc_op *op = (struct tcpdiag_bc_op*)bc;
if (cc > len)
return 0;
if (cc == len)
return 1;
if (op->yes < 4)
return 0;
len -= op->yes;
bc += op->yes;
}
return 0;
}
int tcpdiag_bc_audit(char *bytecode, int bytecode_len)
{
char *bc = bytecode;
int len = bytecode_len;
while (len > 0) {
struct tcpdiag_bc_op *op = (struct tcpdiag_bc_op*)bc;
//printk("BC: %d %d %d {%d} / %d\n", op->code, op->yes, op->no, op[1].no, len);
switch (op->code) {
case TCPDIAG_BC_AUTO:
case TCPDIAG_BC_S_COND:
case TCPDIAG_BC_D_COND:
case TCPDIAG_BC_S_GE:
case TCPDIAG_BC_S_LE:
case TCPDIAG_BC_D_GE:
case TCPDIAG_BC_D_LE:
if (op->yes < 4 || op->yes > len+4)
return -EINVAL;
case TCPDIAG_BC_JMP:
if (op->no < 4 || op->no > len+4)
return -EINVAL;
if (op->no < len &&
!valid_cc(bytecode, bytecode_len, len-op->no))
return -EINVAL;
break;
case TCPDIAG_BC_NOP:
if (op->yes < 4 || op->yes > len+4)
return -EINVAL;
break;
default:
return -EINVAL;
}
bc += op->yes;
len -= op->yes;
}
return len == 0 ? 0 : -EINVAL;
}
int tcpdiag_dump(struct sk_buff *skb, struct netlink_callback *cb)
{
int i, num;
int s_i, s_num;
struct tcpdiagreq *r = NLMSG_DATA(cb->nlh);
struct rtattr *bc = NULL;
if (cb->nlh->nlmsg_len > 4+NLMSG_SPACE(sizeof(struct tcpdiagreq)))
bc = (struct rtattr*)(r+1);
s_i = cb->args[1];
s_num = num = cb->args[2];
if (cb->args[0] == 0) {
if (!(r->tcpdiag_states&(TCPF_LISTEN|TCPF_SYN_RECV)))
goto skip_listen_ht;
tcp_listen_lock();
for (i = s_i; i < TCP_LHTABLE_SIZE; i++) {
struct sock *sk = tcp_listening_hash[i];
if (i > s_i)
s_num = 0;
for (sk = tcp_listening_hash[i], num = 0;
sk != NULL;
sk = sk->next, num++) {
if (num < s_num)
continue;
if (!(r->tcpdiag_states&TCPF_LISTEN) ||
r->id.tcpdiag_dport)
continue;
if (r->id.tcpdiag_sport != sk->sport && r->id.tcpdiag_sport)
continue;
if (bc && !tcpdiag_bc_run(RTA_DATA(bc), RTA_PAYLOAD(bc), sk))
continue;
if (tcpdiag_fill(skb, sk, r->tcpdiag_ext,
NETLINK_CB(cb->skb).pid,
cb->nlh->nlmsg_seq) <= 0) {
tcp_listen_unlock();
goto done;
}
}
}
tcp_listen_unlock();
skip_listen_ht:
cb->args[0] = 1;
s_i = num = s_num = 0;
}
if (!(r->tcpdiag_states&~(TCPF_LISTEN|TCPF_SYN_RECV)))
return skb->len;
for (i = s_i; i < tcp_ehash_size; i++) {
struct tcp_ehash_bucket *head = &tcp_ehash[i];
struct sock *sk;
if (i > s_i)
s_num = 0;
read_lock_bh(&head->lock);
for (sk = head->chain, num = 0;
sk != NULL;
sk = sk->next, num++) {
if (num < s_num)
continue;
if (!(r->tcpdiag_states&(1<<sk->state)))
continue;
if (r->id.tcpdiag_sport != sk->sport && r->id.tcpdiag_sport)
continue;
if (r->id.tcpdiag_dport != sk->dport && r->id.tcpdiag_dport)
continue;
if (bc && !tcpdiag_bc_run(RTA_DATA(bc), RTA_PAYLOAD(bc), sk))
continue;
if (tcpdiag_fill(skb, sk, r->tcpdiag_ext,
NETLINK_CB(cb->skb).pid,
cb->nlh->nlmsg_seq) <= 0) {
read_unlock_bh(&head->lock);
goto done;
}
}
if (r->tcpdiag_states&TCPF_TIME_WAIT) {
for (sk = tcp_ehash[i+tcp_ehash_size].chain;
sk != NULL;
sk = sk->next, num++) {
if (num < s_num)
continue;
if (!(r->tcpdiag_states&(1<<sk->zapped)))
continue;
if (r->id.tcpdiag_sport != sk->sport && r->id.tcpdiag_sport)
continue;
if (r->id.tcpdiag_dport != sk->dport && r->id.tcpdiag_dport)
continue;
if (bc && !tcpdiag_bc_run(RTA_DATA(bc), RTA_PAYLOAD(bc), sk))
continue;
if (tcpdiag_fill(skb, sk, r->tcpdiag_ext,
NETLINK_CB(cb->skb).pid,
cb->nlh->nlmsg_seq) <= 0) {
read_unlock_bh(&head->lock);
goto done;
}
}
}
read_unlock_bh(&head->lock);
}
done:
cb->args[1] = i;
cb->args[2] = num;
return skb->len;
}
static int tcpdiag_dump_done(struct netlink_callback *cb)
{
return 0;
}
static __inline__ int
tcpdiag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
{
if (!(nlh->nlmsg_flags&NLM_F_REQUEST))
return 0;
if (nlh->nlmsg_type != TCPDIAG_GETSOCK)
goto err_inval;
if (NLMSG_LENGTH(sizeof(struct tcpdiagreq)) > skb->len)
goto err_inval;
if (nlh->nlmsg_flags&NLM_F_DUMP) {
if (nlh->nlmsg_len > 4 + NLMSG_SPACE(sizeof(struct tcpdiagreq))) {
struct rtattr *rta = (struct rtattr*)(NLMSG_DATA(nlh) + sizeof(struct tcpdiagreq));
if (rta->rta_type != TCPDIAG_REQ_BYTECODE ||
rta->rta_len < 8 ||
rta->rta_len > nlh->nlmsg_len - NLMSG_SPACE(sizeof(struct tcpdiagreq)))
goto err_inval;
if (tcpdiag_bc_audit(RTA_DATA(rta), RTA_PAYLOAD(rta)))
goto err_inval;
}
return netlink_dump_start(tcpnl, skb, nlh,
tcpdiag_dump,
tcpdiag_dump_done);
} else {
return tcpdiag_get_exact(skb, nlh);
}
err_inval:
return -EINVAL;
}
extern __inline__ void tcpdiag_rcv_skb(struct sk_buff *skb)
{
int err;
struct nlmsghdr * nlh;
if (skb->len >= NLMSG_SPACE(0)) {
nlh = (struct nlmsghdr *)skb->data;
if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len)
return;
err = tcpdiag_rcv_msg(skb, nlh);
if (err)
netlink_ack(skb, nlh, err);
}
}
static void tcpdiag_rcv(struct sock *sk, int len)
{
struct sk_buff *skb;
while ((skb = skb_dequeue(&sk->receive_queue)) != NULL) {
tcpdiag_rcv_skb(skb);
kfree_skb(skb);
}
}
void __init tcpdiag_init(void)
{
tcpnl = netlink_kernel_create(NETLINK_TCPDIAG, tcpdiag_rcv);
if (tcpnl == NULL)
panic("tcpdiag_init: Cannot create netlink socket.");
}
|
|
From: Dave A. <ai...@us...> - 2003-06-10 03:08:17
|
Update of /cvsroot/linux-vax/kernel-2.4/include/linux/netfilter_ipv4
In directory sc8-pr-cvs1:/tmp/cvs-serv14646/include/linux/netfilter_ipv4
Added Files:
ipt_ULOG.h ipt_ah.h ipt_esp.h
Log Message:
DA: additional files from 2.4.1[78] kernels..
--- NEW FILE ---
/* Header file for IP tables userspace logging, Version 1.8
*
* (C) 2000-2002 by Harald Welte <la...@gn...>
*
* Distributed under the terms of GNU GPL */
#ifndef _IPT_ULOG_H
#define _IPT_ULOG_H
#ifndef NETLINK_NFLOG
#define NETLINK_NFLOG 5
#endif
#define ULOG_MAC_LEN 80
#define ULOG_PREFIX_LEN 32
#define ULOG_MAX_QLEN 50
/* Why 50? Well... there is a limit imposed by the slab cache 131000
* bytes. So the multipart netlink-message has to be < 131000 bytes.
* Assuming a standard ethernet-mtu of 1500, we could define this up
* to 80... but even 50 seems to be big enough. */
/* private data structure for each rule with a ULOG target */
struct ipt_ulog_info {
unsigned int nl_group;
size_t copy_range;
size_t qthreshold;
char prefix[ULOG_PREFIX_LEN];
};
/* Format of the ULOG packets passed through netlink */
typedef struct ulog_packet_msg {
unsigned long mark;
long timestamp_sec;
long timestamp_usec;
unsigned int hook;
char indev_name[IFNAMSIZ];
char outdev_name[IFNAMSIZ];
size_t data_len;
char prefix[ULOG_PREFIX_LEN];
unsigned char mac_len;
unsigned char mac[ULOG_MAC_LEN];
unsigned char payload[0];
} ulog_packet_msg_t;
#endif /*_IPT_ULOG_H*/
--- NEW FILE ---
#ifndef _IPT_AH_H
#define _IPT_AH_H
struct ipt_ah
{
u_int32_t spis[2]; /* Security Parameter Index */
u_int8_t invflags; /* Inverse flags */
};
/* Values for "invflags" field in struct ipt_ah. */
#define IPT_AH_INV_SPI 0x01 /* Invert the sense of spi. */
#define IPT_AH_INV_MASK 0x01 /* All possible flags. */
#endif /*_IPT_AH_H*/
--- NEW FILE ---
#ifndef _IPT_ESP_H
#define _IPT_ESP_H
struct ipt_esp
{
u_int32_t spis[2]; /* Security Parameter Index */
u_int8_t invflags; /* Inverse flags */
};
/* Values for "invflags" field in struct ipt_esp. */
#define IPT_ESP_INV_SPI 0x01 /* Invert the sense of spi. */
#define IPT_ESP_INV_MASK 0x01 /* All possible flags. */
#endif /*_IPT_ESP_H*/
|
|
From: Dave A. <ai...@us...> - 2003-06-10 03:08:16
|
Update of /cvsroot/linux-vax/kernel-2.4/include/asm-ppc
In directory sc8-pr-cvs1:/tmp/cvs-serv14646/include/asm-ppc
Added Files:
ans-lcd.h pmac_feature.h
Log Message:
DA: additional files from 2.4.1[78] kernels..
--- NEW FILE ---
#ifndef _PPC_ANS_LCD_H
#define _PPC_ANS_LCD_H
#define ANSLCD_MINOR 156
#define ANSLCD_CLEAR 0x01
#define ANSLCD_SENDCTRL 0x02
#define ANSLCD_SETSHORTDELAY 0x03
#define ANSLCD_SETLONGDELAY 0x04
#endif
--- NEW FILE ---
/*
* Definition of platform feature hooks for PowerMacs
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1998 Paul Mackerras &
* Ben. Herrenschmidt.
*
*
* Note: I removed media-bay details from the feature stuff, I beleive it's
* not worth it, the media-bay driver can directly use the mac-io
* ASIC registers.
*
* Implementation note: Currently, none of these functions will block.
* However, they may internally protect themselves with a spinlock
* for way too long. Be prepared for at least some of these to block
* in the future.
*
* Unless specifically defined, the result code is assumed to be an
* error when negative, 0 is the default success result. Some functions
* may return additional positive result values.
*
* To keep implementation simple, all feature calls are assumed to have
* the prototype parameters (struct device_node* node, int value).
* When either is not used, pass 0.
*/
#ifdef __KERNEL__
#ifndef __PPC_ASM_PMAC_FEATURE_H
#define __PPC_ASM_PMAC_FEATURE_H
/*
* Known Mac motherboard models
*
* Please, report any error here to be...@ke..., thanks !
*/
/* PowerSurge are the first generation of PCI Pmacs. This include
* all of the Grand-Central based machines
*/
#define PMAC_TYPE_PSURGE 0x10 /* PowerSurge */
/* Here is the infamous serie of OHare based machines
*/
#define PMAC_TYPE_COMET 0x20 /* Beleived to be PowerBook 2400 */
#define PMAC_TYPE_HOOPER 0x21 /* Beleived to be PowerBook 3400 */
#define PMAC_TYPE_KANGA 0x22 /* PowerBook 3500 (first G3) */
#define PMAC_TYPE_ALCHEMY 0x23 /* Alchemy motherboard base */
#define PMAC_TYPE_GAZELLE 0x24 /* Spartacus, some 5xxx/6xxx */
#define PMAC_TYPE_UNKNOWN_OHARE 0x2f /* Unknown, but OHare based */
/* Here are the Heathrow based machines
* FIXME: Differenciate wallstreet,mainstreet,wallstreetII
*/
#define PMAC_TYPE_GOSSAMER 0x30 /* Gossamer motherboard */
#define PMAC_TYPE_SILK 0x31 /* Desktop PowerMac G3 */
#define PMAC_TYPE_WALLSTREET 0x32 /* Wallstreet/Mainstreet PowerBook*/
#define PMAC_TYPE_UNKNOWN_HEATHROW 0x3f /* Unknown but heathrow based */
/* Here are newworld machines based on Paddington (heathrow derivative)
*/
#define PMAC_TYPE_101_PBOOK 0x40 /* 101 PowerBook (aka Lombard) */
#define PMAC_TYPE_ORIG_IMAC 0x41 /* First generation iMac */
#define PMAC_TYPE_YOSEMITE 0x42 /* B&W G3 */
#define PMAC_TYPE_YIKES 0x43 /* Yikes G4 (PCI graphics) */
#define PMAC_TYPE_UNKNOWN_PADDINGTON 0x4f /* Unknown but paddington based */
/* Core99 machines based on UniNorth 1.0 and 1.5
*
* Note: A single entry here may cover several actual models according
* to the device-tree. (Sawtooth is most tower G4s, FW_IMAC is most
* FireWire based iMacs, etc...). Those machines are too similar to be
* distinguished here, when they need to be differencied, use the
* device-tree "model" or "compatible" property.
*/
#define PMAC_TYPE_ORIG_IBOOK 0x40 /* First iBook model (no firewire) */
#define PMAC_TYPE_SAWTOOTH 0x41 /* Desktop G4s */
#define PMAC_TYPE_FW_IMAC 0x42 /* FireWire iMacs (except Pangea based) */
#define PMAC_TYPE_FW_IBOOK 0x43 /* FireWire iBooks (except iBook2) */
#define PMAC_TYPE_CUBE 0x44 /* Cube PowerMac */
#define PMAC_TYPE_QUICKSILVER 0x45 /* QuickSilver G4s */
#define PMAC_TYPE_PISMO 0x46 /* Pismo PowerBook */
#define PMAC_TYPE_TITANIUM 0x47 /* Titanium PowerBook */
#define PMAC_TYPE_TITANIUM2 0x48 /* Titanium II PowerBook */
#define PMAC_TYPE_UNKNOWN_CORE99 0x5f
/* MacRISC2 machines based on the Pangea chipset
*/
#define PMAC_TYPE_PANGEA_IMAC 0x100 /* Flower Power iMac */
#define PMAC_TYPE_IBOOK2 0x101 /* iBook2 (polycarbonate) */
#define PMAC_TYPE_UNKNOWN_PANGEA 0x10f
/*
* Motherboard flags
*/
#define PMAC_MB_CAN_SLEEP 0x00000001
#define PMAC_MB_HAS_FW_POWER 0x00000002
/*
* Feature calls supported on pmac
*
*/
/*
* Use this inline wrapper
*/
struct device_node;
static inline int pmac_call_feature(int selector, struct device_node* node,
int param, int value)
{
if (!ppc_md.feature_call)
return -ENODEV;
return ppc_md.feature_call(selector, node, param, value);
}
/* PMAC_FTR_SERIAL_ENABLE (struct device_node* node, int param, int value)
* enable/disable an SCC side. Pass the node corresponding to the
* channel side as a parameter.
* param is the type of port
* if param is ored with PMAC_SCC_FLAG_XMON, then the SCC is locked enabled
* for use by xmon.
*/
#define PMAC_FTR_SCC_ENABLE PMAC_FTR_DEF(0)
#define PMAC_SCC_ASYNC 0
#define PMAC_SCC_IRDA 1
#define PMAC_SCC_I2S1 2
#define PMAC_SCC_FLAG_XMON 0x00001000
/* PMAC_FTR_MODEM_ENABLE (struct device_node* node, 0, int value)
* enable/disable the internal modem.
*/
#define PMAC_FTR_MODEM_ENABLE PMAC_FTR_DEF(1)
/* PMAC_FTR_SWIM3_ENABLE (struct device_node* node, 0,int value)
* enable/disable the swim3 (floppy) cell of a mac-io ASIC
*/
#define PMAC_FTR_SWIM3_ENABLE PMAC_FTR_DEF(2)
/* PMAC_FTR_MESH_ENABLE (struct device_node* node, 0, int value)
* enable/disable the mesh (scsi) cell of a mac-io ASIC
*/
#define PMAC_FTR_MESH_ENABLE PMAC_FTR_DEF(3)
/* PMAC_FTR_IDE_ENABLE (struct device_node* node, int busID, int value)
* enable/disable an IDE port of a mac-io ASIC
* pass the busID parameter
*/
#define PMAC_FTR_IDE_ENABLE PMAC_FTR_DEF(4)
/* PMAC_FTR_IDE_RESET (struct device_node* node, int busID, int value)
* assert(1)/release(0) an IDE reset line (mac-io IDE only)
*/
#define PMAC_FTR_IDE_RESET PMAC_FTR_DEF(5)
/* PMAC_FTR_BMAC_ENABLE (struct device_node* node, 0, int value)
* enable/disable the bmac (ethernet) cell of a mac-io ASIC, also drive
* it's reset line
*/
#define PMAC_FTR_BMAC_ENABLE PMAC_FTR_DEF(6)
/* PMAC_FTR_GMAC_ENABLE (struct device_node* node, 0, int value)
* enable/disable the gmac (ethernet) cell of an uninorth ASIC. This
* control the cell's clock.
*/
#define PMAC_FTR_GMAC_ENABLE PMAC_FTR_DEF(7)
/* PMAC_FTR_GMAC_PHY_RESET (struct device_node* node, 0, 0)
* Perform a HW reset of the PHY connected to a gmac controller.
* Pass the gmac device node, not the PHY node.
*/
#define PMAC_FTR_GMAC_PHY_RESET PMAC_FTR_DEF(8)
/* PMAC_FTR_SOUND_CHIP_ENABLE (struct device_node* node, 0, int value)
* enable/disable the sound chip, whatever it is and provided it can
* acually be controlled
*/
#define PMAC_FTR_SOUND_CHIP_ENABLE PMAC_FTR_DEF(9)
/* -- add various tweaks related to sound routing -- */
/* PMAC_FTR_AIRPORT_ENABLE (struct device_node* node, 0, int value)
* enable/disable the airport card
*/
#define PMAC_FTR_AIRPORT_ENABLE PMAC_FTR_DEF(10)
/* PMAC_FTR_RESET_CPU (NULL, int cpu_nr, 0)
* toggle the reset line of a CPU on an uninorth-based SMP machine
*/
#define PMAC_FTR_RESET_CPU PMAC_FTR_DEF(11)
/* PMAC_FTR_USB_ENABLE (struct device_node* node, 0, int value)
* enable/disable an USB cell, along with the power of the USB "pad"
* on keylargo based machines
*/
#define PMAC_FTR_USB_ENABLE PMAC_FTR_DEF(12)
/* PMAC_FTR_1394_ENABLE (struct device_node* node, 0, int value)
* enable/disable the firewire cell of an uninorth ASIC.
*/
#define PMAC_FTR_1394_ENABLE PMAC_FTR_DEF(13)
/* PMAC_FTR_1394_CABLE_POWER (struct device_node* node, 0, int value)
* enable/disable the firewire cable power supply of the uninorth
* firewire cell
*/
#define PMAC_FTR_1394_CABLE_POWER PMAC_FTR_DEF(14)
/* PMAC_FTR_SLEEP_STATE (struct device_node* node, 0, int value)
* set the sleep state of the motherboard.
* Pass -1 as value to query for sleep capability
*/
#define PMAC_FTR_SLEEP_STATE PMAC_FTR_DEF(15)
/* PMAC_FTR_GET_MB_INFO (NULL, selector, 0)
*
* returns some motherboard infos.
* selector: 0 - model id
* 1 - model flags (capabilities)
* 2 - model name (cast to const char *)
*/
#define PMAC_FTR_GET_MB_INFO PMAC_FTR_DEF(16)
#define PMAC_MB_INFO_MODEL 0
#define PMAC_MB_INFO_FLAGS 1
#define PMAC_MB_INFO_NAME 2
/* PMAC_FTR_READ_GPIO (NULL, int index, 0)
*
* read a GPIO from a mac-io controller of type KeyLargo or Pangea.
* the value returned is a byte (positive), or a negative error code
*/
#define PMAC_FTR_READ_GPIO PMAC_FTR_DEF(17)
/* PMAC_FTR_WRITE_GPIO (NULL, int index, int value)
*
* write a GPIO of a mac-io controller of type KeyLargo or Pangea.
*/
#define PMAC_FTR_WRITE_GPIO PMAC_FTR_DEF(18)
/* Don't use those directly, they are for the sake of pmac_setup.c */
extern int pmac_do_feature_call(unsigned int selector, ...);
extern void pmac_feature_init(void);
extern void pmac_feature_late_init(void);
#define PMAC_FTR_DEF(x) ((_MACH_Pmac << 16) | (x))
#endif /* __PPC_ASM_PMAC_FEATURE_H */
#endif /* __KERNEL__ */
|
|
From: Dave A. <ai...@us...> - 2003-06-10 03:08:16
|
Update of /cvsroot/linux-vax/kernel-2.4/include/linux
In directory sc8-pr-cvs1:/tmp/cvs-serv14646/include/linux
Added Files:
stringify.h tcp_diag.h
Log Message:
DA: additional files from 2.4.1[78] kernels..
--- NEW FILE ---
#ifndef __LINUX_STRINGIFY_H
#define __LINUX_STRINGIFY_H
/* Indirect stringification. Doing two levels allows the parameter to be a
* macro itself. For example, compile with -DFOO=bar, __stringify(FOO)
* converts to "bar".
*/
#define __stringify_1(x) #x
#define __stringify(x) __stringify_1(x)
#endif /* !__LINUX_STRINGIFY_H */
--- NEW FILE ---
#ifndef _TCP_DIAG_H_
#define _TCP_DIAG_H_ 1
/* Just some random number */
#define TCPDIAG_GETSOCK 18
/* Socket identity */
struct tcpdiag_sockid
{
__u16 tcpdiag_sport;
__u16 tcpdiag_dport;
__u32 tcpdiag_src[4];
__u32 tcpdiag_dst[4];
__u32 tcpdiag_if;
__u32 tcpdiag_cookie[2];
#define TCPDIAG_NOCOOKIE (~0U)
};
/* Request structure */
struct tcpdiagreq
{
__u8 tcpdiag_family; /* Family of addresses. */
__u8 tcpdiag_src_len;
__u8 tcpdiag_dst_len;
__u8 tcpdiag_ext; /* Query extended information */
struct tcpdiag_sockid id;
__u32 tcpdiag_states; /* States to dump */
__u32 tcpdiag_dbs; /* Tables to dump (NI) */
};
enum
{
TCPDIAG_REQ_NONE,
TCPDIAG_REQ_BYTECODE,
};
#define TCPDIAG_REQ_MAX TCPDIAG_REQ_BYTECODE
/* Bytecode is sequence of 4 byte commands followed by variable arguments.
* All the commands identified by "code" are conditional jumps forward:
* to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be
* length of the command and its arguments.
*/
struct tcpdiag_bc_op
{
unsigned char code;
unsigned char yes;
unsigned short no;
};
enum
{
TCPDIAG_BC_NOP,
TCPDIAG_BC_JMP,
TCPDIAG_BC_S_GE,
TCPDIAG_BC_S_LE,
TCPDIAG_BC_D_GE,
TCPDIAG_BC_D_LE,
TCPDIAG_BC_AUTO,
TCPDIAG_BC_S_COND,
TCPDIAG_BC_D_COND,
};
struct tcpdiag_hostcond
{
__u8 family;
__u8 prefix_len;
int port;
__u32 addr[0];
};
/* Base info structure. It contains socket identity (addrs/ports/cookie)
* and, alas, the information shown by netstat. */
struct tcpdiagmsg
{
__u8 tcpdiag_family;
__u8 tcpdiag_state;
__u8 tcpdiag_timer;
__u8 tcpdiag_retrans;
struct tcpdiag_sockid id;
__u32 tcpdiag_expires;
__u32 tcpdiag_rqueue;
__u32 tcpdiag_wqueue;
__u32 tcpdiag_uid;
__u32 tcpdiag_inode;
};
/* Extensions */
enum
{
TCPDIAG_NONE,
TCPDIAG_MEMINFO,
TCPDIAG_INFO,
};
#define TCPDIAG_MAX TCPDIAG_INFO
/* TCPDIAG_MEM */
struct tcpdiag_meminfo
{
__u32 tcpdiag_rmem;
__u32 tcpdiag_wmem;
__u32 tcpdiag_fmem;
__u32 tcpdiag_tmem;
};
#endif /* _TCP_DIAG_H_ */
|
|
From: Dave A. <ai...@us...> - 2003-06-10 03:08:16
|
Update of /cvsroot/linux-vax/kernel-2.4/include/asm-cris In directory sc8-pr-cvs1:/tmp/cvs-serv14646/include/asm-cris Added Files: ethernet.h Log Message: DA: additional files from 2.4.1[78] kernels.. --- NEW FILE --- /* * ioctl defines for ethernet driver * * Copyright (c) 2001 Axis Communications AB * * Author: Mikael Starvik * */ #ifndef _CRIS_ETHERNET_H #define _CRIS_ETHERNET_H #define SET_ETH_SPEED_AUTO SIOCDEVPRIVATE /* Auto neg speed */ #define SET_ETH_SPEED_10 SIOCDEVPRIVATE+1 /* 10 Mbps */ #define SET_ETH_SPEED_100 SIOCDEVPRIVATE+2 /* 100 Mbps. */ #define SET_ETH_DUPLEX_AUTO SIOCDEVPRIVATE+3 /* Auto neg duplex */ #define SET_ETH_DUPLEX_HALF SIOCDEVPRIVATE+4 /* Full duplex */ #define SET_ETH_DUPLEX_FULL SIOCDEVPRIVATE+5 /* Half duplex */ #endif /* _CRIS_ETHERNET_H */ |
|
From: Dave A. <ai...@us...> - 2003-06-10 03:08:15
|
Update of /cvsroot/linux-vax/kernel-2.4/fs/nls In directory sc8-pr-cvs1:/tmp/cvs-serv14646/fs/nls Added Files: nls_cp1250.c Log Message: DA: additional files from 2.4.1[78] kernels.. --- NEW FILE --- /* * linux/fs/nls_cp1250.c * * Charset cp1250 translation tables. * Generated automatically from the Unicode and charset * tables from the Unicode Organization (www.unicode.org). * The Unicode to charset table has only exact mappings. */ #include <linux/module.h> #include <linux/kernel.h> #include <linux/string.h> #include <linux/nls.h> #include <linux/errno.h> static wchar_t charset2uni[256] = { /* 0x00*/ 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, /* 0x10*/ 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, /* 0x20*/ 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, /* 0x30*/ 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, /* 0x40*/ 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, /* 0x50*/ 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, /* 0x60*/ 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, /* 0x70*/ 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f, /* 0x80*/ 0x20ac, 0x0000, 0x201a, 0x0000, 0x201e, 0x2026, 0x2020, 0x2021, 0x0000, 0x2030, 0x0160, 0x2039, 0x015a, 0x0164, 0x017d, 0x0179, /* 0x90*/ 0x0000, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x0000, 0x2122, 0x0161, 0x203a, 0x015b, 0x0165, 0x017e, 0x017a, /* 0xa0*/ 0x00a0, 0x02c7, 0x02d8, 0x0141, 0x00a4, 0x0104, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x015e, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x017b, /* 0xb0*/ 0x00b0, 0x00b1, 0x02db, 0x0142, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x0105, 0x015f, 0x00bb, 0x013d, 0x02dd, 0x013e, 0x017c, /* 0xc0*/ 0x0154, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0139, 0x0106, 0x00c7, 0x010c, 0x00c9, 0x0118, 0x00cb, 0x011a, 0x00cd, 0x00ce, 0x010e, /* 0xd0*/ 0x0110, 0x0143, 0x0147, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x00d7, 0x0158, 0x016e, 0x00da, 0x0170, 0x00dc, 0x00dd, 0x0162, 0x00df, /* 0xe0*/ 0x0155, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x013a, 0x0107, 0x00e7, 0x010d, 0x00e9, 0x0119, 0x00eb, 0x011b, 0x00ed, 0x00ee, 0x010f, /* 0xf0*/ 0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7, 0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9, }; static unsigned char page00[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x40-0x47 */ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ 0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0x00, /* 0xa8-0xaf */ 0xb0, 0xb1, 0x00, 0x00, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0xb8, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ 0x00, 0xc1, 0xc2, 0x00, 0xc4, 0x00, 0x00, 0xc7, /* 0xc0-0xc7 */ 0x00, 0xc9, 0x00, 0xcb, 0x00, 0xcd, 0xce, 0x00, /* 0xc8-0xcf */ 0x00, 0x00, 0x00, 0xd3, 0xd4, 0x00, 0xd6, 0xd7, /* 0xd0-0xd7 */ 0x00, 0x00, 0xda, 0x00, 0xdc, 0xdd, 0x00, 0xdf, /* 0xd8-0xdf */ 0x00, 0xe1, 0xe2, 0x00, 0xe4, 0x00, 0x00, 0xe7, /* 0xe0-0xe7 */ 0x00, 0xe9, 0x00, 0xeb, 0x00, 0xed, 0xee, 0x00, /* 0xe8-0xef */ 0x00, 0x00, 0x00, 0xf3, 0xf4, 0x00, 0xf6, 0xf7, /* 0xf0-0xf7 */ 0x00, 0x00, 0xfa, 0x00, 0xfc, 0xfd, 0x00, 0x00, /* 0xf8-0xff */ }; static unsigned char page01[256] = { 0x00, 0x00, 0xc3, 0xe3, 0xa5, 0xb9, 0xc6, 0xe6, /* 0x00-0x07 */ 0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0xcf, 0xef, /* 0x08-0x0f */ 0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 0xca, 0xea, 0xcc, 0xec, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ 0x00, 0xc5, 0xe5, 0x00, 0x00, 0xbc, 0xbe, 0x00, /* 0x38-0x3f */ 0x00, 0xa3, 0xb3, 0xd1, 0xf1, 0x00, 0x00, 0xd2, /* 0x40-0x47 */ 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ 0xd5, 0xf5, 0x00, 0x00, 0xc0, 0xe0, 0x00, 0x00, /* 0x50-0x57 */ 0xd8, 0xf8, 0x8c, 0x9c, 0x00, 0x00, 0xaa, 0xba, /* 0x58-0x5f */ 0x8a, 0x9a, 0xde, 0xfe, 0x8d, 0x9d, 0x00, 0x00, /* 0x60-0x67 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd9, 0xf9, /* 0x68-0x6f */ 0xdb, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 0x00, 0x8f, 0x9f, 0xaf, 0xbf, 0x8e, 0x9e, 0x00, /* 0x78-0x7f */ }; static unsigned char page02[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa1, /* 0xc0-0xc7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ 0xa2, 0xff, 0x00, 0xb2, 0x00, 0xbd, 0x00, 0x00, /* 0xd8-0xdf */ }; static unsigned char page20[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ }; static unsigned char page21[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ }; static unsigned char *page_uni2charset[256] = { page00, page01, page02, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, page20, page21, NULL, NULL, NULL, NULL, NULL, NULL, }; static unsigned char charset2lower[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ 0x80, 0x00, 0x82, 0x00, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ 0x00, 0x89, 0x9a, 0x8b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x88-0x8f */ 0x00, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ 0x00, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */ 0xa0, 0xa1, 0xa2, 0xb3, 0xa4, 0xb9, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0xba, 0xab, 0xac, 0xad, 0xae, 0xbf, /* 0xa8-0xaf */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbe, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xc0-0xc7 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xc8-0xcf */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xd7, /* 0xd0-0xd7 */ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xdf, /* 0xd8-0xdf */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ }; static unsigned char charset2upper[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x40-0x47 */ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ 0x80, 0x00, 0x82, 0x00, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ 0x00, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ 0x00, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ 0x00, 0x99, 0x8a, 0x9b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x98-0x9f */ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ 0xb0, 0xb1, 0xb2, 0xa3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0xb8, 0xa5, 0xaa, 0xbb, 0xbc, 0xbd, 0xbc, 0xaf, /* 0xb8-0xbf */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0x00, /* 0xd8-0xdf */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xe0-0xe7 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xe8-0xef */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xf7, /* 0xf0-0xf7 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xff, /* 0xf8-0xff */ }; static int uni2char(wchar_t uni, unsigned char *out, int boundlen) { unsigned char *uni2charset; unsigned char cl = uni & 0x00ff; unsigned char ch = (uni & 0xff00) >> 8; if (boundlen <= 0) return -ENAMETOOLONG; uni2charset = page_uni2charset[ch]; if (uni2charset && uni2charset[cl]) out[0] = uni2charset[cl]; else return -EINVAL; return 1; } static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni) { *uni = charset2uni[*rawstring]; if (*uni == 0x0000) return -EINVAL; return 1; } static struct nls_table table = { "cp1250", uni2char, char2uni, charset2lower, charset2upper, THIS_MODULE, }; static int __init init_nls_cp1250(void) { return register_nls(&table); } static void __exit exit_nls_cp1250(void) { unregister_nls(&table); } module_init(init_nls_cp1250) module_exit(exit_nls_cp1250) MODULE_LICENSE("BSD without advertising clause"); /* * Overrides for Emacs so that we follow Linus's tabbing style. * Emacs will notice this stuff at the end of the file and automatically * adjust the settings for this buffer only. This must remain at the end * of the file. * --------------------------------------------------------------------------- * Local variables: * c-indent-level: 8 * c-brace-imaginary-offset: 0 * c-brace-offset: -8 * c-argdecl-indent: 8 * c-label-offset: -8 * c-continued-statement-offset: 8 * c-continued-brace-offset: 0 * End: */ |
|
From: Dave A. <ai...@us...> - 2003-06-10 03:08:14
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/usb/serial
In directory sc8-pr-cvs1:/tmp/cvs-serv14646/drivers/usb/serial
Added Files:
ipaq.c ipaq.h kl5kusb105.c kl5kusb105.h
Log Message:
DA: additional files from 2.4.1[78] kernels..
--- NEW FILE ---
/*
* USB Compaq iPAQ driver
*
* Copyright (C) 2001
* Ganesh Varadarajan <ga...@ve...>
*
* 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.
*
*/
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/signal.h>
#include <linux/errno.h>
#include <linux/poll.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/fcntl.h>
#include <linux/tty.h>
#include <linux/tty_driver.h>
#include <linux/tty_flip.h>
#include <linux/module.h>
#include <linux/spinlock.h>
#include <linux/usb.h>
#ifdef CONFIG_USB_SERIAL_DEBUG
static int debug = 1;
#else
static int debug = 0;
#endif
#include "usb-serial.h"
#include "ipaq.h"
/*
* Version Information
*/
#define DRIVER_VERSION "v0.1"
#define DRIVER_AUTHOR "Ganesh Varadarajan <ga...@ve...>"
#define DRIVER_DESC "USB Compaq iPAQ driver"
/* Function prototypes for an ipaq */
static int ipaq_open (struct usb_serial_port *port, struct file *filp);
static void ipaq_close (struct usb_serial_port *port, struct file *filp);
static int ipaq_startup (struct usb_serial *serial);
static void ipaq_shutdown (struct usb_serial *serial);
static int ipaq_write(struct usb_serial_port *port, int from_user, const unsigned char *buf,
int count);
static int ipaq_write_bulk(struct usb_serial_port *port, int from_user, const unsigned char *buf,
int count);
static int ipaq_write_flush(struct usb_serial_port *port);
static void ipaq_read_bulk_callback (struct urb *urb);
static void ipaq_write_bulk_callback(struct urb *urb);
static int ipaq_write_room(struct usb_serial_port *port);
static int ipaq_chars_in_buffer(struct usb_serial_port *port);
static void ipaq_destroy_lists(struct usb_serial_port *port);
static __devinitdata struct usb_device_id ipaq_id_table [] = {
{ USB_DEVICE(IPAQ_VENDOR_ID, IPAQ_PRODUCT_ID) },
{ } /* Terminating entry */
};
MODULE_DEVICE_TABLE (usb, ipaq_id_table);
/* All of the device info needed for the Compaq iPAQ */
struct usb_serial_device_type ipaq_device = {
name: "Compaq iPAQ",
id_table: ipaq_id_table,
needs_interrupt_in: MUST_HAVE_NOT,
needs_bulk_in: MUST_HAVE,
needs_bulk_out: MUST_HAVE,
num_interrupt_in: 0,
num_bulk_in: 1,
num_bulk_out: 1,
num_ports: 1,
open: ipaq_open,
close: ipaq_close,
startup: ipaq_startup,
shutdown: ipaq_shutdown,
write: ipaq_write,
write_room: ipaq_write_room,
chars_in_buffer: ipaq_chars_in_buffer,
read_bulk_callback: ipaq_read_bulk_callback,
write_bulk_callback: ipaq_write_bulk_callback,
};
static spinlock_t write_list_lock;
static int bytes_in;
static int bytes_out;
static int ipaq_open(struct usb_serial_port *port, struct file *filp)
{
struct usb_serial *serial = port->serial;
struct ipaq_private *priv;
struct ipaq_packet *pkt;
int i, result = 0;
if (port_paranoia_check(port, __FUNCTION__)) {
return -ENODEV;
}
dbg(__FUNCTION__ " - port %d", port->number);
down(&port->sem);
++port->open_count;
MOD_INC_USE_COUNT;
if (!port->active) {
port->active = 1;
bytes_in = 0;
bytes_out = 0;
priv = (struct ipaq_private *)kmalloc(sizeof(struct ipaq_private), GFP_KERNEL);
if (priv == NULL) {
err(__FUNCTION__ " - Out of memory");
return -ENOMEM;
}
port->private = (void *)priv;
priv->active = 0;
priv->queue_len = 0;
INIT_LIST_HEAD(&priv->queue);
INIT_LIST_HEAD(&priv->freelist);
for (i = 0; i < URBDATA_QUEUE_MAX / PACKET_SIZE; i++) {
pkt = kmalloc(sizeof(struct ipaq_packet), GFP_KERNEL);
if (pkt == NULL) {
goto enomem;
}
pkt->data = kmalloc(PACKET_SIZE, GFP_KERNEL);
if (pkt->data == NULL) {
kfree(pkt);
goto enomem;
}
pkt->len = 0;
pkt->written = 0;
INIT_LIST_HEAD(&pkt->list);
list_add(&pkt->list, &priv->freelist);
priv->free_len += PACKET_SIZE;
}
/*
* Force low latency on. This will immediately push data to the line
* discipline instead of queueing.
*/
port->tty->low_latency = 1;
/*
* Lose the small buffers usbserial provides. Make larger ones.
*/
kfree(port->bulk_in_buffer);
kfree(port->bulk_out_buffer);
port->bulk_in_buffer = kmalloc(URBDATA_SIZE, GFP_KERNEL);
if (port->bulk_in_buffer == NULL) {
goto enomem;
}
port->bulk_out_buffer = kmalloc(URBDATA_SIZE, GFP_KERNEL);
if (port->bulk_out_buffer == NULL) {
kfree(port->bulk_in_buffer);
goto enomem;
}
port->read_urb->transfer_buffer = port->bulk_in_buffer;
port->write_urb->transfer_buffer = port->bulk_out_buffer;
port->read_urb->transfer_buffer_length = URBDATA_SIZE;
port->bulk_out_size = port->write_urb->transfer_buffer_length = URBDATA_SIZE;
/* Start reading from the device */
FILL_BULK_URB(port->read_urb, serial->dev,
usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress),
port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length,
ipaq_read_bulk_callback, port);
result = usb_submit_urb(port->read_urb);
if (result) {
err(__FUNCTION__ " - failed submitting read urb, error %d", result);
}
/*
* Send out two control messages observed in win98 sniffs. Not sure what
* they do.
*/
result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21,
0x1, 0, NULL, 0, 5 * HZ);
if (result < 0) {
err(__FUNCTION__ " - failed doing control urb, error %d", result);
}
result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21,
0x1, 0, NULL, 0, 5 * HZ);
if (result < 0) {
err(__FUNCTION__ " - failed doing control urb, error %d", result);
}
}
up(&port->sem);
return result;
enomem:
ipaq_destroy_lists(port);
kfree(priv);
err(__FUNCTION__ " - Out of memory");
return -ENOMEM;
}
static void ipaq_close(struct usb_serial_port *port, struct file *filp)
{
struct usb_serial *serial;
struct ipaq_private *priv = port->private;
if (port_paranoia_check(port, __FUNCTION__)) {
return;
}
dbg(__FUNCTION__ " - port %d", port->number);
serial = get_usb_serial(port, __FUNCTION__);
if (!serial)
return;
down (&port->sem);
--port->open_count;
if (port->open_count <= 0) {
/*
* shut down bulk read and write
*/
usb_unlink_urb(port->write_urb);
usb_unlink_urb(port->read_urb);
ipaq_destroy_lists(port);
kfree(priv);
port->private = NULL;
port->active = 0;
port->open_count = 0;
}
up (&port->sem);
/* Uncomment the following line if you want to see some statistics in your syslog */
/* info ("Bytes In = %d Bytes Out = %d", bytes_in, bytes_out); */
MOD_DEC_USE_COUNT;
}
static void ipaq_read_bulk_callback(struct urb *urb)
{
struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
struct usb_serial *serial = get_usb_serial (port, __FUNCTION__);
struct tty_struct *tty;
unsigned char *data = urb->transfer_buffer;
int i, result;
if (port_paranoia_check(port, __FUNCTION__))
return;
dbg(__FUNCTION__ " - port %d", port->number);
if (!serial) {
dbg(__FUNCTION__ " - bad serial pointer, exiting");
return;
}
if (urb->status) {
dbg(__FUNCTION__ " - nonzero read bulk status received: %d", urb->status);
return;
}
usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data);
tty = port->tty;
if (urb->actual_length) {
for (i = 0; i < urb->actual_length ; ++i) {
/* if we insert more than TTY_FLIPBUF_SIZE characters, we drop them. */
if(tty->flip.count >= TTY_FLIPBUF_SIZE) {
tty_flip_buffer_push(tty);
}
/* this doesn't actually push the data through unless tty->low_latency is set */
tty_insert_flip_char(tty, data[i], 0);
}
tty_flip_buffer_push(tty);
bytes_in += urb->actual_length;
}
/* Continue trying to always read */
FILL_BULK_URB(port->read_urb, serial->dev,
usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress),
port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length,
ipaq_read_bulk_callback, port);
result = usb_submit_urb(port->read_urb);
if (result)
err(__FUNCTION__ " - failed resubmitting read urb, error %d", result);
return;
}
static int ipaq_write(struct usb_serial_port *port, int from_user, const unsigned char *buf,
int count)
{
const unsigned char *current_position = buf;
int bytes_sent = 0;
int transfer_size;
dbg(__FUNCTION__ " - port %d", port->number);
usb_serial_debug_data(__FILE__, __FUNCTION__, count, buf);
while (count > 0) {
transfer_size = min(count, PACKET_SIZE);
if (ipaq_write_bulk(port, from_user, current_position, transfer_size)) {
break;
}
current_position += transfer_size;
bytes_sent += transfer_size;
count -= transfer_size;
bytes_out += transfer_size;
}
return bytes_sent;
}
static int ipaq_write_bulk(struct usb_serial_port *port, int from_user, const unsigned char *buf,
int count)
{
struct ipaq_private *priv = port->private;
struct ipaq_packet *pkt = NULL;
int result = 0;
unsigned long flags;
if (priv->free_len <= 0) {
dbg(__FUNCTION__ " - we're stuffed");
return -EAGAIN;
}
spin_lock_irqsave(&write_list_lock, flags);
if (!list_empty(&priv->freelist)) {
pkt = list_entry(priv->freelist.next, struct ipaq_packet, list);
list_del(&pkt->list);
priv->free_len -= PACKET_SIZE;
}
spin_unlock_irqrestore(&write_list_lock, flags);
if (pkt == NULL) {
dbg(__FUNCTION__ " - we're stuffed");
return -EAGAIN;
}
if (from_user) {
copy_from_user(pkt->data, buf, count);
} else {
memcpy(pkt->data, buf, count);
}
usb_serial_debug_data(__FILE__, __FUNCTION__, count, pkt->data);
pkt->len = count;
pkt->written = 0;
spin_lock_irqsave(&write_list_lock, flags);
list_add_tail(&pkt->list, &priv->queue);
priv->queue_len += count;
if (priv->active == 0) {
priv->active = 1;
result = ipaq_write_flush(port);
}
spin_unlock_irqrestore(&write_list_lock, flags);
return result;
}
static int ipaq_write_flush(struct usb_serial_port *port)
{
struct ipaq_private *priv = (struct ipaq_private *)port->private;
struct usb_serial *serial = port->serial;
int count, room, result;
struct ipaq_packet *pkt;
struct urb *urb = port->write_urb;
struct list_head *tmp;
if (urb->status == -EINPROGRESS) {
/* Should never happen */
err(__FUNCTION__ " - flushing while urb is active !");
return -EAGAIN;
}
room = URBDATA_SIZE;
for (tmp = priv->queue.next; tmp != &priv->queue;) {
pkt = list_entry(tmp, struct ipaq_packet, list);
tmp = tmp->next;
count = min(room, (int)(pkt->len - pkt->written));
memcpy(urb->transfer_buffer + (URBDATA_SIZE - room),
pkt->data + pkt->written, count);
room -= count;
pkt->written += count;
priv->queue_len -= count;
if (pkt->written == pkt->len) {
list_del(&pkt->list);
list_add(&pkt->list, &priv->freelist);
priv->free_len += PACKET_SIZE;
}
if (room == 0) {
break;
}
}
count = URBDATA_SIZE - room;
FILL_BULK_URB(port->write_urb, serial->dev,
usb_sndbulkpipe(serial->dev, port->bulk_out_endpointAddress),
port->write_urb->transfer_buffer, count, ipaq_write_bulk_callback,
port);
result = usb_submit_urb(urb);
if (result) {
err(__FUNCTION__ " - failed submitting write urb, error %d", result);
}
return result;
}
static void ipaq_write_bulk_callback(struct urb *urb)
{
struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
struct ipaq_private *priv = (struct ipaq_private *)port->private;
unsigned long flags;
if (port_paranoia_check (port, __FUNCTION__)) {
return;
}
dbg(__FUNCTION__ " - port %d", port->number);
if (urb->status) {
dbg(__FUNCTION__ " - nonzero write bulk status received: %d", urb->status);
}
spin_lock_irqsave(&write_list_lock, flags);
if (!list_empty(&priv->queue)) {
ipaq_write_flush(port);
} else {
priv->active = 0;
}
spin_unlock_irqrestore(&write_list_lock, flags);
queue_task(&port->tqueue, &tq_immediate);
mark_bh(IMMEDIATE_BH);
return;
}
static int ipaq_write_room(struct usb_serial_port *port)
{
struct ipaq_private *priv = (struct ipaq_private *)port->private;
dbg(__FUNCTION__ " - freelen %d", priv->free_len);
return priv->free_len;
}
static int ipaq_chars_in_buffer(struct usb_serial_port *port)
{
struct ipaq_private *priv = (struct ipaq_private *)port->private;
dbg(__FUNCTION__ " - queuelen %d", priv->queue_len);
return priv->queue_len;
}
static void ipaq_destroy_lists(struct usb_serial_port *port)
{
struct ipaq_private *priv = (struct ipaq_private *)port->private;
struct list_head *tmp;
struct ipaq_packet *pkt;
for (tmp = priv->queue.next; tmp != &priv->queue;) {
pkt = list_entry(tmp, struct ipaq_packet, list);
tmp = tmp->next;
kfree(pkt->data);
kfree(pkt);
}
for (tmp = priv->freelist.next; tmp != &priv->freelist;) {
pkt = list_entry(tmp, struct ipaq_packet, list);
tmp = tmp->next;
kfree(pkt->data);
kfree(pkt);
}
return;
}
static int ipaq_startup(struct usb_serial *serial)
{
dbg(__FUNCTION__);
usb_set_configuration(serial->dev, 1);
return 0;
}
static void ipaq_shutdown(struct usb_serial *serial)
{
int i;
dbg (__FUNCTION__);
/* stop reads and writes on all ports */
for (i=0; i < serial->num_ports; ++i) {
while (serial->port[i].open_count > 0) {
ipaq_close(&serial->port[i], NULL);
}
}
}
static int __init ipaq_init(void)
{
usb_serial_register(&ipaq_device);
info(DRIVER_DESC " " DRIVER_VERSION);
return 0;
}
static void __exit ipaq_exit(void)
{
usb_serial_deregister(&ipaq_device);
}
module_init(ipaq_init);
module_exit(ipaq_exit);
MODULE_AUTHOR( DRIVER_AUTHOR );
MODULE_DESCRIPTION( DRIVER_DESC );
MODULE_LICENSE("GPL");
MODULE_PARM(debug, "i");
MODULE_PARM_DESC(debug, "Debug enabled or not");
--- NEW FILE ---
/*
* USB Compaq iPAQ driver
*
* Copyright (C) 2001
* Ganesh Varadarajan <ga...@ve...>
*
* 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.
*
*
*/
#ifndef __LINUX_USB_SERIAL_IPAQ_H
#define __LINUX_USB_SERIAL_IPAQ_H
#define IPAQ_VENDOR_ID 0x049f
#define IPAQ_PRODUCT_ID 0x0003
/*
* Since we can't queue our bulk write urbs (don't know why - it just
* doesn't work), we can send down only one write urb at a time. The simplistic
* approach taken by the generic usbserial driver will work, but it's not good
* for performance. Therefore, we buffer upto URBDATA_QUEUE_MAX bytes of write
* requests coming from the line discipline. This is done by chaining them
* in lists of struct ipaq_packet, each packet holding a maximum of
* PACKET_SIZE bytes.
*
* ipaq_write() can be called from bottom half context; hence we can't
* allocate memory for packets there. So we initialize a pool of packets at
* the first open and maintain a freelist.
*
* The value of PACKET_SIZE was empirically determined by
* checking the maximum write sizes sent down by the ppp ldisc.
* URBDATA_QUEUE_MAX is set to 64K, which is the maximum TCP window size
* supported by the iPAQ.
*/
struct ipaq_packet {
char *data;
size_t len;
size_t written;
struct list_head list;
};
struct ipaq_private {
int active;
int queue_len;
int free_len;
struct list_head queue;
struct list_head freelist;
};
#define URBDATA_SIZE 4096
#define URBDATA_QUEUE_MAX (64 * 1024)
#define PACKET_SIZE 256
#endif
--- NEW FILE ---
/*
* KLSI KL5KUSB105 chip RS232 converter driver
*
* Copyright (C) 2001 Utz-Uwe Haus <ha...@uu...>
*
* 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.
*
* All information about the device was acquired using SniffUSB ans snoopUSB
* on Windows98.
* It was written out of frustration with the PalmConnect USB Serial adapter
* sold by Palm Inc.
* Neither Palm, nor their contractor (MCCI) or their supplier (KLSI) provided
* information that was not already available.
*
* It seems that KLSI bought some silicon-design information from ScanLogic,
* whose SL11R processor is at the core of the KL5KUSB chipset from KLSI.
[...1093 lines suppressed...]
usb_serial_deregister (&kl5kusb105d_device);
}
module_init (klsi_105_init);
module_exit (klsi_105_exit);
MODULE_AUTHOR( DRIVER_AUTHOR );
MODULE_DESCRIPTION( DRIVER_DESC );
MODULE_LICENSE("GPL");
MODULE_PARM(debug, "i");
MODULE_PARM_DESC(debug, "enable extensive debugging messages");
/* FIXME: implement
MODULE_PARM(num_urbs, "i");
MODULE_PARM_DESC(num_urbs, "number of URBs to use in write pool");
*/
/* vim: set sts=8 ts=8 sw=8: */
--- NEW FILE ---
/*
* Definitions for the KLSI KL5KUSB105 serial port adapter
*/
/* vendor/product pairs that are known to contain this chipset */
#define PALMCONNECT_VID 0x0830
#define PALMCONNECT_PID 0x0080
#define KLSI_VID 0x05e9
#define KLSI_KL5KUSB105D_PID 0x00c0
/* Vendor commands: */
/* port table -- the chip supports up to 4 channels */
/* baud rates */
typedef enum {
kl5kusb105a_sio_b115200 = 0,
kl5kusb105a_sio_b57600 = 1,
kl5kusb105a_sio_b38400 = 2,
kl5kusb105a_sio_b19200 = 4,
kl5kusb105a_sio_b14400 = 5,
kl5kusb105a_sio_b9600 = 6,
kl5kusb105a_sio_b4800 = 8, /* unchecked */
kl5kusb105a_sio_b2400 = 9, /* unchecked */
kl5kusb105a_sio_b1200 = 0xa, /* unchecked */
kl5kusb105a_sio_b600 = 0xb /* unchecked */
} KL5KUSB105A_SIO_baudrate_t;
/* data bits */
#define kl5kusb105a_dtb_7 7
#define kl5kusb105a_dtb_8 8
/* requests: */
#define KL5KUSB105A_SIO_SET_DATA 1
#define KL5KUSB105A_SIO_POLL 2
#define KL5KUSB105A_SIO_CONFIGURE 3
/* values used for request KL5KUSB105A_SIO_CONFIGURE */
#define KL5KUSB105A_SIO_CONFIGURE_READ_ON 3
#define KL5KUSB105A_SIO_CONFIGURE_READ_OFF 2
/* Interpretation of modem status lines */
/* These need sorting out by individually connecting pins and checking
* results. FIXME!
* When data is being sent we see 0x30 in the lower byte; this must
* contain DSR and CTS ...
*/
#define KL5KUSB105A_DSR ((1<<4) | (1<<5))
#define KL5KUSB105A_CTS ((1<<5) | (1<<4))
#define KL5KUSB105A_WANTS_TO_SEND 0x30
//#define KL5KUSB105A_DTR /* Data Terminal Ready */
//#define KL5KUSB105A_CTS /* Clear To Send */
//#define KL5KUSB105A_CD /* Carrier Detect */
//#define KL5KUSB105A_DSR /* Data Set Ready */
//#define KL5KUSB105A_RxD /* Receive pin */
//#define KL5KUSB105A_LE
//#define KL5KUSB105A_RTS
//#define KL5KUSB105A_ST
//#define KL5KUSB105A_SR
//#define KL5KUSB105A_RI /* Ring Indicator */
/* vim: set ts=8 sts=8: */
|
|
From: Dave A. <ai...@us...> - 2003-06-10 03:08:14
|
Update of /cvsroot/linux-vax/kernel-2.4/fs/freevxfs
In directory sc8-pr-cvs1:/tmp/cvs-serv14646/fs/freevxfs
Added Files:
vxfs_kcompat.h
Log Message:
DA: additional files from 2.4.1[78] kernels..
--- NEW FILE ---
#ifndef _VXFS_KCOMPAT_H
#define _VXFS_KCOMPAT_H
#include <linux/version.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
#include <linux/blkdev.h>
typedef long sector_t;
/* Dito. */
static inline void map_bh(struct buffer_head *bh, struct super_block *sb, int block)
{
bh->b_state |= 1 << BH_Mapped;
bh->b_dev = sb->s_dev;
bh->b_blocknr = block;
}
/* From fs/block_dev.c (Linux 2.5.2-pre2) */
static inline int sb_set_blocksize(struct super_block *sb, int size)
{
int bits;
if (set_blocksize(sb->s_dev, size) < 0)
return 0;
sb->s_blocksize = size;
for (bits = 9, size >>= 9; size >>= 1; bits++)
;
sb->s_blocksize_bits = bits;
return sb->s_blocksize;
}
/* Dito. */
static inline int sb_min_blocksize(struct super_block *sb, int size)
{
int minsize = get_hardsect_size(sb->s_dev);
if (size < minsize)
size = minsize;
return sb_set_blocksize(sb, size);
}
#endif /* Kernel 2.4 */
#endif /* _VXFS_KCOMPAT_H */
|
|
From: Dave A. <ai...@us...> - 2003-06-10 03:08:14
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/video
In directory sc8-pr-cvs1:/tmp/cvs-serv14646/drivers/video
Added Files:
tridentfb.c tridentfb.h
Log Message:
DA: additional files from 2.4.1[78] kernels..
--- NEW FILE ---
/*
* Frame buffer driver for Trident Blade and Image series
*
* Copyright 2001,2002 - Jani Monoses <ja...@as...>
*
* $Id: tridentfb.c,v 1.1 2003/06/10 03:08:11 airlied Exp $
*
* CREDITS:(in order of appearance)
* skeletonfb.c by Geert Uytterhoeven and other fb code in drivers/video
* Special thanks ;) to Mattia Crivellini <ti...@mc...>
* much inspired by the XFree86 4.1.0 Trident driver sources by Alan Hourihane
* the FreeVGA project
* Francesco Salvestrini <sal...@us...> XP support,code,suggestions
* NOTES:
* Tested on Compaq Presario 12XL300 with CyberBladei1
* Tested on Toshiba 1800-514 with CyberBladeXPAi1
* No monitors were harmed during the writing of this driver
* TODO:
* timing value tweaking so it looks good on every monitor in every mode
[...1268 lines suppressed...]
return 0;
}
static struct fb_ops tridentfb_ops = {
fb_get_fix:fbgen_get_fix,
fb_get_var:fbgen_get_var,
fb_set_var:fbgen_set_var,
fb_get_cmap:fbgen_get_cmap,
fb_set_cmap:fbgen_set_cmap,
fb_pan_display:fbgen_pan_display,
};
#ifdef MODULE
module_init(tridentfb_init);
#endif
module_exit(tridentfb_exit);
MODULE_AUTHOR("Jani Monoses <ja...@as...>");
MODULE_DESCRIPTION("Framebuffer driver for Trident cards");
MODULE_LICENSE("GPL");
--- NEW FILE ---
#ifndef TRIDENTFB_DEBUG
#define TRIDENTFB_DEBUG 0
#endif
#if TRIDENTFB_DEBUG
#define debug(f,a...) printk("%s:" f, __FUNCTION__ , ## a)
#else
#define debug(f,a...)
#endif
#define output(f, a...) printk("tridentfb: " f, ## a)
#define Kb (1024)
#define Mb (Kb*Kb)
/* PCI IDS of supported cards temporarily here */
#define CYBER9320 0x9320
#define CYBER9388 0x9388
#define CYBER9397 0x9397
#define CYBER9397DVD 0x939A
#define CYBER9520 0x9520
#define CYBER9525DVD 0x9525
#define IMAGE975 0x9750
#define IMAGE985 0x9850
#define BLADE3D 0x9880
#define CYBERBLADEE4 0x9540
#define CYBERBLADEi7 0x8400
#define CYBERBLADEi7D 0x8420
#define CYBERBLADEi1 0x8500
#define CYBERBLADEi1D 0x8520
#define CYBERBLADEAi1 0x8600
#define CYBERBLADEAi1D 0x8620
#define CYBERBLADEXPAi1 0x8820
#define CYBERBLADEXPm8 0x9910
#define CYBERBLADEXPm16 0x9930
/* acceleration families */
#define IMAGE 0
#define BLADE 1
#define XP 2
#define is_image() (family == IMAGE)
#define is_blade() (family == BLADE)
#define is_xp() (family == XP)
/* these defines are for 'lcd' variable */
#define LCD_STRETCH 0
#define LCD_CENTER 1
#define LCD_BIOS 2
/* display types */
#define DISPLAY_CRT 0
#define DISPLAY_FP 1
#define flatpanel (displaytype == DISPLAY_FP)
/* these are for defaultaccel variable */
#define ACCEL 1
#define NOACCEL 0
#define TRIDENT_IOSIZE 0x20000
#define NTSC 14.31818
#define PAL 17.73448
/* General Registers */
#define SPR 0x1F /* Software Programming Register (videoram) */
/* 3C4 */
#define RevisionID 0x09
#define OldOrNew 0x0B
#define ConfPort1 0x0C
#define ConfPort2 0x0C
#define NewMode2 0x0D
#define NewMode1 0x0E
#define Protection 0x11
#define MCLKLow 0x16
#define MCLKHigh 0x17
#define ClockLow 0x18
#define ClockHigh 0x19
#define SSetup 0x20
#define SKey 0x37
#define SPKey 0x57
/* 0x3x4 */
#define CRTHTotal 0x00
#define CRTHDispEnd 0x01
#define CRTHBlankStart 0x02
#define CRTHBlankEnd 0x03
#define CRTHSyncStart 0x04
#define CRTHSyncEnd 0x05
#define CRTVTotal 0x06
#define CRTVDispEnd 0x12
#define CRTVBlankStart 0x15
#define CRTVBlankEnd 0x16
#define CRTVSyncStart 0x10
#define CRTVSyncEnd 0x11
#define CRTOverflow 0x07
#define CRTPRowScan 0x08
#define CRTMaxScanLine 0x09
#define CRTModeControl 0x17
#define CRTLineCompare 0x18
/* 3x4 */
#define StartAddrHigh 0x0C
#define StartAddrLow 0x0D
#define Offset 0x13
#define Underline 0x14
#define CRTCMode 0x17
#define CRTCModuleTest 0x1E
#define FIFOControl 0x20
#define LinearAddReg 0x21
#define DRAMTiming 0x23
#define New32 0x23
#define RAMDACTiming 0x25
#define CRTHiOrd 0x27
#define AddColReg 0x29
#define InterfaceSel 0x2A
#define HorizOverflow 0x2B
#define GETest 0x2D
#define Performance 0x2F
#define GraphEngReg 0x36
#define I2C 0x37
#define PixelBusReg 0x38
#define PCIReg 0x39
#define DRAMControl 0x3A
#define MiscContReg 0x3C
#define CursorXLow 0x40
#define CursorXHigh 0x41
#define CursorYLow 0x42
#define CursorYHigh 0x43
#define CursorLocLow 0x44
#define CursorLocHigh 0x45
#define CursorXOffset 0x46
#define CursorYOffset 0x47
#define CursorFG1 0x48
#define CursorFG2 0x49
#define CursorFG3 0x4A
#define CursorFG4 0x4B
#define CursorBG1 0x4C
#define CursorBG2 0x4D
#define CursorBG3 0x4E
#define CursorBG4 0x4F
#define CursorControl 0x50
#define PCIRetry 0x55
#define PreEndControl 0x56
#define PreEndFetch 0x57
#define PCIMaster 0x60
#define Enhancement0 0x62
#define NewEDO 0x64
#define TVinterface 0xC0
#define TVMode 0xC1
#define ClockControl 0xCF
/* 3CE */
#define MiscExtFunc 0x0F
#define PowerStatus 0x23
#define MiscIntContReg 0x2F
#define CyberControl 0x30
#define CyberEnhance 0x31
#define FPConfig 0x33
#define VertStretch 0x52
#define HorStretch 0x53
#define BiosMode 0x5c
#define BiosReg 0x5d
|
|
From: Dave A. <ai...@us...> - 2003-06-10 03:08:12
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/sound/cs4281
In directory sc8-pr-cvs1:/tmp/cvs-serv14646/drivers/sound/cs4281
Added Files:
cs4281_wrapper.h cs4281pm-24.h
Log Message:
DA: additional files from 2.4.1[78] kernels..
--- NEW FILE ---
/*******************************************************************************
*
* "cs4281_wrapper.h" -- Cirrus Logic-Crystal CS4281 linux audio driver.
*
* Copyright (C) 2000,2001 Cirrus Logic Corp.
* -- tom woller (tw...@cr...) or
* (au...@cr...).
*
* 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.
*
* 12/22/00 trw - new file.
* 04/18/01 trw - rework entire wrapper logic.
*
*******************************************************************************/
#ifndef __CS4281_WRAPPER_H
#define __CS4281_WRAPPER_H
/* 2.4.x wrapper */
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,12)
static int cs4281_null_suspend(struct pci_dev *pcidev, u32 unused) { return 0; }
static int cs4281_null_resume(struct pci_dev *pcidev) { return 0; }
#else
#define no_llseek cs4281_llseek
static loff_t cs4281_llseek(struct file *file, loff_t offset, int origin)
{
return -ESPIPE;
}
void cs4281_null_suspend(struct pci_dev *pcidev) { return; }
void cs4281_null_resume(struct pci_dev *pcidev) { return; }
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,3)
/* Some versions of 2.4.2 resolve pci_set_dma_mask and some do not...
* but 2.4.0 definitely does not
*/
#define pci_set_dma_mask(dev,data) 0;
#else
#endif
#define cs4x_mem_map_reserve(page) mem_map_reserve(page)
#define cs4x_mem_map_unreserve(page) mem_map_unreserve(page)
#endif /* #ifndef __CS4281_WRAPPER_H */
--- NEW FILE ---
/*******************************************************************************
*
* "cs4281pm-24.h" -- Cirrus Logic-Crystal CS4281 linux audio driver.
*
* Copyright (C) 2000,2001 Cirrus Logic Corp.
* -- tom woller (tw...@cr...) or
* (au...@cr...).
*
* 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.
*
* 2001.04.05 trw - new file.
*
*******************************************************************************/
#ifndef NOT_CS4281_PM
#include <linux/pm.h>
#include <linux/config.h>
#include "cs4281pm.h"
//#define CS4281_PCI_PM_SUPPORT_ENABLE 1
#if CS4281_PCI_PM_SUPPORT_ENABLE
#define cs_pm_register(a, b, c) 0;
#define cs_pm_unregister_all(a)
/*
* for now (12/22/00) only enable the pm_register PM support.
* allow these table entries to be null.
*/
#define CS4281_SUSPEND_TBL cs4281_suspend_tbl
#define CS4281_RESUME_TBL cs4281_resume_tbl
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,12)
static int cs4281_suspend_tbl(struct pci_dev *pcidev, u32 unused);
static int cs4281_resume_tbl(struct pci_dev *pcidev);
#else
void cs4281_suspend_tbl(struct pci_dev *pcidev);
void cs4281_resume_tbl(struct pci_dev *pcidev);
#endif //LINUX_VERSION
#else //CS4281_PCI_PM_SUPPORT_ENABLE
#ifdef CONFIG_PM
int cs4281_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data);
#define cs_pm_register(a, b, c) pm_register((a), (b), (c));
#define cs_pm_unregister_all(a) pm_unregister_all((a));
#define CS4281_SUSPEND_TBL cs4281_null_suspend
#define CS4281_RESUME_TBL cs4281_null_resume
#else
#define cs_pm_register(a, b, c) 0;
#define cs_pm_unregister_all(a)
#define CS4281_SUSPEND_TBL cs4281_null_suspend
#define CS4281_RESUME_TBL cs4281_null_resume
#endif //CONFIG_PM
#endif //CS4281_PCI_PM_SUPPORT_ENABLE
#else
#define cs_pm_register(a, b, c) 0;
#define cs_pm_unregister_all(a)
#define CS4281_SUSPEND_TBL cs4281_null_suspend
#define CS4281_RESUME_TBL cs4281_null_resume
#endif //NOT_CS4281_PM
|
|
From: Dave A. <ai...@us...> - 2003-06-10 03:08:11
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/net
In directory sc8-pr-cvs1:/tmp/cvs-serv14646/drivers/net
Added Files:
mii.c
Log Message:
DA: additional files from 2.4.1[78] kernels..
--- NEW FILE ---
/*
mii.c: MII interface library
Maintained by Jeff Garzik <jg...@ma...>
Copyright 2001 Jeff Garzik
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/ethtool.h>
#include <linux/mii.h>
int mii_ethtool_gset(struct mii_if_info *mii, struct ethtool_cmd *ecmd)
{
struct net_device *dev = mii->dev;
u32 advert, bmcr, lpa, nego;
ecmd->supported =
(SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full |
SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full |
SUPPORTED_Autoneg | SUPPORTED_TP | SUPPORTED_MII);
/* only supports twisted-pair */
ecmd->port = PORT_MII;
/* only supports internal transceiver */
ecmd->transceiver = XCVR_INTERNAL;
/* this isn't fully supported at higher layers */
ecmd->phy_address = mii->phy_id;
ecmd->advertising = ADVERTISED_TP | ADVERTISED_MII;
advert = mii->mdio_read(dev, mii->phy_id, MII_ADVERTISE);
if (advert & ADVERTISE_10HALF)
ecmd->advertising |= ADVERTISED_10baseT_Half;
if (advert & ADVERTISE_10FULL)
ecmd->advertising |= ADVERTISED_10baseT_Full;
if (advert & ADVERTISE_100HALF)
ecmd->advertising |= ADVERTISED_100baseT_Half;
if (advert & ADVERTISE_100FULL)
ecmd->advertising |= ADVERTISED_100baseT_Full;
bmcr = mii->mdio_read(dev, mii->phy_id, MII_BMCR);
lpa = mii->mdio_read(dev, mii->phy_id, MII_LPA);
if (bmcr & BMCR_ANENABLE) {
ecmd->advertising |= ADVERTISED_Autoneg;
ecmd->autoneg = AUTONEG_ENABLE;
nego = mii_nway_result(advert & lpa);
if (nego == LPA_100FULL || nego == LPA_100HALF)
ecmd->speed = SPEED_100;
else
ecmd->speed = SPEED_10;
if (nego == LPA_100FULL || nego == LPA_10FULL) {
ecmd->duplex = DUPLEX_FULL;
mii->full_duplex = 1;
} else {
ecmd->duplex = DUPLEX_HALF;
mii->full_duplex = 0;
}
} else {
ecmd->autoneg = AUTONEG_DISABLE;
ecmd->speed = (bmcr & BMCR_SPEED100) ? SPEED_100 : SPEED_10;
ecmd->duplex = (bmcr & BMCR_FULLDPLX) ? DUPLEX_FULL : DUPLEX_HALF;
}
/* ignore maxtxpkt, maxrxpkt for now */
return 0;
}
int mii_ethtool_sset(struct mii_if_info *mii, struct ethtool_cmd *ecmd)
{
struct net_device *dev = mii->dev;
if (ecmd->speed != SPEED_10 && ecmd->speed != SPEED_100)
return -EINVAL;
if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL)
return -EINVAL;
if (ecmd->port != PORT_MII)
return -EINVAL;
if (ecmd->transceiver != XCVR_INTERNAL)
return -EINVAL;
if (ecmd->phy_address != mii->phy_id)
return -EINVAL;
if (ecmd->autoneg != AUTONEG_DISABLE && ecmd->autoneg != AUTONEG_ENABLE)
return -EINVAL;
/* ignore supported, maxtxpkt, maxrxpkt */
if (ecmd->autoneg == AUTONEG_ENABLE) {
u32 bmcr, advert, tmp;
if ((ecmd->advertising & (ADVERTISED_10baseT_Half |
ADVERTISED_10baseT_Full |
ADVERTISED_100baseT_Half |
ADVERTISED_100baseT_Full)) == 0)
return -EINVAL;
/* advertise only what has been requested */
advert = mii->mdio_read(dev, mii->phy_id, MII_ADVERTISE);
tmp = advert & ~(ADVERTISE_ALL | ADVERTISE_100BASE4);
if (ADVERTISED_10baseT_Half)
tmp |= ADVERTISE_10HALF;
if (ADVERTISED_10baseT_Full)
tmp |= ADVERTISE_10FULL;
if (ADVERTISED_100baseT_Half)
tmp |= ADVERTISE_100HALF;
if (ADVERTISED_100baseT_Full)
tmp |= ADVERTISE_100FULL;
if (advert != tmp) {
mii->mdio_write(dev, mii->phy_id, MII_ADVERTISE, tmp);
mii->advertising = tmp;
}
/* turn on autonegotiation, and force a renegotiate */
bmcr = mii->mdio_read(dev, mii->phy_id, MII_BMCR);
bmcr |= (BMCR_ANENABLE | BMCR_ANRESTART);
mii->mdio_write(dev, mii->phy_id, MII_BMCR, bmcr);
mii->duplex_lock = 0;
} else {
u32 bmcr, tmp;
/* turn off auto negotiation, set speed and duplexity */
bmcr = mii->mdio_read(dev, mii->phy_id, MII_BMCR);
tmp = bmcr & ~(BMCR_ANENABLE | BMCR_SPEED100 | BMCR_FULLDPLX);
if (ecmd->speed == SPEED_100)
bmcr |= BMCR_SPEED100;
if (ecmd->duplex == DUPLEX_FULL) {
bmcr |= BMCR_FULLDPLX;
mii->full_duplex = 1;
} else
mii->full_duplex = 0;
if (bmcr != tmp)
mii->mdio_write(dev, mii->phy_id, MII_BMCR, bmcr);
mii->duplex_lock = 1;
}
return 0;
}
int mii_link_ok (struct mii_if_info *mii)
{
if (mii->mdio_read(mii->dev, mii->phy_id, MII_BMSR) & BMSR_LSTATUS)
return 1;
return 0;
}
int mii_nway_restart (struct mii_if_info *mii)
{
int bmcr;
int r = -EINVAL;
/* if autoneg is off, it's an error */
bmcr = mii->mdio_read(mii->dev, mii->phy_id, MII_BMCR);
if (bmcr & BMCR_ANENABLE) {
bmcr |= BMCR_ANRESTART;
mii->mdio_write(mii->dev, mii->phy_id, MII_BMCR, bmcr);
r = 0;
}
return r;
}
MODULE_AUTHOR ("Jeff Garzik <jg...@ma...>");
MODULE_DESCRIPTION ("MII hardware support library");
MODULE_LICENSE("GPL");
EXPORT_SYMBOL(mii_link_ok);
EXPORT_SYMBOL(mii_nway_restart);
EXPORT_SYMBOL(mii_ethtool_gset);
EXPORT_SYMBOL(mii_ethtool_sset);
|
|
From: Dave A. <ai...@us...> - 2003-06-10 03:08:11
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/s390
In directory sc8-pr-cvs1:/tmp/cvs-serv14646/drivers/s390
Added Files:
sysinfo.c
Log Message:
DA: additional files from 2.4.1[78] kernels..
--- NEW FILE ---
/*
* drivers/s390/sysinfo.c
*
* Copyright (C) 2001 IBM Deutschland Entwicklung GmbH, IBM Corporation
* Author(s): Ulrich Weigand (Ulr...@de...)
*/
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/proc_fs.h>
#include <linux/init.h>
#include <asm/ebcdic.h>
struct sysinfo_1_1_1
{
char reserved_0[32];
char manufacturer[16];
char type[4];
char reserved_1[12];
char model[16];
char sequence[16];
char plant[4];
};
struct sysinfo_1_2_1
{
char reserved_0[80];
char sequence[16];
char plant[4];
char reserved_1[2];
unsigned short cpu_address;
};
struct sysinfo_1_2_2
{
char reserved_0[32];
unsigned int capability;
unsigned short cpus_total;
unsigned short cpus_configured;
unsigned short cpus_standby;
unsigned short cpus_reserved;
unsigned short adjustment[0];
};
struct sysinfo_2_2_1
{
char reserved_0[80];
char sequence[16];
char plant[4];
unsigned short cpu_id;
unsigned short cpu_address;
};
struct sysinfo_2_2_2
{
char reserved_0[32];
unsigned short lpar_number;
char reserved_1;
unsigned char characteristics;
#define LPAR_CHAR_DEDICATED (1 << 7)
#define LPAR_CHAR_SHARED (1 << 6)
#define LPAR_CHAR_LIMITED (1 << 5)
unsigned short cpus_total;
unsigned short cpus_configured;
unsigned short cpus_standby;
unsigned short cpus_reserved;
char name[8];
unsigned int caf;
char reserved_2[16];
unsigned short cpus_dedicated;
unsigned short cpus_shared;
};
struct sysinfo_3_2_2
{
char reserved_0[31];
unsigned char count;
struct
{
char reserved_0[4];
unsigned short cpus_total;
unsigned short cpus_configured;
unsigned short cpus_standby;
unsigned short cpus_reserved;
char name[8];
unsigned int caf;
char cpi[16];
char reserved_1[24];
} vm[8];
};
union s390_sysinfo
{
struct sysinfo_1_1_1 sysinfo_1_1_1;
struct sysinfo_1_2_1 sysinfo_1_2_1;
struct sysinfo_1_2_2 sysinfo_1_2_2;
struct sysinfo_2_2_1 sysinfo_2_2_1;
struct sysinfo_2_2_2 sysinfo_2_2_2;
struct sysinfo_3_2_2 sysinfo_3_2_2;
};
static inline int stsi (void *sysinfo,
int fc, int sel1, int sel2)
{
int cc, retv;
#ifndef CONFIG_ARCH_S390X
__asm__ __volatile__ ( "lr\t0,%2\n"
"\tlr\t1,%3\n"
"\tstsi\t0(%4)\n"
"0:\tipm\t%0\n"
"\tsrl\t%0,28\n"
"1:lr\t%1,0\n"
".section .fixup,\"ax\"\n"
"2:\tlhi\t%0,3\n"
"\tbras\t1,3f\n"
"\t.long 1b\n"
"3:\tl\t1,0(1)\n"
"\tbr\t1\n"
".previous\n"
".section __ex_table,\"a\"\n"
"\t.align 4\n"
"\t.long 0b,2b\n"
".previous\n"
: "=d" (cc), "=d" (retv)
: "d" ((fc << 28) | sel1), "d" (sel2), "a" (sysinfo)
: "cc", "memory", "0", "1" );
#else
__asm__ __volatile__ ( "lr\t0,%2\n"
"lr\t1,%3\n"
"\tstsi\t0(%4)\n"
"0:\tipm\t%0\n"
"\tsrl\t%0,28\n"
"1:lr\t%1,0\n"
".section .fixup,\"ax\"\n"
"2:\tlhi\t%0,3\n"
"\tjg\t1b\n"
".previous\n"
".section __ex_table,\"a\"\n"
"\t.align 8\n"
"\t.quad 0b,2b\n"
".previous\n"
: "=d" (cc), "=d" (retv)
: "d" ((fc << 28) | sel1), "d" (sel2), "a" (sysinfo)
: "cc", "memory", "0", "1" );
#endif
return cc? -1 : retv;
}
static inline int stsi_0 (void)
{
int rc = stsi (NULL, 0, 0, 0);
return rc == -1 ? rc : (((unsigned int)rc) >> 28);
}
static inline int stsi_1_1_1 (struct sysinfo_1_1_1 *info)
{
int rc = stsi (info, 1, 1, 1);
if (rc != -1)
{
EBCASC (info->manufacturer, sizeof(info->manufacturer));
EBCASC (info->type, sizeof(info->type));
EBCASC (info->model, sizeof(info->model));
EBCASC (info->sequence, sizeof(info->sequence));
EBCASC (info->plant, sizeof(info->plant));
}
return rc == -1 ? rc : 0;
}
static inline int stsi_1_2_1 (struct sysinfo_1_2_1 *info)
{
int rc = stsi (info, 1, 2, 1);
if (rc != -1)
{
EBCASC (info->sequence, sizeof(info->sequence));
EBCASC (info->plant, sizeof(info->plant));
}
return rc == -1 ? rc : 0;
}
static inline int stsi_1_2_2 (struct sysinfo_1_2_2 *info)
{
int rc = stsi (info, 1, 2, 2);
return rc == -1 ? rc : 0;
}
static inline int stsi_2_2_1 (struct sysinfo_2_2_1 *info)
{
int rc = stsi (info, 2, 2, 1);
if (rc != -1)
{
EBCASC (info->sequence, sizeof(info->sequence));
EBCASC (info->plant, sizeof(info->plant));
}
return rc == -1 ? rc : 0;
}
static inline int stsi_2_2_2 (struct sysinfo_2_2_2 *info)
{
int rc = stsi (info, 2, 2, 2);
if (rc != -1)
{
EBCASC (info->name, sizeof(info->name));
}
return rc == -1 ? rc : 0;
}
static inline int stsi_3_2_2 (struct sysinfo_3_2_2 *info)
{
int rc = stsi (info, 3, 2, 2);
if (rc != -1)
{
int i;
for (i = 0; i < info->count; i++)
{
EBCASC (info->vm[i].name, sizeof(info->vm[i].name));
EBCASC (info->vm[i].cpi, sizeof(info->vm[i].cpi));
}
}
return rc == -1 ? rc : 0;
}
static int proc_read_sysinfo(char *page, char **start,
off_t off, int count,
int *eof, void *data)
{
unsigned long info_page = get_free_page (GFP_KERNEL);
union s390_sysinfo *info = (union s390_sysinfo *) info_page;
int len = 0;
int level;
int i;
if (!info)
return 0;
level = stsi_0 ();
if (level < 1)
goto out;
if (stsi_1_1_1 (&info->sysinfo_1_1_1))
goto out;
len += sprintf (page+len, "Manufacturer: %-16.16s\n",
info->sysinfo_1_1_1.manufacturer);
len += sprintf (page+len, "Type: %-4.4s\n",
info->sysinfo_1_1_1.type);
len += sprintf (page+len, "Model: %-16.16s\n",
info->sysinfo_1_1_1.model);
len += sprintf (page+len, "Sequence Code: %-16.16s\n",
info->sysinfo_1_1_1.sequence);
len += sprintf (page+len, "Plant: %-4.4s\n",
info->sysinfo_1_1_1.plant);
if (stsi_1_2_2 (&info->sysinfo_1_2_2))
goto out;
len += sprintf (page+len, "\n");
len += sprintf (page+len, "CPUs Total: %d\n",
info->sysinfo_1_2_2.cpus_total);
len += sprintf (page+len, "CPUs Configured: %d\n",
info->sysinfo_1_2_2.cpus_configured);
len += sprintf (page+len, "CPUs Standby: %d\n",
info->sysinfo_1_2_2.cpus_standby);
len += sprintf (page+len, "CPUs Reserved: %d\n",
info->sysinfo_1_2_2.cpus_reserved);
len += sprintf (page+len, "Capability: %d\n",
info->sysinfo_1_2_2.capability);
for (i = 2; i <= info->sysinfo_1_2_2.cpus_total; i++)
len += sprintf (page+len, "Adjustment %02d-way: %d\n",
i, info->sysinfo_1_2_2.adjustment[i-2]);
if (level < 2)
goto out;
if (stsi_2_2_2 (&info->sysinfo_2_2_2))
goto out;
len += sprintf (page+len, "\n");
len += sprintf (page+len, "LPAR Number: %d\n",
info->sysinfo_2_2_2.lpar_number);
len += sprintf (page+len, "LPAR Characteristics: ");
if (info->sysinfo_2_2_2.characteristics & LPAR_CHAR_DEDICATED)
len += sprintf (page+len, "Dedicated ");
if (info->sysinfo_2_2_2.characteristics & LPAR_CHAR_SHARED)
len += sprintf (page+len, "Shared ");
if (info->sysinfo_2_2_2.characteristics & LPAR_CHAR_LIMITED)
len += sprintf (page+len, "Limited ");
len += sprintf (page+len, "\n");
len += sprintf (page+len, "LPAR Name: %-8.8s\n",
info->sysinfo_2_2_2.name);
len += sprintf (page+len, "LPAR Adjustment: %d\n",
info->sysinfo_2_2_2.caf);
len += sprintf (page+len, "LPAR CPUs Total: %d\n",
info->sysinfo_2_2_2.cpus_total);
len += sprintf (page+len, "LPAR CPUs Configured: %d\n",
info->sysinfo_2_2_2.cpus_configured);
len += sprintf (page+len, "LPAR CPUs Standby: %d\n",
info->sysinfo_2_2_2.cpus_standby);
len += sprintf (page+len, "LPAR CPUs Reserved: %d\n",
info->sysinfo_2_2_2.cpus_reserved);
len += sprintf (page+len, "LPAR CPUs Dedicated: %d\n",
info->sysinfo_2_2_2.cpus_dedicated);
len += sprintf (page+len, "LPAR CPUs Shared: %d\n",
info->sysinfo_2_2_2.cpus_shared);
if (level < 3)
goto out;
if (stsi_3_2_2 (&info->sysinfo_3_2_2))
goto out;
for (i = 0; i < info->sysinfo_3_2_2.count; i++)
{
len += sprintf (page+len, "\n");
len += sprintf (page+len, "VM%02d Name: %-8.8s\n",
i, info->sysinfo_3_2_2.vm[i].name);
len += sprintf (page+len, "VM%02d Control Program: %-16.16s\n",
i, info->sysinfo_3_2_2.vm[i].cpi);
len += sprintf (page+len, "VM%02d Adjustment: %d\n",
i, info->sysinfo_3_2_2.vm[i].caf);
len += sprintf (page+len, "VM%02d CPUs Total: %d\n",
i, info->sysinfo_3_2_2.vm[i].cpus_total);
len += sprintf (page+len, "VM%02d CPUs Configured: %d\n",
i, info->sysinfo_3_2_2.vm[i].cpus_configured);
len += sprintf (page+len, "VM%02d CPUs Standby: %d\n",
i, info->sysinfo_3_2_2.vm[i].cpus_standby);
len += sprintf (page+len, "VM%02d CPUs Reserved: %d\n",
i, info->sysinfo_3_2_2.vm[i].cpus_reserved);
}
out:
free_page (info_page);
return len;
}
static __init int create_proc_sysinfo(void)
{
create_proc_read_entry ("sysinfo", 0444, NULL,
proc_read_sysinfo, NULL);
return 0;
}
__initcall(create_proc_sysinfo);
|
|
From: Dave A. <ai...@us...> - 2003-06-10 03:08:11
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/net/wireless
In directory sc8-pr-cvs1:/tmp/cvs-serv14646/drivers/net/wireless
Added Files:
hermes_rid.h ieee802_11.h
Log Message:
DA: additional files from 2.4.1[78] kernels..
--- NEW FILE ---
#ifndef _HERMES_RID_H
#define _HERMES_RID_H
/*
* Configuration RIDs
*/
#define HERMES_RID_CNFPORTTYPE 0xFC00 /* used */
#define HERMES_RID_CNFOWNMACADDR 0xFC01 /* used */
#define HERMES_RID_CNFDESIREDSSID 0xFC02 /* used */
#define HERMES_RID_CNFOWNCHANNEL 0xFC03 /* used */
#define HERMES_RID_CNFOWNSSID 0xFC04 /* used */
#define HERMES_RID_CNFOWNATIMWINDOW 0xFC05
#define HERMES_RID_CNFSYSTEMSCALE 0xFC06 /* used */
#define HERMES_RID_CNFMAXDATALEN 0xFC07
#define HERMES_RID_CNFWDSADDRESS 0xFC08
#define HERMES_RID_CNFPMENABLED 0xFC09 /* used */
#define HERMES_RID_CNFPMEPS 0xFC0A
#define HERMES_RID_CNFMULTICASTRECEIVE 0xFC0B /* used */
#define HERMES_RID_CNFMAXSLEEPDURATION 0xFC0C /* used */
#define HERMES_RID_CNFPMHOLDOVERDURATION 0xFC0D /* used */
#define HERMES_RID_CNFOWNNAME 0xFC0E /* used */
#define HERMES_RID_CNFOWNDTIMPERIOD 0xFC10
#define HERMES_RID_CNFWDSADDRESS1 0xFC11
#define HERMES_RID_CNFWDSADDRESS2 0xFC12
#define HERMES_RID_CNFWDSADDRESS3 0xFC13
#define HERMES_RID_CNFWDSADDRESS4 0xFC14
#define HERMES_RID_CNFWDSADDRESS5 0xFC15
#define HERMES_RID_CNFWDSADDRESS6 0xFC16
#define HERMES_RID_CNFMULTICASTPMBUFFERING 0xFC17
#define HERMES_RID_CNFWEPENABLED_AGERE 0xFC20 /* used */
#define HERMES_RID_CNFMANDATORYBSSID_SYMBOL 0xFC21
#define HERMES_RID_CNFWEPDEFAULTKEYID 0xFC23 /* used */
#define HERMES_RID_CNFDEFAULTKEY0 0xFC24 /* used */
#define HERMES_RID_CNFDEFAULTKEY1 0xFC25 /* used */
#define HERMES_RID_CNFMWOROBUST_AGERE 0xFC25 /* used */
#define HERMES_RID_CNFDEFAULTKEY2 0xFC26 /* used */
#define HERMES_RID_CNFDEFAULTKEY3 0xFC27 /* used */
#define HERMES_RID_CNFWEPFLAGS_INTERSIL 0xFC28 /* used */
#define HERMES_RID_CNFWEPKEYMAPPINGTABLE 0xFC29
#define HERMES_RID_CNFAUTHENTICATION 0xFC2A /* used */
#define HERMES_RID_CNFMAXASSOCSTA 0xFC2B
#define HERMES_RID_CNFKEYLENGTH_SYMBOL 0xFC2B
#define HERMES_RID_CNFTXCONTROL 0xFC2C
#define HERMES_RID_CNFROAMINGMODE 0xFC2D
#define HERMES_RID_CNFHOSTAUTHENTICATION 0xFC2E
#define HERMES_RID_CNFRCVCRCERROR 0xFC30
#define HERMES_RID_CNFMMLIFE 0xFC31
#define HERMES_RID_CNFALTRETRYCOUNT 0xFC32
#define HERMES_RID_CNFBEACONINT 0xFC33
#define HERMES_RID_CNFAPPCFINFO 0xFC34
#define HERMES_RID_CNFSTAPCFINFO 0xFC35
#define HERMES_RID_CNFPRIORITYQUSAGE 0xFC37
#define HERMES_RID_CNFTIMCTRL 0xFC40
#define HERMES_RID_CNFTHIRTY2TALLY 0xFC42
#define HERMES_RID_CNFENHSECURITY 0xFC43
#define HERMES_RID_CNFGROUPADDRESSES 0xFC80 /* used */
#define HERMES_RID_CNFCREATEIBSS 0xFC81 /* used */
#define HERMES_RID_CNFFRAGMENTATIONTHRESHOLD 0xFC82 /* used */
#define HERMES_RID_CNFRTSTHRESHOLD 0xFC83 /* used */
#define HERMES_RID_CNFTXRATECONTROL 0xFC84 /* used */
#define HERMES_RID_CNFPROMISCUOUSMODE 0xFC85 /* used */
#define HERMES_RID_CNFBASICRATES_SYMBOL 0xFC8A
#define HERMES_RID_CNFPREAMBLE_SYMBOL 0xFC8C /* used */
#define HERMES_RID_CNFFRAGMENTATIONTHRESHOLD0 0xFC90
#define HERMES_RID_CNFFRAGMENTATIONTHRESHOLD1 0xFC91
#define HERMES_RID_CNFFRAGMENTATIONTHRESHOLD2 0xFC92
#define HERMES_RID_CNFFRAGMENTATIONTHRESHOLD3 0xFC93
#define HERMES_RID_CNFFRAGMENTATIONTHRESHOLD4 0xFC94
#define HERMES_RID_CNFFRAGMENTATIONTHRESHOLD5 0xFC95
#define HERMES_RID_CNFFRAGMENTATIONTHRESHOLD6 0xFC96
#define HERMES_RID_CNFRTSTHRESHOLD0 0xFC97
#define HERMES_RID_CNFRTSTHRESHOLD1 0xFC98
#define HERMES_RID_CNFRTSTHRESHOLD2 0xFC99
#define HERMES_RID_CNFRTSTHRESHOLD3 0xFC9A
#define HERMES_RID_CNFRTSTHRESHOLD4 0xFC9B
#define HERMES_RID_CNFRTSTHRESHOLD5 0xFC9C
#define HERMES_RID_CNFRTSTHRESHOLD6 0xFC9D
#define HERMES_RID_CNFSHORTPREAMBLE 0xFCB0
#define HERMES_RID_CNFWEPKEYS_AGERE 0xFCB0 /* used */
#define HERMES_RID_CNFEXCLUDELONGPREAMBLE 0xFCB1
#define HERMES_RID_CNFTXKEY_AGERE 0xFCB1 /* used */
#define HERMES_RID_CNFAUTHENTICATIONRSPTO 0xFCB2
#define HERMES_RID_CNFBASICRATES 0xFCB3
#define HERMES_RID_CNFSUPPORTEDRATES 0xFCB4
#define HERMES_RID_CNFTICKTIME 0xFCE0 /* used */
#define HERMES_RID_CNFSCANREQUEST 0xFCE1
#define HERMES_RID_CNFJOINREQUEST 0xFCE2
#define HERMES_RID_CNFAUTHENTICATESTATION 0xFCE3
#define HERMES_RID_CNFCHANNELINFOREQUEST 0xFCE4
/*
* Information RIDs
*/
#define HERMES_RID_MAXLOADTIME 0xFD00
#define HERMES_RID_DOWNLOADBUFFER 0xFD01
#define HERMES_RID_PRIID 0xFD02
#define HERMES_RID_PRISUPRANGE 0xFD03
#define HERMES_RID_CFIACTRANGES 0xFD04
#define HERMES_RID_NICSERNUM 0xFD0A
#define HERMES_RID_NICID 0xFD0B
#define HERMES_RID_MFISUPRANGE 0xFD0C
#define HERMES_RID_CFISUPRANGE 0xFD0D
#define HERMES_RID_CHANNELLIST 0xFD10 /* used */
#define HERMES_RID_REGULATORYDOMAINS 0xFD11
#define HERMES_RID_TEMPTYPE 0xFD12
#define HERMES_RID_CIS 0xFD13
#define HERMES_RID_STAID 0xFD20 /* used */
#define HERMES_RID_STASUPRANGE 0xFD21
#define HERMES_RID_MFIACTRANGES 0xFD22
#define HERMES_RID_CFIACTRANGES2 0xFD23
#define HERMES_RID_SECONDARYVERSION_SYMBOL 0xFD24 /* used */
#define HERMES_RID_PORTSTATUS 0xFD40
#define HERMES_RID_CURRENTSSID 0xFD41 /* used */
#define HERMES_RID_CURRENTBSSID 0xFD42 /* used */
#define HERMES_RID_COMMSQUALITY 0xFD43 /* used */
#define HERMES_RID_CURRENTTXRATE 0xFD44 /* used */
#define HERMES_RID_CURRENTBEACONINTERVAL 0xFD45
#define HERMES_RID_CURRENTSCALETHRESHOLDS 0xFD46
#define HERMES_RID_PROTOCOLRSPTIME 0xFD47
#define HERMES_RID_SHORTRETRYLIMIT 0xFD48 /* used */
#define HERMES_RID_LONGRETRYLIMIT 0xFD49 /* used */
#define HERMES_RID_MAXTRANSMITLIFETIME 0xFD4A /* used */
#define HERMES_RID_MAXRECEIVELIFETIME 0xFD4B
#define HERMES_RID_CFPOLLABLE 0xFD4C
#define HERMES_RID_AUTHENTICATIONALGORITHMS 0xFD4D
#define HERMES_RID_PRIVACYOPTIONIMPLEMENTED 0xFD4F
#define HERMES_RID_CURRENTTXRATE1 0xFD80
#define HERMES_RID_CURRENTTXRATE2 0xFD81
#define HERMES_RID_CURRENTTXRATE3 0xFD82
#define HERMES_RID_CURRENTTXRATE4 0xFD83
#define HERMES_RID_CURRENTTXRATE5 0xFD84
#define HERMES_RID_CURRENTTXRATE6 0xFD85
#define HERMES_RID_OWNMACADDR 0xFD86
#define HERMES_RID_SCANRESULTSTABLE 0xFD88
#define HERMES_RID_PHYTYPE 0xFDC0
#define HERMES_RID_CURRENTCHANNEL 0xFDC1 /* used */
#define HERMES_RID_CURRENTPOWERSTATE 0xFDC2
#define HERMES_RID_CCAMODE 0xFDC3
#define HERMES_RID_SUPPORTEDDATARATES 0xFDC6 /* used */
#define HERMES_RID_BUILDSEQ 0xFFFE
#define HERMES_RID_FWID 0xFFFF
/* "ID" structure - used for ESSID and station nickname */
struct hermes_idstring {
u16 len;
u16 val[16];
} __attribute__ ((packed));
typedef struct hermes_multicast {
u8 addr[HERMES_MAX_MULTICAST][ETH_ALEN];
} __attribute__ ((packed)) hermes_multicast_t;
#endif
--- NEW FILE ---
#ifndef _IEEE802_11_H
#define _IEEE802_11_H
struct ieee802_11_hdr {
u16 frame_ctl;
u16 duration_id;
u8 addr1[ETH_ALEN];
u8 addr2[ETH_ALEN];
u8 addr3[ETH_ALEN];
u16 seq_ctl;
u8 addr4[ETH_ALEN];
u16 data_len;
} __attribute__ ((packed));
/* Frame control field constants */
#define IEEE802_11_FCTL_VERS 0x0002
#define IEEE802_11_FCTL_FTYPE 0x000c
#define IEEE802_11_FCTL_STYPE 0x00f0
#define IEEE802_11_FCTL_TODS 0x0100
#define IEEE802_11_FCTL_FROMDS 0x0200
#define IEEE802_11_FCTL_MOREFRAGS 0x0400
#define IEEE802_11_FCTL_RETRY 0x0800
#define IEEE802_11_FCTL_PM 0x1000
#define IEEE802_11_FCTL_MOREDATA 0x2000
#define IEEE802_11_FCTL_WEP 0x4000
#define IEEE802_11_FCTL_ORDER 0x8000
#define IEEE802_11_FTYPE_MGMT 0x0000
#define IEEE802_11_FTYPE_CTL 0x0004
#define IEEE802_11_FTYPE_DATA 0x0008
/* management */
#define IEEE802_11_STYPE_ASSOC_REQ 0x0000
#define IEEE802_11_STYPE_ASSOC_RESP 0x0010
#define IEEE802_11_STYPE_REASSOC_REQ 0x0020
#define IEEE802_11_STYPE_REASSOC_RESP 0x0030
#define IEEE802_11_STYPE_PROBE_REQ 0x0040
#define IEEE802_11_STYPE_PROBE_RESP 0x0050
#define IEEE802_11_STYPE_BEACON 0x0080
#define IEEE802_11_STYPE_ATIM 0x0090
#define IEEE802_11_STYPE_DISASSOC 0x00A0
#define IEEE802_11_STYPE_AUTH 0x00B0
#define IEEE802_11_STYPE_DEAUTH 0x00C0
/* control */
#define IEEE802_11_STYPE_PSPOLL 0x00A0
#define IEEE802_11_STYPE_RTS 0x00B0
#define IEEE802_11_STYPE_CTS 0x00C0
#define IEEE802_11_STYPE_ACK 0x00D0
#define IEEE802_11_STYPE_CFEND 0x00E0
#define IEEE802_11_STYPE_CFENDACK 0x00F0
/* data */
#define IEEE802_11_STYPE_DATA 0x0000
#define IEEE802_11_STYPE_DATA_CFACK 0x0010
#define IEEE802_11_STYPE_DATA_CFPOLL 0x0020
#define IEEE802_11_STYPE_DATA_CFACKPOLL 0x0030
#define IEEE802_11_STYPE_NULLFUNC 0x0040
#define IEEE802_11_STYPE_CFACK 0x0050
#define IEEE802_11_STYPE_CFPOLL 0x0060
#define IEEE802_11_STYPE_CFACKPOLL 0x0070
#define IEEE802_11_SCTL_FRAG 0x000F
#define IEEE802_11_SCTL_SEQ 0xFFF0
#endif /* _IEEE802_11_H */
|