Re: How to tell if a vnode resides in a usb mass storage device?
Re: How to tell if a vnode resides in a usb mass storage device?
- Subject: Re: How to tell if a vnode resides in a usb mass storage device?
- From: Haohao Lee <email@hidden>
- Date: Fri, 28 Sep 2018 11:42:00 +0800
Thanks, I'll check it out.
On Tue, Sep 25, 2018 at 7:17 PM Irad K <email@hidden> wrote:
> You can get the vnode's fsid and decide whether it matches that of the usb
> device.
>
>
> uint64_t getVnodeFsid(const vfs_context_t ctx, const vnode_t vp)
>
> {
>
> struct vnode_attr vap;
>
> VATTR_INIT(&vap);
>
> VATTR_WANTED(&vap, va_fileid);
>
> vnode_getattr(vp, &vap, ctx);
>
> return (vap.va_fileid);
>
> }
>
> now you need to know what's the usb mount fsid which can be done in
> user-space and passed to your driver.
> you can use getmntinfo command and iterate the mount drives until you get
> to your desired device (by checking f_mntonname)
>
> Irad
>
>
> On Tue, Sep 25, 2018 at 10:58 AM Haohao Lee <email@hidden> wrote:
>
>> Hi folks,
>>
>> We need find if a vnode (file) is from a usb drive. More generally, do we
>> have a way to get device info from a vnode.
>>
>> It can be done easily in Linux via super_block stuff, but there is no
>> such thing in xnu.
>>
>> Any suggestion is appreciated!
>>
>> Hao
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Darwin-kernel mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>>
>> This email sent to email@hidden
>>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden