From: Greg KH <greg@kroah.com>
To: Stanley Wang <stanley.wang@linux.co.intel.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
PCI_Hot_Plug_Discuss <pcihpd-discuss@lists.sourceforge.net>
Subject: Re: [PATCH] Replace pcihpfs with sysfs.
Date: Wed, 29 Jan 2003 21:23:13 -0800 [thread overview]
Message-ID: <20030130052313.GK12898@kroah.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0301301118010.20600-100000@manticore.sh.intel.com>
On Thu, Jan 30, 2003 at 11:21:54AM +0800, Stanley Wang wrote:
> On Wed, 22 Jan 2003, Greg KH wrote:
>
> > > diff -Nru a/drivers/hotplug/cpci_hotplug_core.c b/drivers/hotplug/cpci_hotplug_core.c
> > > --- a/drivers/hotplug/cpci_hotplug_core.c Wed Jan 22 09:30:20 2003
> > > +++ b/drivers/hotplug/cpci_hotplug_core.c Wed Jan 22 09:30:20 2003
> > > @@ -130,7 +130,7 @@
> > > return -EINVAL;
> > > memcpy(&info, hotplug_slot->info, sizeof(struct hotplug_slot_info));
> > > info.latch_status = value;
> > > - return pci_hp_change_slot_info(hotplug_slot->name, &info);
> > > + return 0;
> >
> > We really need to keep this functionality. Unfortunatly sysfs doesn't
> > support that yet. I'd keep the call to pci_hp_change_slot_info() around
> > to point out that this needs to be fixed in sysfs.
> Sorry for my carelessness. I found that we could implement this function
> with sysfs. Following the patch against my last patch. And I will resend a
> new updated all-in-one patch to you.
No, this patch does not update the proper file within sysfs, only the
directory entry, which isn't what we really want. I just sent off the
following patch to Pat Mochel that adds sysfs_update_file() to sysfs,
and modified the pci hotplug core to use it. I've already applied your
previous patches, so you don't have to resend anything to me :)
thanks,
greg k-h
# sysfs: add sysfs_update_file() function.
diff -Nru a/fs/sysfs/inode.c b/fs/sysfs/inode.c
--- a/fs/sysfs/inode.c Wed Jan 29 14:05:17 2003
+++ b/fs/sysfs/inode.c Wed Jan 29 14:05:17 2003
@@ -37,6 +37,7 @@
#include <linux/backing-dev.h>
#include <linux/kobject.h>
#include <linux/mount.h>
+#include <linux/dnotify.h>
#include <asm/uaccess.h>
/* Random magic number */
@@ -714,6 +715,46 @@
dput(victim);
}
up(&dir->d_inode->i_sem);
+}
+
+/**
+ * sysfs_update_file - update the modified timestamp on an object attribute.
+ * @kobj: object we're acting for.
+ * @attr: attribute descriptor.
+ *
+ * Also call dnotify for the dentry, which lots of userspace programs
+ * use.
+ */
+int sysfs_update_file(struct kobject * kobj, struct attribute * attr)
+{
+ struct dentry * dir = kobj->dentry;
+ struct dentry * victim;
+ int res = -ENOENT;
+
+ down(&dir->d_inode->i_sem);
+ victim = get_dentry(dir, attr->name);
+ if (!IS_ERR(victim)) {
+ /* make sure dentry is really there */
+ if (victim->d_inode &&
+ (victim->d_parent->d_inode == dir->d_inode)) {
+ victim->d_inode->i_mtime = CURRENT_TIME;
+ dnotify_parent(victim, DN_MODIFY);
+
+ /**
+ * Drop reference from initial get_dentry().
+ */
+ dput(victim);
+ res = 0;
+ }
+
+ /**
+ * Drop the reference acquired from get_dentry() above.
+ */
+ dput(victim);
+ }
+ up(&dir->d_inode->i_sem);
+
+ return res;
}
diff -Nru a/include/linux/sysfs.h b/include/linux/sysfs.h
--- a/include/linux/sysfs.h Wed Jan 29 14:05:17 2003
+++ b/include/linux/sysfs.h Wed Jan 29 14:05:17 2003
@@ -30,6 +30,9 @@
extern int
sysfs_create_file(struct kobject *, struct attribute *);
+extern int
+sysfs_update_file(struct kobject *, struct attribute *);
+
extern void
sysfs_remove_file(struct kobject *, struct attribute *);
next prev parent reply other threads:[~2003-01-30 5:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-22 1:39 [PATCH] Replace pcihpfs with sysfs Stanley Wang
2003-01-23 4:54 ` Greg KH
2003-01-23 10:34 ` Stanley Wang
2003-01-24 0:45 ` Greg KH
2003-01-24 2:12 ` Stanley Wang
2003-01-30 3:32 ` [Resend][PATCH] " Stanley Wang
2003-01-30 3:21 ` [PATCH] " Stanley Wang
2003-01-30 5:23 ` Greg KH [this message]
2003-01-30 5:46 ` Stanley Wang
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=20030130052313.GK12898@kroah.com \
--to=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pcihpd-discuss@lists.sourceforge.net \
--cc=stanley.wang@linux.co.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.