diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-01-29 01:41:54 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-01-29 01:41:54 +0000 |
commit | f969d69ba9f952e5bdd38278e25e26a3e4a61a70 (patch) | |
tree | b3530d803df59d726afaabebc6626987dee1ca05 /net | |
parent | a10ce7ef2066b455d69187643ddf2073bfc4db24 (diff) |
Merge with 2.3.27.
Diffstat (limited to 'net')
61 files changed, 898 insertions, 1326 deletions
diff --git a/net/802/tr.c b/net/802/tr.c index f3fa70ac1..bf0b8452e 100644 --- a/net/802/tr.c +++ b/net/802/tr.c @@ -447,7 +447,9 @@ static void rif_check_expire(unsigned long dummy) * routing. */ -#ifdef CONFIG_PROC_FS +#ifndef CONFIG_PROC_FS +int rif_get_info(char *buffer,char **start, off_t offset, int length, int dummy) {} +#else int rif_get_info(char *buffer,char **start, off_t offset, int length, int dummy) { int len=0; @@ -529,15 +531,6 @@ int rif_get_info(char *buffer,char **start, off_t offset, int length, int dummy) * too much for this. */ -#ifdef CONFIG_PROC_FS -static struct proc_dir_entry tr_rif_proc = { - PROC_NET_TR_RIF, 6, "tr_rif", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - rif_get_info -}; -#endif - void __init rif_init(struct net_proto *unused) { rif_timer.expires = RIF_TIMEOUT; @@ -546,7 +539,5 @@ void __init rif_init(struct net_proto *unused) init_timer(&rif_timer); add_timer(&rif_timer); -#ifdef CONFIG_PROC_FS - proc_net_register(&tr_rif_proc); -#endif + proc_net_create("tr_rif",0,rif_get_info); } diff --git a/net/appletalk/aarp.c b/net/appletalk/aarp.c index 6aba2f14f..392e01c2c 100644 --- a/net/appletalk/aarp.c +++ b/net/appletalk/aarp.c @@ -1159,22 +1159,14 @@ void aarp_cleanup_module(void) #ifdef CONFIG_PROC_FS -static struct proc_dir_entry proc_aarp_entries= -{ - PROC_NET_AT_AARP, 4, "aarp", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - aarp_get_info -}; - void aarp_register_proc_fs(void) { - proc_net_register(&proc_aarp_entries); + proc_net_create("aarp", 0, aarp_get_info); } void aarp_unregister_proc_fs(void) { - proc_net_unregister(PROC_NET_AT_AARP); + proc_net_remove("aarp"); } #endif diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index 4ab75098d..b31a46226 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c @@ -2069,32 +2069,6 @@ EXPORT_SYMBOL(aarp_send_ddp); EXPORT_SYMBOL(atrtr_get_dev); EXPORT_SYMBOL(atalk_find_dev_addr); -#ifdef CONFIG_PROC_FS -static struct proc_dir_entry proc_appletalk= -{ - PROC_NET_ATALK, 9, "appletalk", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - atalk_get_info -}; - -static struct proc_dir_entry proc_atalk_route= -{ - PROC_NET_AT_ROUTE, 11,"atalk_route", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - atalk_rt_get_info -}; - -static struct proc_dir_entry proc_atalk_iface= -{ - PROC_NET_ATIF, 11,"atalk_iface", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - atalk_if_get_info -}; -#endif /* CONFIG_PROC_FS */ - /* Called by proto.c on kernel start up */ void __init atalk_proto_init(struct net_proto *pro) @@ -2113,9 +2087,9 @@ void __init atalk_proto_init(struct net_proto *pro) aarp_proto_init(); #ifdef CONFIG_PROC_FS - proc_net_register(&proc_appletalk); - proc_net_register(&proc_atalk_route); - proc_net_register(&proc_atalk_iface); + proc_net_create("appletalk", 0, atalk_get_info); + proc_net_create("atalk_route", 0, atalk_rt_get_info); + proc_net_create("atalk_iface", 0, atalk_if_get_info); aarp_register_proc_fs(); #endif /* CONFIG_PROC_FS */ @@ -2155,9 +2129,9 @@ void cleanup_module(void) #endif /* CONFIG_SYSCTL */ #ifdef CONFIG_PROC_FS - proc_net_unregister(PROC_NET_ATALK); - proc_net_unregister(PROC_NET_AT_ROUTE); - proc_net_unregister(PROC_NET_ATIF); + proc_net_remove("appletalk"); + proc_net_remove("atalk_route"); + proc_net_remove("atalk_iface"); aarp_unregister_proc_fs(); #endif /* CONFIG_PROC_FS */ diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 003580065..6aa960f9f 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c @@ -1766,27 +1766,6 @@ EXPORT_SYMBOL(asc2ax); EXPORT_SYMBOL(null_ax25_address); EXPORT_SYMBOL(ax25_display_timer); -#ifdef CONFIG_PROC_FS -static struct proc_dir_entry proc_ax25_route = { - PROC_NET_AX25_ROUTE, 10, "ax25_route", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - ax25_rt_get_info -}; -static struct proc_dir_entry proc_ax25 = { - PROC_NET_AX25, 4, "ax25", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - ax25_get_info -}; -static struct proc_dir_entry proc_ax25_calls = { - PROC_NET_AX25_CALLS, 10, "ax25_calls", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - ax25_uid_get_info -}; -#endif - void __init ax25_proto_init(struct net_proto *pro) { sock_register(&ax25_family_ops); @@ -1798,9 +1777,9 @@ void __init ax25_proto_init(struct net_proto *pro) #endif #ifdef CONFIG_PROC_FS - proc_net_register(&proc_ax25_route); - proc_net_register(&proc_ax25); - proc_net_register(&proc_ax25_calls); + proc_net_create("ax25_route", 0, ax25_rt_get_info); + proc_net_create("ax25", 0, ax25_get_info); + proc_net_create("ax25_calls", 0, ax25_uid_get_info); #endif printk(KERN_INFO "NET4: G4KLX/GW4PTS AX.25 for Linux. Version 0.37 for Linux NET4.0\n"); @@ -1820,10 +1799,9 @@ int init_module(void) void cleanup_module(void) { #ifdef CONFIG_PROC_FS - proc_net_unregister(PROC_NET_AX25_ROUTE); - proc_net_unregister(PROC_NET_AX25); - proc_net_unregister(PROC_NET_AX25_CALLS); - proc_net_unregister(PROC_NET_AX25_ROUTE); + proc_net_remove("ax25_route"); + proc_net_remove("ax25"); + proc_net_remove("ax25_calls"); #endif ax25_rt_free(); ax25_uid_free(); diff --git a/net/bridge/br.c b/net/bridge/br.c index 136c5c7c3..dc70cfe5d 100644 --- a/net/bridge/br.c +++ b/net/bridge/br.c @@ -831,14 +831,6 @@ int br_tree_get_info(char *buffer, char **start, off_t offset, int length, int d return len; } -#ifdef CONFIG_PROC_FS -struct proc_dir_entry proc_net_bridge= { - PROC_NET_BRIDGE, 6, "bridge", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - br_tree_get_info -}; -#endif void __init br_init(void) { /* (4.8.1) */ int port_no; @@ -895,9 +887,7 @@ void __init br_init(void) br_stats.exempt_protocols = 0; /*start_hello_timer();*/ /* Vova Oksman: register the function for the PROCfs "bridge" file */ -#ifdef CONFIG_PROC_FS - proc_net_register(&proc_net_bridge); -#endif + proc_net_create("bridge", 0, br_tree_get_info); } static inline unsigned short make_port_id(int port_no) diff --git a/net/core/dev.c b/net/core/dev.c index 078caeb99..612a14d5c 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -354,14 +354,18 @@ struct net_device *dev_getbyhwaddr(unsigned short type, char *ha) int dev_alloc_name(struct net_device *dev, const char *name) { int i; + char buf[32]; /* * If you need over 100 please also fix the algorithm... */ for(i=0;i<100;i++) { - sprintf(dev->name,name,i); - if(__dev_get_by_name(dev->name)==NULL) + sprintf(buf,name,i); + if(__dev_get_by_name(buf)==NULL) + { + strcpy(dev->name, buf); return i; + } } return -ENFILE; /* Over 100 of the things .. bail out! */ } @@ -1994,39 +1998,9 @@ int unregister_netdevice(struct net_device *dev) * present) and leaves us with a valid list of present and active devices. * */ -extern int lance_init(void); -extern int bpq_init(void); -extern int scc_init(void); -extern void sdla_setup(void); -extern void dlci_setup(void); -extern int dmascc_init(void); - -extern int lapbeth_init(void); -extern void arcnet_init(void); -extern void ip_auto_config(void); -#ifdef CONFIG_8xx -extern int cpm_enet_init(void); -#endif /* CONFIG_8xx */ -#ifdef CONFIG_PROC_FS -static struct proc_dir_entry proc_net_dev = { - PROC_NET_DEV, 3, "dev", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - dev_get_info -}; -#endif - -#ifdef CONFIG_NET_RADIO -#ifdef CONFIG_PROC_FS -static struct proc_dir_entry proc_net_wireless = { - PROC_NET_WIRELESS, 8, "wireless", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - dev_get_wireless_info -}; -#endif /* CONFIG_PROC_FS */ -#endif /* CONFIG_NET_RADIO */ +extern void net_device_init(void); +extern void ip_auto_config(void); int __init net_dev_init(void) { @@ -2050,51 +2024,6 @@ int __init net_dev_init(void) br_init(); #endif - /* - * This is Very Ugly(tm). - * - * Some devices want to be initialized early.. - */ - -#if defined(CONFIG_SCC) - scc_init(); -#endif -#if defined(CONFIG_DMASCC) - dmascc_init(); -#endif -#if defined(CONFIG_BPQETHER) - bpq_init(); -#endif -#if defined(CONFIG_DLCI) - dlci_setup(); -#endif -#if defined(CONFIG_SDLA) - sdla_setup(); -#endif -#if defined(CONFIG_LAPBETHER) - lapbeth_init(); -#endif -#if defined(CONFIG_PLIP) - plip_init(); -#endif -#if defined(CONFIG_ARCNET) - arcnet_init(); -#endif -#if defined(CONFIG_8xx) - cpm_enet_init(); -#endif - /* - * SLHC if present needs attaching so other people see it - * even if not opened. - */ - -#ifdef CONFIG_INET -#if (defined(CONFIG_SLIP) && defined(CONFIG_SLIP_COMPRESSED)) \ - || defined(CONFIG_PPP) \ - || (defined(CONFIG_ISDN) && defined(CONFIG_ISDN_PPP)) - slhc_install(); -#endif -#endif #ifdef CONFIG_NET_PROFILE net_profile_init(); @@ -2121,6 +2050,12 @@ int __init net_dev_init(void) dev->xmit_lock_owner = -1; dev->iflink = -1; dev_hold(dev); + /* + * We can allocate the name ahead of time. If the + * init fails the name will be reissued correctly. + */ + if (strchr(dev->name, '%')) + dev_alloc_name(dev, dev->name); if (dev->init && dev->init(dev)) { /* * It failed to come up. Unhook it. @@ -2142,18 +2077,12 @@ int __init net_dev_init(void) } #ifdef CONFIG_PROC_FS - proc_net_register(&proc_net_dev); - { - struct proc_dir_entry *ent = create_proc_entry("net/dev_stat", 0, 0); - ent->read_proc = dev_proc_stats; - } -#endif - + proc_net_create("dev", 0, dev_get_info); + create_proc_read_entry("net/dev_stat", 0, 0, dev_proc_stats, NULL); #ifdef CONFIG_NET_RADIO -#ifdef CONFIG_PROC_FS - proc_net_register(&proc_net_wireless); -#endif /* CONFIG_PROC_FS */ + proc_net_create("wireless", 0, dev_get_wireless_info); #endif /* CONFIG_NET_RADIO */ +#endif /* CONFIG_PROC_FS */ init_bh(NET_BH, net_bh); @@ -2162,6 +2091,12 @@ int __init net_dev_init(void) dst_init(); dev_mcast_init(); + /* + * Initialise network devices + */ + + net_device_init(); + #ifdef CONFIG_IP_PNP ip_auto_config(); #endif diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c index c52df0507..2facf1bc1 100644 --- a/net/core/dev_mcast.c +++ b/net/core/dev_mcast.c @@ -258,10 +258,7 @@ done: void __init dev_mcast_init(void) { #ifdef CONFIG_PROC_FS - struct proc_dir_entry *ent; - - ent = create_proc_entry("net/dev_mcast", 0, 0); - ent->read_proc = dev_mc_read_proc; + create_proc_read_entry("net/dev_mcast", 0, 0, dev_mc_read_proc, NULL); #endif } diff --git a/net/core/profile.c b/net/core/profile.c index e43a3d6e1..8b2616c50 100644 --- a/net/core/profile.c +++ b/net/core/profile.c @@ -265,10 +265,7 @@ int __init net_profile_init(void) int i; #ifdef CONFIG_PROC_FS - struct proc_dir_entry *ent; - - ent = create_proc_entry("net/profile", 0, 0); - ent->read_proc = profile_read_proc; + create_proc_read_entry("net/profile", 0, 0, profile_read_proc, NULL); #endif register_netdevice(&whitehole_dev); diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c index aa7759ded..077f3051c 100644 --- a/net/decnet/af_decnet.c +++ b/net/decnet/af_decnet.c @@ -1980,8 +1980,6 @@ static struct packet_type dn_dix_packet_type = NULL, }; -#ifdef CONFIG_PROC_FS - static int dn_get_info(char *buffer, char **start, off_t offset, int length, int dummy) { struct sock *sk; @@ -2036,22 +2034,11 @@ static int dn_get_info(char *buffer, char **start, off_t offset, int length, int return len; } -struct proc_dir_entry decnet_linkinfo = { - PROC_NET_DN_SKT, 6, "decnet", S_IFREG | S_IRUGO, - 1, 0, 0, 0, &proc_net_inode_operations, dn_get_info -}; - #ifdef CONFIG_DECNET_RAW extern int dn_raw_get_info(char *, char **, off_t, int, int); -struct proc_dir_entry decnet_rawinfo = { - PROC_NET_DN_RAW, 10, "decnet_raw", S_IFREG | S_IRUGO, - 1, 0, 0, 0, &proc_net_inode_operations, dn_raw_get_info -}; - #endif /* CONFIG_DECNET_RAW */ -#endif /* CONFIG_PROC_FS */ static struct net_proto_family dn_family_ops = { AF_DECnet, dn_create @@ -2089,11 +2076,9 @@ void __init decnet_proto_init(struct net_proto *pro) dev_add_pack(&dn_dix_packet_type); register_netdevice_notifier(&dn_dev_notifier); -#ifdef CONFIG_PROC_FS - proc_net_register(&decnet_linkinfo); + proc_net_create("decnet", 0, dn_get_info); #ifdef CONFIG_DECNET_RAW - proc_net_register(&decnet_rawinfo); -#endif + proc_net_create("decnet_raw", 0, dn_raw_get_info); #endif dn_dev_init(); dn_neigh_init(); @@ -2222,11 +2207,9 @@ void cleanup_module(void) dn_fib_cleanup(); #endif /* CONFIG_DECNET_ROUTER */ -#ifdef CONFIG_PROC_FS - proc_net_unregister(PROC_NET_DN_SKT); + proc_net_remove("decnet"); #ifdef CONFIG_DECNET_RAW - proc_net_unregister(PROC_NET_DN_RAW); -#endif + proc_net_remove("decnet_raw"); #endif dev_remove_pack(&dn_dix_packet_type); diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index ddd0d630c..435f7859d 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c @@ -1214,13 +1214,6 @@ static int decnet_dev_get_info(char *buffer, char **start, off_t offset, int len return(len); } -static struct proc_dir_entry proc_net_decnet_dev = { - PROC_NET_DN_DEV, 10, "decnet_dev", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - decnet_dev_get_info -}; - #endif /* CONFIG_PROC_FS */ #ifdef CONFIG_RTNETLINK @@ -1271,7 +1264,7 @@ void __init dn_dev_init(void) #endif /* CONFIG_RTNETLINK */ #ifdef CONFIG_PROC_FS - proc_net_register(&proc_net_decnet_dev); + proc_net_create("decnet_dev", 0, decnet_dev_get_info); #endif /* CONFIG_PROC_FS */ #ifdef CONFIG_SYSCTL @@ -1303,7 +1296,7 @@ void dn_dev_cleanup(void) #endif /* CONFIG_SYSCTL */ #ifdef CONFIG_PROC_FS - proc_net_unregister(PROC_NET_DN_DEV); + proc_net_remove("decnet_dev"); #endif /* CONFIG_PROC_FS */ dn_dev_devices_off(); diff --git a/net/decnet/dn_fib.c b/net/decnet/dn_fib.c index e34f4b6aa..d07eefa97 100644 --- a/net/decnet/dn_fib.c +++ b/net/decnet/dn_fib.c @@ -798,20 +798,13 @@ static int decnet_rt_get_info(char *buffer, char **start, off_t offset, int leng return pinfo.len; } -static struct proc_dir_entry proc_net_decnet_route = { - PROC_NET_DN_ROUTE, 12, "decnet_route", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - decnet_rt_get_info -}; - #endif /* CONFIG_PROC_FS */ #ifdef CONFIG_DECNET_MODULE void dn_fib_cleanup(void) { #ifdef CONFIG_PROC_FS - proc_net_unregister(PROC_NET_DN_ROUTE); + proc_net_create("decnet_route",0,decnet_rt_get_info); #endif /* CONFIG_PROC_FS */ } #endif /* CONFIG_DECNET_MODULE */ @@ -822,7 +815,7 @@ void __init dn_fib_init(void) memset(dn_fib_tables, 0, DN_NUM_TABLES * sizeof(struct dn_fib_table *)); #ifdef CONFIG_PROC_FS - proc_net_register(&proc_net_decnet_route); + proc_net_remove("decnet_route"); #endif } diff --git a/net/decnet/dn_neigh.c b/net/decnet/dn_neigh.c index 996beaa0c..775e1a26d 100644 --- a/net/decnet/dn_neigh.c +++ b/net/decnet/dn_neigh.c @@ -643,13 +643,6 @@ done: return len; } -static struct proc_dir_entry proc_net_dn_neigh = { - PROC_NET_DN_ADJ, 12, "decnet_neigh", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - dn_neigh_get_info -}; - #endif void __init dn_neigh_init(void) @@ -657,7 +650,7 @@ void __init dn_neigh_init(void) neigh_table_init(&dn_neigh_table); #ifdef CONFIG_PROC_FS - proc_net_register(&proc_net_dn_neigh); + proc_net_create("decnet_neigh",0,dn_neigh_get_info); #endif /* CONFIG_PROC_FS */ } @@ -665,7 +658,7 @@ void __init dn_neigh_init(void) void dn_neigh_cleanup(void) { #ifdef CONFIG_PROC_FS - proc_net_unregister(PROC_NET_DN_ADJ); + proc_net_remove("decnet_neigh"); #endif /* CONFIG_PROC_FS */ neigh_table_clear(&dn_neigh_table); } diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index c0ca04ac0..7abab2b8d 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c @@ -959,13 +959,6 @@ static int decnet_cache_get_info(char *buffer, char **start, off_t offset, int l return(len); } -static struct proc_dir_entry proc_net_decnet_cache = { - PROC_NET_DN_CACHE, 12, "decnet_cache", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - decnet_cache_get_info -}; - #endif /* CONFIG_PROC_FS */ void __init dn_route_init(void) @@ -982,7 +975,7 @@ void __init dn_route_init(void) add_timer(&dn_route_timer); #ifdef CONFIG_PROC_FS - proc_net_register(&proc_net_decnet_cache); + proc_net_create("decnet_cache",0,decnet_cache_get_info); #endif /* CONFIG_PROC_FS */ } @@ -992,7 +985,7 @@ void dn_route_cleanup(void) del_timer(&dn_route_timer); dn_run_flush(0); #ifdef CONFIG_PROC_FS - proc_net_unregister(PROC_NET_DN_CACHE); + proc_net_remove("decnet_cache"); #endif /* CONFIG_PROC_FS */ } #endif /* CONFIG_DECNET_MODULE */ diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 526dd4dd6..396cf38d8 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -948,45 +948,6 @@ struct net_proto_family inet_family_ops = { }; -#ifdef CONFIG_PROC_FS -static struct proc_dir_entry proc_net_raw = { - PROC_NET_RAW, 3, "raw", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - raw_get_info -}; -static struct proc_dir_entry proc_net_netstat = { - PROC_NET_NETSTAT, 7, "netstat", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - netstat_get_info -}; -static struct proc_dir_entry proc_net_snmp = { - PROC_NET_SNMP, 4, "snmp", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - snmp_get_info -}; -static struct proc_dir_entry proc_net_sockstat = { - PROC_NET_SOCKSTAT, 8, "sockstat", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - afinet_get_info -}; -static struct proc_dir_entry proc_net_tcp = { - PROC_NET_TCP, 3, "tcp", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - tcp_get_info -}; -static struct proc_dir_entry proc_net_udp = { - PROC_NET_UDP, 3, "udp", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - udp_get_info -}; -#endif /* CONFIG_PROC_FS */ - extern void tcp_init(void); extern void tcp_v4_init(struct net_proto_family *); @@ -1071,13 +1032,12 @@ void __init inet_proto_init(struct net_proto *pro) /* * Create all the /proc entries. */ - #ifdef CONFIG_PROC_FS - proc_net_register(&proc_net_raw); - proc_net_register(&proc_net_snmp); - proc_net_register(&proc_net_netstat); - proc_net_register(&proc_net_sockstat); - proc_net_register(&proc_net_tcp); - proc_net_register(&proc_net_udp); + proc_net_create ("raw", 0, raw_get_info); + proc_net_create ("netstat", 0, netstat_get_info); + proc_net_create ("snmp", 0, snmp_get_info); + proc_net_create ("sockstat", 0, afinet_get_info); + proc_net_create ("tcp", 0, tcp_get_info); + proc_net_create ("udp", 0, udp_get_info); #endif /* CONFIG_PROC_FS */ } diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 0b1ee6387..263cd36e0 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c @@ -980,11 +980,12 @@ out: /* * Write the contents of the ARP cache to a PROCfs file. */ -#ifdef CONFIG_PROC_FS - +#ifndef CONFIG_PROC_FS +static int arp_get_info(char *buffer, char **start, off_t offset, int length, int dummy) { return 0; } +#else #define HBUFFERLEN 30 -int arp_get_info(char *buffer, char **start, off_t offset, int length, int dummy) +static int arp_get_info(char *buffer, char **start, off_t offset, int length, int dummy) { int len=0; off_t pos=0; @@ -1116,24 +1117,14 @@ static struct packet_type arp_packet_type = NULL }; -#ifdef CONFIG_PROC_FS -static struct proc_dir_entry proc_net_arp = { - PROC_NET_ARP, 3, "arp", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - arp_get_info -}; -#endif - void __init arp_init (void) { neigh_table_init(&arp_tbl); dev_add_pack(&arp_packet_type); -#ifdef CONFIG_PROC_FS - proc_net_register(&proc_net_arp); -#endif + proc_net_create ("arp", 0, arp_get_info); + #ifdef CONFIG_SYSCTL neigh_sysctl_register(NULL, &arp_tbl.parms, NET_IPV4, NET_IPV4_NEIGH, "ipv4"); #endif diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 656acf2c9..47cc41a92 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c @@ -648,12 +648,7 @@ struct notifier_block fib_netdev_notifier = { void __init ip_fib_init(void) { #ifdef CONFIG_PROC_FS - proc_net_register(&(struct proc_dir_entry) { - PROC_NET_ROUTE, 5, "route", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - fib_get_procinfo - }); + proc_net_create("route",0,fib_get_procinfo); #endif /* CONFIG_PROC_FS */ #ifndef CONFIG_IP_MULTIPLE_TABLES diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 5e6b50ea7..fa464f24c 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -1006,18 +1006,6 @@ static struct packet_type ip_packet_type = }; - -#ifdef CONFIG_PROC_FS -#ifdef CONFIG_IP_MULTICAST -static struct proc_dir_entry proc_net_igmp = { - PROC_NET_IGMP, 4, "igmp", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - ip_mc_procinfo -}; -#endif -#endif - /* * IP registers the packet type and then calls the subprotocol initialisers */ @@ -1028,10 +1016,8 @@ void __init ip_init(void) ip_rt_init(); -#ifdef CONFIG_PROC_FS #ifdef CONFIG_IP_MULTICAST - proc_net_register(&proc_net_igmp); + proc_net_create("igmp", S_IFREG | S_IRUGO, ip_mc_procinfo); #endif -#endif } diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 6bb331fcd..b65d6f405 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c @@ -1703,18 +1703,6 @@ done: } #ifdef CONFIG_PROC_FS -static struct proc_dir_entry proc_net_ipmr_vif = { - PROC_NET_IPMR_VIF, 9 ,"ip_mr_vif", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - ipmr_vif_info -}; -static struct proc_dir_entry proc_net_ipmr_mfc = { - PROC_NET_IPMR_MFC, 11 ,"ip_mr_cache", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - ipmr_mfc_info -}; #endif #ifdef CONFIG_IP_PIMSM_V2 @@ -1746,7 +1734,7 @@ void __init ip_mr_init(void) ipmr_expire_timer.function=ipmr_expire_process; register_netdevice_notifier(&ip_mr_notifier); #ifdef CONFIG_PROC_FS - proc_net_register(&proc_net_ipmr_vif); - proc_net_register(&proc_net_ipmr_mfc); + proc_net_create("ip_mr_vif",0,ipmr_vif_info); + proc_net_create("ip_mr_cache",0,ipmr_mfc_info); #endif } diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 72bb07336..2fe7e0fdb 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -201,8 +201,9 @@ static __inline__ unsigned rt_hash_code(u32 daddr, u32 saddr, u8 tos) return (hash^(hash>>8)) & 0xFF; } -#ifdef CONFIG_PROC_FS - +#ifndef CONFIG_PROC_FS +static int rt_cache_get_info(char *buffer, char **start, off_t offset, int length, int dummy) { return 0; } +#else static int rt_cache_get_info(char *buffer, char **start, off_t offset, int length, int dummy) { int len=0; @@ -2147,11 +2148,6 @@ static int ip_rt_acct_read(char *buffer, char **start, off_t offset, void __init ip_rt_init(void) { -#ifdef CONFIG_PROC_FS -#ifdef CONFIG_NET_CLS_ROUTE - struct proc_dir_entry *ent; -#endif -#endif ipv4_dst_ops.kmem_cachep = kmem_cache_create("ip_dst_cache", sizeof(struct rtable), 0, SLAB_HWCACHE_ALIGN, @@ -2167,16 +2163,8 @@ void __init ip_rt_init(void) + ip_rt_gc_interval; add_timer(&rt_periodic_timer); -#ifdef CONFIG_PROC_FS - proc_net_register(&(struct proc_dir_entry) { - PROC_NET_RTCACHE, 8, "rt_cache", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - rt_cache_get_info - }); + proc_net_create ("rt_cache", 0, rt_cache_get_info); #ifdef CONFIG_NET_CLS_ROUTE - ent = create_proc_entry("net/rt_acct", 0, 0); - ent->read_proc = ip_rt_acct_read; -#endif + create_proc_read_entry("net/rt_acct", 0, 0, ip_rt_acct_read, NULL); #endif } diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 2f6bd37c9..0472ba4f8 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -1401,11 +1401,6 @@ static void tcp_fin(struct sk_buff *skb, struct sock *sk, struct tcphdr *th) tcp_send_ack(sk); - if (!sk->dead) { - wake_up_interruptible(sk->sleep); - sock_wake_async(sk->socket, 1, POLL_HUP); - } - switch(sk->state) { case TCP_SYN_RECV: case TCP_ESTABLISHED: @@ -1440,7 +1435,11 @@ static void tcp_fin(struct sk_buff *skb, struct sock *sk, struct tcphdr *th) */ printk("tcp_fin: Impossible, sk->state=%d\n", sk->state); break; - }; + } + if (!sk->dead) { + wake_up_interruptible(sk->sleep); + sock_wake_async(sk->socket, 1, POLL_HUP); + } } /* These routines update the SACK block as out-of-order packets arrive or diff --git a/net/ipv6/README b/net/ipv6/README index ca82fe438..a3f3f575a 100644 --- a/net/ipv6/README +++ b/net/ipv6/README @@ -1,6 +1,6 @@ To join in the work on Linux IPv6 send mail to: - majordomo@nuclecu.unam.mx + majordomo@oss.sgi.com and in the body of the message include: diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index c57c99a35..157fe6c4e 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -1590,13 +1590,6 @@ done: return len; } -struct proc_dir_entry iface_proc_entry = -{ - 0, 8, "if_inet6", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, NULL, - &iface_proc_info -}; #endif /* CONFIG_PROC_FS */ /* @@ -2008,7 +2001,7 @@ void __init addrconf_init(void) #endif #ifdef CONFIG_PROC_FS - proc_net_register(&iface_proc_entry); + proc_net_create("if_inet6", 0, iface_proc_info); #endif addr_chk_timer.expires = jiffies + ADDR_CHECK_FREQUENCY; @@ -2075,7 +2068,7 @@ void addrconf_cleanup(void) rtnl_unlock(); #ifdef CONFIG_PROC_FS - proc_net_unregister(iface_proc_entry.low_ino); + proc_net_remove("if_inet6"); #endif } #endif /* MODULE */ diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 72012bc59..1e056d2ea 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c @@ -459,39 +459,6 @@ struct net_proto_family inet6_family_ops = { inet6_create }; -#ifdef CONFIG_PROC_FS -static struct proc_dir_entry proc_net_raw6 = { - PROC_NET_RAW6, 4, "raw6", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - raw6_get_info -}; -static struct proc_dir_entry proc_net_tcp6 = { - PROC_NET_TCP6, 4, "tcp6", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - tcp6_get_info -}; -static struct proc_dir_entry proc_net_udp6 = { - PROC_NET_RAW6, 4, "udp6", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - udp6_get_info -}; -static struct proc_dir_entry proc_net_sockstat6 = { - PROC_NET_SOCKSTAT6, 9, "sockstat6", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - afinet6_get_info -}; -static struct proc_dir_entry proc_net_snmp6 = { - PROC_NET_SNMP6, 5, "snmp6", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - afinet6_get_snmp -}; -#endif /* CONFIG_PROC_FS */ - #ifdef MODULE int ipv6_unload(void) { @@ -566,11 +533,11 @@ void __init inet6_proto_init(struct net_proto *pro) /* Create /proc/foo6 entries. */ #ifdef CONFIG_PROC_FS - proc_net_register(&proc_net_raw6); - proc_net_register(&proc_net_tcp6); - proc_net_register(&proc_net_udp6); - proc_net_register(&proc_net_sockstat6); - proc_net_register(&proc_net_snmp6); + proc_net_create("raw6", 0, raw6_get_info); + proc_net_create("tcp6", 0, tcp6_get_info); + proc_net_create("udp6", 0, udp6_get_info); + proc_net_create("sockstat6", 0, afinet6_get_info); + proc_net_create("snmp6", 0, afinet6_get_snmp); #endif /* Now the userspace is allowed to create INET6 sockets. */ @@ -603,11 +570,11 @@ void cleanup_module(void) /* First of all disallow new sockets creation. */ sock_unregister(PF_INET6); #ifdef CONFIG_PROC_FS - proc_net_unregister(proc_net_raw6.low_ino); - proc_net_unregister(proc_net_tcp6.low_ino); - proc_net_unregister(proc_net_udp6.low_ino); - proc_net_unregister(proc_net_sockstat6.low_ino); - proc_net_unregister(proc_net_snmp6.low_ino); + proc_net_remove("raw6"); + proc_net_remove("tcp6"); + proc_net_remove("udp6"); + proc_net_remove("sockstat6"); + proc_net_remove("snmp6"); #endif /* Cleanup code parts. */ sit_cleanup(); diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c index cba690104..4dd29b60e 100644 --- a/net/ipv6/ip6_flowlabel.c +++ b/net/ipv6/ip6_flowlabel.c @@ -606,15 +606,10 @@ done: void ip6_flowlabel_init() { -#ifdef CONFIG_PROC_FS - struct proc_dir_entry *ent; -#endif - init_timer(&ip6_fl_gc_timer); ip6_fl_gc_timer.function = ip6_fl_gc; #ifdef CONFIG_PROC_FS - ent = create_proc_entry("net/ip6_flowlabel", 0, 0); - ent->read_proc = ip6_fl_read_proc; + create_proc_read_entry("net/ip6_flowlabel", 0, 0, ip6_fl_read_proc, NULL); #endif } diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 324c37e9d..1abc90346 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c @@ -707,9 +707,6 @@ done: int __init igmp6_init(struct net_proto_family *ops) { -#ifdef CONFIG_PROC_FS - struct proc_dir_entry *ent; -#endif struct sock *sk; int err; @@ -738,8 +735,7 @@ int __init igmp6_init(struct net_proto_family *ops) sk->net_pinfo.af_inet6.hop_limit = 1; #ifdef CONFIG_PROC_FS - ent = create_proc_entry("net/igmp6", 0, 0); - ent->read_proc = igmp6_read_proc; + create_proc_read_entry("net/igmp6", 0, 0, igmp6_read_proc, NULL); #endif return 0; diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 47b6c2c2c..dab819da8 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c @@ -1179,18 +1179,10 @@ done: return len; } -struct proc_dir_entry ndisc_proc_entry = -{ - PROC_NET_NDISC, 5, "ndisc", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, NULL, - &ndisc_get_info -}; #endif #endif /* CONFIG_PROC_FS */ - int __init ndisc_init(struct net_proto_family *ops) { struct sock *sk; @@ -1230,7 +1222,7 @@ int __init ndisc_init(struct net_proto_family *ops) #ifdef CONFIG_PROC_FS #ifndef CONFIG_RTNETLINK - proc_net_register(&ndisc_proc_entry); + proc_net_create("ndisc", 0, ndisc_get_info); #endif #endif #ifdef CONFIG_SYSCTL @@ -1244,7 +1236,7 @@ void ndisc_cleanup(void) { #ifdef CONFIG_PROC_FS #ifndef CONFIG_RTNETLINK - proc_net_unregister(ndisc_proc_entry.low_ino); + proc_net_remove("ndisc"); #endif #endif neigh_table_clear(&nd_tbl); diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 8a187184b..431ef0c85 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -1861,19 +1861,6 @@ static int rt6_proc_stats(char *buffer, char **start, off_t offset, int length, return len; } - -static struct proc_dir_entry proc_rt6_info = { - PROC_NET_RT6, 10, "ipv6_route", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - rt6_proc_info -}; -static struct proc_dir_entry proc_rt6_stats = { - PROC_NET_RT6_STATS, 9, "rt6_stats", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - rt6_proc_stats -}; #endif /* CONFIG_PROC_FS */ #ifdef CONFIG_SYSCTL @@ -1936,8 +1923,8 @@ void __init ip6_route_init(void) NULL, NULL); fib6_init(); #ifdef CONFIG_PROC_FS - proc_net_register(&proc_rt6_info); - proc_net_register(&proc_rt6_stats); + proc_net_create("ipv6_route", 0, rt6_proc_info); + proc_net_create("rt6_stats", 0, rt6_proc_stats); #endif } @@ -1945,8 +1932,8 @@ void __init ip6_route_init(void) void ip6_route_cleanup(void) { #ifdef CONFIG_PROC_FS - proc_net_unregister(PROC_NET_RT6); - proc_net_unregister(PROC_NET_RT6_STATS); + proc_net_remove("ipv6_route"); + proc_net_remove("rt6_stats"); #endif rt6_ifdown(NULL); diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index ab24b855f..d94e52a69 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c @@ -2388,23 +2388,6 @@ extern struct datalink_proto *make_8023_client(void); extern void destroy_EII_client(struct datalink_proto *); extern void destroy_8023_client(struct datalink_proto *); -#ifdef CONFIG_PROC_FS -struct proc_dir_entry ipx_procinfo = { - PROC_NET_IPX, 3, "ipx", S_IFREG | S_IRUGO, - 1, 0, 0, 0, &proc_net_inode_operations, ipx_get_info -}; - -struct proc_dir_entry ipx_if_procinfo = { - PROC_NET_IPX_INTERFACE, 13, "ipx_interface", S_IFREG | S_IRUGO, - 1, 0, 0, 0, &proc_net_inode_operations, ipx_interface_get_info -}; - -struct proc_dir_entry ipx_rt_procinfo = { - PROC_NET_IPX_ROUTE, 9, "ipx_route", S_IFREG | S_IRUGO, - 1, 0, 0, 0, &proc_net_inode_operations, ipx_rt_get_info -}; -#endif - static unsigned char ipx_8022_type = 0xE0; static unsigned char ipx_snap_id[5] = { 0x0, 0x0, 0x0, 0x81, 0x37 }; @@ -2429,9 +2412,9 @@ void ipx_proto_init(struct net_proto *pro) register_netdevice_notifier(&ipx_dev_notifier); #ifdef CONFIG_PROC_FS - proc_net_register(&ipx_procinfo); - proc_net_register(&ipx_if_procinfo); - proc_net_register(&ipx_rt_procinfo); + proc_net_create("ipx", 0, ipx_get_info); + proc_net_create("ipx_interface", 0, ipx_interface_get_info); + proc_net_create("ipx_route", 0, ipx_rt_get_info); #endif printk(KERN_INFO "NET4: Linux IPX 0.38 for NET4.0\n"); @@ -2482,9 +2465,9 @@ static void ipx_proto_finito(void) } #ifdef CONFIG_PROC_FS - proc_net_unregister(PROC_NET_IPX_ROUTE); - proc_net_unregister(PROC_NET_IPX_INTERFACE); - proc_net_unregister(PROC_NET_IPX); + proc_net_remove("ipx_route"); + proc_net_remove("ipx_interface"); + proc_net_remove("ipx"); #endif unregister_netdevice_notifier(&ipx_dev_notifier); diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index 7a01c28ea..ed9aa5f52 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Sun May 31 10:12:43 1998 - * Modified at: Fri Oct 1 19:11:04 1999 + * Modified at: Sun Oct 31 19:32:37 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * Sources: af_netroom.c, af_ax25.c, af_rose.c, af_x25.c etc. * @@ -278,8 +278,14 @@ static void irda_get_value_confirm(int result, __u16 obj_id, ASSERT(priv != NULL, return;); self = (struct irda_sock *) priv; - if (!self) + if (!self) { + WARNING(__FUNCTION__ "(), lost myself!\n"); return; + } + + /* We probably don't need to make any more queries */ + iriap_close(self->iriap); + self->iriap = NULL; /* Check if request succeeded */ if (result != IAS_SUCCESS) { @@ -366,14 +372,21 @@ static int irda_open_tsap(struct irda_sock *self, __u8 tsap_sel, char *name) */ static int irda_find_lsap_sel(struct irda_sock *self, char *name) { - IRDA_DEBUG(1, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); ASSERT(self != NULL, return -1;); + if (self->iriap) { + WARNING(__FUNCTION__ "(), busy with a previous query\n"); + return -EBUSY; + } + + self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self, + irda_get_value_confirm); + /* Query remote LM-IAS */ - iriap_getvaluebyclass_request(name, "IrDA:TinyTP:LsapSel", - self->saddr, self->daddr, - irda_get_value_confirm, self); + iriap_getvaluebyclass_request(self->iriap, self->saddr, self->daddr, + name, "IrDA:TinyTP:LsapSel"); /* Wait for answer */ interruptible_sleep_on(&self->ias_wait); @@ -742,6 +755,9 @@ void irda_destroy_socket(struct irda_sock *self) if (self->ias_obj) irias_delete_object(self->ias_obj); + if (self->iriap) + iriap_close(self->iriap); + if (self->tsap) { irttp_disconnect_request(self->tsap, NULL, P_NORMAL); irttp_close_tsap(self->tsap); diff --git a/net/irda/ircomm/ircomm_core.c b/net/irda/ircomm/ircomm_core.c index e7c1f5064..379e342ad 100644 --- a/net/irda/ircomm/ircomm_core.c +++ b/net/irda/ircomm/ircomm_core.c @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Sun Jun 6 20:37:34 1999 - * Modified at: Tue Oct 5 11:37:11 1999 + * Modified at: Sat Oct 30 12:48:14 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. @@ -80,7 +80,7 @@ int __init ircomm_init(void) #ifdef MODULE void ircomm_cleanup(void) { - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); hashbin_delete(ircomm, (FREE_FUNC) __ircomm_close); @@ -101,8 +101,8 @@ struct ircomm_cb *ircomm_open(notify_t *notify, __u8 service_type, int line) struct ircomm_cb *self = NULL; int ret; - DEBUG(2, __FUNCTION__ "(), service_type=0x%02x\n", - service_type); + IRDA_DEBUG(2, __FUNCTION__ "(), service_type=0x%02x\n", + service_type); ASSERT(ircomm != NULL, return NULL;); @@ -143,7 +143,7 @@ struct ircomm_cb *ircomm_open(notify_t *notify, __u8 service_type, int line) */ static int __ircomm_close(struct ircomm_cb *self) { - DEBUG(2, __FUNCTION__"()\n"); + IRDA_DEBUG(2, __FUNCTION__"()\n"); ASSERT(self != NULL, return -EIO;); ASSERT(self->magic == IRCOMM_MAGIC, return -EIO;); @@ -199,7 +199,7 @@ int ircomm_connect_request(struct ircomm_cb *self, __u8 dlsap_sel, struct ircomm_info info; int ret; - DEBUG(2 , __FUNCTION__"()\n"); + IRDA_DEBUG(2 , __FUNCTION__"()\n"); ASSERT(self != NULL, return -1;); ASSERT(self->magic == IRCOMM_MAGIC, return -1;); @@ -226,7 +226,7 @@ void ircomm_connect_indication(struct ircomm_cb *self, struct sk_buff *skb, { int clen = 0; - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); /* Check if the packet contains data on the control channel */ if (skb->len > 0) @@ -260,7 +260,7 @@ int ircomm_connect_response(struct ircomm_cb *self, struct sk_buff *userdata) ASSERT(self != NULL, return -1;); ASSERT(self->magic == IRCOMM_MAGIC, return -1;); - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); ret = ircomm_do_event(self, IRCOMM_CONNECT_RESPONSE, userdata, NULL); @@ -276,7 +276,7 @@ int ircomm_connect_response(struct ircomm_cb *self, struct sk_buff *userdata) void ircomm_connect_confirm(struct ircomm_cb *self, struct sk_buff *skb, struct ircomm_info *info) { - DEBUG(4, __FUNCTION__"()\n"); + IRDA_DEBUG(4, __FUNCTION__"()\n"); if (self->notify.connect_confirm ) self->notify.connect_confirm(self->notify.instance, @@ -295,7 +295,7 @@ int ircomm_data_request(struct ircomm_cb *self, struct sk_buff *skb) { int ret; - DEBUG(4, __FUNCTION__"()\n"); + IRDA_DEBUG(4, __FUNCTION__"()\n"); ASSERT(self != NULL, return -EFAULT;); ASSERT(self->magic == IRCOMM_MAGIC, return -EFAULT;); @@ -314,7 +314,7 @@ int ircomm_data_request(struct ircomm_cb *self, struct sk_buff *skb) */ void ircomm_data_indication(struct ircomm_cb *self, struct sk_buff *skb) { - DEBUG(4, __FUNCTION__"()\n"); + IRDA_DEBUG(4, __FUNCTION__"()\n"); ASSERT(skb->len > 0, return;); @@ -350,7 +350,7 @@ void ircomm_process_data(struct ircomm_cb *self, struct sk_buff *skb) if (skb->len) ircomm_data_indication(self, skb); else { - DEBUG(4, __FUNCTION__ "(), data was control info only!\n"); + IRDA_DEBUG(4, __FUNCTION__ "(), data was control info only!\n"); dev_kfree_skb(skb); } } @@ -365,7 +365,7 @@ int ircomm_control_request(struct ircomm_cb *self, struct sk_buff *skb) { int ret; - DEBUG(2, __FUNCTION__"()\n"); + IRDA_DEBUG(2, __FUNCTION__"()\n"); ASSERT(self != NULL, return -EFAULT;); ASSERT(self->magic == IRCOMM_MAGIC, return -EFAULT;); @@ -387,7 +387,7 @@ static void ircomm_control_indication(struct ircomm_cb *self, { struct sk_buff *ctrl_skb; - DEBUG(2, __FUNCTION__"()\n"); + IRDA_DEBUG(2, __FUNCTION__"()\n"); ctrl_skb = skb_clone(skb, GFP_ATOMIC); if (!ctrl_skb) @@ -413,7 +413,7 @@ int ircomm_disconnect_request(struct ircomm_cb *self, struct sk_buff *userdata) struct ircomm_info info; int ret; - DEBUG(2, __FUNCTION__"()\n"); + IRDA_DEBUG(2, __FUNCTION__"()\n"); ASSERT(self != NULL, return -1;); ASSERT(self->magic == IRCOMM_MAGIC, return -1;); @@ -432,7 +432,7 @@ int ircomm_disconnect_request(struct ircomm_cb *self, struct sk_buff *userdata) void ircomm_disconnect_indication(struct ircomm_cb *self, struct sk_buff *skb, struct ircomm_info *info) { - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); ASSERT(info != NULL, return;); @@ -450,7 +450,7 @@ void ircomm_disconnect_indication(struct ircomm_cb *self, struct sk_buff *skb, */ void ircomm_flow_request(struct ircomm_cb *self, LOCAL_FLOW flow) { - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRCOMM_MAGIC, return;); diff --git a/net/irda/ircomm/ircomm_event.c b/net/irda/ircomm/ircomm_event.c index 18f0b24db..7e2bdd50a 100644 --- a/net/irda/ircomm/ircomm_event.c +++ b/net/irda/ircomm/ircomm_event.c @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Sun Jun 6 20:33:11 1999 - * Modified at: Thu Sep 2 10:09:25 1999 + * Modified at: Sat Oct 30 13:05:23 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. @@ -50,7 +50,6 @@ static int ircomm_state_waitr(struct ircomm_cb *self, IRCOMM_EVENT event, static int ircomm_state_conn(struct ircomm_cb *self, IRCOMM_EVENT event, struct sk_buff *skb, struct ircomm_info *info); - char *ircomm_state[] = { "IRCOMM_IDLE", "IRCOMM_WAITI", @@ -108,8 +107,8 @@ static int ircomm_state_idle(struct ircomm_cb *self, IRCOMM_EVENT event, ircomm_connect_indication(self, skb, info); break; default: - DEBUG(4, __FUNCTION__"(), unknown event: %s\n", - ircomm_event[event]); + IRDA_DEBUG(4, __FUNCTION__"(), unknown event: %s\n", + ircomm_event[event]); return -EINVAL; } return ret; @@ -138,8 +137,8 @@ static int ircomm_state_waiti(struct ircomm_cb *self, IRCOMM_EVENT event, ircomm_disconnect_indication(self, skb, info); break; default: - DEBUG(0, __FUNCTION__"(), unknown event: %s\n", - ircomm_event[event]); + IRDA_DEBUG(0, __FUNCTION__"(), unknown event: %s\n", + ircomm_event[event]); ret = -EINVAL; } return ret; @@ -171,8 +170,8 @@ static int ircomm_state_waitr(struct ircomm_cb *self, IRCOMM_EVENT event, ircomm_disconnect_indication(self, skb, info); break; default: - DEBUG(0, __FUNCTION__ "(), unknown event = %s\n", - ircomm_event[event]); + IRDA_DEBUG(0, __FUNCTION__ "(), unknown event = %s\n", + ircomm_event[event]); ret = -EINVAL; } return ret; @@ -213,14 +212,13 @@ static int ircomm_state_conn(struct ircomm_cb *self, IRCOMM_EVENT event, ret = self->issue.disconnect_request(self, skb, info); break; default: - DEBUG(0, __FUNCTION__ "(), unknown event = %s\n", - ircomm_event[event]); + IRDA_DEBUG(0, __FUNCTION__ "(), unknown event = %s\n", + ircomm_event[event]); ret = -EINVAL; } return ret; } - /* * Function ircomm_do_event (self, event, skb) * @@ -230,8 +228,8 @@ static int ircomm_state_conn(struct ircomm_cb *self, IRCOMM_EVENT event, int ircomm_do_event(struct ircomm_cb *self, IRCOMM_EVENT event, struct sk_buff *skb, struct ircomm_info *info) { - DEBUG(4, __FUNCTION__": state=%s, event=%s\n", - ircomm_state[self->state], ircomm_event[event]); + IRDA_DEBUG(4, __FUNCTION__": state=%s, event=%s\n", + ircomm_state[self->state], ircomm_event[event]); return (*state[self->state])(self, event, skb, info); } @@ -246,6 +244,6 @@ void ircomm_next_state(struct ircomm_cb *self, IRCOMM_STATE state) { self->state = state; - DEBUG(4, __FUNCTION__": next state=%s, service type=%d\n", - ircomm_state[self->state], self->service_type); + IRDA_DEBUG(4, __FUNCTION__": next state=%s, service type=%d\n", + ircomm_state[self->state], self->service_type); } diff --git a/net/irda/ircomm/ircomm_lmp.c b/net/irda/ircomm/ircomm_lmp.c index 64f3a449c..bf35c75e0 100644 --- a/net/irda/ircomm/ircomm_lmp.c +++ b/net/irda/ircomm/ircomm_lmp.c @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Sun Jun 6 20:48:27 1999 - * Modified at: Fri Aug 13 07:21:29 1999 + * Modified at: Sat Oct 30 12:55:24 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * Sources: Previous IrLPT work by Thomas Davis * @@ -49,7 +49,7 @@ int ircomm_open_lsap(struct ircomm_cb *self) { notify_t notify; - DEBUG(0, __FUNCTION__ "()\n"); + IRDA_DEBUG(0, __FUNCTION__ "()\n"); /* Register callbacks */ irda_notify_init(¬ify); @@ -62,7 +62,7 @@ int ircomm_open_lsap(struct ircomm_cb *self) self->lsap = irlmp_open_lsap(LSAP_ANY, ¬ify); if (!self->lsap) { - DEBUG(0,__FUNCTION__"failed to allocate tsap\n"); + IRDA_DEBUG(0,__FUNCTION__"failed to allocate tsap\n"); return -1; } self->slsap_sel = self->lsap->slsap_sel; @@ -90,7 +90,7 @@ int ircomm_lmp_connect_request(struct ircomm_cb *self, { int ret = 0; - DEBUG(0, __FUNCTION__ "()\n"); + IRDA_DEBUG(0, __FUNCTION__ "()\n"); ret = irlmp_connect_request(self->lsap, info->dlsap_sel, info->saddr, info->daddr, NULL, userdata); @@ -107,7 +107,7 @@ int ircomm_lmp_connect_response(struct ircomm_cb *self, struct sk_buff *skb) { int ret; - DEBUG(0, __FUNCTION__"()\n"); + IRDA_DEBUG(0, __FUNCTION__"()\n"); ret = irlmp_connect_response(self->lsap, skb); @@ -121,7 +121,7 @@ int ircomm_lmp_disconnect_request(struct ircomm_cb *self, struct sk_buff *skb; int ret; - DEBUG(0, __FUNCTION__ "()\n"); + IRDA_DEBUG(0, __FUNCTION__ "()\n"); if (!userdata) { skb = dev_alloc_skb(64); @@ -157,13 +157,13 @@ void ircomm_lmp_flow_control(struct sk_buff *skb) cb = (struct irda_skb_cb *) skb->cb; - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); line = cb->line; self = (struct ircomm_cb *) hashbin_find(ircomm, line, NULL); if (!self) { - DEBUG(2, __FUNCTION__ "(), didn't find myself\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), didn't find myself\n"); return; } @@ -173,7 +173,7 @@ void ircomm_lmp_flow_control(struct sk_buff *skb) self->pkt_count--; if ((self->pkt_count < 2) && (self->flow_status == FLOW_STOP)) { - DEBUG(2, __FUNCTION__ "(), asking TTY to start again!\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), asking TTY to start again!\n"); self->flow_status = FLOW_START; if (self->notify.flow_indication) self->notify.flow_indication(self->notify.instance, @@ -199,12 +199,12 @@ int ircomm_lmp_data_request(struct ircomm_cb *self, struct sk_buff *skb, cb->line = self->line; - DEBUG(4, __FUNCTION__"(), sending frame\n"); + IRDA_DEBUG(4, __FUNCTION__"(), sending frame\n"); skb->destructor = ircomm_lmp_flow_control; if ((self->pkt_count++ > 7) && (self->flow_status == FLOW_START)) { - DEBUG(2, __FUNCTION__ "(), asking TTY to slow down!\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), asking TTY to slow down!\n"); self->flow_status = FLOW_STOP; if (self->notify.flow_indication) self->notify.flow_indication(self->notify.instance, @@ -230,7 +230,7 @@ int ircomm_lmp_data_indication(void *instance, void *sap, { struct ircomm_cb *self = (struct ircomm_cb *) instance; - DEBUG(4, __FUNCTION__"()\n"); + IRDA_DEBUG(4, __FUNCTION__"()\n"); ASSERT(self != NULL, return -1;); ASSERT(self->magic == IRCOMM_MAGIC, return -1;); @@ -257,7 +257,7 @@ void ircomm_lmp_connect_confirm(void *instance, void *sap, struct ircomm_cb *self = (struct ircomm_cb *) instance; struct ircomm_info info; - DEBUG(0, __FUNCTION__"()\n"); + IRDA_DEBUG(0, __FUNCTION__"()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRCOMM_MAGIC, return;); @@ -287,7 +287,7 @@ void ircomm_lmp_connect_indication(void *instance, void *sap, struct ircomm_cb *self = (struct ircomm_cb *)instance; struct ircomm_info info; - DEBUG(0, __FUNCTION__"()\n"); + IRDA_DEBUG(0, __FUNCTION__"()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRCOMM_MAGIC, return;); @@ -314,7 +314,7 @@ void ircomm_lmp_disconnect_indication(void *instance, void *sap, struct ircomm_cb *self = (struct ircomm_cb *) instance; struct ircomm_info info; - DEBUG(0, __FUNCTION__"()\n"); + IRDA_DEBUG(0, __FUNCTION__"()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRCOMM_MAGIC, return;); diff --git a/net/irda/ircomm/ircomm_param.c b/net/irda/ircomm/ircomm_param.c index b6012d511..382027892 100644 --- a/net/irda/ircomm/ircomm_param.c +++ b/net/irda/ircomm/ircomm_param.c @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Mon Jun 7 10:25:11 1999 - * Modified at: Mon Oct 4 09:36:53 1999 + * Modified at: Sat Oct 30 13:05:42 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. @@ -106,13 +106,13 @@ int ircomm_param_request(struct ircomm_tty_cb *self, __u8 pi, int flush) struct sk_buff *skb; int count; - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); ASSERT(self != NULL, return -1;); ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); if (self->state != IRCOMM_TTY_READY) { - DEBUG(2, __FUNCTION__ "(), not ready yet!\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), not ready yet!\n"); return 0; } @@ -142,7 +142,7 @@ int ircomm_param_request(struct ircomm_tty_cb *self, __u8 pi, int flush) count = irda_param_insert(self, pi, skb->tail, skb_tailroom(skb), &ircomm_param_info); if (count < 0) { - DEBUG(0, __FUNCTION__ "(), no room for parameter!\n"); + IRDA_DEBUG(0, __FUNCTION__ "(), no room for parameter!\n"); restore_flags(flags); return -1; } @@ -180,30 +180,30 @@ static int ircomm_param_service_type(void *instance, param_t *param, int get) * Now choose a preferred service type of those available */ if (service_type & IRCOMM_3_WIRE_RAW) { - DEBUG(2, __FUNCTION__ "(), peer supports 3 wire raw\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), peer supports 3 wire raw\n"); self->session.service_type |= IRCOMM_3_WIRE_RAW; } if (service_type & IRCOMM_3_WIRE) { - DEBUG(2, __FUNCTION__ "(), peer supports 3 wire\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), peer supports 3 wire\n"); self->session.service_type |= IRCOMM_3_WIRE; } if (service_type & IRCOMM_9_WIRE) { - DEBUG(2, __FUNCTION__ "(), peer supports 9 wire\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), peer supports 9 wire\n"); self->session.service_type |= IRCOMM_9_WIRE; } if (service_type & IRCOMM_CENTRONICS) { - DEBUG(2, __FUNCTION__ "(), peer supports Centronics\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), peer supports Centronics\n"); self->session.service_type |= IRCOMM_CENTRONICS; } self->session.service_type &= self->service_type; if (!self->session.service_type) { - DEBUG(2, __FUNCTION__"(), No common service type to use!\n"); + IRDA_DEBUG(2, __FUNCTION__"(), No common service type to use!\n"); return -1; } - DEBUG(2, __FUNCTION__ "(), resulting service type=0x%02x\n", - self->session.service_type); + IRDA_DEBUG(2, __FUNCTION__ "(), resulting service type=0x%02x\n", + self->session.service_type); return 0; } @@ -227,8 +227,8 @@ static int ircomm_param_port_type(void *instance, param_t *param, int get) else { self->session.port_type = param->pv.b; - DEBUG(0, __FUNCTION__ "(), port type=%d\n", - self->session.port_type); + IRDA_DEBUG(0, __FUNCTION__ "(), port type=%d\n", + self->session.port_type); } return 0; } @@ -247,9 +247,9 @@ static int ircomm_param_port_name(void *instance, param_t *param, int get) ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); if (get) { - DEBUG(0, __FUNCTION__ "(), not imp!\n"); + IRDA_DEBUG(0, __FUNCTION__ "(), not imp!\n"); } else { - DEBUG(0, __FUNCTION__ "(), port-name=%s\n", param->pv.c); + IRDA_DEBUG(0, __FUNCTION__ "(), port-name=%s\n", param->pv.c); strncpy(self->session.port_name, param->pv.c, 32); } @@ -274,7 +274,7 @@ static int ircomm_param_data_rate(void *instance, param_t *param, int get) else self->session.data_rate = param->pv.i; - DEBUG(2, __FUNCTION__ "(), data rate = %d\n", param->pv.i); + IRDA_DEBUG(2, __FUNCTION__ "(), data rate = %d\n", param->pv.i); return 0; } @@ -318,7 +318,7 @@ static int ircomm_param_flow_control(void *instance, param_t *param, int get) else self->session.flow_control = param->pv.b; - DEBUG(1, __FUNCTION__ "(), flow control = 0x%02x\n", param->pv.b); + IRDA_DEBUG(1, __FUNCTION__ "(), flow control = 0x%02x\n", param->pv.b); return 0; } @@ -344,8 +344,8 @@ static int ircomm_param_xon_xoff(void *instance, param_t *param, int get) self->session.xonxoff[1] = param->pv.s >> 8; } - DEBUG(0, __FUNCTION__ "(), XON/XOFF = 0x%02x\n,0x%02x", - param->pv.s & 0xff, param->pv.s >> 8); + IRDA_DEBUG(0, __FUNCTION__ "(), XON/XOFF = 0x%02x\n,0x%02x", + param->pv.s & 0xff, param->pv.s >> 8); return 0; } @@ -371,8 +371,8 @@ static int ircomm_param_enq_ack(void *instance, param_t *param, int get) self->session.enqack[1] = param->pv.s >> 8; } - DEBUG(0, __FUNCTION__ "(), ENQ/ACK = 0x%02x,0x%02x\n", - param->pv.s & 0xff, param->pv.s >> 8); + IRDA_DEBUG(0, __FUNCTION__ "(), ENQ/ACK = 0x%02x,0x%02x\n", + param->pv.s & 0xff, param->pv.s >> 8); return 0; } @@ -385,7 +385,7 @@ static int ircomm_param_enq_ack(void *instance, param_t *param, int get) */ static int ircomm_param_line_status(void *instance, param_t *param, int get) { - DEBUG(2, __FUNCTION__ "(), not impl.\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), not impl.\n"); return 0; } @@ -444,7 +444,7 @@ static int ircomm_param_dce(void *instance, param_t *param, int get) struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; __u8 dce; - DEBUG(1, __FUNCTION__ "(), dce = 0x%02x\n", param->pv.b); + IRDA_DEBUG(1, __FUNCTION__ "(), dce = 0x%02x\n", param->pv.b); dce = param->pv.b; @@ -456,7 +456,7 @@ static int ircomm_param_dce(void *instance, param_t *param, int get) /* Check if any of the settings have changed */ if (dce & 0x0f) { if (dce & IRCOMM_DELTA_CTS) { - DEBUG(2, __FUNCTION__ "(), CTS \n"); + IRDA_DEBUG(2, __FUNCTION__ "(), CTS \n"); } } diff --git a/net/irda/ircomm/ircomm_ttp.c b/net/irda/ircomm/ircomm_ttp.c index 9c188aa49..211bc14a8 100644 --- a/net/irda/ircomm/ircomm_ttp.c +++ b/net/irda/ircomm/ircomm_ttp.c @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Sun Jun 6 20:48:27 1999 - * Modified at: Mon Sep 27 11:17:23 1999 + * Modified at: Sat Oct 30 12:55:36 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. @@ -49,7 +49,7 @@ int ircomm_open_tsap(struct ircomm_cb *self) { notify_t notify; - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); /* Register callbacks */ irda_notify_init(¬ify); @@ -64,7 +64,7 @@ int ircomm_open_tsap(struct ircomm_cb *self) self->tsap = irttp_open_tsap(LSAP_ANY, DEFAULT_INITIAL_CREDIT, ¬ify); if (!self->tsap) { - DEBUG(0,__FUNCTION__"failed to allocate tsap\n"); + IRDA_DEBUG(0,__FUNCTION__"failed to allocate tsap\n"); return -1; } self->slsap_sel = self->tsap->stsap_sel; @@ -92,7 +92,7 @@ int ircomm_ttp_connect_request(struct ircomm_cb *self, { int ret = 0; - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); ret = irttp_connect_request(self->tsap, info->dlsap_sel, info->saddr, info->daddr, @@ -110,7 +110,7 @@ int ircomm_ttp_connect_response(struct ircomm_cb *self, struct sk_buff *skb) { int ret; - DEBUG(4, __FUNCTION__"()\n"); + IRDA_DEBUG(4, __FUNCTION__"()\n"); ret = irttp_connect_response(self->tsap, SAR_DISABLE, skb); @@ -133,7 +133,7 @@ int ircomm_ttp_data_request(struct ircomm_cb *self, struct sk_buff *skb, ASSERT(skb != NULL, return -1;); - DEBUG(2, __FUNCTION__"(), clen=%d\n", clen); + IRDA_DEBUG(2, __FUNCTION__"(), clen=%d\n", clen); /* * Insert clen field, currently we either send data only, or control @@ -164,7 +164,7 @@ int ircomm_ttp_data_indication(void *instance, void *sap, { struct ircomm_cb *self = (struct ircomm_cb *) instance; - DEBUG(4, __FUNCTION__"()\n"); + IRDA_DEBUG(4, __FUNCTION__"()\n"); ASSERT(self != NULL, return -1;); ASSERT(self->magic == IRCOMM_MAGIC, return -1;); @@ -184,7 +184,7 @@ void ircomm_ttp_connect_confirm(void *instance, void *sap, struct ircomm_cb *self = (struct ircomm_cb *) instance; struct ircomm_info info; - DEBUG(4, __FUNCTION__"()\n"); + IRDA_DEBUG(4, __FUNCTION__"()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRCOMM_MAGIC, return;); @@ -220,7 +220,7 @@ void ircomm_ttp_connect_indication(void *instance, void *sap, struct ircomm_cb *self = (struct ircomm_cb *)instance; struct ircomm_info info; - DEBUG(4, __FUNCTION__"()\n"); + IRDA_DEBUG(4, __FUNCTION__"()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRCOMM_MAGIC, return;); @@ -270,7 +270,7 @@ void ircomm_ttp_disconnect_indication(void *instance, void *sap, struct ircomm_cb *self = (struct ircomm_cb *) instance; struct ircomm_info info; - DEBUG(4, __FUNCTION__"()\n"); + IRDA_DEBUG(4, __FUNCTION__"()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRCOMM_MAGIC, return;); @@ -290,7 +290,7 @@ void ircomm_ttp_flow_indication(void *instance, void *sap, LOCAL_FLOW cmd) { struct ircomm_cb *self = (struct ircomm_cb *) instance; - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRCOMM_MAGIC, return;); diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c index 14da65d89..e79b10bcd 100644 --- a/net/irda/ircomm/ircomm_tty.c +++ b/net/irda/ircomm/ircomm_tty.c @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Sun Jun 6 21:00:56 1999 - * Modified at: Tue Oct 19 21:32:04 1999 + * Modified at: Sat Oct 30 12:49:26 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * Sources: serial.c and previous IrCOMM work by Takahide Higuchi * @@ -144,7 +144,7 @@ void ircomm_tty_cleanup(void) { int ret; - DEBUG(4, __FUNCTION__"()\n"); + IRDA_DEBUG(4, __FUNCTION__"()\n"); ret = tty_unregister_driver(&driver); if (ret) { @@ -171,7 +171,7 @@ static int ircomm_tty_startup(struct ircomm_tty_cb *self) /* Already open */ if (self->flags & ASYNC_INITIALIZED) { - DEBUG(2, __FUNCTION__ "(), already open so break out!\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), already open so break out!\n"); return 0; } @@ -226,7 +226,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, tty = self->tty; - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); if (tty->driver.subtype == SERIAL_TYPE_CALLOUT) { /* this is a callout device */ @@ -258,17 +258,17 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, return -EBUSY; self->flags |= ASYNC_NORMAL_ACTIVE; - DEBUG(1, __FUNCTION__ "(), O_NONBLOCK requested!\n"); + IRDA_DEBUG(1, __FUNCTION__ "(), O_NONBLOCK requested!\n"); return 0; } if (self->flags & ASYNC_CALLOUT_ACTIVE) { if (self->normal_termios.c_cflag & CLOCAL) - DEBUG(1, __FUNCTION__ "(), doing CLOCAL!\n"); + IRDA_DEBUG(1, __FUNCTION__ "(), doing CLOCAL!\n"); do_clocal = 1; } else { if (tty->termios->c_cflag & CLOCAL) - DEBUG(1, __FUNCTION__ "(), doing CLOCAL!\n"); + IRDA_DEBUG(1, __FUNCTION__ "(), doing CLOCAL!\n"); do_clocal = 1; } @@ -282,7 +282,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, retval = 0; add_wait_queue(&self->open_wait, &wait); - DEBUG(2, "%s(%d):block_til_ready before block on %s open_count=%d\n", + IRDA_DEBUG(2, "%s(%d):block_til_ready before block on %s open_count=%d\n", __FILE__,__LINE__, tty->driver.name, self->open_count ); save_flags(flags); cli(); @@ -329,7 +329,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, break; } - DEBUG(1, "%s(%d):block_til_ready blocking on %s open_count=%d\n", + IRDA_DEBUG(1, "%s(%d):block_til_ready blocking on %s open_count=%d\n", __FILE__,__LINE__, tty->driver.name, self->open_count ); schedule(); @@ -342,7 +342,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, self->open_count++; self->blocked_open--; - DEBUG(1, "%s(%d):block_til_ready after blocking on %s open_count=%d\n", + IRDA_DEBUG(1, "%s(%d):block_til_ready after blocking on %s open_count=%d\n", __FILE__,__LINE__, tty->driver.name, self->open_count); if (!retval) @@ -364,7 +364,7 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) int line; int ret; - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); MOD_INC_USE_COUNT; line = MINOR(tty->device) - tty->driver.minor_start; @@ -415,8 +415,8 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) tty->driver_data = self; self->tty = tty; - DEBUG(1, __FUNCTION__"(), %s%d, count = %d\n", tty->driver.name, - self->line, self->open_count); + IRDA_DEBUG(1, __FUNCTION__"(), %s%d, count = %d\n", tty->driver.name, + self->line, self->open_count); /* Not really used by us, but lets do it anyway */ self->tty->low_latency = (self->flags & ASYNC_LOW_LATENCY) ? 1 : 0; @@ -440,9 +440,9 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) /* Check if this is a "normal" ircomm device, or an irlpt device */ if (line < 0x10) { self->service_type = IRCOMM_3_WIRE | IRCOMM_9_WIRE; - DEBUG(2, __FUNCTION__ "(), IrCOMM device\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), IrCOMM device\n"); } else { - DEBUG(2, __FUNCTION__ "(), IrLPT device\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), IrLPT device\n"); self->service_type = IRCOMM_3_WIRE_RAW; } @@ -453,7 +453,7 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) ret = ircomm_tty_block_til_ready(self, filp); if (ret) { /* MOD_DEC_USE_COUNT; "info->tty" will cause this? */ - DEBUG(0, __FUNCTION__ + IRDA_DEBUG(0, __FUNCTION__ "(), returning after block_til_ready with %d\n", ret); @@ -478,7 +478,7 @@ static void ircomm_tty_close(struct tty_struct *tty, struct file *filp) struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; unsigned long flags; - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); if (!tty) return; @@ -493,7 +493,7 @@ static void ircomm_tty_close(struct tty_struct *tty, struct file *filp) MOD_DEC_USE_COUNT; restore_flags(flags); - DEBUG(2, __FUNCTION__ "(), returning 1\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), returning 1\n"); return; } @@ -507,7 +507,7 @@ static void ircomm_tty_close(struct tty_struct *tty, struct file *filp) MOD_DEC_USE_COUNT; restore_flags(flags); - DEBUG(2, __FUNCTION__ "(), open count > 0\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), open count > 0\n"); return; } self->flags |= ASYNC_CLOSING; @@ -658,8 +658,8 @@ static int ircomm_tty_write(struct tty_struct *tty, int from_user, int len = 0; int size; - DEBUG(3, __FUNCTION__ "(), count=%d, hw_stopped=%d\n", count, - tty->hw_stopped); + IRDA_DEBUG(3, __FUNCTION__ "(), count=%d, hw_stopped=%d\n", count, + tty->hw_stopped); ASSERT(self != NULL, return -1;); ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); @@ -772,7 +772,7 @@ static int ircomm_tty_write_room(struct tty_struct *tty) ret = self->max_data_size; restore_flags(flags); } - DEBUG(2, __FUNCTION__ "(), ret=%d\n", ret); + IRDA_DEBUG(2, __FUNCTION__ "(), ret=%d\n", ret); return ret; } @@ -788,7 +788,7 @@ static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout) struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; unsigned long orig_jiffies, poll_time; - DEBUG(0, __FUNCTION__ "()\n"); + IRDA_DEBUG(0, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); @@ -820,7 +820,7 @@ static void ircomm_tty_throttle(struct tty_struct *tty) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); @@ -851,7 +851,7 @@ static void ircomm_tty_unthrottle(struct tty_struct *tty) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); @@ -866,7 +866,7 @@ static void ircomm_tty_unthrottle(struct tty_struct *tty) self->session.dte |= (IRCOMM_RTS|IRCOMM_DELTA_RTS); ircomm_param_request(self, IRCOMM_DTE, TRUE); - DEBUG(1, __FUNCTION__"(), FLOW_START\n"); + IRDA_DEBUG(1, __FUNCTION__"(), FLOW_START\n"); } ircomm_flow_request(self->ircomm, FLOW_START); } @@ -908,7 +908,7 @@ static void ircomm_tty_hangup(struct tty_struct *tty) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; - DEBUG(2, __FUNCTION__"()\n"); + IRDA_DEBUG(2, __FUNCTION__"()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); @@ -939,7 +939,7 @@ static void ircomm_tty_hangup(struct tty_struct *tty) */ static void ircomm_tty_send_xchar(struct tty_struct *tty, char ch) { - DEBUG(0, __FUNCTION__"(), not impl\n"); + IRDA_DEBUG(0, __FUNCTION__"(), not impl\n"); } /* @@ -994,15 +994,16 @@ void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self) /*wake_up_interruptible(&self->delta_msr_wait);*/ } if ((self->flags & ASYNC_CHECK_CD) && (status & IRCOMM_DELTA_CD)) { - DEBUG(2, __FUNCTION__ "(), ttys%d CD now %s...\n", self->line, - (status & IRCOMM_CD) ? "on" : "off"); + IRDA_DEBUG(2, __FUNCTION__ + "(), ttys%d CD now %s...\n", self->line, + (status & IRCOMM_CD) ? "on" : "off"); if (status & IRCOMM_CD) { wake_up_interruptible(&self->open_wait); } else if (!((self->flags & ASYNC_CALLOUT_ACTIVE) && (self->flags & ASYNC_CALLOUT_NOHUP))) { - DEBUG(2, __FUNCTION__ "(), Doing serial hangup..\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), Doing serial hangup..\n"); if (tty) tty_hangup(tty); @@ -1011,7 +1012,7 @@ void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self) if (self->flags & ASYNC_CTS_FLOW) { if (tty->hw_stopped) { if (status & IRCOMM_CTS) { - DEBUG(2, __FUNCTION__ "(), CTS tx start...\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), CTS tx start...\n"); tty->hw_stopped = 0; @@ -1021,7 +1022,7 @@ void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self) } } else { if (!(status & IRCOMM_CTS)) { - DEBUG(2, __FUNCTION__ "(), CTS tx stop...\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), CTS tx stop...\n"); tty->hw_stopped = 1; } @@ -1040,7 +1041,7 @@ static int ircomm_tty_data_indication(void *instance, void *sap, { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; - DEBUG(2, __FUNCTION__"()\n"); + IRDA_DEBUG(2, __FUNCTION__"()\n"); ASSERT(self != NULL, return -1;); ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); @@ -1072,7 +1073,7 @@ static int ircomm_tty_control_indication(void *instance, void *sap, struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; int clen; - DEBUG(4, __FUNCTION__"()\n"); + IRDA_DEBUG(4, __FUNCTION__"()\n"); ASSERT(self != NULL, return -1;); ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); @@ -1107,7 +1108,7 @@ static void ircomm_tty_flow_indication(void *instance, void *sap, switch (cmd) { case FLOW_START: - DEBUG(2, __FUNCTION__ "(), hw start!\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), hw start!\n"); tty->hw_stopped = 0; /* ircomm_tty_do_softint will take care of the rest */ @@ -1117,7 +1118,7 @@ static void ircomm_tty_flow_indication(void *instance, void *sap, default: /* If we get here, something is very wrong, better stop */ case FLOW_STOP: - DEBUG(2, __FUNCTION__ "(), hw stopped!\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), hw stopped!\n"); tty->hw_stopped = 1; break; } diff --git a/net/irda/ircomm/ircomm_tty_attach.c b/net/irda/ircomm/ircomm_tty_attach.c index 52a6ec5e9..db8f382dc 100644 --- a/net/irda/ircomm/ircomm_tty_attach.c +++ b/net/irda/ircomm/ircomm_tty_attach.c @@ -2,11 +2,11 @@ * * Filename: ircomm_tty_attach.c * Version: - * Description: + * Description: Code for attaching the serial driver to IrCOMM * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Sat Jun 5 17:42:00 1999 - * Modified at: Tue Oct 19 21:32:17 1999 + * Modified at: Sun Oct 31 22:19:37 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. @@ -124,14 +124,14 @@ static int (*state[])(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event, */ int ircomm_tty_attach_cable(struct ircomm_tty_cb *self) { - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); ASSERT(self != NULL, return -1;); ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); /* Check if somebody has already connected to us */ if (ircomm_is_connected(self->ircomm)) { - DEBUG(0, __FUNCTION__ "(), already connected!\n"); + IRDA_DEBUG(0, __FUNCTION__ "(), already connected!\n"); return 0; } @@ -142,7 +142,7 @@ int ircomm_tty_attach_cable(struct ircomm_tty_cb *self) /* Check if somebody has already connected to us */ if (ircomm_is_connected(self->ircomm)) { - DEBUG(0, __FUNCTION__ "(), already connected!\n"); + IRDA_DEBUG(0, __FUNCTION__ "(), already connected!\n"); return 0; } @@ -159,7 +159,7 @@ int ircomm_tty_attach_cable(struct ircomm_tty_cb *self) */ void ircomm_tty_detach_cable(struct ircomm_tty_cb *self) { - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); @@ -168,6 +168,9 @@ void ircomm_tty_detach_cable(struct ircomm_tty_cb *self) irlmp_unregister_client(self->ckey); irlmp_unregister_service(self->skey); + if (self->iriap) + iriap_close(self->iriap); + /* Remove LM-IAS object */ if (self->obj) { irias_delete_object(self->obj); @@ -246,16 +249,17 @@ static int ircomm_tty_send_initial_parameters(struct ircomm_tty_cb *self) * Set default values, but only if the application for some reason * haven't set them already */ - DEBUG(2, __FUNCTION__ "(), data-rate = %d\n", self->session.data_rate); + IRDA_DEBUG(2, __FUNCTION__ "(), data-rate = %d\n", + self->session.data_rate); if (!self->session.data_rate) self->session.data_rate = 9600; - DEBUG(2, __FUNCTION__ "(), data-format = %d\n", - self->session.data_format); + IRDA_DEBUG(2, __FUNCTION__ "(), data-format = %d\n", + self->session.data_format); if (!self->session.data_format) self->session.data_format = IRCOMM_WSIZE_8; /* 8N1 */ - DEBUG(2, __FUNCTION__ "(), flow-control = %d\n", - self->session.flow_control); + IRDA_DEBUG(2, __FUNCTION__ "(), flow-control = %d\n", + self->session.flow_control); /*self->session.flow_control = IRCOMM_RTS_CTS_IN|IRCOMM_RTS_CTS_OUT;*/ /* Do not set delta values for the initial parameters */ @@ -295,7 +299,7 @@ static void ircomm_tty_discovery_indication(discovery_t *discovery) struct ircomm_tty_cb *self; struct ircomm_tty_info info; - DEBUG(2, __FUNCTION__"()\n"); + IRDA_DEBUG(2, __FUNCTION__"()\n"); info.daddr = discovery->daddr; info.saddr = discovery->saddr; @@ -323,7 +327,7 @@ void ircomm_tty_disconnect_indication(void *instance, void *sap, { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); @@ -347,20 +351,24 @@ static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id, { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) priv; - DEBUG(2, __FUNCTION__"()\n"); + IRDA_DEBUG(2, __FUNCTION__"()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); + /* We probably don't need to make any more queries */ + iriap_close(self->iriap); + self->iriap = NULL; + /* Check if request succeeded */ if (result != IAS_SUCCESS) { - DEBUG(4, __FUNCTION__ "(), got NULL value!\n"); + IRDA_DEBUG(4, __FUNCTION__ "(), got NULL value!\n"); return; } switch (value->type) { case IAS_OCT_SEQ: - DEBUG(2, __FUNCTION__"(), got octet sequence\n"); + IRDA_DEBUG(2, __FUNCTION__"(), got octet sequence\n"); irda_param_extract_all(self, value->t.oct_seq, value->len, &ircomm_param_info); @@ -370,21 +378,21 @@ static void ircomm_tty_getvalue_confirm(int result, __u16 obj_id, break; case IAS_INTEGER: /* Got LSAP selector */ - DEBUG(2, __FUNCTION__"(), got lsapsel = %d\n", - value->t.integer); + IRDA_DEBUG(2, __FUNCTION__"(), got lsapsel = %d\n", + value->t.integer); if (value->t.integer == -1) { - DEBUG(0, __FUNCTION__"(), invalid value!\n"); + IRDA_DEBUG(0, __FUNCTION__"(), invalid value!\n"); } else self->dlsap_sel = value->t.integer; ircomm_tty_do_event(self, IRCOMM_TTY_GOT_LSAPSEL, NULL, NULL); break; case IAS_MISSING: - DEBUG(0, __FUNCTION__"(), got IAS_MISSING\n"); + IRDA_DEBUG(0, __FUNCTION__"(), got IAS_MISSING\n"); break; default: - DEBUG(0, __FUNCTION__"(), got unknown type!\n"); + IRDA_DEBUG(0, __FUNCTION__"(), got unknown type!\n"); break; } } @@ -403,7 +411,7 @@ void ircomm_tty_connect_confirm(void *instance, void *sap, { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); @@ -430,7 +438,7 @@ void ircomm_tty_connect_indication(void *instance, void *sap, struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; int clen; - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); @@ -455,7 +463,7 @@ void ircomm_tty_connect_indication(void *instance, void *sap, */ void ircomm_tty_link_established(struct ircomm_tty_cb *self) { - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); del_timer(&self->watchdog_timer); @@ -465,7 +473,7 @@ void ircomm_tty_link_established(struct ircomm_tty_cb *self) * the client will have to wait for the CD to be set. */ if (!(self->flags & ASYNC_CTS_FLOW)) { - DEBUG(2, __FUNCTION__ "(), starting hardware!\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), starting hardware!\n"); if (!self->tty) return; self->tty->hw_stopped = 0; @@ -504,7 +512,7 @@ void ircomm_tty_watchdog_timer_expired(void *data) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) data; - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); @@ -525,8 +533,8 @@ static int ircomm_tty_state_idle(struct ircomm_tty_cb *self, { int ret = 0; - DEBUG(2, __FUNCTION__": state=%s, event=%s\n", - ircomm_tty_state[self->state], ircomm_tty_event[event]); + IRDA_DEBUG(2, __FUNCTION__": state=%s, event=%s\n", + ircomm_tty_state[self->state], ircomm_tty_event[event]); switch (event) { case IRCOMM_TTY_ATTACH_CABLE: @@ -540,11 +548,19 @@ static int ircomm_tty_state_idle(struct ircomm_tty_cb *self, self->daddr = info->daddr; self->saddr = info->saddr; - iriap_getvaluebyclass_request("IrDA:IrCOMM", "Parameters", - self->saddr, self->daddr, - ircomm_tty_getvalue_confirm, - self); + if (self->iriap) { + WARNING(__FUNCTION__ + "(), busy with a previous query\n"); + return -EBUSY; + } + self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self, + ircomm_tty_getvalue_confirm); + + iriap_getvaluebyclass_request(self->iriap, + self->saddr, self->daddr, + "IrDA:IrCOMM", "Parameters"); + ircomm_tty_start_watchdog_timer(self, 3*HZ); ircomm_tty_next_state(self, IRCOMM_TTY_QUERY_PARAMETERS); break; @@ -566,8 +582,8 @@ static int ircomm_tty_state_idle(struct ircomm_tty_cb *self, ircomm_tty_next_state(self, IRCOMM_TTY_IDLE); break; default: - DEBUG(2, __FUNCTION__"(), unknown event: %s\n", - ircomm_tty_event[event]); + IRDA_DEBUG(2, __FUNCTION__"(), unknown event: %s\n", + ircomm_tty_event[event]); return -EINVAL; } return ret; @@ -586,27 +602,34 @@ static int ircomm_tty_state_search(struct ircomm_tty_cb *self, { int ret = 0; - DEBUG(2, __FUNCTION__": state=%s, event=%s\n", - ircomm_tty_state[self->state], ircomm_tty_event[event]); + IRDA_DEBUG(2, __FUNCTION__": state=%s, event=%s\n", + ircomm_tty_state[self->state], ircomm_tty_event[event]); switch (event) { case IRCOMM_TTY_DISCOVERY_INDICATION: self->daddr = info->daddr; self->saddr = info->saddr; + if (self->iriap) { + WARNING(__FUNCTION__ + "(), busy with a previous query\n"); + return -EBUSY; + } + + self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self, + ircomm_tty_getvalue_confirm); + if (self->service_type == IRCOMM_3_WIRE_RAW) { - iriap_getvaluebyclass_request("IrLPT", - "IrDA:IrLMP:LsapSel", - self->saddr, self->daddr, - ircomm_tty_getvalue_confirm, - self); + iriap_getvaluebyclass_request(self->iriap, self->saddr, + self->daddr, "IrLPT", + "IrDA:IrLMP:LsapSel"); ircomm_tty_next_state(self, IRCOMM_TTY_QUERY_LSAP_SEL); } else { - iriap_getvaluebyclass_request("IrDA:IrCOMM", - "Parameters", - self->saddr, self->daddr, - ircomm_tty_getvalue_confirm, - self); + iriap_getvaluebyclass_request(self->iriap, self->saddr, + self->daddr, + "IrDA:IrCOMM", + "Parameters"); + ircomm_tty_next_state(self, IRCOMM_TTY_QUERY_PARAMETERS); } ircomm_tty_start_watchdog_timer(self, 3*HZ); @@ -631,8 +654,8 @@ static int ircomm_tty_state_search(struct ircomm_tty_cb *self, ircomm_tty_next_state(self, IRCOMM_TTY_IDLE); break; default: - DEBUG(2, __FUNCTION__"(), unknown event: %s\n", - ircomm_tty_event[event]); + IRDA_DEBUG(2, __FUNCTION__"(), unknown event: %s\n", + ircomm_tty_event[event]); return -EINVAL; } return ret; @@ -651,16 +674,23 @@ static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self, { int ret = 0; - DEBUG(2, __FUNCTION__": state=%s, event=%s\n", - ircomm_tty_state[self->state], ircomm_tty_event[event]); + IRDA_DEBUG(2, __FUNCTION__": state=%s, event=%s\n", + ircomm_tty_state[self->state], ircomm_tty_event[event]); switch (event) { case IRCOMM_TTY_GOT_PARAMETERS: - iriap_getvaluebyclass_request("IrDA:IrCOMM", - "IrDA:TinyTP:LsapSel", - self->saddr, self->daddr, - ircomm_tty_getvalue_confirm, - self); + if (self->iriap) { + WARNING(__FUNCTION__ + "(), busy with a previous query\n"); + return -EBUSY; + } + + self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self, + ircomm_tty_getvalue_confirm); + + iriap_getvaluebyclass_request(self->iriap, self->saddr, + self->daddr, "IrDA:IrCOMM", + "IrDA:TinyTP:LsapSel"); ircomm_tty_start_watchdog_timer(self, 3*HZ); ircomm_tty_next_state(self, IRCOMM_TTY_QUERY_LSAP_SEL); @@ -685,8 +715,8 @@ static int ircomm_tty_state_query_parameters(struct ircomm_tty_cb *self, ircomm_tty_next_state(self, IRCOMM_TTY_IDLE); break; default: - DEBUG(2, __FUNCTION__"(), unknown event: %s\n", - ircomm_tty_event[event]); + IRDA_DEBUG(2, __FUNCTION__"(), unknown event: %s\n", + ircomm_tty_event[event]); return -EINVAL; } return ret; @@ -705,8 +735,8 @@ static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self, { int ret = 0; - DEBUG(2, __FUNCTION__": state=%s, event=%s\n", - ircomm_tty_state[self->state], ircomm_tty_event[event]); + IRDA_DEBUG(2, __FUNCTION__": state=%s, event=%s\n", + ircomm_tty_state[self->state], ircomm_tty_event[event]); switch (event) { case IRCOMM_TTY_GOT_LSAPSEL: @@ -737,8 +767,8 @@ static int ircomm_tty_state_query_lsap_sel(struct ircomm_tty_cb *self, ircomm_tty_next_state(self, IRCOMM_TTY_IDLE); break; default: - DEBUG(2, __FUNCTION__"(), unknown event: %s\n", - ircomm_tty_event[event]); + IRDA_DEBUG(2, __FUNCTION__"(), unknown event: %s\n", + ircomm_tty_event[event]); return -EINVAL; } return ret; @@ -757,8 +787,8 @@ static int ircomm_tty_state_setup(struct ircomm_tty_cb *self, { int ret = 0; - DEBUG(2, __FUNCTION__": state=%s, event=%s\n", - ircomm_tty_state[self->state], ircomm_tty_event[event]); + IRDA_DEBUG(2, __FUNCTION__": state=%s, event=%s\n", + ircomm_tty_state[self->state], ircomm_tty_event[event]); switch (event) { case IRCOMM_TTY_CONNECT_CONFIRM: @@ -793,8 +823,8 @@ static int ircomm_tty_state_setup(struct ircomm_tty_cb *self, ircomm_tty_next_state(self, IRCOMM_TTY_IDLE); break; default: - DEBUG(2, __FUNCTION__"(), unknown event: %s\n", - ircomm_tty_event[event]); + IRDA_DEBUG(2, __FUNCTION__"(), unknown event: %s\n", + ircomm_tty_event[event]); return -EINVAL; } return ret; @@ -830,8 +860,8 @@ static int ircomm_tty_state_ready(struct ircomm_tty_cb *self, ircomm_tty_check_modem_status(self); break; default: - DEBUG(2, __FUNCTION__"(), unknown event: %s\n", - ircomm_tty_event[event]); + IRDA_DEBUG(2, __FUNCTION__"(), unknown event: %s\n", + ircomm_tty_event[event]); return -EINVAL; } return ret; @@ -846,8 +876,8 @@ static int ircomm_tty_state_ready(struct ircomm_tty_cb *self, int ircomm_tty_do_event(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event, struct sk_buff *skb, struct ircomm_tty_info *info) { - DEBUG(2, __FUNCTION__": state=%s, event=%s\n", - ircomm_tty_state[self->state], ircomm_tty_event[event]); + IRDA_DEBUG(2, __FUNCTION__": state=%s, event=%s\n", + ircomm_tty_state[self->state], ircomm_tty_event[event]); return (*state[self->state])(self, event, skb, info); } @@ -862,7 +892,7 @@ void ircomm_tty_next_state(struct ircomm_tty_cb *self, IRCOMM_TTY_STATE state) { self->state = state; - DEBUG(2, __FUNCTION__": next state=%s, service type=%d\n", - ircomm_tty_state[self->state], self->service_type); + IRDA_DEBUG(2, __FUNCTION__": next state=%s, service type=%d\n", + ircomm_tty_state[self->state], self->service_type); } diff --git a/net/irda/ircomm/ircomm_tty_ioctl.c b/net/irda/ircomm/ircomm_tty_ioctl.c index fdbe2b1f2..5262af954 100644 --- a/net/irda/ircomm/ircomm_tty_ioctl.c +++ b/net/irda/ircomm/ircomm_tty_ioctl.c @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Thu Jun 10 14:39:09 1999 - * Modified at: Tue Aug 31 10:29:36 1999 + * Modified at: Sat Oct 30 12:50:41 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. @@ -145,7 +145,6 @@ void ircomm_tty_set_termios(struct tty_struct *tty, { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; unsigned int cflag = tty->termios->c_cflag; - unsigned long flags; if ((cflag == old_termios->c_cflag) && (RELEVANT_IFLAG(tty->termios->c_iflag) == @@ -194,7 +193,7 @@ static int ircomm_tty_get_modem_info(struct ircomm_tty_cb *self, { unsigned int result; - DEBUG(1, __FUNCTION__ "()\n"); + IRDA_DEBUG(1, __FUNCTION__ "()\n"); result = ((self->session.dte & IRCOMM_RTS) ? TIOCM_RTS : 0) | ((self->session.dte & IRCOMM_DTR) ? TIOCM_DTR : 0) @@ -219,7 +218,7 @@ static int ircomm_tty_set_modem_info(struct ircomm_tty_cb *self, __u8 old_rts, old_dtr; int error; - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); ASSERT(self != NULL, return -1;); ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); @@ -282,7 +281,7 @@ static int ircomm_tty_get_serial_info(struct ircomm_tty_cb *self, if (!retinfo) return -EFAULT; - DEBUG(1, __FUNCTION__ "()\n"); + IRDA_DEBUG(1, __FUNCTION__ "()\n"); memset(&info, 0, sizeof(info)); info.line = self->line; @@ -314,11 +313,11 @@ static int ircomm_tty_get_serial_info(struct ircomm_tty_cb *self, static int ircomm_tty_set_serial_info(struct ircomm_tty_cb *tty, struct serial_struct *new_info) { +#if 0 struct serial_struct new_serial; struct ircomm_tty_cb old_driver; - DEBUG(2, __FUNCTION__ "()\n"); -#if 0 + IRDA_DEBUG(2, __FUNCTION__ "()\n"); if (copy_from_user(&new_serial,new_info,sizeof(new_serial))) return -EFAULT; @@ -412,11 +411,11 @@ int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file, ret = ircomm_tty_set_serial_info(self, (struct serial_struct *) arg); break; case TIOCMIWAIT: - DEBUG(0, "(), TIOCMIWAIT, not impl!\n"); + IRDA_DEBUG(0, "(), TIOCMIWAIT, not impl!\n"); break; case TIOCGICOUNT: - DEBUG(0, __FUNCTION__ "(), TIOCGICOUNT not impl!\n"); + IRDA_DEBUG(0, __FUNCTION__ "(), TIOCGICOUNT not impl!\n"); #if 0 save_flags(flags); cli(); cnow = driver->icount; diff --git a/net/irda/iriap.c b/net/irda/iriap.c index 10fdd4627..bcd43e8c0 100644 --- a/net/irda/iriap.c +++ b/net/irda/iriap.c @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Thu Aug 21 00:02:07 1997 - * Modified at: Sat Oct 9 17:00:56 1999 + * Modified at: Sun Oct 31 22:10:45 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, @@ -60,7 +60,6 @@ static __u32 service_handle; extern char *lmp_reasons[]; -static struct iriap_cb *iriap_open( __u8 slsap, int mode); static void __iriap_close(struct iriap_cb *self); static void iriap_disconnect_indication(void *instance, void *sap, LM_REASON reason, struct sk_buff *skb); @@ -115,7 +114,7 @@ int __init iriap_init(void) * Register server support with IrLMP so we can accept incoming * connections */ - iriap_open(LSAP_IAS, IAS_SERVER); + iriap_open(LSAP_IAS, IAS_SERVER, NULL, NULL); return 0; } @@ -139,7 +138,8 @@ void iriap_cleanup(void) * * Opens an instance of the IrIAP layer, and registers with IrLMP */ -struct iriap_cb *iriap_open(__u8 slsap_sel, int mode) +struct iriap_cb *iriap_open(__u8 slsap_sel, int mode, void *priv, + CONFIRM_CALLBACK callback) { struct iriap_cb *self; struct lsap_cb *lsap; @@ -181,6 +181,9 @@ struct iriap_cb *iriap_open(__u8 slsap_sel, int mode) self->slsap_sel = slsap_sel; self->mode = mode; + self->confirm = callback; + self->priv = priv; + init_timer(&self->watchdog_timer); hashbin_insert(iriap, (queue_t *) self, slsap_sel, NULL); @@ -275,7 +278,7 @@ static void iriap_disconnect_indication(void *instance, void *sap, iriap_do_client_event(self, IAP_LM_DISCONNECT_INDICATION, NULL); /* Close instance only if client */ - iriap_close(self); + /* iriap_close(self); */ } else { IRDA_DEBUG(4, __FUNCTION__ "(), disconnect as server\n"); @@ -348,28 +351,21 @@ void iriap_getvalue(void) * Retreive all values from attribute in all objects with given class * name */ -void iriap_getvaluebyclass_request(char *name, char *attr, - __u32 saddr, __u32 daddr, - CONFIRM_CALLBACK callback, void *priv) +int iriap_getvaluebyclass_request(struct iriap_cb *self, + __u32 saddr, __u32 daddr, + char *name, char *attr) { struct sk_buff *skb; - struct iriap_cb *self; int name_len, attr_len; - __u8 slsap = LSAP_ANY; /* Source LSAP to use */ __u8 *frame; + ASSERT(self != NULL, return -1;); + ASSERT(self->magic == IAS_MAGIC, return -1;); + /* Client must supply the destination device address */ if (!daddr) - return; + return -1; - self = iriap_open(slsap, IAS_CLIENT); - if (!self) - return; - - self->mode = IAS_CLIENT; - self->confirm = callback; - self->priv = priv; - self->daddr = daddr; self->saddr = saddr; @@ -383,7 +379,7 @@ void iriap_getvaluebyclass_request(char *name, char *attr, skb = dev_alloc_skb(64); if (!skb) - return; + return -ENOMEM; name_len = strlen(name); attr_len = strlen(attr); @@ -401,6 +397,8 @@ void iriap_getvaluebyclass_request(char *name, char *attr, memcpy(frame+3+name_len, attr, attr_len); /* Insert attr */ iriap_do_client_event(self, IAP_CALL_REQUEST_GVBC, skb); + + return 0; } /* @@ -467,8 +465,9 @@ void iriap_getvaluebyclass_confirm(struct iriap_cb *self, struct sk_buff *skb) /* case CS_ISO_8859_9: */ /* case CS_UNICODE: */ default: - IRDA_DEBUG(0, __FUNCTION__"(), charset %s, not supported\n", - ias_charset_types[charset]); + IRDA_DEBUG(0, __FUNCTION__ + "(), charset %s, not supported\n", + ias_charset_types[charset]); return; /* break; */ } @@ -761,7 +760,7 @@ static int iriap_data_indication(void *instance, void *sap, if (self->mode == IAS_SERVER) { /* Call server */ IRDA_DEBUG(4, __FUNCTION__ "(), Calling server!\n"); - iriap_do_r_connect_event( self, IAP_RECV_F_LST, skb); + iriap_do_r_connect_event(self, IAP_RECV_F_LST, skb); return 0; } @@ -779,12 +778,14 @@ static int iriap_data_indication(void *instance, void *sap, } opcode &= ~IAP_LST; /* Mask away LST bit */ - + switch (opcode) { case GET_INFO_BASE: IRDA_DEBUG(0, "IrLMP GetInfoBaseDetails not implemented!\n"); break; case GET_VALUE_BY_CLASS: + iriap_do_call_event(self, IAP_RECV_F_LST, skb); + switch (frame[1]) { case IAS_SUCCESS: iriap_getvaluebyclass_confirm(self, skb); @@ -793,7 +794,7 @@ static int iriap_data_indication(void *instance, void *sap, WARNING(__FUNCTION__ "(), No such class!\n"); /* Finished, close connection! */ iriap_disconnect_request(self); - + if (self->confirm) self->confirm(IAS_CLASS_UNKNOWN, 0, NULL, self->priv); @@ -808,16 +809,12 @@ static int iriap_data_indication(void *instance, void *sap, self->priv); break; } - iriap_do_call_event(self, IAP_RECV_F_LST, skb); - - /* - * We remove LSAPs used by IrIAS as a client since these - * are more difficult to reuse! - */ - iriap_close(self); + + /* iriap_close(self); */ break; default: - IRDA_DEBUG(0, __FUNCTION__ "(), Unknown op-code: %02x\n", opcode); + IRDA_DEBUG(0, __FUNCTION__ "(), Unknown op-code: %02x\n", + opcode); break; } return 0; @@ -874,7 +871,7 @@ void iriap_watchdog_timer_expired(void *data) ASSERT(self != NULL, return;); ASSERT(self->magic == IAS_MAGIC, return;); - iriap_close(self); + /* iriap_close(self); */ } #ifdef CONFIG_PROC_FS diff --git a/net/irda/iriap_event.c b/net/irda/iriap_event.c index 6fc2ead68..cc9d0c11a 100644 --- a/net/irda/iriap_event.c +++ b/net/irda/iriap_event.c @@ -6,10 +6,11 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Thu Aug 21 00:02:07 1997 - * Modified at: Sun May 9 11:01:47 1999 + * Modified at: Sun Oct 31 22:13:00 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * - * Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. + * Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>, + * All Rights Reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -27,42 +28,42 @@ #include <net/irda/iriap.h> #include <net/irda/iriap_event.h> -static void state_s_disconnect ( struct iriap_cb *self, IRIAP_EVENT event, +static void state_s_disconnect (struct iriap_cb *self, IRIAP_EVENT event, + struct sk_buff *skb); +static void state_s_connecting (struct iriap_cb *self, IRIAP_EVENT event, + struct sk_buff *skb); +static void state_s_call (struct iriap_cb *self, IRIAP_EVENT event, + struct sk_buff *skb); + +static void state_s_make_call (struct iriap_cb *self, IRIAP_EVENT event, + struct sk_buff *skb); +static void state_s_calling (struct iriap_cb *self, IRIAP_EVENT event, + struct sk_buff *skb); +static void state_s_outstanding (struct iriap_cb *self, IRIAP_EVENT event, + struct sk_buff *skb); +static void state_s_replying (struct iriap_cb *self, IRIAP_EVENT event, struct sk_buff *skb); -static void state_s_connecting ( struct iriap_cb *self, IRIAP_EVENT event, +static void state_s_wait_for_call(struct iriap_cb *self, IRIAP_EVENT event, struct sk_buff *skb); -static void state_s_call ( struct iriap_cb *self, IRIAP_EVENT event, +static void state_s_wait_active (struct iriap_cb *self, IRIAP_EVENT event, struct sk_buff *skb); -static void state_s_make_call ( struct iriap_cb *self, IRIAP_EVENT event, +static void state_r_disconnect (struct iriap_cb *self, IRIAP_EVENT event, struct sk_buff *skb); -static void state_s_calling ( struct iriap_cb *self, IRIAP_EVENT event, +static void state_r_call (struct iriap_cb *self, IRIAP_EVENT event, struct sk_buff *skb); -static void state_s_outstanding ( struct iriap_cb *self, IRIAP_EVENT event, +static void state_r_waiting (struct iriap_cb *self, IRIAP_EVENT event, struct sk_buff *skb); -static void state_s_replying ( struct iriap_cb *self, IRIAP_EVENT event, +static void state_r_wait_active (struct iriap_cb *self, IRIAP_EVENT event, struct sk_buff *skb); -static void state_s_wait_for_call( struct iriap_cb *self, IRIAP_EVENT event, +static void state_r_receiving (struct iriap_cb *self, IRIAP_EVENT event, struct sk_buff *skb); -static void state_s_wait_active ( struct iriap_cb *self, IRIAP_EVENT event, +static void state_r_execute (struct iriap_cb *self, IRIAP_EVENT event, struct sk_buff *skb); - -static void state_r_disconnect ( struct iriap_cb *self, IRIAP_EVENT event, - struct sk_buff *skb); -static void state_r_call ( struct iriap_cb *self, IRIAP_EVENT event, - struct sk_buff *skb); -static void state_r_waiting ( struct iriap_cb *self, IRIAP_EVENT event, - struct sk_buff *skb); -static void state_r_wait_active ( struct iriap_cb *self, IRIAP_EVENT event, - struct sk_buff *skb); -static void state_r_receiving ( struct iriap_cb *self, IRIAP_EVENT event, - struct sk_buff *skb); -static void state_r_execute ( struct iriap_cb *self, IRIAP_EVENT event, - struct sk_buff *skb); -static void state_r_returning ( struct iriap_cb *self, IRIAP_EVENT event, +static void state_r_returning (struct iriap_cb *self, IRIAP_EVENT event, struct sk_buff *skb); -static void (*iriap_state[])( struct iriap_cb *self, IRIAP_EVENT event, +static void (*iriap_state[])(struct iriap_cb *self, IRIAP_EVENT event, struct sk_buff *skb) = { /* Client FSM */ state_s_disconnect, @@ -89,89 +90,72 @@ static void (*iriap_state[])( struct iriap_cb *self, IRIAP_EVENT event, state_r_returning, }; -void iriap_next_client_state( struct iriap_cb *self, IRIAP_STATE state) +void iriap_next_client_state(struct iriap_cb *self, IRIAP_STATE state) { - ASSERT( self != NULL, return;); - ASSERT( self->magic == IAS_MAGIC, return;); - - switch ( state) { - /* case S_DISCONNECT: IRDA_DEBUG( 0, "IAP Client = S_DISCONNECT\n"); break; */ -/* case S_CONNECTING: IRDA_DEBUG( 0, "IAP Client = S_CONNECTING\n"); break; */ -/* case S_CALL: IRDA_DEBUG( 0, "IAP Client = S_CALL\n"); break; */ - default: - break; - } + ASSERT(self != NULL, return;); + ASSERT(self->magic == IAS_MAGIC, return;); + self->client_state = state; } -void iriap_next_call_state( struct iriap_cb *self, IRIAP_STATE state) +void iriap_next_call_state(struct iriap_cb *self, IRIAP_STATE state) { - ASSERT( self != NULL, return;); - ASSERT( self->magic == IAS_MAGIC, return;); - -/* switch ( state) { */ -/* case S_MAKE_CALL: IRDA_DEBUG( 0, "IAP Call = S_MAKE_CALL\n"); break; */ -/* case S_CALLING: IRDA_DEBUG( 0, "IAP Call = S_CALLING\n"); break; */ -/* case S_OUTSTANDING: IRDA_DEBUG( 0, "IAP Call = S_OUTSTANDING\n");break; */ -/* case S_REPLYING: IRDA_DEBUG( 0, "IAP Call = S_REPLYING\n"); break; */ -/* case S_WAIT_FOR_CALL: IRDA_DEBUG( 0, "IAP Call = S_WAIT_FOR_CALL\n"); break; */ -/* case S_WAIT_ACTIVE: IRDA_DEBUG( 0, "IAP Call = S_WAIT_ACTIVE\n"); break; */ -/* default: */ -/* break; */ -/* } */ + ASSERT(self != NULL, return;); + ASSERT(self->magic == IAS_MAGIC, return;); + self->call_state = state; } -void iriap_next_server_state( struct iriap_cb *self, IRIAP_STATE state) +void iriap_next_server_state(struct iriap_cb *self, IRIAP_STATE state) { - ASSERT( self != NULL, return;); - ASSERT( self->magic == IAS_MAGIC, return;); + ASSERT(self != NULL, return;); + ASSERT(self->magic == IAS_MAGIC, return;); self->server_state = state; } -void iriap_next_r_connect_state( struct iriap_cb *self, IRIAP_STATE state) +void iriap_next_r_connect_state(struct iriap_cb *self, IRIAP_STATE state) { - ASSERT( self != NULL, return;); - ASSERT( self->magic == IAS_MAGIC, return;); + ASSERT(self != NULL, return;); + ASSERT(self->magic == IAS_MAGIC, return;); self->r_connect_state = state; } -void iriap_do_client_event( struct iriap_cb *self, IRIAP_EVENT event, - struct sk_buff *skb) +void iriap_do_client_event(struct iriap_cb *self, IRIAP_EVENT event, + struct sk_buff *skb) { - ASSERT( self != NULL, return;); - ASSERT( self->magic == IAS_MAGIC, return;); + ASSERT(self != NULL, return;); + ASSERT(self->magic == IAS_MAGIC, return;); - (*iriap_state[ self->client_state]) ( self, event, skb); + (*iriap_state[ self->client_state]) (self, event, skb); } -void iriap_do_call_event( struct iriap_cb *self, IRIAP_EVENT event, - struct sk_buff *skb) +void iriap_do_call_event(struct iriap_cb *self, IRIAP_EVENT event, + struct sk_buff *skb) { - ASSERT( self != NULL, return;); - ASSERT( self->magic == IAS_MAGIC, return;); + ASSERT(self != NULL, return;); + ASSERT(self->magic == IAS_MAGIC, return;); - (*iriap_state[ self->call_state]) ( self, event, skb); + (*iriap_state[ self->call_state]) (self, event, skb); } -void iriap_do_server_event( struct iriap_cb *self, IRIAP_EVENT event, +void iriap_do_server_event(struct iriap_cb *self, IRIAP_EVENT event, struct sk_buff *skb) { - ASSERT( self != NULL, return;); - ASSERT( self->magic == IAS_MAGIC, return;); + ASSERT(self != NULL, return;); + ASSERT(self->magic == IAS_MAGIC, return;); - (*iriap_state[ self->server_state]) ( self, event, skb); + (*iriap_state[ self->server_state]) (self, event, skb); } -void iriap_do_r_connect_event( struct iriap_cb *self, IRIAP_EVENT event, - struct sk_buff *skb) +void iriap_do_r_connect_event(struct iriap_cb *self, IRIAP_EVENT event, + struct sk_buff *skb) { - ASSERT( self != NULL, return;); - ASSERT( self->magic == IAS_MAGIC, return;); + ASSERT(self != NULL, return;); + ASSERT(self->magic == IAS_MAGIC, return;); - (*iriap_state[ self->r_connect_state]) ( self, event, skb); + (*iriap_state[ self->r_connect_state]) (self, event, skb); } @@ -181,26 +165,26 @@ void iriap_do_r_connect_event( struct iriap_cb *self, IRIAP_EVENT event, * S-Disconnect, The device has no LSAP connection to a particular * remote device. */ -static void state_s_disconnect( struct iriap_cb *self, IRIAP_EVENT event, - struct sk_buff *skb) +static void state_s_disconnect(struct iriap_cb *self, IRIAP_EVENT event, + struct sk_buff *skb) { int ret; - ASSERT( self != NULL, return;); - ASSERT( self->magic == IAS_MAGIC, return;); + ASSERT(self != NULL, return;); + ASSERT(self->magic == IAS_MAGIC, return;); - switch( event) { + switch (event) { case IAP_CALL_REQUEST_GVBC: - iriap_next_client_state( self, S_CONNECTING); + iriap_next_client_state(self, S_CONNECTING); self->skb = skb; - ret = irlmp_connect_request( self->lsap, LSAP_IAS, + ret = irlmp_connect_request(self->lsap, LSAP_IAS, self->saddr, self->daddr, NULL, NULL); break; case IAP_LM_DISCONNECT_INDICATION: break; default: - IRDA_DEBUG( 0, __FUNCTION__"(), Unknown event %d\n", event); + IRDA_DEBUG(0, __FUNCTION__"(), Unknown event %d\n", event); break; } } @@ -211,28 +195,28 @@ static void state_s_disconnect( struct iriap_cb *self, IRIAP_EVENT event, * S-Connecting * */ -static void state_s_connecting( struct iriap_cb *self, IRIAP_EVENT event, - struct sk_buff *skb) +static void state_s_connecting(struct iriap_cb *self, IRIAP_EVENT event, + struct sk_buff *skb) { - ASSERT( self != NULL, return;); - ASSERT( self->magic == IAS_MAGIC, return;); + ASSERT(self != NULL, return;); + ASSERT(self->magic == IAS_MAGIC, return;); - switch( event) { + switch (event) { case IAP_LM_CONNECT_CONFIRM: /* * Jump to S-Call FSM */ - iriap_do_call_event( self, IAP_CALL_REQUEST, skb); - /* iriap_call_request( self, 0,0,0); */ - iriap_next_client_state( self, S_CALL); + iriap_do_call_event(self, IAP_CALL_REQUEST, skb); + /* iriap_call_request(self, 0,0,0); */ + iriap_next_client_state(self, S_CALL); break; case IAP_LM_DISCONNECT_INDICATION: /* Abort calls */ - iriap_next_call_state( self, S_MAKE_CALL); - iriap_next_client_state( self, S_DISCONNECT); + iriap_next_call_state(self, S_MAKE_CALL); + iriap_next_client_state(self, S_DISCONNECT); break; default: - IRDA_DEBUG( 0, __FUNCTION__ "(), Unknown event %d\n", event); + IRDA_DEBUG(0, __FUNCTION__ "(), Unknown event %d\n", event); break; } } @@ -244,19 +228,19 @@ static void state_s_connecting( struct iriap_cb *self, IRIAP_EVENT event, * device. Whenever the LSAP connection is disconnected, this state * catches that event and clears up */ -static void state_s_call( struct iriap_cb *self, IRIAP_EVENT event, - struct sk_buff *skb) +static void state_s_call(struct iriap_cb *self, IRIAP_EVENT event, + struct sk_buff *skb) { - ASSERT( self != NULL, return;); + ASSERT(self != NULL, return;); - switch( event) { + switch (event) { case IAP_LM_DISCONNECT_INDICATION: /* Abort calls */ - iriap_next_call_state( self, S_MAKE_CALL); - iriap_next_client_state( self, S_DISCONNECT); + iriap_next_call_state(self, S_MAKE_CALL); + iriap_next_client_state(self, S_DISCONNECT); break; default: - IRDA_DEBUG( 0, "state_s_call: Unknown event %d\n", event); + IRDA_DEBUG(0, "state_s_call: Unknown event %d\n", event); break; } } @@ -267,23 +251,22 @@ static void state_s_call( struct iriap_cb *self, IRIAP_EVENT event, * S-Make-Call * */ -static void state_s_make_call( struct iriap_cb *self, IRIAP_EVENT event, - struct sk_buff *skb) +static void state_s_make_call(struct iriap_cb *self, IRIAP_EVENT event, + struct sk_buff *skb) { - ASSERT( self != NULL, return;); + ASSERT(self != NULL, return;); - switch( event) { + switch (event) { case IAP_CALL_REQUEST: - irlmp_data_request( self->lsap, self->skb); - iriap_next_call_state( self, S_OUTSTANDING); + irlmp_data_request(self->lsap, self->skb); + iriap_next_call_state(self, S_OUTSTANDING); break; default: - IRDA_DEBUG( 0, "state_s_make_call: Unknown event %d\n", event); + IRDA_DEBUG(0, __FUNCTION__ "(), Unknown event %d\n", event); break; } - if ( skb) { - dev_kfree_skb( skb); - } + if (skb) + dev_kfree_skb(skb); } /* @@ -292,10 +275,10 @@ static void state_s_make_call( struct iriap_cb *self, IRIAP_EVENT event, * S-Calling * */ -static void state_s_calling( struct iriap_cb *self, IRIAP_EVENT event, - struct sk_buff *skb) +static void state_s_calling(struct iriap_cb *self, IRIAP_EVENT event, + struct sk_buff *skb) { - IRDA_DEBUG( 0, __FUNCTION__ "(), Not implemented\n"); + IRDA_DEBUG(0, __FUNCTION__ "(), Not implemented\n"); } /* @@ -304,21 +287,21 @@ static void state_s_calling( struct iriap_cb *self, IRIAP_EVENT event, * S-Outstanding, The device is waiting for a response to a command * */ -static void state_s_outstanding( struct iriap_cb *self, IRIAP_EVENT event, - struct sk_buff *skb) +static void state_s_outstanding(struct iriap_cb *self, IRIAP_EVENT event, + struct sk_buff *skb) { - ASSERT( self != NULL, return;); + ASSERT(self != NULL, return;); - switch( event) { + switch (event) { case IAP_RECV_F_LST: - iriap_send_ack( self); + iriap_send_ack(self); /*LM_Idle_request(idle); */ - dev_kfree_skb( skb); - iriap_next_call_state( self, S_WAIT_FOR_CALL); + dev_kfree_skb(skb); + iriap_next_call_state(self, S_WAIT_FOR_CALL); break; default: - IRDA_DEBUG( 0, __FUNCTION__ "(), Unknown event %d\n", event); + IRDA_DEBUG(0, __FUNCTION__ "(), Unknown event %d\n", event); break; } } @@ -328,10 +311,10 @@ static void state_s_outstanding( struct iriap_cb *self, IRIAP_EVENT event, * * S-Replying, The device is collecting a multiple part response */ -static void state_s_replying( struct iriap_cb *self, IRIAP_EVENT event, - struct sk_buff *skb) +static void state_s_replying(struct iriap_cb *self, IRIAP_EVENT event, + struct sk_buff *skb) { - IRDA_DEBUG( 0, __FUNCTION__ "(), Not implemented\n"); + IRDA_DEBUG(0, __FUNCTION__ "(), Not implemented\n"); } /* @@ -340,10 +323,10 @@ static void state_s_replying( struct iriap_cb *self, IRIAP_EVENT event, * S-Wait-for-Call * */ -static void state_s_wait_for_call( struct iriap_cb *self, IRIAP_EVENT event, +static void state_s_wait_for_call(struct iriap_cb *self, IRIAP_EVENT event, struct sk_buff *skb) { - IRDA_DEBUG( 0, __FUNCTION__ "(), Not implemented\n"); + IRDA_DEBUG(0, __FUNCTION__ "(), Not implemented\n"); } @@ -353,10 +336,10 @@ static void state_s_wait_for_call( struct iriap_cb *self, IRIAP_EVENT event, * S-Wait-Active * */ -static void state_s_wait_active( struct iriap_cb *self, IRIAP_EVENT event, - struct sk_buff *skb) +static void state_s_wait_active(struct iriap_cb *self, IRIAP_EVENT event, + struct sk_buff *skb) { - IRDA_DEBUG( 0, __FUNCTION__ "(), Not implemented\n"); + IRDA_DEBUG(0, __FUNCTION__ "(), Not implemented\n"); } /************************************************************************** @@ -371,18 +354,16 @@ static void state_s_wait_active( struct iriap_cb *self, IRIAP_EVENT event, * LM-IAS server is disconnected (not processing any requests!) * */ -static void state_r_disconnect( struct iriap_cb *self, IRIAP_EVENT event, - struct sk_buff *skb) +static void state_r_disconnect(struct iriap_cb *self, IRIAP_EVENT event, + struct sk_buff *skb) { struct sk_buff *tx_skb; - switch( event) { + switch (event) { case IAP_LM_CONNECT_INDICATION: - tx_skb = dev_alloc_skb( 64); - if ( tx_skb == NULL) { - IRDA_DEBUG( 0,"state_r_disconnect: " - "Could not allocate an sk_buff of length %d\n", - 64); + tx_skb = dev_alloc_skb(64); + if (tx_skb == NULL) { + WARNING(__FUNCTION__ "(), unable to malloc!\n"); return; } @@ -392,20 +373,20 @@ static void state_r_disconnect( struct iriap_cb *self, IRIAP_EVENT event, irlmp_connect_response(self->lsap, tx_skb); /*LM_Idle_request(idle); */ - iriap_next_server_state( self, R_CALL); + iriap_next_server_state(self, R_CALL); /* * Jump to R-Connect FSM, we skip R-Waiting since we do not * care about LM_Idle_request()! */ - iriap_next_r_connect_state( self, R_RECEIVING); + iriap_next_r_connect_state(self, R_RECEIVING); if (skb) - dev_kfree_skb( skb); + dev_kfree_skb(skb); break; default: - IRDA_DEBUG( 0, "state_r_disconnect: Unknown event %d\n", event); + IRDA_DEBUG(0, __FUNCTION__ "(), unknown event %d\n", event); break; } } @@ -416,20 +397,20 @@ static void state_r_disconnect( struct iriap_cb *self, IRIAP_EVENT event, * * */ -static void state_r_call( struct iriap_cb *self, IRIAP_EVENT event, - struct sk_buff *skb) +static void state_r_call(struct iriap_cb *self, IRIAP_EVENT event, + struct sk_buff *skb) { - IRDA_DEBUG( 4, "state_r_call()\n"); + IRDA_DEBUG(4, "state_r_call()\n"); - switch( event) { + switch (event) { case IAP_LM_DISCONNECT_INDICATION: /* Abort call */ - iriap_next_server_state( self, R_DISCONNECT); - iriap_next_r_connect_state( self, R_WAITING); + iriap_next_server_state(self, R_DISCONNECT); + iriap_next_r_connect_state(self, R_WAITING); break; default: - IRDA_DEBUG( 0, "state_r_call, unknown event!\n"); + IRDA_DEBUG(0, __FUNCTION__ "(), unknown event!\n"); break; } } @@ -444,16 +425,16 @@ static void state_r_call( struct iriap_cb *self, IRIAP_EVENT event, * * */ -static void state_r_waiting( struct iriap_cb *self, IRIAP_EVENT event, - struct sk_buff *skb) +static void state_r_waiting(struct iriap_cb *self, IRIAP_EVENT event, + struct sk_buff *skb) { - IRDA_DEBUG( 0, __FUNCTION__ "(), Not implemented\n"); + IRDA_DEBUG(0, __FUNCTION__ "(), Not implemented\n"); } -static void state_r_wait_active( struct iriap_cb *self, +static void state_r_wait_active(struct iriap_cb *self, IRIAP_EVENT event, struct sk_buff *skb) { - IRDA_DEBUG( 0, __FUNCTION__ "(), Not implemented\n"); + IRDA_DEBUG(0, __FUNCTION__ "(), Not implemented\n"); } /* @@ -462,19 +443,19 @@ static void state_r_wait_active( struct iriap_cb *self, * We are receiving a command * */ -static void state_r_receiving( struct iriap_cb *self, IRIAP_EVENT event, - struct sk_buff *skb) +static void state_r_receiving(struct iriap_cb *self, IRIAP_EVENT event, + struct sk_buff *skb) { - IRDA_DEBUG( 4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); - switch( event) { + switch (event) { case IAP_RECV_F_LST: - iriap_next_r_connect_state( self, R_EXECUTE); + iriap_next_r_connect_state(self, R_EXECUTE); - iriap_call_indication( self, skb); + iriap_call_indication(self, skb); break; default: - IRDA_DEBUG( 0, __FUNCTION__ "(), unknown event!\n"); + IRDA_DEBUG(0, __FUNCTION__ "(), unknown event!\n"); break; } @@ -486,40 +467,40 @@ static void state_r_receiving( struct iriap_cb *self, IRIAP_EVENT event, * The server is processing the request * */ -static void state_r_execute( struct iriap_cb *self, IRIAP_EVENT event, - struct sk_buff *skb) +static void state_r_execute(struct iriap_cb *self, IRIAP_EVENT event, + struct sk_buff *skb) { - IRDA_DEBUG( 4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); - ASSERT( skb != NULL, return;); + ASSERT(skb != NULL, return;); - if ( !self || self->magic != IAS_MAGIC) { - IRDA_DEBUG( 0, "state_r_execute: bad pointer self\n"); + if (!self || self->magic != IAS_MAGIC) { + IRDA_DEBUG(0, __FUNCTION__ "(), bad pointer self\n"); return; } - switch( event) { + switch (event) { case IAP_CALL_RESPONSE: /* * Since we don't implement the Waiting state, we return * to state Receiving instead, DB. */ - iriap_next_r_connect_state( self, R_RECEIVING); + iriap_next_r_connect_state(self, R_RECEIVING); - irlmp_data_request( self->lsap, skb); + irlmp_data_request(self->lsap, skb); break; default: - IRDA_DEBUG( 0, __FUNCTION__ "(), unknown event!\n"); + IRDA_DEBUG(0, __FUNCTION__ "(), unknown event!\n"); break; } } -static void state_r_returning( struct iriap_cb *self, IRIAP_EVENT event, - struct sk_buff *skb) +static void state_r_returning(struct iriap_cb *self, IRIAP_EVENT event, + struct sk_buff *skb) { - IRDA_DEBUG( 0, __FUNCTION__ "(), event=%d\n", event); + IRDA_DEBUG(0, __FUNCTION__ "(), event=%d\n", event); - switch( event) { + switch (event) { case IAP_RECV_F_LST: break; diff --git a/net/irda/irlan/irlan_client.c b/net/irda/irlan/irlan_client.c index 467cf957a..4faa8edf5 100644 --- a/net/irda/irlan/irlan_client.c +++ b/net/irda/irlan/irlan_client.c @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Sun Aug 31 20:14:37 1997 - * Modified at: Thu Jul 8 13:50:16 1999 + * Modified at: Sun Oct 31 19:44:41 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * Sources: skeleton.c by Donald Becker <becker@CESDIS.gsfc.nasa.gov> * slip.c by Laurence Culhane, <loz@holmes.demon.co.uk> @@ -71,7 +71,7 @@ static void irlan_client_kick_timer_expired(void *data) { struct irlan_cb *self = (struct irlan_cb *) data; - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRLAN_MAGIC, return;); @@ -90,7 +90,7 @@ static void irlan_client_kick_timer_expired(void *data) void irlan_client_start_kick_timer(struct irlan_cb *self, int timeout) { - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); irda_start_timer(&self->client.kick_timer, timeout, (void *) self, irlan_client_kick_timer_expired); @@ -106,7 +106,7 @@ void irlan_client_wakeup(struct irlan_cb *self, __u32 saddr, __u32 daddr) { struct irmanager_event mgr_event; - DEBUG(1, __FUNCTION__ "()\n"); + IRDA_DEBUG(1, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRLAN_MAGIC, return;); @@ -168,7 +168,7 @@ void irlan_client_discovery_indication(discovery_t *discovery) struct irlan_cb *self; __u32 saddr, daddr; - DEBUG(1, __FUNCTION__"()\n"); + IRDA_DEBUG(1, __FUNCTION__"()\n"); ASSERT(irlan != NULL, return;); ASSERT(discovery != NULL, return;); @@ -183,7 +183,7 @@ void irlan_client_discovery_indication(discovery_t *discovery) if (self) { ASSERT(self->magic == IRLAN_MAGIC, return;); - DEBUG(1, __FUNCTION__ "(), Found instance (%08x)!\n", + IRDA_DEBUG(1, __FUNCTION__ "(), Found instance (%08x)!\n", daddr); irlan_client_wakeup(self, saddr, daddr); @@ -194,7 +194,7 @@ void irlan_client_discovery_indication(discovery_t *discovery) /* * We have no instance for daddr, so start a new one */ - DEBUG(1, __FUNCTION__ "(), starting new instance!\n"); + IRDA_DEBUG(1, __FUNCTION__ "(), starting new instance!\n"); self = irlan_open(saddr, daddr, TRUE); /* Restart watchdog timer */ @@ -212,7 +212,7 @@ static int irlan_client_ctrl_data_indication(void *instance, void *sap, { struct irlan_cb *self; - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); self = (struct irlan_cb *) instance; @@ -223,7 +223,7 @@ static int irlan_client_ctrl_data_indication(void *instance, void *sap, irlan_do_client_event(self, IRLAN_DATA_INDICATION, skb); /* Ready for a new command */ - DEBUG(2, __FUNCTION__ "(), clearing tx_busy\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), clearing tx_busy\n"); self->client.tx_busy = FALSE; /* Check if we have some queued commands waiting to be sent */ @@ -240,7 +240,7 @@ static void irlan_client_ctrl_disconnect_indication(void *instance, void *sap, struct tsap_cb *tsap; struct sk_buff *skb; - DEBUG(4, __FUNCTION__ "(), reason=%d\n", reason); + IRDA_DEBUG(4, __FUNCTION__ "(), reason=%d\n", reason); self = (struct irlan_cb *) instance; tsap = (struct tsap_cb *) sap; @@ -272,7 +272,7 @@ void irlan_client_open_ctrl_tsap(struct irlan_cb *self) struct tsap_cb *tsap; notify_t notify; - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRLAN_MAGIC, return;); @@ -292,7 +292,7 @@ void irlan_client_open_ctrl_tsap(struct irlan_cb *self) tsap = irttp_open_tsap(LSAP_ANY, DEFAULT_INITIAL_CREDIT, ¬ify); if (!tsap) { - DEBUG(2, __FUNCTION__ "(), Got no tsap!\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), Got no tsap!\n"); return; } self->client.tsap_ctrl = tsap; @@ -312,7 +312,7 @@ static void irlan_client_ctrl_connect_confirm(void *instance, void *sap, { struct irlan_cb *self; - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); self = (struct irlan_cb *) instance; @@ -338,7 +338,7 @@ void irlan_client_reconnect_data_channel(struct irlan_cb *self) struct sk_buff *skb; __u8 *frame; - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRLAN_MAGIC, return;); @@ -381,7 +381,7 @@ void irlan_client_parse_response(struct irlan_cb *self, struct sk_buff *skb) ASSERT(skb != NULL, return;); - DEBUG(4, __FUNCTION__ "() skb->len=%d\n", (int) skb->len); + IRDA_DEBUG(4, __FUNCTION__ "() skb->len=%d\n", (int) skb->len); ASSERT(self != NULL, return;); ASSERT(self->magic == IRLAN_MAGIC, return;); @@ -412,7 +412,7 @@ void irlan_client_parse_response(struct irlan_cb *self, struct sk_buff *skb) /* How many parameters? */ count = frame[1]; - DEBUG(4, __FUNCTION__ "(), got %d parameters\n", count); + IRDA_DEBUG(4, __FUNCTION__ "(), got %d parameters\n", count); ptr = frame+2; @@ -420,7 +420,7 @@ void irlan_client_parse_response(struct irlan_cb *self, struct sk_buff *skb) for (i=0; i<count;i++) { ret = irlan_extract_param(ptr, name, value, &val_len); if (ret < 0) { - DEBUG(2, __FUNCTION__ "(), IrLAN, Error!\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), IrLAN, Error!\n"); break; } ptr += ret; @@ -444,7 +444,7 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param, __u8 *bytes; int i; - DEBUG(4, __FUNCTION__ "(), parm=%s\n", param); + IRDA_DEBUG(4, __FUNCTION__ "(), parm=%s\n", param); ASSERT(self != NULL, return;); ASSERT(self->magic == IRLAN_MAGIC, return;); @@ -484,14 +484,14 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param, else if (strcmp(value, "HOSTED") == 0) self->client.access_type = ACCESS_HOSTED; else { - DEBUG(2, __FUNCTION__ "(), unknown access type!\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), unknown access type!\n"); } } /* * IRLAN version */ if (strcmp(param, "IRLAN_VER") == 0) { - DEBUG(4, "IrLAN version %d.%d\n", (__u8) value[0], + IRDA_DEBUG(4, "IrLAN version %d.%d\n", (__u8) value[0], (__u8) value[1]); self->version[0] = value[0]; @@ -503,41 +503,41 @@ static void irlan_check_response_param(struct irlan_cb *self, char *param, */ if (strcmp(param, "DATA_CHAN") == 0) { self->dtsap_sel_data = value[0]; - DEBUG(4, "Data TSAP = %02x\n", self->dtsap_sel_data); + IRDA_DEBUG(4, "Data TSAP = %02x\n", self->dtsap_sel_data); return; } if (strcmp(param, "CON_ARB") == 0) { memcpy(&tmp_cpu, value, 2); /* Align value */ le16_to_cpus(&tmp_cpu); /* Convert to host order */ self->client.recv_arb_val = tmp_cpu; - DEBUG(2, __FUNCTION__ "(), receive arb val=%d\n", - self->client.recv_arb_val); + IRDA_DEBUG(2, __FUNCTION__ "(), receive arb val=%d\n", + self->client.recv_arb_val); } if (strcmp(param, "MAX_FRAME") == 0) { memcpy(&tmp_cpu, value, 2); /* Align value */ le16_to_cpus(&tmp_cpu); /* Convert to host order */ self->client.max_frame = tmp_cpu; - DEBUG(4, __FUNCTION__ "(), max frame=%d\n", - self->client.max_frame); + IRDA_DEBUG(4, __FUNCTION__ "(), max frame=%d\n", + self->client.max_frame); } /* * RECONNECT_KEY, in case the link goes down! */ if (strcmp(param, "RECONNECT_KEY") == 0) { - DEBUG(4, "Got reconnect key: "); + IRDA_DEBUG(4, "Got reconnect key: "); /* for (i = 0; i < val_len; i++) */ /* printk("%02x", value[i]); */ memcpy(self->client.reconnect_key, value, val_len); self->client.key_len = val_len; - DEBUG(4, "\n"); + IRDA_DEBUG(4, "\n"); } /* * FILTER_ENTRY, have we got an ethernet address? */ if (strcmp(param, "FILTER_ENTRY") == 0) { bytes = value; - DEBUG(4, "Ethernet address = %02x:%02x:%02x:%02x:%02x:%02x\n", + IRDA_DEBUG(4, "Ethernet address = %02x:%02x:%02x:%02x:%02x:%02x\n", bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5]); for (i = 0; i < 6; i++) @@ -556,16 +556,20 @@ void irlan_client_get_value_confirm(int result, __u16 obj_id, { struct irlan_cb *self; - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); ASSERT(priv != NULL, return;); self = (struct irlan_cb *) priv; ASSERT(self->magic == IRLAN_MAGIC, return;); + /* We probably don't need to make any more queries */ + iriap_close(self->client.iriap); + self->client.iriap = NULL; + /* Check if request succeeded */ if (result != IAS_SUCCESS) { - DEBUG(2, __FUNCTION__ "(), got NULL value!\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), got NULL value!\n"); irlan_do_client_event(self, IRLAN_IAS_PROVIDER_NOT_AVAIL, NULL); return; @@ -582,16 +586,17 @@ void irlan_client_get_value_confirm(int result, __u16 obj_id, } break; case IAS_STRING: - DEBUG(2, __FUNCTION__ "(), got string %s\n", value->t.string); + IRDA_DEBUG(2, __FUNCTION__ "(), got string %s\n", + value->t.string); break; case IAS_OCT_SEQ: - DEBUG(2, __FUNCTION__ "(), OCT_SEQ not implemented\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), OCT_SEQ not implemented\n"); break; case IAS_MISSING: - DEBUG(2, __FUNCTION__ "(), MISSING not implemented\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), MISSING not implemented\n"); break; default: - DEBUG(2, __FUNCTION__ "(), unknown type!\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), unknown type!\n"); break; } irlan_do_client_event(self, IRLAN_IAS_PROVIDER_NOT_AVAIL, NULL); diff --git a/net/irda/irlan/irlan_client_event.c b/net/irda/irlan/irlan_client_event.c index f2d627785..3a1aac699 100644 --- a/net/irda/irlan/irlan_client_event.c +++ b/net/irda/irlan/irlan_client_event.c @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Sun Aug 31 20:14:37 1997 - * Modified at: Mon Jul 5 11:06:57 1999 + * Modified at: Sun Oct 31 19:41:55 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, @@ -92,26 +92,33 @@ void irlan_do_client_event(struct irlan_cb *self, IRLAN_EVENT event, static int irlan_client_state_idle(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb) { - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); ASSERT(self != NULL, return -1;); ASSERT(self->magic == IRLAN_MAGIC, return -1;); switch (event) { case IRLAN_DISCOVERY_INDICATION: + if (self->client.iriap) { + WARNING(__FUNCTION__ + "(), busy with a previous query\n"); + return -EBUSY; + } + + self->client.iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self, + irlan_client_get_value_confirm); /* Get some values from peer IAS */ - iriap_getvaluebyclass_request( - "IrLAN", "IrDA:TinyTP:LsapSel", - self->saddr, self->daddr, - irlan_client_get_value_confirm, self); + iriap_getvaluebyclass_request(self->client.iriap, + self->saddr, self->daddr, + "IrLAN", "IrDA:TinyTP:LsapSel"); irlan_next_client_state(self, IRLAN_QUERY); break; case IRLAN_WATCHDOG_TIMEOUT: - DEBUG(2, __FUNCTION__ "(), IRLAN_WATCHDOG_TIMEOUT\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), IRLAN_WATCHDOG_TIMEOUT\n"); break; default: - DEBUG(4, __FUNCTION__ "(), Unknown event %d\n", event); + IRDA_DEBUG(4, __FUNCTION__ "(), Unknown event %d\n", event); break; } if (skb) @@ -130,7 +137,7 @@ static int irlan_client_state_idle(struct irlan_cb *self, IRLAN_EVENT event, static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb) { - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); ASSERT(self != NULL, return -1;); ASSERT(self->magic == IRLAN_MAGIC, return -1;); @@ -148,7 +155,7 @@ static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, irlan_next_client_state(self, IRLAN_CONN); break; case IRLAN_IAS_PROVIDER_NOT_AVAIL: - DEBUG(2, __FUNCTION__ "(), IAS_PROVIDER_NOT_AVAIL\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), IAS_PROVIDER_NOT_AVAIL\n"); irlan_next_client_state(self, IRLAN_IDLE); /* Give the client a kick! */ @@ -161,10 +168,10 @@ static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, irlan_next_client_state(self, IRLAN_IDLE); break; case IRLAN_WATCHDOG_TIMEOUT: - DEBUG(2, __FUNCTION__ "(), IRLAN_WATCHDOG_TIMEOUT\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), IRLAN_WATCHDOG_TIMEOUT\n"); break; default: - DEBUG(2, __FUNCTION__"(), Unknown event %d\n", event); + IRDA_DEBUG(2, __FUNCTION__"(), Unknown event %d\n", event); break; } if (skb) @@ -183,7 +190,7 @@ static int irlan_client_state_query(struct irlan_cb *self, IRLAN_EVENT event, static int irlan_client_state_conn(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb) { - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); ASSERT(self != NULL, return -1;); @@ -198,10 +205,10 @@ static int irlan_client_state_conn(struct irlan_cb *self, IRLAN_EVENT event, irlan_next_client_state(self, IRLAN_IDLE); break; case IRLAN_WATCHDOG_TIMEOUT: - DEBUG(2, __FUNCTION__ "(), IRLAN_WATCHDOG_TIMEOUT\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), IRLAN_WATCHDOG_TIMEOUT\n"); break; default: - DEBUG(2, __FUNCTION__ "(), Unknown event %d\n", event); + IRDA_DEBUG(2, __FUNCTION__ "(), Unknown event %d\n", event); break; } if (skb) @@ -218,7 +225,7 @@ static int irlan_client_state_conn(struct irlan_cb *self, IRLAN_EVENT event, static int irlan_client_state_info(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb) { - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); ASSERT(self != NULL, return -1;); @@ -238,10 +245,10 @@ static int irlan_client_state_info(struct irlan_cb *self, IRLAN_EVENT event, irlan_next_client_state(self, IRLAN_IDLE); break; case IRLAN_WATCHDOG_TIMEOUT: - DEBUG(2, __FUNCTION__ "(), IRLAN_WATCHDOG_TIMEOUT\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), IRLAN_WATCHDOG_TIMEOUT\n"); break; default: - DEBUG(2, __FUNCTION__ "(), Unknown event %d\n", event); + IRDA_DEBUG(2, __FUNCTION__ "(), Unknown event %d\n", event); break; } if (skb) @@ -260,7 +267,7 @@ static int irlan_client_state_info(struct irlan_cb *self, IRLAN_EVENT event, static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb) { - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); ASSERT(self != NULL, return -1;); @@ -275,10 +282,10 @@ static int irlan_client_state_media(struct irlan_cb *self, IRLAN_EVENT event, irlan_next_client_state(self, IRLAN_IDLE); break; case IRLAN_WATCHDOG_TIMEOUT: - DEBUG(2, __FUNCTION__ "(), IRLAN_WATCHDOG_TIMEOUT\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), IRLAN_WATCHDOG_TIMEOUT\n"); break; default: - DEBUG(2, __FUNCTION__ "(), Unknown event %d\n", event); + IRDA_DEBUG(2, __FUNCTION__ "(), Unknown event %d\n", event); break; } if (skb) @@ -299,7 +306,7 @@ static int irlan_client_state_open(struct irlan_cb *self, IRLAN_EVENT event, { struct qos_info qos; - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); ASSERT(self != NULL, return -1;); @@ -338,7 +345,7 @@ static int irlan_client_state_open(struct irlan_cb *self, IRLAN_EVENT event, irlan_next_client_state(self, IRLAN_DATA); break; default: - DEBUG(2, __FUNCTION__ "(), unknown access type!\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), unknown access type!\n"); break; } break; @@ -347,10 +354,10 @@ static int irlan_client_state_open(struct irlan_cb *self, IRLAN_EVENT event, irlan_next_client_state(self, IRLAN_IDLE); break; case IRLAN_WATCHDOG_TIMEOUT: - DEBUG(2, __FUNCTION__ "(), IRLAN_WATCHDOG_TIMEOUT\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), IRLAN_WATCHDOG_TIMEOUT\n"); break; default: - DEBUG(2, __FUNCTION__ "(), Unknown event %d\n", event); + IRDA_DEBUG(2, __FUNCTION__ "(), Unknown event %d\n", event); break; } @@ -370,7 +377,7 @@ static int irlan_client_state_open(struct irlan_cb *self, IRLAN_EVENT event, static int irlan_client_state_wait(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb) { - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); ASSERT(self != NULL, return -1;); @@ -384,10 +391,10 @@ static int irlan_client_state_wait(struct irlan_cb *self, IRLAN_EVENT event, irlan_next_client_state(self, IRLAN_IDLE); break; case IRLAN_WATCHDOG_TIMEOUT: - DEBUG(2, __FUNCTION__ "(), IRLAN_WATCHDOG_TIMEOUT\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), IRLAN_WATCHDOG_TIMEOUT\n"); break; default: - DEBUG(2, __FUNCTION__ "(), Unknown event %d\n", event); + IRDA_DEBUG(2, __FUNCTION__ "(), Unknown event %d\n", event); break; } if (skb) @@ -401,7 +408,7 @@ static int irlan_client_state_arb(struct irlan_cb *self, IRLAN_EVENT event, { struct qos_info qos; - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); ASSERT(self != NULL, return -1;); @@ -423,7 +430,7 @@ static int irlan_client_state_arb(struct irlan_cb *self, IRLAN_EVENT event, } else if (self->client.recv_arb_val > self->provider.send_arb_val) { - DEBUG(2, __FUNCTION__ "(), lost the battle :-(\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), lost the battle :-(\n"); } break; case IRLAN_DATA_CONNECT_INDICATION: @@ -434,10 +441,10 @@ static int irlan_client_state_arb(struct irlan_cb *self, IRLAN_EVENT event, irlan_next_client_state(self, IRLAN_IDLE); break; case IRLAN_WATCHDOG_TIMEOUT: - DEBUG(2, __FUNCTION__ "(), IRLAN_WATCHDOG_TIMEOUT\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), IRLAN_WATCHDOG_TIMEOUT\n"); break; default: - DEBUG(2, __FUNCTION__ "(), Unknown event %d\n", event); + IRDA_DEBUG(2, __FUNCTION__ "(), Unknown event %d\n", event); break; } if (skb) @@ -456,7 +463,7 @@ static int irlan_client_state_arb(struct irlan_cb *self, IRLAN_EVENT event, static int irlan_client_state_data(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb) { - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); ASSERT(self != NULL, return -1;); ASSERT(self->magic == IRLAN_MAGIC, return -1;); @@ -470,7 +477,7 @@ static int irlan_client_state_data(struct irlan_cb *self, IRLAN_EVENT event, irlan_next_client_state(self, IRLAN_IDLE); break; default: - DEBUG(2, __FUNCTION__ "(), Unknown event %d\n", event); + IRDA_DEBUG(2, __FUNCTION__ "(), Unknown event %d\n", event); break; } if (skb) @@ -488,7 +495,7 @@ static int irlan_client_state_data(struct irlan_cb *self, IRLAN_EVENT event, static int irlan_client_state_close(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb) { - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); if (skb) dev_kfree_skb(skb); @@ -505,7 +512,7 @@ static int irlan_client_state_close(struct irlan_cb *self, IRLAN_EVENT event, static int irlan_client_state_sync(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb) { - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); if (skb) dev_kfree_skb(skb); diff --git a/net/irda/irlan/irlan_common.c b/net/irda/irlan/irlan_common.c index 0e80c0db8..caa3550c1 100644 --- a/net/irda/irlan/irlan_common.c +++ b/net/irda/irlan/irlan_common.c @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Sun Aug 31 20:14:37 1997 - * Modified at: Tue Oct 5 11:36:11 1999 + * Modified at: Sun Oct 31 19:43:50 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>, @@ -61,7 +61,6 @@ static __u32 ckey, skey; /* Module parameters */ static int eth = 0; /* Use "eth" or "irlan" name for devices */ static int access = ACCESS_PEER; /* PEER, DIRECT or HOSTED */ -static int timeout = IRLAN_TIMEOUT; static char *irlan_state[] = { "IRLAN_IDLE", @@ -114,7 +113,7 @@ void irlan_watchdog_timer_expired(void *data) struct irmanager_event mgr_event; struct irlan_cb *self; - DEBUG(0, __FUNCTION__ "()\n"); + IRDA_DEBUG(0, __FUNCTION__ "()\n"); self = (struct irlan_cb *) data; @@ -123,7 +122,7 @@ void irlan_watchdog_timer_expired(void *data) /* Check if device still configured */ if (self->dev.start) { - DEBUG(0, __FUNCTION__ + IRDA_DEBUG(0, __FUNCTION__ "(), notifying irmanager to stop irlan!\n"); mgr_event.event = EVENT_IRLAN_STOP; sprintf(mgr_event.devname, "%s", self->ifname); @@ -137,7 +136,7 @@ void irlan_watchdog_timer_expired(void *data) */ self->notify_irmanager = FALSE; } else { - DEBUG(0, __FUNCTION__ "(), closing instance!\n"); + IRDA_DEBUG(0, __FUNCTION__ "(), closing instance!\n"); /*irlan_close(self);*/ } } @@ -150,7 +149,7 @@ void irlan_watchdog_timer_expired(void *data) */ void irlan_start_watchdog_timer(struct irlan_cb *self, int timeout) { - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); irda_start_timer(&self->watchdog_timer, timeout, (void *) self, irlan_watchdog_timer_expired); @@ -167,7 +166,7 @@ int __init irlan_init(void) struct irlan_cb *new; __u16 hints; - DEBUG(4, __FUNCTION__"()\n"); + IRDA_DEBUG(4, __FUNCTION__"()\n"); /* Allocate master structure */ irlan = hashbin_new(HB_LOCAL); @@ -176,10 +175,10 @@ int __init irlan_init(void) return -ENOMEM; } #ifdef CONFIG_PROC_FS - create_proc_entry("irlan", 0, proc_irda)->get_info = irlan_proc_read; + create_proc_info_entry("irlan", 0, proc_irda, irlan_proc_read); #endif /* CONFIG_PROC_FS */ - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); hints = irlmp_service_to_hint(S_LAN); @@ -205,7 +204,7 @@ int __init irlan_init(void) void irlan_cleanup(void) { - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); irlmp_unregister_client(ckey); @@ -230,7 +229,7 @@ int irlan_register_netdev(struct irlan_cb *self) { int i=0; - DEBUG(0, __FUNCTION__ "()\n"); + IRDA_DEBUG(0, __FUNCTION__ "()\n"); /* Check if we should call the device eth<x> or irlan<x> */ if (!eth) { @@ -242,7 +241,7 @@ int irlan_register_netdev(struct irlan_cb *self) self->dev.name = self->ifname; if (register_netdev(&self->dev) != 0) { - DEBUG(2, __FUNCTION__ "(), register_netdev() failed!\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), register_netdev() failed!\n"); return -1; } self->netdev_registered = TRUE; @@ -260,7 +259,7 @@ struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr, int netdev) { struct irlan_cb *self; - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); /* * Initialize the irlan structure. @@ -321,7 +320,7 @@ static void __irlan_close(struct irlan_cb *self) { struct sk_buff *skb; - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRLAN_MAGIC, return;); @@ -331,6 +330,9 @@ static void __irlan_close(struct irlan_cb *self) /* Close all open connections and remove TSAPs */ irlan_close_tsaps(self); + + if (self->client.iriap) + iriap_close(self->client.iriap); /* Remove frames queued on the control channel */ while ((skb = skb_dequeue(&self->client.txq))) { @@ -356,21 +358,21 @@ void irlan_close(struct irlan_cb *self) { struct irlan_cb *entry; - DEBUG(0, __FUNCTION__ "()\n"); + IRDA_DEBUG(0, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRLAN_MAGIC, return;); /* Check if device is still configured */ if (self->dev.start) { - DEBUG(0, __FUNCTION__ + IRDA_DEBUG(0, __FUNCTION__ "(), Device still configured, closing later!\n"); /* Give it a chance to reconnect */ irlan_start_watchdog_timer(self, IRLAN_TIMEOUT); return; } - DEBUG(2, __FUNCTION__ "(), daddr=%08x\n", self->daddr); + IRDA_DEBUG(2, __FUNCTION__ "(), daddr=%08x\n", self->daddr); entry = hashbin_remove(irlan, self->daddr, NULL); ASSERT(entry == self, return;); @@ -391,7 +393,7 @@ void irlan_connect_indication(void *instance, void *sap, struct qos_info *qos, struct irlan_cb *self; struct tsap_cb *tsap; - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); self = (struct irlan_cb *) instance; tsap = (struct tsap_cb *) sap; @@ -403,7 +405,7 @@ void irlan_connect_indication(void *instance, void *sap, struct qos_info *qos, self->max_sdu_size = max_sdu_size; self->max_header_size = max_header_size; - DEBUG(0, "IrLAN, We are now connected!\n"); + IRDA_DEBUG(0, "IrLAN, We are now connected!\n"); del_timer(&self->watchdog_timer); @@ -438,7 +440,7 @@ void irlan_connect_confirm(void *instance, void *sap, struct qos_info *qos, /* TODO: we could set the MTU depending on the max_sdu_size */ - DEBUG(2, "IrLAN, We are now connected!\n"); + IRDA_DEBUG(2, "IrLAN, We are now connected!\n"); del_timer(&self->watchdog_timer); /* @@ -470,7 +472,7 @@ void irlan_disconnect_indication(void *instance, void *sap, LM_REASON reason, struct irlan_cb *self; struct tsap_cb *tsap; - DEBUG(0, __FUNCTION__ "(), reason=%d\n", reason); + IRDA_DEBUG(0, __FUNCTION__ "(), reason=%d\n", reason); self = (struct irlan_cb *) instance; tsap = (struct tsap_cb *) sap; @@ -482,7 +484,7 @@ void irlan_disconnect_indication(void *instance, void *sap, LM_REASON reason, ASSERT(tsap == self->tsap_data, return;); - DEBUG(2, "IrLAN, data channel disconnected by peer!\n"); + IRDA_DEBUG(2, "IrLAN, data channel disconnected by peer!\n"); switch(reason) { case LM_USER_REQUEST: /* User request */ @@ -492,13 +494,13 @@ void irlan_disconnect_indication(void *instance, void *sap, LM_REASON reason, irlan_start_watchdog_timer(self, IRLAN_TIMEOUT); break; case LM_CONNECT_FAILURE: /* Failed to establish IrLAP connection */ - DEBUG(2, __FUNCTION__ "(), LM_CONNECT_FAILURE not impl\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), LM_CONNECT_FAILURE not impl\n"); break; case LM_LAP_RESET: /* IrLAP reset */ - DEBUG(2, __FUNCTION__ "(), LM_CONNECT_FAILURE not impl\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), LM_CONNECT_FAILURE not impl\n"); break; case LM_INIT_DISCONNECT: - DEBUG(2, __FUNCTION__ "(), LM_CONNECT_FAILURE not impl\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), LM_CONNECT_FAILURE not impl\n"); break; default: break; @@ -513,7 +515,7 @@ void irlan_open_data_tsap(struct irlan_cb *self) struct tsap_cb *tsap; notify_t notify; - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRLAN_MAGIC, return;); @@ -535,7 +537,7 @@ void irlan_open_data_tsap(struct irlan_cb *self) tsap = irttp_open_tsap(LSAP_ANY, DEFAULT_INITIAL_CREDIT, ¬ify); if (!tsap) { - DEBUG(2, __FUNCTION__ "(), Got no tsap!\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), Got no tsap!\n"); return; } self->tsap_data = tsap; @@ -549,7 +551,7 @@ void irlan_open_data_tsap(struct irlan_cb *self) void irlan_close_tsaps(struct irlan_cb *self) { - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRLAN_MAGIC, return;); @@ -634,7 +636,7 @@ int irlan_run_ctrl_tx_queue(struct irlan_cb *self) { struct sk_buff *skb; - DEBUG(3, __FUNCTION__ "()\n"); + IRDA_DEBUG(3, __FUNCTION__ "()\n"); if (irda_lock(&self->client.tx_busy) == FALSE) return -EBUSY; @@ -653,7 +655,7 @@ int irlan_run_ctrl_tx_queue(struct irlan_cb *self) dev_kfree_skb(skb); return -1; } - DEBUG(3, __FUNCTION__ "(), sending ...\n"); + IRDA_DEBUG(3, __FUNCTION__ "(), sending ...\n"); return irttp_data_request(self->client.tsap_ctrl, skb); } @@ -666,7 +668,7 @@ int irlan_run_ctrl_tx_queue(struct irlan_cb *self) */ void irlan_ctrl_data_request(struct irlan_cb *self, struct sk_buff *skb) { - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); /* Queue command */ skb_queue_tail(&self->client.txq, skb); @@ -686,7 +688,7 @@ void irlan_get_provider_info(struct irlan_cb *self) struct sk_buff *skb; __u8 *frame; - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRLAN_MAGIC, return;); @@ -719,7 +721,7 @@ void irlan_open_data_channel(struct irlan_cb *self) struct sk_buff *skb; __u8 *frame; - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRLAN_MAGIC, return;); @@ -752,7 +754,7 @@ void irlan_close_data_channel(struct irlan_cb *self) struct sk_buff *skb; __u8 *frame; - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRLAN_MAGIC, return;); @@ -791,7 +793,7 @@ void irlan_open_unicast_addr(struct irlan_cb *self) struct sk_buff *skb; __u8 *frame; - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRLAN_MAGIC, return;); @@ -830,7 +832,7 @@ void irlan_set_broadcast_filter(struct irlan_cb *self, int status) struct sk_buff *skb; __u8 *frame; - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRLAN_MAGIC, return;); @@ -870,7 +872,7 @@ void irlan_set_multicast_filter(struct irlan_cb *self, int status) struct sk_buff *skb; __u8 *frame; - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRLAN_MAGIC, return;); @@ -911,7 +913,7 @@ void irlan_get_unicast_addr(struct irlan_cb *self) struct sk_buff *skb; __u8 *frame; - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRLAN_MAGIC, return;); @@ -947,7 +949,7 @@ void irlan_get_media_char(struct irlan_cb *self) struct sk_buff *skb; __u8 *frame; - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRLAN_MAGIC, return;); @@ -1034,7 +1036,7 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, int n=0; if (skb == NULL) { - DEBUG(2, __FUNCTION__ "(), Got NULL skb\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), Got NULL skb\n"); return 0; } @@ -1051,7 +1053,7 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, ASSERT(value_len > 0, return 0;); break; default: - DEBUG(2, __FUNCTION__ "(), Unknown parameter type!\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), Unknown parameter type!\n"); return 0; break; } @@ -1061,7 +1063,7 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, /* Make space for data */ if (skb_tailroom(skb) < (param_len+value_len+3)) { - DEBUG(2, __FUNCTION__ "(), No more space at end of skb\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), No more space at end of skb\n"); return 0; } skb_put(skb, param_len+value_len+3); @@ -1108,13 +1110,13 @@ int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len) __u16 val_len; int n=0; - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); /* get length of parameter name (1 byte) */ name_len = buf[n++]; if (name_len > 254) { - DEBUG(2, __FUNCTION__ "(), name_len > 254\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), name_len > 254\n"); return -RSP_INVALID_COMMAND_FORMAT; } @@ -1131,7 +1133,7 @@ int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len) le16_to_cpus(&val_len); n+=2; if (val_len > 1016) { - DEBUG(2, __FUNCTION__ "(), parameter length to long\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), parameter length to long\n"); return -RSP_INVALID_COMMAND_FORMAT; } *len = val_len; @@ -1141,8 +1143,8 @@ int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len) value[val_len] = '\0'; n+=val_len; - DEBUG(4, "Parameter: %s ", name); - DEBUG(4, "Value: %s\n", value); + IRDA_DEBUG(4, "Parameter: %s ", name); + IRDA_DEBUG(4, "Value: %s\n", value); return n; } diff --git a/net/irda/irlan/irlan_eth.c b/net/irda/irlan/irlan_eth.c index e24b14109..85c75b846 100644 --- a/net/irda/irlan/irlan_eth.c +++ b/net/irda/irlan/irlan_eth.c @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Thu Oct 15 08:37:58 1998 - * Modified at: Sun Jun 20 20:23:33 1999 + * Modified at: Sat Oct 30 12:58:30 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * Sources: skeleton.c by Donald Becker <becker@CESDIS.gsfc.nasa.gov> * slip.c by Laurence Culhane, <loz@holmes.demon.co.uk> @@ -50,7 +50,7 @@ int irlan_eth_init(struct net_device *dev) struct irmanager_event mgr_event; struct irlan_cb *self; - DEBUG(2, __FUNCTION__"()\n"); + IRDA_DEBUG(2, __FUNCTION__"()\n"); ASSERT(dev != NULL, return -1;); @@ -115,7 +115,7 @@ int irlan_eth_open(struct net_device *dev) { struct irlan_cb *self; - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); ASSERT(dev != NULL, return -1;); @@ -150,7 +150,7 @@ int irlan_eth_close(struct net_device *dev) { struct irlan_cb *self = (struct irlan_cb *) dev->priv; - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); /* Stop device */ dev->tbusy = 1; @@ -342,7 +342,7 @@ void irlan_eth_send_gratuitous_arp(struct net_device *dev) * is useful if we have changed access points on the same * subnet. */ - DEBUG(4, "IrLAN: Sending gratuitous ARP\n"); + IRDA_DEBUG(4, "IrLAN: Sending gratuitous ARP\n"); in_dev = in_dev_get(dev); if (in_dev == NULL) return; @@ -370,14 +370,14 @@ void irlan_eth_set_multicast_list(struct net_device *dev) self = dev->priv; - DEBUG(2, __FUNCTION__ "()\n"); + IRDA_DEBUG(2, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRLAN_MAGIC, return;); /* Check if data channel has been connected yet */ if (self->client.state != IRLAN_DATA) { - DEBUG(1, __FUNCTION__ "(), delaying!\n"); + IRDA_DEBUG(1, __FUNCTION__ "(), delaying!\n"); return; } @@ -387,20 +387,20 @@ void irlan_eth_set_multicast_list(struct net_device *dev) } else if ((dev->flags & IFF_ALLMULTI) || dev->mc_count > HW_MAX_ADDRS) { /* Disable promiscuous mode, use normal mode. */ - DEBUG(4, __FUNCTION__ "(), Setting multicast filter\n"); + IRDA_DEBUG(4, __FUNCTION__ "(), Setting multicast filter\n"); /* hardware_set_filter(NULL); */ irlan_set_multicast_filter(self, TRUE); } else if (dev->mc_count) { - DEBUG(4, __FUNCTION__ "(), Setting multicast filter\n"); + IRDA_DEBUG(4, __FUNCTION__ "(), Setting multicast filter\n"); /* Walk the address list, and load the filter */ /* hardware_set_filter(dev->mc_list); */ irlan_set_multicast_filter(self, TRUE); } else { - DEBUG(4, __FUNCTION__ "(), Clearing multicast filter\n"); + IRDA_DEBUG(4, __FUNCTION__ "(), Clearing multicast filter\n"); irlan_set_multicast_filter(self, FALSE); } diff --git a/net/irda/irlan/irlan_event.c b/net/irda/irlan/irlan_event.c index 93d7c4efe..50e9664cb 100644 --- a/net/irda/irlan/irlan_event.c +++ b/net/irda/irlan/irlan_event.c @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Tue Oct 20 09:10:16 1998 - * Modified at: Sun May 9 21:17:44 1999 + * Modified at: Sat Oct 30 12:59:01 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved. @@ -40,7 +40,7 @@ char *irlan_state[] = { void irlan_next_client_state(struct irlan_cb *self, IRLAN_STATE state) { - DEBUG(2, __FUNCTION__"(), %s\n", irlan_state[state]); + IRDA_DEBUG(2, __FUNCTION__"(), %s\n", irlan_state[state]); ASSERT(self != NULL, return;); ASSERT(self->magic == IRLAN_MAGIC, return;); @@ -50,7 +50,7 @@ void irlan_next_client_state(struct irlan_cb *self, IRLAN_STATE state) void irlan_next_provider_state(struct irlan_cb *self, IRLAN_STATE state) { - DEBUG(2, __FUNCTION__"(), %s\n", irlan_state[state]); + IRDA_DEBUG(2, __FUNCTION__"(), %s\n", irlan_state[state]); ASSERT(self != NULL, return;); ASSERT(self->magic == IRLAN_MAGIC, return;); diff --git a/net/irda/irlan/irlan_filter.c b/net/irda/irlan/irlan_filter.c index ec7178db4..ac0f5cdb8 100644 --- a/net/irda/irlan/irlan_filter.c +++ b/net/irda/irlan/irlan_filter.c @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Fri Jan 29 11:16:38 1999 - * Modified at: Fri May 14 23:11:01 1999 + * Modified at: Sat Oct 30 12:58:45 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved. @@ -41,7 +41,7 @@ void handle_filter_request(struct irlan_cb *self, struct sk_buff *skb) if ((self->provider.filter_type == IRLAN_DIRECTED) && (self->provider.filter_operation == DYNAMIC)) { - DEBUG(0, "Giving peer a dynamic Ethernet address\n"); + IRDA_DEBUG(0, "Giving peer a dynamic Ethernet address\n"); self->provider.mac_address[0] = 0x40; self->provider.mac_address[1] = 0x00; self->provider.mac_address[2] = 0x00; @@ -71,7 +71,7 @@ void handle_filter_request(struct irlan_cb *self, struct sk_buff *skb) if ((self->provider.filter_type == IRLAN_DIRECTED) && (self->provider.filter_mode == FILTER)) { - DEBUG(0, "Directed filter on\n"); + IRDA_DEBUG(0, "Directed filter on\n"); skb->data[0] = 0x00; /* Success */ skb->data[1] = 0x00; return; @@ -79,7 +79,7 @@ void handle_filter_request(struct irlan_cb *self, struct sk_buff *skb) if ((self->provider.filter_type == IRLAN_DIRECTED) && (self->provider.filter_mode == NONE)) { - DEBUG(0, "Directed filter off\n"); + IRDA_DEBUG(0, "Directed filter off\n"); skb->data[0] = 0x00; /* Success */ skb->data[1] = 0x00; return; @@ -88,7 +88,7 @@ void handle_filter_request(struct irlan_cb *self, struct sk_buff *skb) if ((self->provider.filter_type == IRLAN_BROADCAST) && (self->provider.filter_mode == FILTER)) { - DEBUG(0, "Broadcast filter on\n"); + IRDA_DEBUG(0, "Broadcast filter on\n"); skb->data[0] = 0x00; /* Success */ skb->data[1] = 0x00; return; @@ -96,7 +96,7 @@ void handle_filter_request(struct irlan_cb *self, struct sk_buff *skb) if ((self->provider.filter_type == IRLAN_BROADCAST) && (self->provider.filter_mode == NONE)) { - DEBUG(0, "Broadcast filter off\n"); + IRDA_DEBUG(0, "Broadcast filter off\n"); skb->data[0] = 0x00; /* Success */ skb->data[1] = 0x00; return; @@ -104,7 +104,7 @@ void handle_filter_request(struct irlan_cb *self, struct sk_buff *skb) if ((self->provider.filter_type == IRLAN_MULTICAST) && (self->provider.filter_mode == FILTER)) { - DEBUG(0, "Multicast filter on\n"); + IRDA_DEBUG(0, "Multicast filter on\n"); skb->data[0] = 0x00; /* Success */ skb->data[1] = 0x00; return; @@ -112,7 +112,7 @@ void handle_filter_request(struct irlan_cb *self, struct sk_buff *skb) if ((self->provider.filter_type == IRLAN_MULTICAST) && (self->provider.filter_mode == NONE)) { - DEBUG(0, "Multicast filter off\n"); + IRDA_DEBUG(0, "Multicast filter off\n"); skb->data[0] = 0x00; /* Success */ skb->data[1] = 0x00; return; @@ -120,7 +120,7 @@ void handle_filter_request(struct irlan_cb *self, struct sk_buff *skb) if ((self->provider.filter_type == IRLAN_MULTICAST) && (self->provider.filter_operation == GET)) { - DEBUG(0, "Multicast filter get\n"); + IRDA_DEBUG(0, "Multicast filter get\n"); skb->data[0] = 0x00; /* Success? */ skb->data[1] = 0x02; irlan_insert_string_param(skb, "FILTER_MODE", "NONE"); @@ -130,7 +130,7 @@ void handle_filter_request(struct irlan_cb *self, struct sk_buff *skb) skb->data[0] = 0x00; /* Command not supported */ skb->data[1] = 0x00; - DEBUG(0, "Not implemented!\n"); + IRDA_DEBUG(0, "Not implemented!\n"); } /* @@ -143,20 +143,20 @@ void irlan_check_command_param(struct irlan_cb *self, char *param, char *value) { __u8 *bytes; - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); bytes = value; ASSERT(self != NULL, return;); ASSERT(self->magic == IRLAN_MAGIC, return;); - DEBUG(4, "%s, %s\n", param, value); + IRDA_DEBUG(4, "%s, %s\n", param, value); /* * This is experimental!! DB. */ if (strcmp(param, "MODE") == 0) { - DEBUG(0, __FUNCTION__ "()\n"); + IRDA_DEBUG(0, __FUNCTION__ "()\n"); self->use_udata = TRUE; return; } diff --git a/net/irda/irlan/irlan_provider.c b/net/irda/irlan/irlan_provider.c index f3a87bf86..aeac03f7b 100644 --- a/net/irda/irlan/irlan_provider.c +++ b/net/irda/irlan/irlan_provider.c @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Sun Aug 31 20:14:37 1997 - * Modified at: Wed Jun 9 11:03:29 1999 + * Modified at: Sat Oct 30 12:52:10 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * Sources: skeleton.c by Donald Becker <becker@CESDIS.gsfc.nasa.gov> * slip.c by Laurence Culhane, <loz@holmes.demon.co.uk> @@ -70,7 +70,7 @@ static int irlan_provider_data_indication(void *instance, void *sap, struct irlan_cb *self; __u8 code; - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); self = (struct irlan_cb *) instance; @@ -82,32 +82,32 @@ static int irlan_provider_data_indication(void *instance, void *sap, code = skb->data[0]; switch(code) { case CMD_GET_PROVIDER_INFO: - DEBUG(4, "Got GET_PROVIDER_INFO command!\n"); + IRDA_DEBUG(4, "Got GET_PROVIDER_INFO command!\n"); irlan_do_provider_event(self, IRLAN_GET_INFO_CMD, skb); break; case CMD_GET_MEDIA_CHAR: - DEBUG(4, "Got GET_MEDIA_CHAR command!\n"); + IRDA_DEBUG(4, "Got GET_MEDIA_CHAR command!\n"); irlan_do_provider_event(self, IRLAN_GET_MEDIA_CMD, skb); break; case CMD_OPEN_DATA_CHANNEL: - DEBUG(4, "Got OPEN_DATA_CHANNEL command!\n"); + IRDA_DEBUG(4, "Got OPEN_DATA_CHANNEL command!\n"); irlan_do_provider_event(self, IRLAN_OPEN_DATA_CMD, skb); break; case CMD_FILTER_OPERATION: - DEBUG(4, "Got FILTER_OPERATION command!\n"); + IRDA_DEBUG(4, "Got FILTER_OPERATION command!\n"); irlan_do_provider_event(self, IRLAN_FILTER_CONFIG_CMD, skb); break; case CMD_RECONNECT_DATA_CHAN: - DEBUG(2, __FUNCTION__"(), Got RECONNECT_DATA_CHAN command\n"); - DEBUG(2, __FUNCTION__"(), NOT IMPLEMENTED\n"); + IRDA_DEBUG(2, __FUNCTION__"(), Got RECONNECT_DATA_CHAN command\n"); + IRDA_DEBUG(2, __FUNCTION__"(), NOT IMPLEMENTED\n"); break; case CMD_CLOSE_DATA_CHAN: - DEBUG(2, "Got CLOSE_DATA_CHAN command!\n"); - DEBUG(2, __FUNCTION__"(), NOT IMPLEMENTED\n"); + IRDA_DEBUG(2, "Got CLOSE_DATA_CHAN command!\n"); + IRDA_DEBUG(2, __FUNCTION__"(), NOT IMPLEMENTED\n"); break; default: - DEBUG(2, __FUNCTION__ "(), Unknown command!\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), Unknown command!\n"); break; } return 0; @@ -129,7 +129,7 @@ static void irlan_provider_connect_indication(void *instance, void *sap, struct tsap_cb *tsap; __u32 saddr, daddr; - DEBUG(0, __FUNCTION__ "()\n"); + IRDA_DEBUG(0, __FUNCTION__ "()\n"); self = (struct irlan_cb *) instance; tsap = (struct tsap_cb *) sap; @@ -150,11 +150,11 @@ static void irlan_provider_connect_indication(void *instance, void *sap, new = (struct irlan_cb *) hashbin_find(irlan, daddr, NULL); if (new) { ASSERT(new->magic == IRLAN_MAGIC, return;); - DEBUG(0, __FUNCTION__ "(), found instance!\n"); + IRDA_DEBUG(0, __FUNCTION__ "(), found instance!\n"); /* Update saddr, since client may have moved to a new link */ new->saddr = saddr; - DEBUG(2, __FUNCTION__ "(), saddr=%08x\n", new->saddr); + IRDA_DEBUG(2, __FUNCTION__ "(), saddr=%08x\n", new->saddr); /* Make sure that any old provider control TSAP is removed */ if ((new != self) && new->provider.tsap_ctrl) { @@ -165,7 +165,7 @@ static void irlan_provider_connect_indication(void *instance, void *sap, } } else { /* This must be the master instance, so start a new instance */ - DEBUG(0, __FUNCTION__ "(), starting new provider!\n"); + IRDA_DEBUG(0, __FUNCTION__ "(), starting new provider!\n"); new = irlan_open(saddr, daddr, TRUE); } @@ -182,7 +182,7 @@ static void irlan_provider_connect_indication(void *instance, void *sap, new->provider.tsap_ctrl = irttp_dup(self->provider.tsap_ctrl, new); if (!new->provider.tsap_ctrl) { - DEBUG(0, __FUNCTION__ "(), dup failed!\n"); + IRDA_DEBUG(0, __FUNCTION__ "(), dup failed!\n"); return; } @@ -245,7 +245,7 @@ void irlan_provider_disconnect_indication(void *instance, void *sap, struct irlan_cb *self; struct tsap_cb *tsap; - DEBUG(4, __FUNCTION__ "(), reason=%d\n", reason); + IRDA_DEBUG(4, __FUNCTION__ "(), reason=%d\n", reason); self = (struct irlan_cb *) instance; tsap = (struct tsap_cb *) sap; @@ -299,7 +299,7 @@ int irlan_provider_parse_command(struct irlan_cb *self, int cmd, ASSERT(skb != NULL, return -RSP_PROTOCOL_ERROR;); - DEBUG(4, __FUNCTION__ "(), skb->len=%d\n", (int)skb->len); + IRDA_DEBUG(4, __FUNCTION__ "(), skb->len=%d\n", (int)skb->len); ASSERT(self != NULL, return -RSP_PROTOCOL_ERROR;); ASSERT(self->magic == IRLAN_MAGIC, return -RSP_PROTOCOL_ERROR;); @@ -321,7 +321,7 @@ int irlan_provider_parse_command(struct irlan_cb *self, int cmd, /* How many parameters? */ count = frame[1]; - DEBUG(4, "Got %d parameters\n", count); + IRDA_DEBUG(4, "Got %d parameters\n", count); ptr = frame+2; @@ -329,7 +329,7 @@ int irlan_provider_parse_command(struct irlan_cb *self, int cmd, for (i=0; i<count;i++) { ret = irlan_extract_param(ptr, name, value, &val_len); if (ret < 0) { - DEBUG(2, __FUNCTION__ "(), IrLAN, Error!\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), IrLAN, Error!\n"); break; } ptr+=ret; @@ -354,7 +354,7 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command, { struct sk_buff *skb; - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); ASSERT(self != NULL, return;); ASSERT(self->magic == IRLAN_MAGIC, return;); @@ -379,7 +379,7 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command, irlan_insert_string_param(skb, "MEDIA", "802.5"); break; default: - DEBUG(2, __FUNCTION__ "(), unknown media type!\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), unknown media type!\n"); break; } irlan_insert_short_param(skb, "IRLAN_VER", 0x0101); @@ -403,7 +403,7 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command, irlan_insert_string_param(skb, "ACCESS_TYPE", "HOSTED"); break; default: - DEBUG(2, __FUNCTION__ "(), Unknown access type\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), Unknown access type\n"); break; } irlan_insert_short_param(skb, "MAX_FRAME", 0x05ee); @@ -424,7 +424,7 @@ void irlan_provider_send_reply(struct irlan_cb *self, int command, handle_filter_request(self, skb); break; default: - DEBUG(2, __FUNCTION__ "(), Unknown command!\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), Unknown command!\n"); break; } @@ -442,7 +442,7 @@ int irlan_provider_open_ctrl_tsap(struct irlan_cb *self) struct tsap_cb *tsap; notify_t notify; - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); ASSERT(self != NULL, return -1;); ASSERT(self->magic == IRLAN_MAGIC, return -1;); @@ -463,7 +463,7 @@ int irlan_provider_open_ctrl_tsap(struct irlan_cb *self) tsap = irttp_open_tsap(LSAP_ANY, 1, ¬ify); if (!tsap) { - DEBUG(2, __FUNCTION__ "(), Got no tsap!\n"); + IRDA_DEBUG(2, __FUNCTION__ "(), Got no tsap!\n"); return -1; } self->provider.tsap_ctrl = tsap; diff --git a/net/irda/irlan/irlan_provider_event.c b/net/irda/irlan/irlan_provider_event.c index 29e660fa7..19a1f2f0d 100644 --- a/net/irda/irlan/irlan_provider_event.c +++ b/net/irda/irlan/irlan_provider_event.c @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Sun Aug 31 20:14:37 1997 - * Modified at: Fri May 7 10:53:58 1999 + * Modified at: Sat Oct 30 12:52:41 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved. @@ -72,7 +72,7 @@ void irlan_do_provider_event(struct irlan_cb *self, IRLAN_EVENT event, static int irlan_provider_state_idle(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb) { - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); ASSERT(self != NULL, return -1;); @@ -82,7 +82,7 @@ static int irlan_provider_state_idle(struct irlan_cb *self, IRLAN_EVENT event, irlan_next_provider_state( self, IRLAN_INFO); break; default: - DEBUG(4, __FUNCTION__ "(), Unknown event %d\n", event); + IRDA_DEBUG(4, __FUNCTION__ "(), Unknown event %d\n", event); break; } if (skb) @@ -101,7 +101,7 @@ static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, { int ret; - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); ASSERT(self != NULL, return -1;); @@ -147,7 +147,7 @@ static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, irlan_next_provider_state(self, IRLAN_IDLE); break; default: - DEBUG( 0, __FUNCTION__ "(), Unknown event %d\n", event); + IRDA_DEBUG( 0, __FUNCTION__ "(), Unknown event %d\n", event); break; } if (skb) @@ -166,7 +166,7 @@ static int irlan_provider_state_info(struct irlan_cb *self, IRLAN_EVENT event, static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb) { - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); ASSERT(self != NULL, return -1;); @@ -186,7 +186,7 @@ static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, irlan_next_provider_state(self, IRLAN_IDLE); break; default: - DEBUG(2, __FUNCTION__ "(), Unknown event %d\n", event); + IRDA_DEBUG(2, __FUNCTION__ "(), Unknown event %d\n", event); break; } if (skb) @@ -205,7 +205,7 @@ static int irlan_provider_state_open(struct irlan_cb *self, IRLAN_EVENT event, static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb) { - DEBUG(4, __FUNCTION__ "()\n"); + IRDA_DEBUG(4, __FUNCTION__ "()\n"); ASSERT(self != NULL, return -1;); ASSERT(self->magic == IRLAN_MAGIC, return -1;); @@ -221,7 +221,7 @@ static int irlan_provider_state_data(struct irlan_cb *self, IRLAN_EVENT event, irlan_next_provider_state(self, IRLAN_IDLE); break; default: - DEBUG( 0, __FUNCTION__ "(), Unknown event %d\n", event); + IRDA_DEBUG( 0, __FUNCTION__ "(), Unknown event %d\n", event); break; } if (skb) diff --git a/net/irda/irmod.c b/net/irda/irmod.c index 7a2fa169a..80c71d998 100644 --- a/net/irda/irmod.c +++ b/net/irda/irmod.c @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Mon Dec 15 13:55:39 1997 - * Modified at: Mon Oct 18 14:54:35 1999 + * Modified at: Sun Oct 31 20:31:01 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1997, 1999 Dag Brattli, All Rights Reserved. @@ -130,6 +130,8 @@ EXPORT_SYMBOL(irda_param_pack); EXPORT_SYMBOL(irda_param_unpack); /* IrIAP/IrIAS */ +EXPORT_SYMBOL(iriap_open); +EXPORT_SYMBOL(iriap_close); EXPORT_SYMBOL(iriap_getvaluebyclass_request); EXPORT_SYMBOL(irias_object_change_attribute); EXPORT_SYMBOL(irias_add_integer_attrib); @@ -216,7 +218,6 @@ int __init irda_init(void) #ifdef MODULE irda_device_init(); /* Called by init/main.c when non-modular */ #endif - iriap_init(); irttp_init(); @@ -393,8 +394,9 @@ static int irda_open( struct inode * inode, struct file *file) { IRDA_DEBUG( 4, __FUNCTION__ "()\n"); - if ( irda.in_use) { - IRDA_DEBUG( 0, __FUNCTION__ "(), irmanager is already running!\n"); + if (irda.in_use) { + IRDA_DEBUG(0, __FUNCTION__ + "(), irmanager is already running!\n"); return -1; } irda.in_use = TRUE; @@ -410,8 +412,8 @@ static int irda_open( struct inode * inode, struct file *file) * Ioctl, used by irmanager to ... * */ -static int irda_ioctl( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) +static int irda_ioctl(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) { struct irda_todo *todo; int err = 0; @@ -419,14 +421,14 @@ static int irda_ioctl( struct inode *inode, struct file *filp, IRDA_DEBUG(4, __FUNCTION__ "()\n"); - if ( _IOC_DIR(cmd) & _IOC_READ) + if (_IOC_DIR(cmd) & _IOC_READ) err = verify_area( VERIFY_WRITE, (void *) arg, size); - else if ( _IOC_DIR(cmd) & _IOC_WRITE) + else if (_IOC_DIR(cmd) & _IOC_WRITE) err = verify_area( VERIFY_READ, (void *) arg, size); - if ( err) + if (err) return err; - switch( cmd) { + switch (cmd) { case IRMGR_IOCTNPC: /* Got process context! */ IRDA_DEBUG(4, __FUNCTION__ "(), got process context!\n"); @@ -523,24 +525,6 @@ void irda_mod_dec_use_count(void) #endif } -/* - * Function irda_proc_modcount (inode, fill) - * - * Use by the proc file system functions to prevent the irda module - * being removed while the use is standing in the net/irda directory - */ -void irda_proc_modcount(struct inode *inode, int fill) -{ -#ifdef MODULE -#ifdef CONFIG_PROC_FS - if (fill) - MOD_INC_USE_COUNT; - else - MOD_DEC_USE_COUNT; -#endif /* CONFIG_PROC_FS */ -#endif /* MODULE */ -} - #ifdef MODULE MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); diff --git a/net/irda/irproc.c b/net/irda/irproc.c index 940aacf7c..820fbd275 100644 --- a/net/irda/irproc.c +++ b/net/irda/irproc.c @@ -25,6 +25,7 @@ #include <linux/miscdevice.h> #include <linux/proc_fs.h> +#include <linux/module.h> #include <net/irda/irda.h> #include <net/irda/irmod.h> @@ -70,12 +71,10 @@ void irda_proc_register(void) int i; proc_irda = create_proc_entry("net/irda", S_IFDIR, NULL); -#ifdef MODULE - proc_irda->fill_inode = &irda_proc_modcount; -#endif /* MODULE */ + proc_irda->owner = THIS_MODULE; for (i=0;i<IRDA_ENTRIES_NUM;i++) - create_proc_entry(dir[i].name,0,proc_irda)->get_info=dir[i].fn; + create_proc_info_entry(dir[i].name,0,proc_irda,dir[i].fn); } /* diff --git a/net/irda/wrapper.c b/net/irda/wrapper.c index f884290f7..6f21b15f3 100644 --- a/net/irda/wrapper.c +++ b/net/irda/wrapper.c @@ -6,7 +6,7 @@ * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Mon Aug 4 20:40:53 1997 - * Modified at: Mon Oct 18 15:51:58 1999 + * Modified at: Sat Oct 30 17:24:25 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * Modified at: Fri May 28 3:11 CST 1999 * Modified by: Horst von Brand <vonbrand@sleipnir.valparaiso.cl> @@ -39,17 +39,21 @@ static inline int stuff_byte(__u8 byte, __u8 *buf); -static int state_outside_frame(struct net_device *dev, - struct iobuff_t *rx_buff, __u8 byte); -static int state_begin_frame(struct net_device *dev, - struct iobuff_t *rx_buff, __u8 byte); -static int state_link_escape(struct net_device *dev, - struct iobuff_t *rx_buff, __u8 byte); -static int state_inside_frame(struct net_device *dev, +static void state_outside_frame(struct net_device *dev, + struct net_device_stats *stats, + struct iobuff_t *rx_buff, __u8 byte); +static void state_begin_frame(struct net_device *dev, + struct net_device_stats *stats, + struct iobuff_t *rx_buff, __u8 byte); +static void state_link_escape(struct net_device *dev, + struct net_device_stats *stats, struct iobuff_t *rx_buff, __u8 byte); +static void state_inside_frame(struct net_device *dev, + struct net_device_stats *stats, + struct iobuff_t *rx_buff, __u8 byte); -static int (*state[])(struct net_device *dev, struct iobuff_t *rx_buff, - __u8 byte) = +static void (*state[])(struct net_device *dev, struct net_device_stats *stats, + struct iobuff_t *rx_buff, __u8 byte) = { state_outside_frame, state_begin_frame, @@ -149,18 +153,18 @@ static inline int stuff_byte(__u8 byte, __u8 *buf) /* * Function async_bump (buf, len, stats) * - * Got a frame, make a copy of it, and pass it up the stack! - * + * Got a frame, make a copy of it, and pass it up the stack! We can try + * to inline it since it's only called from state_inside_frame */ -int async_bump(struct net_device *dev, __u8 *buf, int len) +inline void async_bump(struct net_device *dev, struct net_device_stats *stats, + __u8 *buf, int len) { - struct net_device_stats *stats = dev->get_stats(dev); struct sk_buff *skb; skb = dev_alloc_skb(len+1); if (!skb) { stats->rx_dropped++; - return -ENOMEM; + return; } /* Align IP header to 20 bytes */ @@ -177,9 +181,7 @@ int async_bump(struct net_device *dev, __u8 *buf, int len) netif_rx(skb); stats->rx_packets++; - stats->rx_bytes += len; - - return skb->len; + stats->rx_bytes += len; } /* @@ -188,10 +190,11 @@ int async_bump(struct net_device *dev, __u8 *buf, int len) * Parse and de-stuff frame received from the IrDA-port * */ -inline int async_unwrap_char(struct net_device *dev, struct iobuff_t *rx_buff, - __u8 byte) +inline void async_unwrap_char(struct net_device *dev, + struct net_device_stats *stats, + struct iobuff_t *rx_buff, __u8 byte) { - return (*state[rx_buff->state])(dev, rx_buff, byte); + (*state[rx_buff->state])(dev, stats, rx_buff, byte); } /* @@ -200,8 +203,9 @@ inline int async_unwrap_char(struct net_device *dev, struct iobuff_t *rx_buff, * * */ -static int state_outside_frame(struct net_device *dev, - struct iobuff_t *rx_buff, __u8 byte) +static void state_outside_frame(struct net_device *dev, + struct net_device_stats *stats, + struct iobuff_t *rx_buff, __u8 byte) { switch (byte) { case BOF: @@ -217,7 +221,6 @@ static int state_outside_frame(struct net_device *dev, default: break; } - return 0; } /* @@ -226,11 +229,10 @@ static int state_outside_frame(struct net_device *dev, * Begin of frame detected * */ -static int state_begin_frame(struct net_device *dev, - struct iobuff_t *rx_buff, __u8 byte) +static void state_begin_frame(struct net_device *dev, + struct net_device_stats *stats, + struct iobuff_t *rx_buff, __u8 byte) { - struct net_device_stats *stats = dev->get_stats(dev); - /* Time to initialize receive buffer */ rx_buff->data = rx_buff->head; rx_buff->len = 0; @@ -258,7 +260,6 @@ static int state_begin_frame(struct net_device *dev, rx_buff->state = INSIDE_FRAME; break; } - return 0; } /* @@ -267,8 +268,9 @@ static int state_begin_frame(struct net_device *dev, * * */ -static int state_link_escape(struct net_device *dev, - struct iobuff_t *rx_buff, __u8 byte) +static void state_link_escape(struct net_device *dev, + struct net_device_stats *stats, + struct iobuff_t *rx_buff, __u8 byte) { switch (byte) { case BOF: /* New frame? */ @@ -298,7 +300,6 @@ static int state_link_escape(struct net_device *dev, } break; } - return 0; } /* @@ -307,10 +308,10 @@ static int state_link_escape(struct net_device *dev, * Handle bytes received within a frame * */ -static int state_inside_frame(struct net_device *dev, - struct iobuff_t *rx_buff, __u8 byte) +static void state_inside_frame(struct net_device *dev, + struct net_device_stats *stats, + struct iobuff_t *rx_buff, __u8 byte) { - struct net_device_stats *stats = dev->get_stats(dev); int ret = 0; switch (byte) { @@ -328,7 +329,7 @@ static int state_inside_frame(struct net_device *dev, /* Test FCS and signal success if the frame is good */ if (rx_buff->fcs == GOOD_FCS) { /* Deliver frame */ - async_bump(dev, rx_buff->data, rx_buff->len); + async_bump(dev, stats, rx_buff->data, rx_buff->len); ret = TRUE; break; } else { @@ -350,7 +351,6 @@ static int state_inside_frame(struct net_device *dev, } break; } - return 0; } diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index b46d1325d..9c472a937 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -967,9 +967,6 @@ struct net_proto_family netlink_family_ops = { void netlink_proto_init(struct net_proto *pro) { -#ifdef CONFIG_PROC_FS - struct proc_dir_entry *ent; -#endif struct sk_buff *dummy_skb; if (sizeof(struct netlink_skb_parms) > sizeof(dummy_skb->cb)) { @@ -978,7 +975,6 @@ void netlink_proto_init(struct net_proto *pro) } sock_register(&netlink_family_ops); #ifdef CONFIG_PROC_FS - ent = create_proc_entry("net/netlink", 0, 0); - ent->read_proc = netlink_read_proc; + create_proc_read_entry("net/netlink", 0, 0, netlink_read_proc, NULL); #endif } diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index c6b3a84c9..3c219cdf0 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c @@ -1268,27 +1268,6 @@ static struct notifier_block nr_dev_notifier = { 0 }; -#ifdef CONFIG_PROC_FS -static struct proc_dir_entry proc_net_nr = { - PROC_NET_NR, 2, "nr", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - nr_get_info -}; -static struct proc_dir_entry proc_net_nr_neigh = { - PROC_NET_NR_NEIGH, 8, "nr_neigh", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - nr_neigh_get_info -}; -static struct proc_dir_entry proc_net_nr_nodes = { - PROC_NET_NR_NODES, 8, "nr_nodes", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - nr_nodes_get_info -}; -#endif - static struct net_device *dev_nr; void __init nr_proto_init(struct net_proto *pro) @@ -1328,9 +1307,9 @@ void __init nr_proto_init(struct net_proto *pro) nr_loopback_init(); #ifdef CONFIG_PROC_FS - proc_net_register(&proc_net_nr); - proc_net_register(&proc_net_nr_neigh); - proc_net_register(&proc_net_nr_nodes); + proc_net_create("nr", 0, nr_get_info); + proc_net_create("nr_neigh", 0, nr_neigh_get_info); + proc_net_create("nr_nodes", 0, nr_nodes_get_info); #endif } @@ -1355,9 +1334,9 @@ void cleanup_module(void) int i; #ifdef CONFIG_PROC_FS - proc_net_unregister(PROC_NET_NR); - proc_net_unregister(PROC_NET_NR_NEIGH); - proc_net_unregister(PROC_NET_NR_NODES); + proc_net_remove("nr"); + proc_net_remove("nr_neigh"); + proc_net_remove("nr_nodes"); #endif nr_loopback_clear(); diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 2a91fdf64..48c9578e3 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -1698,7 +1698,7 @@ static int packet_mmap(struct file *file, struct socket *sock, struct vm_area_st int err = -EINVAL; int i; - if (vma->vm_offset) + if (vma->vm_pgoff) return -EINVAL; size = vma->vm_end - vma->vm_start; diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index ba9935aac..114e03944 100644 --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c @@ -1458,33 +1458,6 @@ static struct notifier_block rose_dev_notifier = { 0 }; -#ifdef CONFIG_PROC_FS -static struct proc_dir_entry proc_net_rose = { - PROC_NET_RS, 4, "rose", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - rose_get_info -}; -static struct proc_dir_entry proc_net_rose_neigh = { - PROC_NET_RS_NEIGH, 10, "rose_neigh", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - rose_neigh_get_info -}; -static struct proc_dir_entry proc_net_rose_nodes = { - PROC_NET_RS_NODES, 10, "rose_nodes", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - rose_nodes_get_info -}; -static struct proc_dir_entry proc_net_rose_routes = { - PROC_NET_RS_ROUTES, 11, "rose_routes", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - rose_routes_get_info -}; -#endif - static struct net_device *dev_rose; void __init rose_proto_init(struct net_proto *pro) @@ -1527,10 +1500,10 @@ void __init rose_proto_init(struct net_proto *pro) rose_add_loopback_neigh(); #ifdef CONFIG_PROC_FS - proc_net_register(&proc_net_rose); - proc_net_register(&proc_net_rose_neigh); - proc_net_register(&proc_net_rose_nodes); - proc_net_register(&proc_net_rose_routes); + proc_net_create("rose", 0, rose_get_info); + proc_net_create("rose_neigh", 0, rose_neigh_get_info); + proc_net_create("rose_nodes", 0, rose_nodes_get_info); + proc_net_create("rose_routes", 0, rose_routes_get_info); #endif } @@ -1555,10 +1528,10 @@ void cleanup_module(void) int i; #ifdef CONFIG_PROC_FS - proc_net_unregister(PROC_NET_RS); - proc_net_unregister(PROC_NET_RS_NEIGH); - proc_net_unregister(PROC_NET_RS_NODES); - proc_net_unregister(PROC_NET_RS_ROUTES); + proc_net_remove("rose"); + proc_net_remove("rose_neigh"); + proc_net_remove("rose_nodes"); + proc_net_remove("rose_routes"); #endif rose_loopback_clear(); diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 8a8e3276d..09f16a51c 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c @@ -1133,9 +1133,6 @@ int __init pktsched_init(void) #ifdef CONFIG_RTNETLINK struct rtnetlink_link *link_p; #endif -#ifdef CONFIG_PROC_FS - struct proc_dir_entry *ent; -#endif #if PSCHED_CLOCK_SOURCE == PSCHED_CPU if (psched_calibrate_clock() < 0) @@ -1216,8 +1213,7 @@ int __init pktsched_init(void) #endif #ifdef CONFIG_PROC_FS - ent = create_proc_entry("net/psched", 0, 0); - ent->read_proc = psched_read_proc; + create_proc_read_entry("net/psched", 0, 0, psched_read_proc, NULL); #endif return 0; diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index e6df7ac76..df722997f 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -294,7 +294,8 @@ rpc_call_setup(struct rpc_task *task, u32 proc, task->tk_flags |= flags; /* Increment call count */ - rpcproc_count(task->tk_client, proc)++; + if (task->tk_proc < task->tk_client->cl_maxproc) + rpcproc_count(task->tk_client, proc)++; } /* @@ -319,9 +320,14 @@ static void call_bind(struct rpc_task *task) { struct rpc_clnt *clnt = task->tk_client; + struct rpc_xprt *xprt = clnt->cl_xprt; - task->tk_action = call_reserve; + if (xprt->stream && !xprt->connected) + task->tk_action = call_reconnect; + else + task->tk_action = call_reserve; task->tk_status = 0; + if (!clnt->cl_port) rpc_getport(task, clnt); } @@ -340,6 +346,7 @@ call_reserve(struct rpc_task *task) clnt->cl_protname, clnt->cl_server, clnt->cl_softrtry? "giving up" : "retrying"); if (!clnt->cl_softrtry) { + task->tk_action = call_bind; rpc_delay(task, 5*HZ); return; } @@ -376,25 +383,27 @@ call_reserveresult(struct rpc_task *task) if (task->tk_status >= 0) { task->tk_action = call_allocate; - goto out; - } else if (task->tk_status == -EAGAIN) { + return; + } + + switch (task->tk_status) { + case -EAGAIN: + case -ENOBUFS: task->tk_timeout = task->tk_client->cl_timeout.to_resrvval; task->tk_status = 0; - xprt_reserve(task); - goto out; - } else if (task->tk_status == -ETIMEDOUT) { + task->tk_action = call_reserve; + break; + case -ETIMEDOUT: dprintk("RPC: task timed out\n"); task->tk_action = call_timeout; - goto out; - } else { + break; + default: task->tk_action = NULL; + if (!task->tk_rqstp) { + printk("RPC: task has no request, exit EIO\n"); + rpc_exit(task, -EIO); + } } - if (!task->tk_rqstp) { - printk("RPC: task has no request, exit EIO\n"); - rpc_exit(task, -EIO); - } -out: - return; } /* @@ -424,7 +433,7 @@ call_allocate(struct rpc_task *task) if (!signalled()) { xprt_release(task); task->tk_action = call_reserve; - rpc_delay(task, HZ); + rpc_delay(task, HZ>>4); return; } @@ -477,7 +486,7 @@ call_encode(struct rpc_task *task) printk("RPC: call_header failed, exit EIO\n"); rpc_exit(task, -EIO); } else - if ((status = encode(req, p, task->tk_argp)) < 0) { + if (encode && (status = encode(req, p, task->tk_argp)) < 0) { printk(KERN_WARNING "%s: can't encode arguments: %d\n", clnt->cl_protname, -status); rpc_exit(task, status); @@ -508,19 +517,16 @@ call_receive(struct rpc_task *task) task->tk_pid, task->tk_status); task->tk_action = call_status; - /* In case of error, evaluate status */ - if (task->tk_status < 0) - return; + + /* Need to ensure cleanups are performed by xprt_receive_status() */ + xprt_receive(task); /* If we have no decode function, this means we're performing * a void call (a la lockd message passing). */ if (!rpcproc_decode(task->tk_client, task->tk_proc)) { - rpc_remove_wait_queue(task); /* remove from xprt_pending */ task->tk_action = NULL; return; } - - xprt_receive(task); } /* @@ -530,6 +536,7 @@ static void call_status(struct rpc_task *task) { struct rpc_clnt *clnt = task->tk_client; + struct rpc_xprt *xprt = clnt->cl_xprt; struct rpc_rqst *req; int status = task->tk_status; @@ -538,28 +545,49 @@ call_status(struct rpc_task *task) if (status >= 0) { task->tk_action = call_decode; - } else if (status == -ETIMEDOUT) { + return; + } + + task->tk_status = 0; + req = task->tk_rqstp; + switch(status) { + case -ETIMEDOUT: task->tk_action = call_timeout; - } else if (status == -EAGAIN) { - if (!(req = task->tk_rqstp)) + break; + case -EAGAIN: + if (!req) task->tk_action = call_reserve; else if (!task->tk_buffer) task->tk_action = call_allocate; - else if (req->rq_damaged) + else if (req->rq_damaged) { task->tk_action = call_encode; - else + clnt->cl_stats->rpcretrans++; + } else { task->tk_action = call_transmit; - } else if (status == -ENOTCONN) { - task->tk_action = call_reconnect; - } else if (status == -ECONNREFUSED && clnt->cl_autobind) { - task->tk_action = call_bind; - clnt->cl_port = 0; - } else { + clnt->cl_stats->rpcretrans++; + } + break; + case -ECONNREFUSED: + case -ENOTCONN: + if (clnt->cl_autobind || !clnt->cl_port) { + clnt->cl_port = 0; + task->tk_action = call_bind; + } else if (xprt->stream) + task->tk_action = call_reconnect; + else { + rpc_delay(task, 5*HZ); /* Hope it all wears off */ + if (req->rq_damaged) + task->tk_action = call_encode; + else + task->tk_action = call_transmit; + clnt->cl_stats->rpcretrans++; + } + break; + default: if (clnt->cl_chatty) printk("%s: RPC call returned error %d\n", - clnt->cl_protname, -status); - task->tk_action = NULL; - return; + clnt->cl_protname, -status); + rpc_exit(task, status); } } @@ -600,7 +628,7 @@ call_timeout(struct rpc_task *task) if (req) printk("%s: server %s not responding, still trying\n", clnt->cl_protname, clnt->cl_server); - else + else printk("%s: task %d can't get a request slot\n", clnt->cl_protname, task->tk_pid); } @@ -610,6 +638,8 @@ call_timeout(struct rpc_task *task) minor_timeout: if (!clnt->cl_port) { task->tk_action = call_bind; + } else if (clnt->cl_xprt->stream && !clnt->cl_xprt->connected) { + task->tk_action = call_reconnect; } else if (!req) { task->tk_action = call_reserve; } else if (req->rq_damaged) { @@ -628,14 +658,12 @@ minor_timeout: static void call_reconnect(struct rpc_task *task) { + struct rpc_clnt *clnt = task->tk_client; dprintk("RPC: %4d call_reconnect status %d\n", task->tk_pid, task->tk_status); - if (task->tk_status == 0) { - task->tk_action = call_status; - task->tk_status = -EAGAIN; - return; - } - task->tk_client->cl_stats->netreconn++; + task->tk_action = call_reserve; + task->tk_status = 0; + clnt->cl_stats->netreconn++; xprt_reconnect(task); } @@ -685,7 +713,9 @@ call_decode(struct rpc_task *task) } task->tk_action = NULL; - task->tk_status = decode(req, p, task->tk_resp); + + if (decode) + task->tk_status = decode(req, p, task->tk_resp); dprintk("RPC: %4d call_decode result %d\n", task->tk_pid, task->tk_status); } @@ -714,11 +744,10 @@ call_refreshresult(struct rpc_task *task) dprintk("RPC: %4d call_refreshresult (status %d)\n", task->tk_pid, task->tk_status); - if (task->tk_status < 0) { - task->tk_status = -EACCES; - task->tk_action = NULL; - } else - task->tk_action = call_reserve; + if (task->tk_status < 0) + rpc_exit(task, -EACCES); + else + task->tk_action = call_bind; } /* diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c index 2749eaac5..1ef445f61 100644 --- a/net/sunrpc/stats.c +++ b/net/sunrpc/stats.c @@ -126,14 +126,10 @@ svc_proc_read(char *buffer, char **start, off_t offset, int count, static inline struct proc_dir_entry * do_register(const char *name, void *data, int issvc) { - struct proc_dir_entry *ent; - dprintk("RPC: registering /proc/net/rpc/%s\n", name); - ent = create_proc_entry(name, 0, proc_net_rpc); - ent->read_proc = issvc? svc_proc_read : rpc_proc_read; - ent->data = data; - - return ent; + return create_proc_read_entry(name, 0, proc_net_rpc, + issvc? svc_proc_read : rpc_proc_read, + data); } struct proc_dir_entry * @@ -168,9 +164,7 @@ rpc_proc_init(void) struct proc_dir_entry *ent; ent = create_proc_entry("net/rpc", S_IFDIR, 0); if (ent) { -#ifdef MODULE - ent->fill_inode = rpc_modcount; -#endif + ent->owner = THIS_MODULE; proc_net_rpc = ent; } } @@ -187,21 +181,6 @@ rpc_proc_exit(void) } #ifdef MODULE -/* - * This is called as the proc_dir_entry fill_inode function - * when an inode is going into or out of service (fill == 1 - * or 0 respectively). - * - * We use it here to keep the module from being unloaded - * while /proc inodes are in use. - */ -void rpc_modcount(struct inode *inode, int fill) -{ - if (fill) - MOD_INC_USE_COUNT; - else - MOD_DEC_USE_COUNT; -} int init_module(void) diff --git a/net/sunrpc/sysctl.c b/net/sunrpc/sysctl.c index 03bedba70..7f588a1c6 100644 --- a/net/sunrpc/sysctl.c +++ b/net/sunrpc/sysctl.c @@ -14,6 +14,7 @@ #include <linux/ctype.h> #include <linux/fs.h> #include <linux/sysctl.h> +#include <linux/module.h> #include <asm/uaccess.h> #include <linux/sunrpc/types.h> @@ -38,11 +39,9 @@ rpc_register_sysctl(void) { if (!sunrpc_table_header) { sunrpc_table_header = register_sysctl_table(sunrpc_table, 1); -#ifdef MODULE #ifdef CONFIG_PROC_FS if (sunrpc_table[0].de) - sunrpc_table[0].de->fill_inode = rpc_modcount; -#endif + sunrpc_table[0].de->owner = THIS_MODULE; #endif } diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 2a439cc70..72fae92b9 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -1777,7 +1777,6 @@ void __init unix_proto_init(struct net_proto *pro) #endif { struct sk_buff *dummy_skb; - struct proc_dir_entry *ent; printk(KERN_INFO "NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.\n"); if (sizeof(struct unix_skb_parms) > sizeof(dummy_skb->cb)) @@ -1791,8 +1790,7 @@ void __init unix_proto_init(struct net_proto *pro) } sock_register(&unix_family_ops); #ifdef CONFIG_PROC_FS - ent = create_proc_entry("net/unix", 0, 0); - ent->read_proc = unix_read_proc; + create_proc_read_entry("net/unix", 0, 0, unix_read_proc, NULL); #endif #ifdef MODULE diff --git a/net/wanrouter/wanproc.c b/net/wanrouter/wanproc.c index 948b4af2c..f62552b0b 100644 --- a/net/wanrouter/wanproc.c +++ b/net/wanrouter/wanproc.c @@ -193,16 +193,6 @@ static struct proc_dir_entry proc_router = name_root, /* .name */ 0555 | S_IFDIR, /* .mode */ 2, /* .nlink */ - 0, /* .uid */ - 0, /* .gid */ - 0, /* .size */ - &proc_dir_inode_operations, /* .ops */ - NULL, /* .get_info */ - NULL, /* .fill_node */ - NULL, /* .next */ - NULL, /* .parent */ - NULL, /* .subdir */ - NULL, /* .data */ }; /* diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index 247acd268..c77cb79a7 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c @@ -1283,21 +1283,6 @@ void x25_kill_by_neigh(struct x25_neigh *neigh) } } -#ifdef CONFIG_PROC_FS -static struct proc_dir_entry proc_net_x25 = { - PROC_NET_X25, 3, "x25", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - x25_get_info -}; -static struct proc_dir_entry proc_net_x25_routes = { - PROC_NET_X25_ROUTES, 10, "x25_routes", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_net_inode_operations, - x25_routes_get_info -}; -#endif - void __init x25_proto_init(struct net_proto *pro) { sock_register(&x25_family_ops); @@ -1314,8 +1299,8 @@ void __init x25_proto_init(struct net_proto *pro) #endif #ifdef CONFIG_PROC_FS - proc_net_register(&proc_net_x25); - proc_net_register(&proc_net_x25_routes); + proc_net_create("x25", 0, x25_get_info); + proc_net_create("x25_routes", 0, x25_routes_get_info); #endif } @@ -1352,8 +1337,8 @@ void cleanup_module(void) { #ifdef CONFIG_PROC_FS - proc_net_unregister(PROC_NET_X25); - proc_net_unregister(PROC_NET_X25_ROUTES); + proc_net_remove("x25"); + proc_net_remove("x25_routes"); #endif x25_link_free(); |