opening files in the kernel
opening files in the kernel
- Subject: opening files in the kernel
- From: Chris Bergmann <email@hidden>
- Date: Sun, 22 Feb 2004 23:05:34 +1000
Greets,
I've been trying to open/read/write/etc a file from within a KEXT,
using the vnode interface. I keep running myself into locking trouble
because I lack a thorough understanding of the correct procedures for
dealing with vnodes. I've tried a few different solutions, however
(apart from the odd case where it "just worked" for a while) they all
end up either deadlocking the vfs or causing a (locking-related) panic.
As a basic background to where i'm coming from- I've converted Apple's
HFS+ code to compile with C++ and made the necessary modifications to
run as a KEXT; now i'm trying to create some additional "system" files.
Apple's existing system files (extents tree, etc) are treated rather
specially by the filesystem and I don't want to go down the same path-
instead I would like to open a file in much the same way as a userland
process would (except using the vfs directly since i'm in a KEXT.)
I notice that the paging system also works this way- the dynamic pager
passes in a file path which the kernel then opens and uses- however I
have tried copying its file access techniques without any luck. I'm
also considering the possibility that i'm lacking the "correct"
userland context that I would need in order to access the filesystem,
however I don't know what would be required here if there is anything.
I'm looking for any suggestions on how to go about this task.. or any
good references such as books describing the usage of the vfs would be
great (i purchased McKusick's 4.4 BSD OS book but it's not overly
helpful in this area.) Pointers to existing source from which I can
learn by example would also be helpful.
It's also worth mentioning that my code generally appears to be not
crashing directly- instead, it's leaving the system in a state where
another process is panicking/deadlocking (Finder, when accessing the
same vnode to gather file stats, or some such.)
thx,
chris
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.