[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: How to get device name with device id?
- From: ashish mahamuni <ashitpro yahoo co in>
- To: liuyue <liuyue ncic ac cn>
- Cc: Ext3-users redhat com
- Subject: Re: How to get device name with device id?
- Date: Thu, 20 Mar 2008 16:43:09 +0530 (IST)
Can you suggest any other method(in user space) for this?
--- On Thu, 20/3/08, liuyue <liuyue ncic ac cn> wrote:
> From: liuyue <liuyue ncic ac cn>
> Subject: Re: How to get device name with device id?
> To: "ashitpro yahoo co in" <ashitpro yahoo co in>, "ext3-users redhat com" <ext3-users redhat com>
> Date: Thursday, 20 March, 2008, 4:34 PM
> ashish mahamuni,
>
> I guess maybe the following function does what you want.
> But it is a kernel function, sorry :(
>
> int __file_to_disk (char * file_name, char *disk_name) {
> int err = 0;
> struct nameidata nd;
> struct super_block * sb;
> struct vfsmount *mnt;
> err = path_lookup(file_name, LOOKUP_FOLLOW,
> &nd);
> if(err){
> DCFS3_ERROR("error to parse the file
> name, %s\n", file_name);
> goto exit;
> }
> mnt = nd.mnt;
> sb = mnt->mnt_sb;
> strcpy (disk_name,
> sb->s_bdev->bd_disk->disk_name);
> path_release(&nd);
> exit:
> return err;
> }
>
> ======= 2008-03-20 19:21:04
> 您在来信中写道:=======
>
> >Hi all,
> >
> >I want to open a device(/dev/sda1, /dev/hda2 etc) in
> which my file exists.
> >I've used 'stat' system call to get the
> device id.
> >
> >But now I want the device name from this id(st_dev).
> >How to get that one?
> >Or
> >Do you have any other method to know the device name
> where my file resides?
> >
> >Thanks
> >
> >
> > Bollywood, fun, friendship, sports and more. You
> name it, we have it on http://in.promos.yahoo.com/groups
> >
> >
> >_______________________________________________
> >Ext3-users mailing list
> >Ext3-users redhat com
> >https://www.redhat.com/mailman/listinfo/ext3-users
> >
> >
>
> = = = = = = = = = = = = = = = = = = = =
>
>
> 致
> 礼!
>
>
> liuyue
> liuyue ncic ac cn
> 2008-03-20
Chat on a cool, new interface. No download required. Go to http://in.messenger.yahoo.com/webmessengerpromo.php
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]