[openbeosstorage] Re: Kernel Interface Design
- From: "Tyler Dauwalder" <tyler@xxxxxxxxxxxxx>
- To: <openbeosstorage@xxxxxxxxxxxxx>
- Date: Tue, 12 Feb 2002 16:23:22 -0800
> My attempt at the emulator code (haven't had chance to try it under BeOS
> yet - but it compiles under gcc). Any comments on this one?
That's not bad. I don't think we need to manage our own file descriptors
now (see my comment in the next paragraph). Combining read and
readdir into one function is an interesting idea.
> Data types - open modes are ints if you use open rather than fopen
> (O_CREAT, etc) - see the attached example
Hmm, good observation. That's what I get for not actually using
POSIX funtions ;-). In light of that, I'm thinking we ought to just
pass the ints returned by POSIX-open() and kernel-open() then,
instead of managing our own file descriptors. The less code
between us and the architecture below us, the better.
> I think Tyler's right about throwing exceptions - this version doesn't,
> but it would make the code clearer if it did.
I wrote up the beginnings of an exception class we can use as
the basis for our error handling. It takes an integer error code and
a string error message. If you compile it with debug support in,
it automatically prints out the error message to stdout when an
exception is created.
I put it in CVS at /storage_kit/source/lib. SKError.cpp and SKError.h
are the files. Test.SKError.cpp just shows an example of using it.
Since catching by value or by reference seemed to involve the copy
constructor being called a couple of times (which meant a lot of
unnecessary string allocation and copying), I decided to make the
copy constructor private so you're required to throw dynamically
allocated exceptions. That means any time you catch an *SKError
pointer and don't raise it again, you have to delete it. Doing it that
way means the constructor only gets called once for each exception.
-Tyler
- Follow-Ups:
- [openbeosstorage] Re: Kernel Interface Design
- From: Mike Lee
- [openbeosstorage] Re: Kernel Interface Design
- From: Keith Poole
- References:
- [openbeosstorage] Kernel Interface Design
- From: Tyler Dauwalder
- [openbeosstorage] Re: Kernel Interface Design
- From: Keith Poole
Other related posts:
- » [openbeosstorage] Kernel Interface Design
- » [openbeosstorage] Re: Kernel Interface Design
- » [openbeosstorage] Re: Kernel Interface Design
- » [openbeosstorage] Re: Kernel Interface Design
- » [openbeosstorage] Re: Kernel Interface Design
- » [openbeosstorage] Re: Kernel Interface Design
- » [openbeosstorage] Re: Kernel Interface Design
- » [openbeosstorage] Re: Kernel Interface Design
- » [openbeosstorage] Re: Kernel Interface Design
- » [openbeosstorage] Re: Kernel Interface Design
- » [openbeosstorage] Re: Kernel Interface Design
- » [openbeosstorage] Re: Kernel Interface Design
- » [openbeosstorage] Re: Kernel Interface Design
- » [openbeosstorage] Re: Kernel Interface Design
- » [openbeosstorage] Re: Kernel Interface Design
- [openbeosstorage] Re: Kernel Interface Design
- From: Mike Lee
- [openbeosstorage] Re: Kernel Interface Design
- From: Keith Poole
- [openbeosstorage] Kernel Interface Design
- From: Tyler Dauwalder
- [openbeosstorage] Re: Kernel Interface Design
- From: Keith Poole