Welcome, Guest. Please login or register.

Author Topic: struct IOFileSys  (Read 4363 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline EinsteinTopic starter

  • Sr. Member
  • ****
  • Join Date: Dec 2004
  • Posts: 402
    • Show all replies
struct IOFileSys
« on: September 13, 2007, 03:32:07 PM »
Hello, I've written a test code sending FSA_IS_FILESYSTEM message to some filesystem handlers.

I receive correct replies from filesystem-like handlers like ram.handler and pipefs.handler, I receive no replies from non-filesystem-like handlers like zero.handler etc. and on real filesystems like afs sfs and fat the system just crashes.

I wonder if there's something wrong with my code (I assume so, I have almost zero experience with doing exec IO, and I have not programmed for a while).
One special thing I wonder about is when I perform:

Code: [Select]
struct IOFileSys * fsRequest;
..
fsRequest = (stuct IOFileSys *) CreateIORequest( fsReplyPort, sizeof( struct IOFileSys) );


Doing that obviously only initializes the embedded IORequest, question is do the non-IORequest members of IOFileSys (fsRequest) also need to be initialized somehow ?

Anyway here's the code:

Code: [Select]
#include
#include
#include
#include

int main( int argc, char * argv[] )
{
    struct MsgPort * fsReplyPort;
    struct IOFileSys * fsRequest;

    if( argc == 2 )
    {
        fsReplyPort = CreateMsgPort();
        fsRequest = (struct IOFileSys *) CreateIORequest( fsReplyPort, sizeof( struct IOFileSys ) );
    OpenDevice( argv[ 1 ], 0, (struct IORequest *) fsRequest, 0 );

    fsRequest->IOFS.io_Command = FSA_IS_FILESYSTEM;

    DoIO( (struct IORequest *) fsRequest );

    /* After DoIO() above, the boolean fsRequest->io_Union.io_IS_FILESYSTEM.io_IsFilesystem
    will hold TRUE if handler is a real filesystem , FALSE otherwise */

        if( ! fsRequest->io_DosError )
        {
            if( fsRequest->io_Union.io_IS_FILESYSTEM.io_IsFilesystem == TRUE )
            {
                printf( "Handler is a filesystem!\n" );
            }
            else
            {
                printf( "Handler is NOT a filesystem!\n" );
            }
        }
        else
        {
            printf( "Error occured while performing IO\n" );
        }

    CloseDevice( (struct IORequest *) fsRequest );
    DeleteIORequest( (struct IORequest *) fsRequest );
    DeleteMsgPort( fsReplyPort );
    }
    else
    {
        printf( "wrong number of argmuments\n" );
    }

    return 0;
}

I have spoken !
 

Offline EinsteinTopic starter

  • Sr. Member
  • ****
  • Join Date: Dec 2004
  • Posts: 402
    • Show all replies
Re: struct IOFileSys
« Reply #1 on: September 15, 2007, 10:44:31 AM »
@Mazze

Would be nice if there were some activity here though, but sure, how and where do I get into the dev ml ?

@Piru

You're right, I'd better do that.


By the way I didnt realize that the device name and unit number i give to OpenDevice() are placed in fsRequest->io_Union.io_OpenDevice.io_DeviceName and fsRequest->io_Union.io_OpenDevice.io_Unit respectively ?!

What's going on, I thought OpenDevice() only knew of an IORequest and nothing more, does it check what the handler is and then understands what structure to use, or does it send a message (struct IOFileSys) to dos.librarys message port ? (which means its dos.library that actually goes about opening the device ?) I know this is most probably also the same in AmigaOS, so what's happening ?

*EDIT*

If it's dos.library that gets a message (struct IOFileSys *) from Exec (OpenDevice()) then I assume it's quite similiar to other oprating systems that have servers for different services, like filesystems.
I have spoken !
 

Offline EinsteinTopic starter

  • Sr. Member
  • ****
  • Join Date: Dec 2004
  • Posts: 402
    • Show all replies
Re: struct IOFileSys
« Reply #2 on: September 15, 2007, 10:58:01 AM »
Pardon, my eyes must be in vacation  :crazy:
I have spoken !
 

Offline EinsteinTopic starter

  • Sr. Member
  • ****
  • Join Date: Dec 2004
  • Posts: 402
    • Show all replies
Re: struct IOFileSys
« Reply #3 on: September 15, 2007, 11:20:45 AM »
I use Opera 9.10 as my primary browser, this is the message I get from Opera when trying to subscibe:

- The server's name "mail.aros.org" does not match the certificate's name "www.hepe.com;www.mutschler.de;www.hepe.com". Somebody may be trying to eavesdrop on you.
- The certificate for "www.hepe.com" is signed by the unknown Certificate Authority "CA Cert Signing Authority". It is not possible to verify that this is a valid certificate

Is this normal ? (I'm such a noob :-D )
I have spoken !
 

Offline EinsteinTopic starter

  • Sr. Member
  • ****
  • Join Date: Dec 2004
  • Posts: 402
    • Show all replies
Re: struct IOFileSys
« Reply #4 on: September 15, 2007, 11:37:04 AM »
Ok, I've subscibed now..

*EDIT*

By the way, one of us is an imposter, there can be only one!  :lol:
I have spoken !
 

Offline EinsteinTopic starter

  • Sr. Member
  • ****
  • Join Date: Dec 2004
  • Posts: 402
    • Show all replies
Re: struct IOFileSys
« Reply #5 on: September 15, 2007, 03:08:00 PM »
Quote

Thomas wrote:

OpenDevice does not even know of an IORequest. It just loads the code into memory and then calls its open vector. Everything else is done by the device itself.


Ok, this this raises alot of questions I didnt properly think about before, I would really like to have this made clear to me.

There are Devices and there are Handlers.
Handlers (usually) operate a level above the devices and implement the DOS device abstraction.
Devices, are a level beneath the handlers. They implement the raw communication with the physical devices, and only figure as a backend to handlers that that need the service of a a device (driver).

Some handlers (non-filesystem-like ones) like nil.handler zero.handler (an maybe con.handler, I wouldnt know) etc obviously do not need a device (driver).

A second type of handlers (filesystem-like ones) like ram.handler, pipefs.handler etc would not (should not, but there is ramdisk.device! ) either need a device driver.

A third type of handlers (real filesystems) obvioulsy would need the devices to perform the raw IO.

So here I am, trying to fit some pieces of the the puzzle together to have a more clear view of how the system operates and what I'd need to perform to do what i'd want to do,

I know I could hack myself to some answers and read the source for others, the latter I'll avoid for now since some of the sources of minor components are very unclean to say the least.

First and foremost, OpenDevice loads, say, afs.handler, then you say it calls its open vector ? what does this "open" do ? obviously the handler is loaded already, I assume it "opens" the IORequest ?! or rather, the eventual low level device name, in io_Union.io_OpenDevice.io_DeviceName (read below paragraph) it would need if it was a real filesystem ?
What about the unit I send to OpenDevice() ? does it get passed along with IOrequest ? that is, does the handlers "open" routine take the unit and itself place it into fsRequest->io_Union.io_OpenDevice.io_Unit ? this would be useless as the union would be overwritten,
What about fsRequest->io_Union.io_OpenDevice.io_DeviceName ? this simply cannot contain the name I pass to OpenDevice(), what would be the point ?

So, the only conclusion I make for now is that the members of io_Union.io_OpenDevice, if filled, will instruct the handlers "open" routine to load and use io_Union.io_OpenDevice.io_DeviceName as its raw device driver backend with io_Union.io_OpenDevice.io_Unit as the unit.

Am I making somewhat correct assumptions or am I drunk ?
I have spoken !
 

Offline EinsteinTopic starter

  • Sr. Member
  • ****
  • Join Date: Dec 2004
  • Posts: 402
    • Show all replies
Re: struct IOFileSys
« Reply #6 on: September 15, 2007, 05:29:54 PM »
@Thomas, I do have the RKRM: Libraries and RKRM: Devices, but I dont bother with them since they are in AmigaGuide format (I've hardly read anything in them, its a mess clicking around in a labyrint), now I'd like to have them in PDF format..
I have spoken !
 

Offline EinsteinTopic starter

  • Sr. Member
  • ****
  • Join Date: Dec 2004
  • Posts: 402
    • Show all replies
Re: struct IOFileSys
« Reply #7 on: September 27, 2007, 09:52:33 AM »
@Mazze

What happened ? It's almost two weeks ago I subscribed now.
I have spoken !
 

Offline EinsteinTopic starter

  • Sr. Member
  • ****
  • Join Date: Dec 2004
  • Posts: 402
    • Show all replies
Re: struct IOFileSys
« Reply #8 on: September 27, 2007, 08:21:30 PM »
Thanks for replying, but I think I'll let him spend his vacation in peace.  :-)
I have spoken !
 

Offline EinsteinTopic starter

  • Sr. Member
  • ****
  • Join Date: Dec 2004
  • Posts: 402
    • Show all replies
Re: struct IOFileSys
« Reply #9 on: October 05, 2007, 08:51:33 PM »
Maybe struct SubscriptionRequest was trashed because his memory was not protected ?  :-P

I did not send an email, I made a subscription request, so should I make a new request or send him a direct mail ?
Anyhow even if a second request fails, I may just pop up in "the channel" and look around.
I have spoken !