Re: [BKPATCH] X25: use seq_file for proc stuff

From: Alexander Viro (viro@math.psu.edu)
Date: Sun Oct 06 2002 - 22:56:20 EST


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.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Oct 07 2002 - 22:00:57 EST