mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: viro@parcelfarce.linux.theplanet.co.uk
To: Tigran Aivazian <tigran@aivazian.fsnet.co.uk>
Cc: Harald Welte <laforge@netfilter.org>, linux-kernel@vger.kernel.org
Subject: Re: seq_file and exporting dynamically allocated data
Date: Mon, 17 Nov 2003 05:48:20 +0000	[thread overview]
Message-ID: <20031117054820.GT24159@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <Pine.LNX.4.44.0311160717250.765-100000@einstein.homenet>

On Sun, Nov 16, 2003 at 07:27:23AM +0000, Tigran Aivazian wrote:
> Hi Al,
> 
> I remembered the other two areas where, maybe, seq API can be slightly 
> improved:
> 
> a) no "THIS_MODULE" style module refcounting, so I had to do manual 
> MOD_INC_USE_COUNT/MOD_DEC_USE_COUNT in ->open/release. I am aware of the 
> deficiencies of this approach, of course (it's been discussed too many 
> times in the last several years).

	You don't need to do that.  Look, these ->open() and ->release()
are not some new methods - they are ->open() and ->release() of your
struct file.  The fact that they happen to call functions from seq_file.c
doesn't change anything - they are struct file methods, sitting in some
instance of struct file_operations.  And just as with any such instance,
you have ->owner in struct file_operations.  Which will be honoured by
open(2) - just as with any other file.

	IOW, there is no need for any special rmmod protection of iterator.
Normal protection of file methods will be enough - after all, even if
iterator is not in the same module, the code in our ->open() directly
refers to it.  I.e. we have a direct dependency and as long as module
where our file_operations are is there, the module with our iterators
will stay around.
 
> b) no way to reset the 'offset' to 0 when the ->next() detects that it is
> back at the head of linked list, i.e. when it should return NULL. It's OK

Let me get it straight - you want an infinite file, with no EOF anywhere
and contents more or less repeating itself?  _And_ you want a working
lseek() on that?

  reply	other threads:[~2003-11-17  5:48 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-14 20:42 Harald Welte
2003-11-14 21:01 ` Tigran Aivazian
2003-11-15  9:38   ` Harald Welte
2003-11-15 17:18     ` viro
2003-11-15 17:33       ` Harald Welte
2003-11-15 19:49         ` Tigran Aivazian
2003-11-15 20:14           ` viro
2003-11-15 20:41             ` Tigran Aivazian
2003-11-15 21:30               ` viro
2003-11-15 20:50             ` Tigran Aivazian
2003-11-15 21:33               ` viro
2003-11-15 21:54                 ` Tigran Aivazian
2003-11-16  7:27                   ` Tigran Aivazian
2003-11-17  5:48                     ` viro [this message]
2003-11-17  8:21                       ` Tigran Aivazian
2003-11-17  8:30                         ` William Lee Irwin III
2003-11-17  8:38                           ` Tigran Aivazian
2003-11-17  8:48                             ` William Lee Irwin III
2003-11-17  9:03                               ` William Lee Irwin III
2003-11-17  9:42                                 ` Tigran Aivazian
2003-11-17  9:50                                   ` William Lee Irwin III
2003-11-17  9:55                                   ` viro
2003-11-17 10:08                                     ` Tigran Aivazian
2003-11-17 10:35                                       ` viro
2003-11-17  9:48                                 ` viro
2003-11-16 20:45               ` Harald Welte
2003-11-15 20:36         ` viro
2003-11-16 20:42           ` Harald Welte

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=20031117054820.GT24159@parcelfarce.linux.theplanet.co.uk \
    --to=viro@parcelfarce.linux.theplanet.co.uk \
    --cc=laforge@netfilter.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tigran@aivazian.fsnet.co.uk \
    /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

Powered by JetHome