Re: How to get vfsmount from inode?

From: Omen Wild (Omen.Wildat_private)
Date: Wed Jul 30 2003 - 15:01:39 PDT

  • Next message: Chris Wright: "Re: How to get vfsmount from inode?"

    Quoting Chris Wright <chrisat_private> on Wed, Jul 30 12:03:
    >
    > One way to know that they at least match is to look at the super_block's
    > root and compare it against the mountpoint's root for each mountpoint in
    > your namespace.  Less than ideal, but it will work.  Then you get to
    > decide what to do if there is more than one match ;-)
    
    Something like this?
    
    ...
    struct vfsmount *mnt = find_vfsmount(inode->i_sb->s_root);
    ...
    
    static struct vfsmount *find_vfsmount(struct dentry *d) {
       struct list_head *list = &current->fs->rootmnt->mnt_list;
       struct list_head *pos;
    
       list_for_each(pos, list) {
    	  struct vfsmount *entry = list_entry(pos, struct vfsmount, mnt_list);
    	  if(entry->mnt_root == d)
    			return entry;
       }
    
       return(NULL);
    }
    
    Does not work (returns NULL), for files NOT on /.  This is under UML if
    it makes a difference.  
    
    Am I getting what I want with list_entry?  I am still wrapping my head
    around the kernels way of doing linked lists.
    
    Ideas?
    
    -- 
    Laughter is the closest distance between two people.
    
    
    

    _______________________________________________ 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 : Wed Jul 30 2003 - 15:02:31 PDT