mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chris Wright <chris@wirex.com>
To: Marcelo Tosatti <marcelo@conectiva.com.br>
Cc: Alexander Viro <viro@math.psu.edu>,
	lkml <linux-kernel@vger.kernel.org>,
	Jeff Muizelaar <kernel@infidigm.net>
Subject: Re: [PATCH] add seq file helpers from 2.5 (fwd)
Date: Thu, 10 Jul 2003 11:28:07 -0700	[thread overview]
Message-ID: <20030710112807.A29562@figure1.int.wirex.com> (raw)
In-Reply-To: <Pine.LNX.4.55L.0307100000100.6316@freak.distro.conectiva>; from marcelo@conectiva.com.br on Thu, Jul 10, 2003 at 12:02:05AM -0300

* Marcelo Tosatti (marcelo@conectiva.com.br) wrote:
> +int single_open(struct file *file, int (*show)(struct seq_file *, void*), void *data)
> +{
> +	struct seq_operations *op = kmalloc(sizeof(*op), GFP_KERNEL);
> +	int res = -ENOMEM;
> +
> +	if (op) {
> +		op->start = single_start;
> +		op->next = single_next;
> +		op->stop = single_stop;
> +		op->show = show;
> +		res = seq_open(file, op);

Any reason not to simply allocate static ops struct?  As in:

  static struct seq_operations single_ops = {
  	.start	= single_start;
	.next	= single_next;
	.stop	= single_stop;
	.show	= show;
  };

  int single_open()
  {
  	req = seq_open(file, &single_ops);
	...
  }

thanks,
-chris
-- 
Linux Security Modules     http://lsm.immunix.org     http://lsm.bkbits.net

  parent reply	other threads:[~2003-07-10 18:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-10  3:02 Marcelo Tosatti
2003-07-10  5:04 ` Randy.Dunlap
2003-07-10 18:28 ` Chris Wright [this message]
2003-07-10 18:45   ` Chris Wright

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030710112807.A29562@figure1.int.wirex.com \
    --to=chris@wirex.com \
    --cc=kernel@infidigm.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    --cc=viro@math.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®