Mounter: Switch out mounter code with the mounter code upstream from A4091.device

This will make it easier to share improvements to the mounter code
This commit is contained in:
Matt Harlum 2025-07-05 03:49:46 +00:00
parent 83f74a8cb1
commit c9402039a7
7 changed files with 20 additions and 1365 deletions

View File

@ -17,7 +17,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.ACCESS_TOKEN }}
submodules: true
- name: Build

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "mounter"]
path = mounter
url = https://github.com/A4091/mounter

View File

@ -22,9 +22,9 @@
#include "idetask.h"
#include "newstyle.h"
#include "td64.h"
#include "mounter.h"
#include "debug.h"
#include "lide_alib.h"
#include "mounter/mounter.h"
#ifdef NO_AUTOCONFIG
extern UBYTE bootblock, bootblock_end;
@ -1006,64 +1006,37 @@ static struct Library * init(BPTR seg_list asm("a0"))
{
struct ExecBase *SysBase = *(struct ExecBase **)4UL;
Info("Init driver.\n");
struct MountStruct *ms = NULL;
struct DeviceBase *mydev = (struct DeviceBase *)MakeLibrary((ULONG *)&device_vectors, // Vectors
NULL, // InitStruct data
(APTR)init_device, // Init function
sizeof(struct DeviceBase), // Library data size
seg_list); // Segment list
BOOL CDBoot = FindCDFS();
if (mydev != NULL) {
ULONG ms_size = (sizeof(struct MountStruct) + (MAX_UNITS * sizeof(struct UnitStruct)));
Info("Add Device.\n");
AddDevice((struct Device *)mydev);
if ((ms = AllocMem(ms_size,MEMF_ANY|MEMF_PUBLIC)) == NULL) goto done;
struct IDETask *itask = (struct IDETask *)mydev->ideTasks.mlh_Head;
ms->deviceName = mydev->lib.lib_Node.ln_Name;
ms->creatorName = NULL;
ms->numUnits = 0;
ms->SysBase = SysBase;
if (!itask->mn_Node.mln_Succ) goto done;
UWORD index = 0;
#if CDBOOT
BOOL CDBoot = FindCDFS();
#endif
struct IDEUnit *unit;
struct MountStruct ms = {
.deviceName = mydev->lib.lib_Node.ln_Name,
.creatorName = mydev->lib.lib_Node.ln_Name,
.SysBase = SysBase,
.cdBoot = CDBoot,
.luns = false,
.slowSpinup = false,
.ignoreLast = true,
.configDev = itask->cd
};
if (SysBase->LibNode.lib_Version >= 36) {
ObtainSemaphoreShared(&mydev->ulSem);
} else {
ObtainSemaphore(&mydev->ulSem);
}
for (unit = (struct IDEUnit *)mydev->units.mlh_Head;
unit->mn_Node.mln_Succ != NULL;
unit = (struct IDEUnit *)unit->mn_Node.mln_Succ)
{
if (unit->present == true) {
#if CDBOOT
// If CDFS not resident don't bother adding the CDROM to the mountlist
if (unit->deviceType == DG_CDROM && !CDBoot) continue;
#endif
ms->Units[index].unitNum = unit->unitNum;
ms->Units[index].configDev = unit->cd;
index++;
}
}
ms->numUnits = index;
ReleaseSemaphore(&mydev->ulSem);
if (ms->numUnits > 0) {
MountDrive(ms);
}
FreeMem(ms,ms_size);
MountDrive(&ms);
if (!seg_list) // Only tweak if we're in boot
TweakBootList(SysBase);
}
done:
return (struct Library *)mydev;

1
mounter Submodule

@ -0,0 +1 @@
Subproject commit 8ffa8ef7b3b00c4e9129e576ca304e0523a41707

1262
mounter.c

File diff suppressed because it is too large Load Diff

View File

@ -1,41 +0,0 @@
#ifndef MOUNTER_H
#define MOUNTER_H
struct UnitStruct
{
ULONG unitNum;
struct ConfigDev *configDev;
};
struct MountStruct
{
// Device name. ("myhddriver.device")
// Offset 0.
UBYTE *deviceName;
// Number of units
UWORD numUnits;
// Name string used to set Creator field in FileSystem.resource (if KS 1.3) and in FileSystem.resource entries.
// If NULL: use device name.
// Offset 8.
const UBYTE *creatorName;
// ConfigDev: set if autoconfig board autoboot support is wanted.
// If NULL and bootable partition found: fake ConfigDev is automatically created.
// Offset 12.
struct ConfigDev *configDev;
// SysBase.
// Offset 16.
struct ExecBase *SysBase;
// Array of UnitStructs
struct UnitStruct Units[];
};
APTR W_CreateIORequest(struct MsgPort *ioReplyPort, ULONG size, struct ExecBase *SysBase);
void W_DeleteIORequest(APTR iorequest, struct ExecBase *SysBase);
struct MsgPort *W_CreateMsgPort(struct ExecBase *SysBase);
void W_DeleteMsgPort(struct MsgPort *port, struct ExecBase *SysBase);
int mount_drives(struct ConfigDev *cd, char *devName, struct MountStruct *ms);
LONG MountDrive(struct MountStruct *ms);
#endif

View File

@ -1,18 +0,0 @@
#ifndef __NDK_COMPAT_H
#define __NDK_COMPAT_H
#include <inttypes.h>
/* ULONG has changed from NDK 3.9 to NDK 3.2.
* However, PRI*32 did not. What is the right way to implement this?
*/
#if INCLUDE_VERSION < 47
#undef PRIu32
#define PRIu32 "lu"
#undef PRId32
#define PRId32 "ld"
#undef PRIx32
#define PRIx32 "lx"
#endif
#endif