Hi David,
Please consider pulling from:
master.kernel.org:/home/acme/BK/x25-2.5
- Arnaldo
You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.
===================================================================
[email protected], 2002-10-07 00:18:10-03:00, [email protected]
o X25: use seq_file for proc stuff
Also some CodingStyle cleanups.
include/net/x25.h | 11 +-
net/x25/Makefile | 2
net/x25/af_x25.c | 146 ++++++++--------------------
net/x25/x25_proc.c | 263 ++++++++++++++++++++++++++++++++++++++++++++++++++++
net/x25/x25_route.c | 65 ------------
5 files changed, 320 insertions(+), 167 deletions(-)
diff -Nru a/include/net/x25.h b/include/net/x25.h
--- a/include/net/x25.h Mon Oct 7 00:29:00 2002
+++ b/include/net/x25.h Mon Oct 7 00:29:00 2002
@@ -220,9 +220,8 @@
/* x25_route.c */
extern struct x25_route *x25_get_route(struct x25_address *addr);
extern struct net_device *x25_dev_get(char *);
-extern void x25_route_device_down(struct net_device *);
+extern void x25_route_device_down(struct net_device *dev);
extern int x25_route_ioctl(unsigned int, void *);
-extern int x25_routes_get_info(char *, char **, off_t, int);
extern void x25_route_free(void);
static __inline__ void x25_route_hold(struct x25_route *rt)
@@ -263,4 +262,12 @@
unsigned flags;
};
#define X25_SKB_CB(s) ((struct x25_skb_cb *) ((s)->cb))
+
+extern struct sock *x25_list;
+extern rwlock_t x25_list_lock;
+extern struct list_head x25_route_list;
+extern rwlock_t x25_route_list_lock;
+
+extern int x25_proc_init(void);
+extern void x25_proc_exit(void);
#endif
diff -Nru a/net/x25/Makefile b/net/x25/Makefile
--- a/net/x25/Makefile Mon Oct 7 00:29:00 2002
+++ b/net/x25/Makefile Mon Oct 7 00:29:00 2002
@@ -6,7 +6,7 @@
x25-y := af_x25.o x25_dev.o x25_facilities.o x25_in.o \
x25_link.o x25_out.o x25_route.o x25_subr.o \
- x25_timer.o
+ x25_timer.o x25_proc.o
x25-$(CONFIG_SYSCTL) += sysctl_net_x25.o
x25-objs := $(x25-y)
diff -Nru a/net/x25/af_x25.c b/net/x25/af_x25.c
--- a/net/x25/af_x25.c Mon Oct 7 00:29:00 2002
+++ b/net/x25/af_x25.c Mon Oct 7 00:29:00 2002
@@ -27,6 +27,8 @@
* 2000-10-02 Henner Eisen Made x25_kick() single threaded per socket.
* 2000-10-27 Henner Eisen MSG_DONTWAIT for fragment allocation.
* 2000-11-14 Henner Eisen Closing datalink from NETDEV_GOING_DOWN
+ * 2002-10-06 Arnaldo C. Melo Get rid of cli/sti, move proc stuff to
+ * x25_proc.c, using seq_file
*/
#include <linux/config.h>
@@ -55,7 +57,6 @@
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/notifier.h>
-#include <linux/proc_fs.h>
#include <linux/init.h>
#include <net/x25.h>
@@ -65,8 +66,8 @@
int sysctl_x25_clear_request_timeout = X25_DEFAULT_T23;
int sysctl_x25_ack_holdback_timeout = X25_DEFAULT_T2;
-static struct sock *x25_list;
-static rwlock_t x25_list_lock = RW_LOCK_UNLOCKED;
+struct sock *x25_list;
+rwlock_t x25_list_lock = RW_LOCK_UNLOCKED;
static struct proto_ops x25_proto_ops;
@@ -246,8 +247,10 @@
read_lock_bh(&x25_list_lock);
for (s = x25_list; s; s = s->next)
- if ((!strcmp(addr->x25_addr, x25_sk(s)->source_addr.x25_addr) ||
- !strcmp(addr->x25_addr, null_x25_address.x25_addr)) &&
+ if ((!strcmp(addr->x25_addr,
+ x25_sk(s)->source_addr.x25_addr) ||
+ !strcmp(addr->x25_addr,
+ null_x25_address.x25_addr)) &&
s->state == TCP_LISTEN)
break;
@@ -318,12 +321,13 @@
}
/*
- * This is called from user mode and the timers. Thus it protects itself against
- * interrupt users but doesn't worry about being called during work.
- * Once it is removed from the queue no interrupt or bottom half will
- * touch it and we are (fairly 8-) ) safe.
+ * This is called from user mode and the timers. Thus it protects itself
+ * against interrupt users but doesn't worry about being called during
+ * work. Once it is removed from the queue no interrupt or bottom half
+ * will touch it and we are (fairly 8-) ) safe.
+ * Not static as it's used by the timer
*/
-void x25_destroy_socket(struct sock *sk) /* Not static as it's used by the timer */
+void x25_destroy_socket(struct sock *sk)
{
struct sk_buff *skb;
@@ -337,7 +341,10 @@
while ((skb = skb_dequeue(&sk->receive_queue)) != NULL) {
if (skb->sk != sk) { /* A pending connection */
- skb->sk->dead = 1; /* Queue the unaccepted socket for death */
+ /*
+ * Queue the unaccepted socket for death
+ */
+ skb->sk->dead = 1;
x25_start_heartbeat(skb->sk);
x25_sk(skb->sk)->state = X25_STATE_0;
}
@@ -631,7 +638,8 @@
return rc;
}
-static int x25_connect(struct socket *sock, struct sockaddr *uaddr, int addr_len, int flags)
+static int x25_connect(struct socket *sock, struct sockaddr *uaddr,
+ int addr_len, int flags)
{
struct sock *sk = sock->sk;
struct x25_opt *x25 = x25_sk(sk);
@@ -642,7 +650,7 @@
lock_sock(sk);
if (sk->state == TCP_ESTABLISHED && sock->state == SS_CONNECTING) {
sock->state = SS_CONNECTED;
- goto out; /* Connect completed during a ERESTARTSYS event */
+ goto out; /* Connect completed during a ERESTARTSYS event */
}
rc = -ECONNREFUSED;
@@ -679,7 +687,7 @@
goto out_put_neigh;
rc = -EINVAL;
- if (sk->zapped) /* Must bind first - autobinding does not work */
+ if (sk->zapped) /* Must bind first - autobinding does not work */
goto out_put_neigh;
if (!strcmp(x25->source_addr.x25_addr, null_x25_address.x25_addr))
@@ -785,7 +793,8 @@
return rc;
}
-static int x25_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len, int peer)
+static int x25_getname(struct socket *sock, struct sockaddr *uaddr,
+ int *uaddr_len, int peer)
{
struct sockaddr_x25 *sx25 = (struct sockaddr_x25 *)uaddr;
struct sock *sk = sock->sk;
@@ -804,7 +813,8 @@
return 0;
}
-int x25_rx_call_request(struct sk_buff *skb, struct x25_neigh *nb, unsigned int lci)
+int x25_rx_call_request(struct sk_buff *skb, struct x25_neigh *nb,
+ unsigned int lci)
{
struct sock *sk;
struct sock *make;
@@ -906,7 +916,8 @@
goto out;
}
-static int x25_sendmsg(struct socket *sock, struct msghdr *msg, int len, struct scm_cookie *scm)
+static int x25_sendmsg(struct socket *sock, struct msghdr *msg, int len,
+ struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
struct x25_opt *x25 = x25_sk(sk);
@@ -1118,7 +1129,8 @@
msg->msg_flags |= MSG_OOB;
} else {
/* Now we can treat all alike */
- skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, flags & MSG_DONTWAIT, &rc);
+ skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT,
+ flags & MSG_DONTWAIT, &rc);
if (!skb)
goto out;
@@ -1236,14 +1248,16 @@
break;
case SIOCX25GFACILITIES: {
struct x25_facilities fac = x25->facilities;
- rc = copy_to_user((void *)arg, &fac, sizeof(fac)) ? -EFAULT : 0;
+ rc = copy_to_user((void *)arg, &fac,
+ sizeof(fac)) ? -EFAULT : 0;
break;
}
case SIOCX25SFACILITIES: {
struct x25_facilities facilities;
rc = -EFAULT;
- if (copy_from_user(&facilities, (void *)arg, sizeof(facilities)))
+ if (copy_from_user(&facilities, (void *)arg,
+ sizeof(facilities)))
break;
rc = -EINVAL;
if (sk->state != TCP_LISTEN && sk->state != TCP_CLOSE)
@@ -1269,7 +1283,8 @@
case SIOCX25GCALLUSERDATA: {
struct x25_calluserdata cud = x25->calluserdata;
- rc = copy_to_user((void *)arg, &cud, sizeof(cud)) ? -EFAULT : 0;
+ rc = copy_to_user((void *)arg, &cud,
+ sizeof(cud)) ? -EFAULT : 0;
break;
}
@@ -1277,7 +1292,8 @@
struct x25_calluserdata calluserdata;
rc = -EFAULT;
- if (copy_from_user(&calluserdata, (void *)arg, sizeof(calluserdata)))
+ if (copy_from_user(&calluserdata, (void *)arg,
+ sizeof(calluserdata)))
break;
rc = -EINVAL;
if (calluserdata.cudlength > X25_MAX_CUD_LEN)
@@ -1290,7 +1306,8 @@
case SIOCX25GCAUSEDIAG: {
struct x25_causediag causediag;
causediag = x25->causediag;
- rc = copy_to_user((void *)arg, &causediag, sizeof(causediag)) ? -EFAULT : 0;
+ rc = copy_to_user((void *)arg, &causediag,
+ sizeof(causediag)) ? -EFAULT : 0;
break;
}
@@ -1302,70 +1319,6 @@
return rc;
}
-static int x25_get_info(char *buffer, char **start, off_t offset, int length)
-{
- struct sock *s;
- struct net_device *dev;
- const char *devname;
- off_t pos = 0;
- off_t begin = 0;
- int len = sprintf(buffer, "dest_addr src_addr dev lci st vs vr "
- "va t t2 t21 t22 t23 Snd-Q Rcv-Q inode\n");
-
- read_lock_bh(&x25_list_lock);
-
- for (s = x25_list; s; s = s->next) {
- struct x25_opt *x25 = x25_sk(s);
-
- if (!x25->neighbour || (dev = x25->neighbour->dev) == NULL)
- devname = "???";
- else
- devname = x25->neighbour->dev->name;
-
- len += sprintf(buffer + len, "%-10s %-10s %-5s %3.3X %d %d "
- "%d %d %3lu %3lu %3lu %3lu %3lu "
- "%5d %5d %ld\n",
- !x25->dest_addr.x25_addr[0] ? "*" :
- x25->dest_addr.x25_addr,
- !x25->source_addr.x25_addr[0] ? "*" :
- x25->source_addr.x25_addr,
- devname,
- x25->lci & 0x0FFF,
- x25->state,
- x25->vs,
- x25->vr,
- x25->va,
- x25_display_timer(s) / HZ,
- x25->t2 / HZ,
- x25->t21 / HZ,
- x25->t22 / HZ,
- x25->t23 / HZ,
- atomic_read(&s->wmem_alloc),
- atomic_read(&s->rmem_alloc),
- s->socket ? SOCK_INODE(s->socket)->i_ino : 0L);
-
- pos = begin + len;
-
- if (pos < offset) {
- len = 0;
- begin = pos;
- }
-
- if (pos > offset + length)
- break;
- }
-
- read_unlock_bh(&x25_list_lock);
-
- *start = buffer + (offset - begin);
- len -= (offset - begin);
-
- if (len > length)
- len = length;
-
- return len;
-}
-
struct net_proto_family x25_family_ops = {
.family = AF_X25,
.create = x25_create,
@@ -1395,7 +1348,6 @@
#include <linux/smp_lock.h>
SOCKOPS_WRAP(x25_proto, AF_X25);
-
static struct packet_type x25_packet_type = {
.type = __constant_htons(ETH_P_X25),
.func = x25_lapb_receive_frame,
@@ -1435,9 +1387,7 @@
x25_register_sysctl();
#endif
- proc_net_create("x25", 0, x25_get_info);
- proc_net_create("x25_routes", 0, x25_routes_get_info);
-
+ x25_proc_init();
#ifdef MODULE
/*
* Register any pre existing devices.
@@ -1457,18 +1407,9 @@
}
module_init(x25_init);
-
-
-MODULE_AUTHOR("Jonathan Naylor <[email protected]>");
-MODULE_DESCRIPTION("The X.25 Packet Layer network layer protocol");
-MODULE_LICENSE("GPL");
-
static void __exit x25_exit(void)
{
-
- proc_net_remove("x25");
- proc_net_remove("x25_routes");
-
+ x25_proc_exit();
x25_link_free();
x25_route_free();
@@ -1484,3 +1425,6 @@
}
module_exit(x25_exit);
+MODULE_AUTHOR("Jonathan Naylor <[email protected]>");
+MODULE_DESCRIPTION("The X.25 Packet Layer network layer protocol");
+MODULE_LICENSE("GPL");
diff -Nru a/net/x25/x25_proc.c b/net/x25/x25_proc.c
--- /dev/null Wed Dec 31 16:00:00 1969
+++ b/net/x25/x25_proc.c Mon Oct 7 00:29:00 2002
@@ -0,0 +1,263 @@
+/*
+ * X.25 Packet Layer release 002
+ *
+ * This is ALPHA test software. This code may break your machine,
+ * randomly fail to work with new releases, misbehave and/or generally
+ * screw up. It might even work.
+ *
+ * This code REQUIRES 2.4 with seq_file support
+ *
+ * This module:
+ * This module is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * History
+ * 2002/10/06 Arnaldo Carvalho de Melo seq_file support
+ */
+
+#include <linux/config.h>
+#include <linux/init.h>
+#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
+#include <net/sock.h>
+#include <net/x25.h>
+
+#ifdef CONFIG_PROC_FS
+static __inline__ struct x25_route *x25_get_route_idx(loff_t pos)
+{
+ struct list_head *route_entry;
+ struct x25_route *rt = NULL;
+
+ list_for_each(route_entry, &x25_route_list) {
+ rt = list_entry(route_entry, struct x25_route, node);
+ if (--pos)
+ break;
+ }
+
+ return rt;
+}
+
+static void *x25_seq_route_start(struct seq_file *seq, loff_t *pos)
+{
+ loff_t l = *pos;
+
+ read_lock_bh(&x25_route_list_lock);
+ return l ? x25_get_route_idx(--l) : (void *)1;
+}
+
+static void *x25_seq_route_next(struct seq_file *seq, void *v, loff_t *pos)
+{
+ struct x25_route *rt;
+
+ ++*pos;
+ if (v == (void *)1) {
+ rt = NULL;
+ if (!list_empty(&x25_route_list))
+ rt = list_entry(x25_route_list.next,
+ struct x25_route, node);
+ goto out;
+ }
+ rt = v;
+ if (rt->node.next != &x25_route_list)
+ rt = list_entry(rt->node.next, struct x25_route, node);
+ else
+ rt = NULL;
+out:
+ return rt;
+}
+
+static void x25_seq_route_stop(struct seq_file *seq, void *v)
+{
+ read_unlock_bh(&x25_route_list_lock);
+}
+
+static int x25_seq_route_show(struct seq_file *seq, void *v)
+{
+ struct x25_route *rt;
+
+ if (v == (void *)1) {
+ seq_puts(seq, "Address Digits Device\n");
+ goto out;
+ }
+
+ rt = v;
+ seq_printf(seq, "%-15s %-6d %-5s\n",
+ rt->address.x25_addr, rt->sigdigits,
+ rt->dev ? rt->dev->name : "???");
+out:
+ return 0;
+}
+
+static __inline__ struct sock *x25_get_socket_idx(loff_t pos)
+{
+ struct sock *s;
+
+ for (s = x25_list; pos && s; s = s->next)
+ --pos;
+
+ return s;
+}
+
+static void *x25_seq_socket_start(struct seq_file *seq, loff_t *pos)
+{
+ loff_t l = *pos;
+
+ read_lock_bh(&x25_list_lock);
+ return l ? x25_get_socket_idx(--l) : (void *)1;
+}
+
+static void *x25_seq_socket_next(struct seq_file *seq, void *v, loff_t *pos)
+{
+ struct sock *s;
+
+ ++*pos;
+ if (v == (void *)1) {
+ s = NULL;
+ if (x25_list)
+ s = x25_list;
+ goto out;
+ }
+ s = v;
+ s = s->next;
+out:
+ return s;
+}
+
+static void x25_seq_socket_stop(struct seq_file *seq, void *v)
+{
+ read_unlock_bh(&x25_list_lock);
+}
+
+static int x25_seq_socket_show(struct seq_file *seq, void *v)
+{
+ struct sock *s;
+ struct x25_opt *x25;
+ struct net_device *dev;
+ const char *devname;
+
+ if (v == (void *)1) {
+ seq_printf(seq, "dest_addr src_addr dev lci st vs vr "
+ "va t t2 t21 t22 t23 Snd-Q Rcv-Q inode\n");
+ goto out;
+ }
+
+ s = v;
+ x25 = x25_sk(s);
+
+ if (!x25->neighbour || (dev = x25->neighbour->dev) == NULL)
+ devname = "???";
+ else
+ devname = x25->neighbour->dev->name;
+
+ seq_printf(seq, "%-10s %-10s %-5s %3.3X %d %d %d %d %3lu %3lu "
+ "%3lu %3lu %3lu %5d %5d %ld\n",
+ !x25->dest_addr.x25_addr[0] ? "*" : x25->dest_addr.x25_addr,
+ !x25->source_addr.x25_addr[0] ? "*" : x25->source_addr.x25_addr,
+ devname, x25->lci & 0x0FFF, x25->state, x25->vs, x25->vr,
+ x25->va, x25_display_timer(s) / HZ, x25->t2 / HZ,
+ x25->t21 / HZ, x25->t22 / HZ, x25->t23 / HZ,
+ atomic_read(&s->wmem_alloc), atomic_read(&s->rmem_alloc),
+ s->socket ? SOCK_INODE(s->socket)->i_ino : 0L);
+out:
+ return 0;
+}
+
+struct seq_operations x25_seq_route_ops = {
+ .start = x25_seq_route_start,
+ .next = x25_seq_route_next,
+ .stop = x25_seq_route_stop,
+ .show = x25_seq_route_show,
+};
+
+struct seq_operations x25_seq_socket_ops = {
+ .start = x25_seq_socket_start,
+ .next = x25_seq_socket_next,
+ .stop = x25_seq_socket_stop,
+ .show = x25_seq_socket_show,
+};
+
+static int x25_seq_socket_open(struct inode *inode, struct file *file)
+{
+ return seq_open(file, &x25_seq_socket_ops);
+}
+
+static int x25_seq_route_open(struct inode *inode, struct file *file)
+{
+ return seq_open(file, &x25_seq_route_ops);
+}
+
+static struct file_operations x25_seq_socket_fops = {
+ .open = x25_seq_socket_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release,
+};
+
+static struct file_operations x25_seq_route_fops = {
+ .open = x25_seq_route_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release,
+};
+
+static int x25_proc_perms(struct inode* inode, int op)
+{
+ return 0;
+}
+
+static struct inode_operations x25_seq_inode = {
+ .permission = x25_proc_perms,
+};
+
+static struct proc_dir_entry *x25_proc_dir;
+
+int __init x25_proc_init(void)
+{
+ struct proc_dir_entry *p;
+ int rc = -ENOMEM;
+
+ x25_proc_dir = proc_mkdir("x25", proc_net);
+ if (!x25_proc_dir)
+ goto out;
+
+ p = create_proc_entry("route", 0, x25_proc_dir);
+ if (!p)
+ goto out_route;
+ p->proc_fops = &x25_seq_route_fops;
+ p->proc_iops = &x25_seq_inode;
+
+ p = create_proc_entry("socket", 0, x25_proc_dir);
+ if (!p)
+ goto out_socket;
+ p->proc_fops = &x25_seq_socket_fops;
+ p->proc_iops = &x25_seq_inode;
+ rc = 0;
+out:
+ return rc;
+out_socket:
+ remove_proc_entry("route", x25_proc_dir);
+out_route:
+ remove_proc_entry("x25", proc_net);
+ goto out;
+}
+
+void __exit x25_proc_exit(void)
+{
+ remove_proc_entry("route", x25_proc_dir);
+ remove_proc_entry("socket", x25_proc_dir);
+ remove_proc_entry("x25", proc_net);
+}
+
+#else /* CONFIG_PROC_FS */
+
+int __init x25_proc_init(void)
+{
+ return 0;
+}
+
+void __exit x25_proc_exit(void)
+{
+}
+#endif /* CONFIG_PROC_FS */
diff -Nru a/net/x25/x25_route.c b/net/x25/x25_route.c
--- a/net/x25/x25_route.c Mon Oct 7 00:29:00 2002
+++ b/net/x25/x25_route.c Mon Oct 7 00:29:00 2002
@@ -18,34 +18,12 @@
*/
#include <linux/config.h>
-#include <linux/errno.h>
-#include <linux/types.h>
-#include <linux/socket.h>
-#include <linux/in.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/timer.h>
-#include <linux/string.h>
-#include <linux/sockios.h>
-#include <linux/net.h>
-#include <linux/inet.h>
-#include <linux/netdevice.h>
-#include <net/arp.h>
#include <linux/if_arp.h>
-#include <linux/skbuff.h>
-#include <net/sock.h>
-#include <asm/system.h>
-#include <asm/uaccess.h>
-#include <linux/fcntl.h>
-#include <linux/termios.h> /* For TIOCINQ/OUTQ */
-#include <linux/mm.h>
-#include <linux/interrupt.h>
-#include <linux/notifier.h>
#include <linux/init.h>
#include <net/x25.h>
-static struct list_head x25_route_list = LIST_HEAD_INIT(x25_route_list);
-static rwlock_t x25_route_list_lock = RW_LOCK_UNLOCKED;
+struct list_head x25_route_list = LIST_HEAD_INIT(x25_route_list);
+rwlock_t x25_route_list_lock = RW_LOCK_UNLOCKED;
/*
* Add a new route.
@@ -225,45 +203,6 @@
out:
return rc;
}
-
-int x25_routes_get_info(char *buffer, char **start, off_t offset, int length)
-{
- struct x25_route *rt;
- struct list_head *entry;
- off_t pos = 0;
- off_t begin = 0;
- int len = sprintf(buffer, "address digits device\n");
-
- read_lock_bh(&x25_route_list_lock);
-
- list_for_each(entry, &x25_route_list) {
- rt = list_entry(entry, struct x25_route, node);
- len += sprintf(buffer + len, "%-15s %-6d %-5s\n",
- rt->address.x25_addr,
- rt->sigdigits,
- rt->dev ? rt->dev->name : "???");
-
- pos = begin + len;
-
- if (pos < offset) {
- len = 0;
- begin = pos;
- }
-
- if (pos > offset + length)
- break;
- }
-
- read_unlock_bh(&x25_route_list_lock);
-
- *start = buffer + (offset - begin);
- len -= (offset - begin);
-
- if (len > length)
- len = length;
-
- return len;
-}
/*
* Release all memory associated with X.25 routing structures.
===================================================================
This BitKeeper patch contains the following changesets:
1.623
## Wrapped with gzip_uu ##
begin 664 bkpatch9058
M'XL(`'S_H#T``\T;:7?B1O(S^A45SXL##H<N9+!W9N+XF&''8T]\;+*[V:<G
MI!;H(22B`P]9LK]]J[H%2"",[4S>&P_0ZJNZ[J[NTKR"^YA%1Q7+'C/I%;P/
MX^2H8H<!LQ-O:C7M<-SL1]AQ$X;8T1J&8]:BL:T?/[0^J^V&VFQ+V/W)2NPA
M3%D4'U64IK9L2683=E2Y.7]W?WER(TFO7\/IT`H&[)8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%]U,1GR5*X8,'YS?GMW<G-W>T_;_F["0F1A>:G<F"\X/9"
M%/YN32;,J2&OX&.*:M7W4(:N%^%C`ZPT":F!P))NH38DXK4)`GC8(;/N4;'!
MD0%+Z$+Q3W!$-*YX,F$,3Z1G'73PN"@5JK18+?ILDH*;$4.EC5=R&)E]<E*H
M'?U"SI#?_<)!T.?VG`:[email protected]<I2N+/5+N;I(6X]%A'`\>)0W[AT08
ME@)[GU]Z+.A;3+7'J#KAR*.4@#W&=14%W08NS$M5XII(*8Y1'VFSIZ9C)=8@
MLL8HNKK0$MB'_WV\?6>>75_=_7S2N\LRLXN^0A?L1S:%KHJJ<?)XJ?*4+QU8
M[7`R,Y/0)']2720,K`@IV'<M.P.,R'N_L]!%^[;1U;V%QOG%R?WE'=V8<M"Z
M(4!CR4&3HG'(Y%@$;`+G^5[BT=LV^8462^36R,;5:L0=]5`5P+%\$MYVZJSC
MC4VE>'=D`1K+K7B3DM$3B>%QS/,C,]R[FE@`RZ?A;I%G]*S!!@6+CC(Z,#0!
MC$+PH<LW7477.J#ANCIWCJLK(7X@X-J`<3D8O.S0EJ7HATIA)#\9X$CLZ1@(
MZ^/UV?WEN7ER?_?^^J:Z]_<P0.]I!7!ES7QTIG\;Z"/_\P_\%X/X,494=MA,
M1V\H$Y3-/3N_/;WI?;KK75]5]^[0+V^^`H9!#O<T/J_11AC:H9^#<=D[/;^Z
M/:_NO?MTN;=V:%D>C)X3LN8F/>VUW2>\`EB`UT7EPF];F[>1Q]V7'=Y5:!C:
M5QZU\I>2'WEM,./*B\[OJ)L:;O5M0/[IM`GT],XJHMQV=D93N^S=WIGOST_.
MS-Y5[V[MK9;:6O"Y=JK>$H*J:%K=U7]!L(?,'L7I^+5LZ`8S^IKT?Y<`)"7B
#,```
`
end
On Mon, 7 Oct 2002, Arnaldo Carvalho de Melo wrote:
> +static struct file_operations x25_seq_socket_fops = {
> + .open = x25_seq_socket_open,
> + .read = seq_read,
> + .llseek = seq_lseek,
> + .release = seq_release,
> +};
> +
> +static struct file_operations x25_seq_route_fops = {
> + .open = x25_seq_route_open,
> + .read = seq_read,
> + .llseek = seq_lseek,
> + .release = seq_release,
> +};
> +
> +static int x25_proc_perms(struct inode* inode, int op)
> +{
> + return 0;
> +}
> +
> +static struct inode_operations x25_seq_inode = {
> + .permission = x25_proc_perms,
> +};
> + p = create_proc_entry("route", 0, x25_proc_dir);
> + if (!p)
> + goto out_route;
> + p->proc_fops = &x25_seq_route_fops;
> + p->proc_iops = &x25_seq_inode;
> +
> + p = create_proc_entry("socket", 0, x25_proc_dir);
> + if (!p)
> + goto out_socket;
> + p->proc_fops = &x25_seq_socket_fops;
> + p->proc_iops = &x25_seq_inode;
Huh???
a) ->permission() always returning 0 on a read-only file is... interesting.
b) if you want it world-readable, kernel is perfectly capable of doing that;
had been since the very beginning. Just set mode to 0444 and be done with
that; no need to have anything special in ->proc_iops.
Em Sun, Oct 06, 2002 at 11:56:20PM -0400, Alexander Viro escreveu:
> Huh???
>
> a) ->permission() always returning 0 on a read-only file is... interesting.
> b) if you want it world-readable, kernel is perfectly capable of doing that;
> had been since the very beginning. Just set mode to 0444 and be done with
> that; no need to have anything special in ->proc_iops.
Just that? Cool, I'll be sending a fix in some minutes.
Thanks Al.
- Arnaldo