xfs
[Top] [All Lists]

Re: finding xfs_mount_t for specified device

To: kss@xxxxxxxx
Subject: Re: finding xfs_mount_t for specified device
From: Russell Cattelan <cattelan@xxxxxxxxxxx>
Date: 17 Apr 2003 11:42:50 -0500
Cc: linux-xfs@xxxxxxxxxxx
In-reply-to: <20030417091320.A26684@xxxxxxxxxxxxx>
Organization:
References: <20030417091320.A26684@xxxxxxxxxxxxx>
Sender: linux-xfs-bounce@xxxxxxxxxxx
I guess some background into what you are trying to accomplish might
help.

On Wed, 2003-04-16 at 19:13, Soon-Son Kwon wrote:
> Hi, I managed to make a very *primative* function 
> that finds xfs_mount_t structure for a specified
> device(e.g. /dev/hda2) from scratch but it does not 
> work as I expected.
> 
> If anyone please take a look at my code and let me 
> know where to modify, I'd appreciate it very much.
> 
> 
> Thanks very much.
> ---
> int xfssnap_findmp(const char *devname, xfs_mount_t *mp)
> {
>         int             fd, size;
>         struct file     *file;
>         struct inode    *inode;
> 
>         bhv_desc_t      *bdp;
>         vn_bhv_head_t   *bhp;
>         vnode_t         *vp; 
>         xfs_inode_t     *ip;
> 
>         xfs_attr_multiop_t      *ops;
>         xfs_fsop_attrmulti_handlereq_t  *am_hreq;
> 
>         size = sizeof(xfs_fsop_attrmulti_handlereq_t);
>         am_hreq = (xfs_fsop_attrmulti_handlereq_t *)kmalloc(size, GFP_KERNEL);
> 
>         fd = open(devname, O_RDONLY, 0);
>         file = fget(fd);
>         inode = file->f_dentry->d_inode;
>  
>         vp = LINVFS_GET_VP(inode);
>         bhp = VN_BHV_HEAD(vp);
>         size = am_hreq->opcount * sizeof(attr_multiop_t);
>         ops = (xfs_attr_multiop_t *)kmalloc(size, GFP_KERNEL);
>         if(!ops)
>         {
>                 VN_RELE(vp);
>                 return -XFS_ERROR(ENOMEM);
>         }
> 
>         bdp = bhv_lookup(bhp, ops);
> 
>         vn_trace_entry(vp, "xfs_ioctl", (inst_t *)__return_address);
> 
>         ip = XFS_BHVTOI(bdp);
>         mp = ip->i_mount;
> 
>         printk("xfssnap_findmp executed\n");
> 
>         kfree(am_hreq);
>         kfree(ops);
>         return 0;
> }
-- 
Russell Cattelan <cattelan@xxxxxxxxxxx>


<Prev in Thread] Current Thread [Next in Thread>