Doing file io from kernel IOKit driver context, again.
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=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=HcbI8YzCK9e+T+CkOM+p3PzwoDHrWCEMTU1O5Q/8Z3o=; b=dPYcgJRj8LX5ow0e/J52GztkwPG6y2gWzQ2nDB4IBzVQiLrnTMJvmnJjJju5DotEDP AxRAltul3soLMjlKy4KBeLgcRTglW0+PKvFlC30ZSxersNyK7u2geNMWXgEhCQv8FJCK hK2SHcImgLsEUOt21InuRfKHskncD3b0+gL2c= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=PDVz5hVNhaPn6btd4Lfr/sMAJWbN6uklYnxvFDTsM9Dd9Lw5JH2iyJk9dVSCMA6I4X NNhuzvruXg+SWywYfdonyOItn6sstLAcfLRqsScaVW4B8ZI+rknx4Q1b2lNGxksYSoxn nZ9HDFIxGoqZfkwNLqezSpsIDKYxoqXxgrCAg= Hello, After searching darwin mailing lists i got a general impression that doing file io from kernel context is discouraged, especially if it is an IOKit driver context.) People mostly just say "don't do it", ask for bigger picture issues and advise an alternative which works. Me, i want to write a driver similar to Apple's Disk Images just for the sake of writing it. Obviously this loop device has to map block device read/writes to file read/writes which means doing file io in kernel. After messing around a bit with IOHDIXController i figured that hdiutil/diskimages-helper calls createDrive64 through HDIX Controller's user client. The data it sends as a parameter seems like an xml plist with image file name among other things. So if the bigger picture issue is actually creating an IOKit loop device driver, how do i safely read and write files from such driver? How does Apple Disk Images handles that? I experimented a bit with the following approach: 1) Pass an image file name to IOKit driver. 2) Lookup and acquire corresponding vnode through VFS layer. 3) Call VNOP_READ, VNOP_WRITE on vnode. It seems to be working fine for me. Is there anything to look out for with this approach? Are there any other alternatives without using a VFS layer? P.S. I also looked at bsd vn driver which does basically the same, but i want my driver to be an IOService object to have access to IORegistryEntry. Thank you, Inso. _______________________________________________ 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... This email sent to site_archiver@lists.apple.com
participants (1)
-
Inso Reiges