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 at redhat.com
>https://www.redhat.com/mailman/listinfo/ext3-users
>
>
= = = = = = = = = = = = = = = = = = =
?????????
??
????????liuyue
????????liuyue at ncic.ac.cn
??????????2008-03-20