FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > EXT3 Users

 
 
LinkBack Thread Tools
 
Old 03-20-2008, 09:51 AM
ashish mahamuni
 
Default How to get device name with device id?

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
 
Old 03-20-2008, 10:04 AM
"liuyue"
 
Default How to get device name with device id?

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
", 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


_______________________________________________
Ext3-users mailing list
Ext3-users@redhat.com
https://www.redhat.com/mailman/listinfo/ext3-users
 
Old 03-20-2008, 10:13 AM
ashish mahamuni
 
Default How to get device name with device id?

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
", 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


_______________________________________________
Ext3-users mailing list
Ext3-users@redhat.com
https://www.redhat.com/mailman/listinfo/ext3-users
 

Thread Tools




All times are GMT. The time now is 10:17 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org