Re: [PATCH] add seq file helpers from 2.5 (fwd)

From: Chris Wright (chris@wirex.com)
Date: Thu Jul 10 2003 - 13:28:07 EST


* 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
-
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 : Tue Jul 15 2003 - 22:00:36 EST