site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com On May 12, 2005, at 11:10 AM, Pezeshgi, Shahriar wrote: struct vnode *vnode; struct vnode_attr vattr; If (VNOP_GETATTR (vnode, &vattr, vfs_context_create(NULL) == 0) { size = vattr.va_size; } VATTR_INIT(&va); VATTR_WANTED(&va, va_data_size); err = vnode_getattr(vp, &va, ctx); if (!err && VATTR_IS_SUPPORTED(&va, va_data_size)) my_file_size = va.va_data_size; = Mike _______________________________________________ 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: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... I'm trying to read a file size from my KEXT under Tiger but I'm getting 0 only, is there anyone with more experience on this? Do not call VNOP_GETATTR, use vnode_getattr. Avoid using the VNOP functions entirely; they are not as a general rule meant to be called directly. You must initialise the vnode_attr structure with VATTR_INIT, and set the requested field(s) appropriately: vnode_t vp; /* use vnode_t, to you it is not a structure, it's a handle */ struct vnode_attr va; vnode_context_t ctx; Note that there are a number of size values associated with a file; pick the one that best suits your needs. Also note that vnode_getattr will synthesise values not supported by the underlying filesystem; you don't need to handle those cases yourself. This email sent to site_archiver@lists.apple.com