Example #1
0
void mount(struct HDTBPartition *table, struct PartitionHandle *ph, STRPTR name, struct DosEnvec *de)
{
    struct ExpansionBase *ExpansionBase;
    struct DeviceNode *dn;
    struct DosEnvec *nde;
    IPTR *params;
    ULONG i;

    D(bug("[HDToolBox] mount('%s')\n", name));

#error "TODO: pass DOS device name in params[0] and set handler name manually"
#warning "TODO: get filesystem"
    if ((de->de_DosType & 0xFFFFFF00) == BBNAME_DOS)
    {
        ExpansionBase = (struct ExpansionBase *)OpenLibrary("expansion.library",41);
        if (ExpansionBase)
        {
            params = (IPTR *)AllocVec(sizeof(struct DosEnvec)+sizeof(IPTR)*4, MEMF_PUBLIC | MEMF_CLEAR);
            if (params)
            {
                nde = (struct DosEnvec *)&params[4];
                CopyMem(de, nde, sizeof(struct DosEnvec));
                params[0] = (IPTR)"afs.handler";
                params[1] = (IPTR)table->hd->devname;
                params[2] = (IPTR)table->hd->unit;
                params[3] = 0;
                i = getOffset(ph->root);
                nde->de_LowCyl += i;
                nde->de_HighCyl += i;
                dn = MakeDosNode(params);
                if (dn)
                {
                    dn->dn_Name = MKBADDR(AllocVec(AROS_BSTR_MEMSIZE4LEN(strlen(name)), MEMF_PUBLIC));
                    dn->dn_Ext.dn_AROS.dn_DevName = AROS_BSTR_ADDR(dn->dn_Name);

                    i = 0;
                    do
                    {
                        AROS_BSTR_putchar(dn->dn_Name, i, name[i]);
                    } while (name[i++]);
                    AROS_BSTR_setstrlen(dn->dn_Name, i-1);
                    AddDosNode(nde->de_BootPri, ADNF_STARTPROC, dn);
                }
                else
                    FreeVec(params);
            }
            CloseLibrary((struct Library *)ExpansionBase);
        }
    }
    else
        kprintf("ignored %s: unknown FS (0x%lx)\n", name, de->de_DosType);
}
Example #2
0
/*******************************************
 Name  : initDeviceList
 Descr.: initializes a devicelist structure
 Input : devicelist - devicelist structure to initialize
         rootblock  - cacheblock of the rootblock
 Output: DOSTRUE for success; DOSFALSE otherwise
********************************************/
LONG initDeviceList
	(
		struct AFSBase *afsbase,
		struct Volume *volume,
		struct BlockCache *rootblock
	)
{
STRPTR name;
BSTR newname;
UBYTE i;

	name=(char *)rootblock->buffer+(BLK_DISKNAME_START(volume)*4);
	volume->devicelist.dl_Next = 0;
	volume->devicelist.dl_Type = DLT_VOLUME;
	volume->devicelist.dl_Lock = 0;
	volume->devicelist.dl_VolumeDate.ds_Days =
		AROS_BE2LONG(rootblock->buffer[BLK_ROOT_DAYS(volume)]);
	volume->devicelist.dl_VolumeDate.ds_Minute =
		AROS_BE2LONG(rootblock->buffer[BLK_ROOT_MINS(volume)]);
	volume->devicelist.dl_VolumeDate.ds_Tick =
		AROS_BE2LONG(rootblock->buffer[BLK_ROOT_TICKS(volume)]);
	volume->devicelist.dl_LockList = 0;
	volume->devicelist.dl_DiskType = volume->dostype;
	if (volume->devicelist.dl_Name != BNULL)
	{
		newname = volume->devicelist.dl_Name;
	}
	else
	{
		newname = MKBADDR(AllocVec(32,MEMF_CLEAR | MEMF_PUBLIC));
		if (newname == BNULL)
			return DOSFALSE;
	}
	for (i=0; i<name[0]; i++)
		AROS_BSTR_putchar(newname, i, name[i+1]);
	AROS_BSTR_setstrlen(newname, name[0]);
	volume->devicelist.dl_Name = newname;
	return DOSTRUE;
}
Example #3
0
static int GM_UNIQUENAME(Init)(LIBBASETYPEPTR conbase)
{
    static const char *devnames[2] = { "CON", "RAW" };
    struct DeviceNode *dn;
    int     	      i;


    /* Really bad hack, but con_handler is in ROM, intuition.library is
       open, if intuition.library is open, then Input.Device must be
       open, too, ... and I don't like to OpenDevice just for Peek-
       Qualifier */

#warning InputDevice open hack. Hope this is not a problem since it is only used for PeekQualifier
    Forbid();
    conbase->inputbase = (struct Device *)FindName(&SysBase->DeviceList, "input.device");
    Permit();

    /* Install CON: and RAW: handlers into device list
     *
     * KLUDGE: con-handler should create only one device node, depending on
     * the startup packet it gets. The mountlists for CON:/RAW: should be into dos.library bootstrap
     * routines.
     */
    for(i = 0; i < 2; i++)
    {
	if((dn = AllocMem(sizeof (struct DeviceNode) + 4 + AROS_BSTR_MEMSIZE4LEN(3),
                          MEMF_CLEAR|MEMF_PUBLIC)))
	{
	    BSTR s = (BSTR)MKBADDR(((IPTR)dn + sizeof(struct DeviceNode) + 3) & ~3);
	    WORD   a;
	    
	    for(a = 0; a < 3; a++)
	    {
		AROS_BSTR_putchar(s, a, devnames[i][a]);
	    }
	    AROS_BSTR_setstrlen(s, 3);

	    dn->dn_Type		= DLT_DEVICE;

	    /* 
	       i equals 1 when dn_DevName is "RAW", and 0 otherwise. This
	       tells con_task that it has to start in RAW mode
	     */   
	    dn->dn_Ext.dn_AROS.dn_Unit		= (struct Unit *)i;

	    dn->dn_Ext.dn_AROS.dn_Device	= &conbase->device;
	    dn->dn_Handler	= NULL;
	    dn->dn_Startup	= NULL;
	    dn->dn_Name		= s;
	    dn->dn_Ext.dn_AROS.dn_DevName	= AROS_BSTR_ADDR(dn->dn_Name);

	    if (AddDosEntry((struct DosList *)dn))
	    {
		if (i == 0)
		    continue;

		return TRUE;
	    }

	    FreeMem(dn, sizeof (struct DeviceNode));
	}
    }

    return FALSE;
}