linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Roskin <proski@gnu.org>
To: "Luis R. Rodriguez" <mcgrof@gmail.com>
Cc: linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: compat-wireless + Linux 2.6.26.8 testing results
Date: Thu, 18 Feb 2010 01:15:34 -0500	[thread overview]
Message-ID: <1266473734.11805.5.camel@mj> (raw)
In-Reply-To: <1266467017.3065.62.camel@mj>

On Wed, 2010-02-17 at 23:23 -0500, Pavel Roskin wrote:

> The idea is to descend the directory structure from the top (i.e. the
> directory to be removed) to look for a child that is a file or an empty
> directory and remove it.  Then start from the top and do the same until
> the top directory has no children.  Then remove the top directory.

Here it is.  I tested it by actually replacing the original function in
wireless-testing.  I checked unloading all wireless drivers.  I also
tested error handling by keeping a file in debugfs open while removing
the modules.

I could compile it against Linux 2.6.26, so it's portable enough for our
purposes.


void debugfs_remove_recursive(struct dentry *dentry)
{
	struct dentry *last = NULL;

	/* Sanity checks */
	if (!dentry || !dentry->d_parent || !dentry->d_parent->d_inode)
		return;

	while (dentry != last) {
		struct dentry *child = dentry;

		/* Find a child without children */
		while (!list_empty(&child->d_subdirs))
			child = list_entry(child->d_subdirs.next, struct dentry,
					   d_u.d_child);

		/* Bail out if we already tried to remove that entry */
		if (child == last)
			return;

		last = child;
		debugfs_remove(child);
	}
}

-- 
Regards,
Pavel Roskin

  reply	other threads:[~2010-02-18  6:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-13  2:10 compat-wireless updated for 2.6.33-rc8, 2.6.32.8 and next-20100212 Luis R. Rodriguez
2010-02-14  5:10 ` compat-wireless + Linux 2.6.26.8 testing results Pavel Roskin
2010-02-16 21:23   ` Luis R. Rodriguez
2010-02-16 22:12     ` Pavel Roskin
2010-02-16 22:59       ` Luis R. Rodriguez
2010-02-17  0:45         ` Luis R. Rodriguez
2010-02-17  0:51           ` Luis R. Rodriguez
2010-02-18  4:23             ` Pavel Roskin
2010-02-18  6:15               ` Pavel Roskin [this message]
2010-02-18 18:30                 ` Luis R. Rodriguez
2010-02-20  0:21                   ` Pavel Roskin
2010-02-20  2:37                     ` Luis R. Rodriguez
2010-02-18  3:44         ` Pavel Roskin
2010-02-18 18:29           ` Luis R. Rodriguez
2010-02-18 19:18             ` Luis R. Rodriguez

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=1266473734.11805.5.camel@mj \
    --to=proski@gnu.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mcgrof@gmail.com \
    /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).