From: "Bill O'Donnell" <billodo@redhat.com>
To: Eric Sandeen <sandeen@sandeen.net>,
xfs@oss.sgi.com, "Darrick J. Wong" <darrick.wong@oracle.com>
Subject: Re: [PATCH 2/3] xfs: create symlink proc/fs/xfs/stat to sys/fs/xfs/stats
Date: Thu, 3 Sep 2015 14:15:01 -0500 [thread overview]
Message-ID: <20150903191501.GA11440@redhat.com> (raw)
In-Reply-To: <20150903183953.GA9848@redhat.com>
On Thu, Sep 03, 2015 at 01:39:53PM -0500, Bill O'Donnell wrote:
> On Thu, Sep 03, 2015 at 01:32:25PM -0500, Eric Sandeen wrote:
> > On 9/3/15 12:57 PM, Darrick J. Wong wrote:
> > > On Thu, Sep 03, 2015 at 11:36:26AM -0500, billodo wrote:
> > >> As a part of the work to move xfs global stats from procfs to sysfs,
> > >> this patch creates the symlink from proc/fs/xfs/stat to sys/fs/xfs/stats.
> > >>
> > >> Signed-off-by: Bill O'Donnell <billodo@redhat.com>
> > >> ---
> > >> fs/xfs/xfs_stats.c | 8 ++++++--
> > >> 1 file changed, 6 insertions(+), 2 deletions(-)
> > >>
> > >> diff --git a/fs/xfs/xfs_stats.c b/fs/xfs/xfs_stats.c
> > >> index 856cf57..ad435f1 100644
> > >> --- a/fs/xfs/xfs_stats.c
> > >> +++ b/fs/xfs/xfs_stats.c
> > >> @@ -244,9 +244,13 @@ xfs_init_procfs(void)
> > >> if (!proc_mkdir("fs/xfs", NULL))
> > >> goto out;
> > >>
> > >> - if (!proc_create("fs/xfs/stat", 0, NULL,
> > >> - &xfs_stat_proc_fops))
> > >> + if (!proc_symlink("fs/xfs/stat", NULL,
> > >> + "/sys/fs/xfs/stats/stats"))
> > >
> > > Uh.... is it actually guaranteed that sysfs is mounted on /sys now?
> > >
> > > I sort of recall gregkh grumbling years ago that sysfs can be mounted anywhere,
> > > and that /proc shouldn't hardcode links to it. But that's just handwaving on
> > > my part.
> >
> > You can blame me for that idea. At least one other driver does
> > do it, though; of_core_init():
> >
> > proc_symlink("device-tree", NULL, "/sys/firmware/devicetree/base");
> >
> > worst-case scenario, your "legacy" stats file will be a broken symlink...
> >
> > -Eric
> >
>
> I'm still looking for something in documentation that dictates such a requirement
> regarding symlinks to sysfs elements.
> -Bill
I did find this in: https://www.kernel.org/doc/Documentation/sysfs-rules.txt
--------------snip--------------------------
- sysfs is always at /sys
Parsing /proc/mounts is a waste of time. Other mount points are a
system configuration bug you should not try to solve. For test cases,
possibly support a SYSFS_PATH environment variable to overwrite the
application's behavior, but never try to search for sysfs. Never try
to mount it, if you are not an early boot script.
-------------snip---------------------------
>
> > > --D
> > >
> > >> + {
> > >> + printk(KERN_INFO "failed to created fs/xfs/stat symlink\n");
> > >> goto out_remove_xfs_dir;
> > >> + }
> > >> +
> > >> #ifdef CONFIG_XFS_QUOTA
> > >> if (!proc_create("fs/xfs/xqmstat", 0, NULL,
> > >> &xqmstat_proc_fops))
> > >> --
> > >> 2.4.3
> >
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2015-09-03 19:15 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-03 16:36 [PATCH 0/3] xfs: new global stats in sysfs billodo
2015-09-03 16:36 ` [PATCH 1/3] xfs: create global stats and stats_clear " billodo
2015-09-03 19:56 ` Eric Sandeen
2015-09-03 20:11 ` Eric Sandeen
2015-09-03 16:36 ` [PATCH 2/3] xfs: create symlink proc/fs/xfs/stat to sys/fs/xfs/stats billodo
2015-09-03 17:57 ` Darrick J. Wong
2015-09-03 18:32 ` Eric Sandeen
2015-09-03 18:39 ` Bill O'Donnell
2015-09-03 19:15 ` Bill O'Donnell [this message]
2015-09-03 19:17 ` Darrick J. Wong
2015-09-03 20:08 ` Eric Sandeen
2015-09-03 16:36 ` [PATCH 3/3] xfs: remove unused procfs code billodo
2015-09-03 20:33 ` [PATCH 0/3] xfs: new global stats in sysfs Eric Sandeen
-- strict thread matches above, loose matches on Subject: below --
2015-09-04 12:55 [PATCH 0/3 V2] " Bill O'Donnell
2015-09-04 12:55 ` [PATCH 2/3] xfs: create symlink proc/fs/xfs/stat to sys/fs/xfs/stats Bill O'Donnell
2015-09-04 18:32 ` Eric Sandeen
2015-09-04 20:42 Bill O'Donnell
2015-09-04 20:54 [PATCH 0/3 V3] xfs: new global stats in sysfs Bill O'Donnell
2015-09-04 20:54 ` [PATCH 2/3] xfs: create symlink proc/fs/xfs/stat to sys/fs/xfs/stats Bill O'Donnell
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=20150903191501.GA11440@redhat.com \
--to=billodo@redhat.com \
--cc=darrick.wong@oracle.com \
--cc=sandeen@sandeen.net \
--cc=xfs@oss.sgi.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