linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Herbert Poetzl <herbert@13thfloor.at>
To: linux-fsdevel@vger.kernel.org
Subject: readdir within kernel
Date: Thu, 19 Dec 2002 06:06:32 +0100	[thread overview]
Message-ID: <20021219050632.GB16235@www.13thfloor.at> (raw)


hi all!

I would like to know if this is the right way to
read a directory contents for a given directory
dentry within a kernel module ...

suggestions and/or hints are very welcome ...


extern	filldir_t xxx_filler;


void	xxx_dump_dir(struct dentry *de)
{
    	struct file pf;
	struct inode *in = de->d_inode;
	int ret;	
		
	ret = init_private_file(&pf, de, FMODE_READ);
	if (!pf.f_op->readdir)
		goto out_close;
		
    	ret = vfs_readdir(&pf, xxx_filler, (void *)0);

out_close:
	if (pf.f_op->release)
		pf.f_op->release(in, &pf);
    	return;
}

many thanks,
Herbert


             reply	other threads:[~2002-12-19  5:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-19  5:06 Herbert Poetzl [this message]
2002-12-19 13:09 ` readdir within kernel Matthew Wilcox

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=20021219050632.GB16235@www.13thfloor.at \
    --to=herbert@13thfloor.at \
    --cc=linux-fsdevel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).