This is a note to let you know that I've just added the patch titled
Subject: sysfs: Implement __sysfs_get_dentry
to my gregkh-2.6 tree. Its filename is
sysfs-implement-__sysfs_get_dentry.patch
This tree can be found at
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/
From ebiederm@xmission.com Thu Jul 3 18:11:48 2008
From: <redacted> (Eric W. Biederman)
Date: Thu, 03 Jul 2008 18:09:04 -0700
Subject: sysfs: Implement __sysfs_get_dentry
To: Greg Kroah-Hartman <gregkh@suse.de>, Andrew Morton <akpm@linux-foundation.org>
Cc: Tejun Heo <redacted>, Daniel Lezcano <redacted>, <redacted>, Al Viro <redacted>, Linux Containers <redacted>, Benjamin Thery <redacted>, <redacted>
Message-ID: [off-list ref]
From: Eric W. Biederman <redacted>
This function is similar but much simpler to sysfs_get_dentry
returns a sysfs dentry if one curently exists.
Signed-off-by: Eric W. Biederman <redacted>
Signed-off-by: Benjamin Thery <redacted>
Signed-off-by: Daniel Lezcano <redacted>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
fs/sysfs/dir.c | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -795,6 +795,45 @@ void sysfs_remove_dir(struct kobject * k
__sysfs_remove_dir(sd);
}
+/**
+ * __sysfs_get_dentry - get dentry for the given sysfs_dirent
+ * @sb: superblock of the dentry to return
+ * @sd: sysfs_dirent of interest
+ *
+ * Get dentry for @sd. Only return a dentry if one currently
+ * exists.
+ *
+ * LOCKING:
+ * Kernel thread context (may sleep)
+ *
+ * RETURNS:
+ * Pointer to found dentry on success, NULL on failure.
+ */
+static struct dentry *__sysfs_get_dentry(struct super_block *sb,
+ struct sysfs_dirent *sd)
+{
+ struct inode *inode;
+ struct dentry *dentry = NULL;
+
+ inode = ilookup5_nowait(sysfs_sb, sd->s_ino, sysfs_ilookup_test, sd);
+ if (inode && !(inode->i_state & I_NEW)) {
+ struct dentry *alias;
+ spin_lock(&dcache_lock);
+ list_for_each_entry(alias, &inode->i_dentry, d_alias) {
+ if (!IS_ROOT(alias) && d_unhashed(alias))
+ continue;
+ if (alias->d_sb != sb)
+ continue;
+ dentry = alias;
+ dget_locked(dentry);
+ break;
+ }
+ spin_unlock(&dcache_lock);
+ }
+ iput(inode);
+ return dentry;
+}
+
int sysfs_rename_dir(struct kobject * kobj, const char *new_name)
{
struct sysfs_dirent *sd = kobj->sd;
Patches currently in gregkh-2.6 which might be from gregkh@suse.de are
.git/logs/refs/heads/master
.git/logs/refs/heads/origin
.git/logs/refs/remotes/aria/master
.git/logs/refs/remotes/aria/origin
.git/logs/HEAD
bad/pci-domain/pci-device-ensure-sysdata-initialised.patch
bad/pci-domain/pci-fix-the-x86-pci-domain-support-fix.patch
bad/pci-domain/x86-pci-domain-support-struct-pci_sysdata.patch
bad/pci-domain/x86-pci-domain-support-a-humble-fix.patch
bad/pci-domain/x86-pci-domain-support-the-meat.patch
bad/relayfs/relay-consolidate-relayfs-core-into-kernel-relay.c.patch
bad/relayfs/relay-relay-header-cleanup.patch
bad/relayfs/sysfs-add-__attr_relay-helper-for-relay-attributes.patch
bad/relayfs/sysfs-relay-channel-buffers-as-sysfs-attributes.patch
bad/usbip/usb-usbip-more-dead-code-fix.patch
bad/usbip/usb-usbip-build-fix.patch
bad/usbip/usb-usbip-warning-fixes.patch
bad/ndevfs.patch
bad/driver-sample.sh.patch
bad/driver-model-convert-driver-model-to-mutexes.patch
bad/gpl_future-test.patch
bad/gregkh-debugfs_example.patch
bad/i2c-device-id-lm75.patch
bad/speakup-kconfig-fix.patch
bad/speakup-build-fix.patch
bad/pci-test-that-drivers-properly-call-pci_set_master.patch
bad/pci-use-new-multi-phase-suspend-infrastructure.patch
bad/speakup-core.patch
bad/uio.patch
bad/usbfs2.patch
bad/no-more-non-gpl-modules.patch
bad/usb-serial-serqt_usb.patch
bad/spi-device.patch
bad/ata_piix-multithread.patch
bad/uio-irq.patch
bad/sysfs-crash-debugging.patch
bad/pci-dynamic-id-cleanup.patch
bad/pci-piggy-bus.patch
115 more lines