Can you suggest any other method(in user space) for this? --- On Thu, 20/3/08, liuyue <liuyue@xxxxxxxxxx> wrote: > From: liuyue <liuyue@xxxxxxxxxx> > Subject: Re: How to get device name with device id? > To: "ashitpro@xxxxxxxxxxx" <ashitpro@xxxxxxxxxxx>, "ext3-users@xxxxxxxxxx" <ext3-users@xxxxxxxxxx> > 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@xxxxxxxxxx > >https://www.redhat.com/mailman/listinfo/ext3-users > > > > > > = = = = = = = = = = = = = = = = = = = = > > > 致 > 礼! > > > liuyue > liuyue@xxxxxxxxxx > 2008-03-20 Chat on a cool, new interface. No download required. Go to http://in.messenger.yahoo.com/webmessengerpromo.php _______________________________________________ Ext3-users mailing list Ext3-users@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/ext3-users