Re: How to tell if a vnode resides in a usb mass storage device?
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=KS1IhqvGzYuywZB3Fpn3HjLINL4qe3RdMjt0imU0rCY=; b=eRw2DTEjPF8xa6ALDoYakAl2lEHiIrRNHUqOpa8FFgDHqHTu6MLWDwWfVNgEFOVeQL ett1shbYKWVUXXg/JJGADQAFLCmaQErwDj9dKhMY0BsIB55oT7nuIysfY4smTsFjhcO4 8Js7Sqj8K2OLIGueC6ayWAHwEEAHAXpMz0LOiV2wTIBv7CSqWbCRjvaZKOkack7fltIn 54pBWMyA1Pbfs+yINrZGpf1AajiuXndoCVExW1cmkX12uTx27BtHamXSTHna6pHp+a8+ OlE9pEaO4eAKxZ2K4kcXQerHgB/S0Nc1o7xRTQvUGhTzC2lfCs45vQwJuskaeMEu3xlh pgWA== Thanks, I'll check it out. On Tue, Sep 25, 2018 at 7:17 PM Irad K <iradization@gmail.com> 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 <hayatelee@gmail.com> 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 (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/darwin-kernel/iradization%40gmail.co...
This email sent to iradization@gmail.com
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.... This email sent to site_archiver@lists.apple.com
participants (1)
-
Haohao Lee