How to get full pathname from an inode?

From: Omen Wild (Omen.Wildat_private)
Date: Thu Jul 24 2003 - 09:48:25 PDT

  • Next message: Valdis.Kletnieksat_private: "Re: How to get full pathname from an inode?"

    Another question.  I am trying to build up the full path name of a file
    from the inode_permission hook.  I have an inode, how do I get the full
    path (including walking over any mount points) from that inode?  The
    code I have is this:
    
       struct dentry *d = list_entry(inode->i_dentry.next, struct dentry, d_alias);
       char *filename = d_path(d, mntget(current->fs->rootmnt), filebuf, PATH_MAX);
       mntput(current->fs->rootmnt);
    
    I swear this /use/ to cross mount points, but does not any more.  I
    have /shared as a mount point, and a file under that gets resolved as
    '/a.txt' rather than '/shared/a.txt'.
    
    Is that the correct way to get the dentry associated with the inode
    that is passed to inode_permission?
    
    Where do I get the global root vfsmount to pass to d_path?
    current->fs->rootmnt must not be it.
    
    I have been doing all my testing under UML if it makes any difference.
    I am using Debian's UML package, version 2.4.20-6um-1, with LSM version
    2.4.20-lsm1 applied.
    
    Thanks,
       Omen
    
    -- 
    T-Shirt saying: My parents were never my age.
    
    
    

    _______________________________________________ linux-security-module mailing list linux-security-moduleat_private http://mail.wirex.com/mailman/listinfo/linux-security-module



    This archive was generated by hypermail 2b30 : Thu Jul 24 2003 - 09:49:33 PDT