aboutsummaryrefslogtreecommitdiffstats
path: root/net/irda/irnet/irnet_irda.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/irda/irnet/irnet_irda.c')
-rw-r--r--net/irda/irnet/irnet_irda.c65
1 files changed, 34 insertions, 31 deletions
diff --git a/net/irda/irnet/irnet_irda.c b/net/irda/irnet/irnet_irda.c
index a4f1439ffdd8..75497e55927d 100644
--- a/net/irda/irnet/irnet_irda.c
+++ b/net/irda/irnet/irnet_irda.c
@@ -9,6 +9,7 @@
9 */ 9 */
10 10
11#include "irnet_irda.h" /* Private header */ 11#include "irnet_irda.h" /* Private header */
12#include <linux/seq_file.h>
12 13
13/* 14/*
14 * PPP disconnect work: we need to make sure we're in 15 * PPP disconnect work: we need to make sure we're in
@@ -1717,34 +1718,23 @@ irnet_expiry_indication(discinfo_t * expiry,
1717 */ 1718 */
1718 1719
1719#ifdef CONFIG_PROC_FS 1720#ifdef CONFIG_PROC_FS
1720/*------------------------------------------------------------------*/
1721/*
1722 * Function irnet_proc_read (buf, start, offset, len, unused)
1723 *
1724 * Give some info to the /proc file system
1725 */
1726static int 1721static int
1727irnet_proc_read(char * buf, 1722irnet_proc_show(struct seq_file *m, void *v)
1728 char ** start,
1729 off_t offset,
1730 int len)
1731{ 1723{
1732 irnet_socket * self; 1724 irnet_socket * self;
1733 char * state; 1725 char * state;
1734 int i = 0; 1726 int i = 0;
1735 1727
1736 len = 0;
1737
1738 /* Get the IrNET server information... */ 1728 /* Get the IrNET server information... */
1739 len += sprintf(buf+len, "IrNET server - "); 1729 seq_printf(m, "IrNET server - ");
1740 len += sprintf(buf+len, "IrDA state: %s, ", 1730 seq_printf(m, "IrDA state: %s, ",
1741 (irnet_server.running ? "running" : "dead")); 1731 (irnet_server.running ? "running" : "dead"));
1742 len += sprintf(buf+len, "stsap_sel: %02x, ", irnet_server.s.stsap_sel); 1732 seq_printf(m, "stsap_sel: %02x, ", irnet_server.s.stsap_sel);
1743 len += sprintf(buf+len, "dtsap_sel: %02x\n", irnet_server.s.dtsap_sel); 1733 seq_printf(m, "dtsap_sel: %02x\n", irnet_server.s.dtsap_sel);
1744 1734
1745 /* Do we need to continue ? */ 1735 /* Do we need to continue ? */
1746 if(!irnet_server.running) 1736 if(!irnet_server.running)
1747 return len; 1737 return 0;
1748 1738
1749 /* Protect access to the instance list */ 1739 /* Protect access to the instance list */
1750 spin_lock_bh(&irnet_server.spinlock); 1740 spin_lock_bh(&irnet_server.spinlock);
@@ -1754,23 +1744,23 @@ irnet_proc_read(char * buf,
1754 while(self != NULL) 1744 while(self != NULL)
1755 { 1745 {
1756 /* Start printing info about the socket. */ 1746 /* Start printing info about the socket. */
1757 len += sprintf(buf+len, "\nIrNET socket %d - ", i++); 1747 seq_printf(m, "\nIrNET socket %d - ", i++);
1758 1748
1759 /* First, get the requested configuration */ 1749 /* First, get the requested configuration */
1760 len += sprintf(buf+len, "Requested IrDA name: \"%s\", ", self->rname); 1750 seq_printf(m, "Requested IrDA name: \"%s\", ", self->rname);
1761 len += sprintf(buf+len, "daddr: %08x, ", self->rdaddr); 1751 seq_printf(m, "daddr: %08x, ", self->rdaddr);
1762 len += sprintf(buf+len, "saddr: %08x\n", self->rsaddr); 1752 seq_printf(m, "saddr: %08x\n", self->rsaddr);
1763 1753
1764 /* Second, get all the PPP info */ 1754 /* Second, get all the PPP info */
1765 len += sprintf(buf+len, " PPP state: %s", 1755 seq_printf(m, " PPP state: %s",
1766 (self->ppp_open ? "registered" : "unregistered")); 1756 (self->ppp_open ? "registered" : "unregistered"));
1767 if(self->ppp_open) 1757 if(self->ppp_open)
1768 { 1758 {
1769 len += sprintf(buf+len, ", unit: ppp%d", 1759 seq_printf(m, ", unit: ppp%d",
1770 ppp_unit_number(&self->chan)); 1760 ppp_unit_number(&self->chan));
1771 len += sprintf(buf+len, ", channel: %d", 1761 seq_printf(m, ", channel: %d",
1772 ppp_channel_index(&self->chan)); 1762 ppp_channel_index(&self->chan));
1773 len += sprintf(buf+len, ", mru: %d", 1763 seq_printf(m, ", mru: %d",
1774 self->mru); 1764 self->mru);
1775 /* Maybe add self->flags ? Later... */ 1765 /* Maybe add self->flags ? Later... */
1776 } 1766 }
@@ -1789,10 +1779,10 @@ irnet_proc_read(char * buf,
1789 state = "weird"; 1779 state = "weird";
1790 else 1780 else
1791 state = "idle"; 1781 state = "idle";
1792 len += sprintf(buf+len, "\n IrDA state: %s, ", state); 1782 seq_printf(m, "\n IrDA state: %s, ", state);
1793 len += sprintf(buf+len, "daddr: %08x, ", self->daddr); 1783 seq_printf(m, "daddr: %08x, ", self->daddr);
1794 len += sprintf(buf+len, "stsap_sel: %02x, ", self->stsap_sel); 1784 seq_printf(m, "stsap_sel: %02x, ", self->stsap_sel);
1795 len += sprintf(buf+len, "dtsap_sel: %02x\n", self->dtsap_sel); 1785 seq_printf(m, "dtsap_sel: %02x\n", self->dtsap_sel);
1796 1786
1797 /* Next socket, please... */ 1787 /* Next socket, please... */
1798 self = (irnet_socket *) hashbin_get_next(irnet_server.list); 1788 self = (irnet_socket *) hashbin_get_next(irnet_server.list);
@@ -1801,8 +1791,21 @@ irnet_proc_read(char * buf,
1801 /* Spin lock end */ 1791 /* Spin lock end */
1802 spin_unlock_bh(&irnet_server.spinlock); 1792 spin_unlock_bh(&irnet_server.spinlock);
1803 1793
1804 return len; 1794 return 0;
1805} 1795}
1796
1797static int irnet_proc_open(struct inode *inode, struct file *file)
1798{
1799 return single_open(file, irnet_proc_show, NULL);
1800}
1801
1802static const struct file_operations irnet_proc_fops = {
1803 .owner = THIS_MODULE,
1804 .open = irnet_proc_open,
1805 .read = seq_read,
1806 .llseek = seq_lseek,
1807 .release = single_release,
1808};
1806#endif /* PROC_FS */ 1809#endif /* PROC_FS */
1807 1810
1808 1811
@@ -1841,7 +1844,7 @@ irda_irnet_init(void)
1841 1844
1842#ifdef CONFIG_PROC_FS 1845#ifdef CONFIG_PROC_FS
1843 /* Add a /proc file for irnet infos */ 1846 /* Add a /proc file for irnet infos */
1844 create_proc_info_entry("irnet", 0, proc_irda, irnet_proc_read); 1847 proc_create("irnet", 0, proc_irda, &irnet_proc_fops);
1845#endif /* CONFIG_PROC_FS */ 1848#endif /* CONFIG_PROC_FS */
1846 1849
1847 /* Setup the IrNET server */ 1850 /* Setup the IrNET server */