lkml.org 
[lkml]   [2009]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] vfs: fix d_path() for unreachable paths
On Mon, Sep 21, 2009 at 03:38:57PM +0100, Al Viro wrote:
> On Mon, Sep 21, 2009 at 10:10:17AM -0400, Mike Frysinger wrote:
>
> > it works without having to copy & paste the same exact structures over
> > and over. a suggestion as how to do it cleanly without bloating the
> > code is certainly welcome. it doesnt really matter that it's on the
> > stack as the usage is small and d_path() is given the size of the
> > buffer, so it isnt going to overflow.
>
> Umm... Surely, you can put a CPU number + one bit into PDE->data? As in
> proc_create_data("icplb", ....., (void *)(cpu * 2))
> proc_create_data("dcplb", ....., (void *)(cpu * 2 + 1))
> and
> struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
> unsigned long n = (unsigned long) pde->data;
> ...
> cpu = n / 2;
> is_D = n & 1;

PS: as to why it is broken... Consider e.g.
mount --bind /proc/cplbinfo/cpu0 /mnt
cat /mnt/icplb
Or, better yet,
mount -t proc none /mnt/cpu
cat /mnt/cpu/cplbinfo/cpu0/icplb


\
 
 \ /
  Last update: 2009-09-21 16:45    [W:0.032 / U:3.508 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site