netdev
[Top] [All Lists]

Re: [PATCH] convering bonding driver /proc interface to seq_file

To: James Morris <jmorris@xxxxxxxxxxxxxxxx>
Subject: Re: [PATCH] convering bonding driver /proc interface to seq_file
From: Stephen Hemminger <shemminger@xxxxxxxx>
Date: Mon, 25 Aug 2003 08:45:21 -0700
Cc: "Hen, Shmulik" <shmulik.hen@xxxxxxxxx>, Chad Tindel <ctindel@xxxxxxxxxxxxxxxxxxxxx>, Jay Vosburgh <fubar@xxxxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxx>, Jeff Garzik <jgarzik@xxxxxxxxx>, <bonding-devel@xxxxxxxxxxxxxxxxxxxxx>, <netdev@xxxxxxxxxxx>
In-reply-to: <Mutt.LNX.4.44.0308250112470.21951-100000@xxxxxxxxxxxxxxxxxxxxxxxxxx>
Organization: Open Source Development Lab
References: <E791C176A6139242A988ABA8B3D9B38A014C94C0@xxxxxxxxxxxxxxxxxxxxxxx> <Mutt.LNX.4.44.0308250112470.21951-100000@xxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
On Mon, 25 Aug 2003 01:15:13 +1000 (EST)
James Morris <jmorris@xxxxxxxxxxxxxxxx> wrote:

> On Sat, 23 Aug 2003, Hen, Shmulik wrote:
> 
> > Also, instead of using a seq_file interface and using a
> > pointer to skip to the relevant part, we've used a different
> > proc creation interface that allows passing a pointer to bond
> > and thus retrieve just the relevant bond device's data.
> 
> Can you provide a pointer to this code?
> 
> seq_file is the standard and preferred way to do this kind of thing.

Using a pointer with seq_file was really easy.

init...
        bond->bond_proc_file = create_proc_entry(dev->name,
                                                 S_IRUGO, 
                                                 bond_proc_dir);
        if (bond->bonc_proc_file) {
                bond->bond_proc_file->data = bond;
                bond->bond_proc_file->proc_fops = &bond_info_fops;
        }

open...
        rc = seq_open(file, &bond_info_seq_ops);
        if (!rc) {
                seq = file->private_data;
                seq->private = PDE(inode)->data;
        }



<Prev in Thread] Current Thread [Next in Thread>