Search Linux Wireless

Re: compat-wireless + Linux 2.6.26.8 testing results

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux