AddBootNode()
Synopsis
BOOL AddBootNode(
LONG bootPri,
ULONG flags,
struct DeviceNode * deviceNode,
struct ConfigDev * configDev );
Function
AddBootNode() will add a device into the system. It does this in
one of two ways:
1. If DOS is running, add the device to DOS's list of devices
immediately.
2. Otherwise, save the information for later use by DOS, possibly
as a boot device.
This allows device drivers to add devices into the system's disk
device list at any time, without having to worry about whether DOS
is available.
If a device is added before DOS is running, then it is possible for
the device to be used as a boot device. This allows for the user
to choose which device he/she wishes to boot from, and even which
OS they may wish to boot from.
The bootstrap will attempt to boot from the highest priority device
on the Expansion BootNode list, and if that fails continue
through the list until it can succeed.
Floppy disk devices should always be given the highest priority, to
allow a user to prevent a hard disk or network boot by inserting a
floppy disk.
AddBootNode() will also perform a second bit of magic, that if there
is no filesystem specified for this device, (i.e. dn_SegList, dn_Task
and dn_Handler are all NULL), then the standard DOS filesystem
will be used for this device.
Result
TRUE if everything was ok,
FALSE if for some reason we failed (lack of memory etc).
Notes
The address of the ConfigDev structure is stored in the ln_Name
field of the BootNode structure.
AddConfigDev()
Synopsis
void AddConfigDev(
struct ConfigDev * configDev );
Function
This function will add a ConfigDev structure to the systems
list of Configuration Devices. This function is not normally
called by user code.
Result
The device will be added to the system.
AddDosNode()
Synopsis
BOOL AddDosNode(
LONG bootPri,
ULONG flags,
struct DeviceNode * deviceNode );
Function
This is the old function for adding devices to the system. It
is recommended that you use the AddBootNode() function.
Unlike AddBootNode() you will have to add a BootNode to the
system yourself.
Result
non-zero if everything succeeded, zero on failure.
Example
// Add a bootable disk to the system. This will start a
// file handler process immediately.
if( AddDosNode( 0, ADNF_STARTPROC, MakeDosNode( paramPacket )))
{
// AddDosNode() ok
}
Notes
It is much better to use AddBootNode() as it will also
construct the BootNode structure, and add it to the system.
FindConfigDev()
Synopsis
struct ConfigDev * FindConfigDev(
struct ConfigDev * oldConfigDev,
LONG manufacturer,
LONG product );
Function
FindConfigDev() will search through the list of ConfigDevs and find
the one with the matching manufacturer and product identifiers.
The search will start with the ConfigDev after the oldConfigDev,
or at the beginning of oldConfigDev is NULL.
A manufacturer or product of -1 is treated as a wildcard and will
match any value.
Result
The address of the first matching ConfigDev structure, or NULL if
none could be found.
Example
// Find all the config devs in the system
struct ConfigDev *cd = NULL;
while((cd = FindConfigDev(NULL, -1, -1)))
{
Printf("Found a device:\tMan = %5d\tProd = %d\n",
cd->cd_Rom.er_Manufacturer,
cd->cd_Rom.er_Product);
}
FreeConfigDev()
Synopsis
void FreeConfigDev(
struct ConfigDev * configDev );
Function
This function will free a ConfigDev structure, as allocated
by the AllocConfigDev() function.
Result
The memory will be returned to the system.
GetCurrentBinding()
Synopsis
ULONG GetCurrentBinding(
struct CurrentBinding * currentBinding,
ULONG bindingSize );
Function
This function will return the contents of the "currentBinding"
structure. The currentBinding structure may be set with
SetConfigBinding(). This is how arguments are passed to a newly
configured device.
A CurrentBinding structure has the following information:
- the name of the currently loaded driver file
- the product string associated with this driver
- a singly linked list of ConfigDev structures
You may not need this information, but it is recommended that you
at least make sure you can deal with the product code in the
ConfigDev structure.
Result
The size of the CurrentBinding structure returned.
MakeDosNode()
Synopsis
struct DeviceNode * MakeDosNode(
APTR parmPacket );
Function
MakeDosNode() will create a DeviceNode structure suitable for
passing to dos.library which contains all the information about
a device stored in the parmPacket array. This will allow you to
enter a DOS device into the system from the information contained
in a DosEnvec structure (such as in a RigidDiskBlock PartitionBlock
structure).
MakeDosNode() will allocate the memory that it needs to construct
the DeviceNode, the strings and a FileSysStartupMsg that is passed
to the filesystem handler on startup.
You can use AddBootNode() to add a node to the system.
Result
deviceNode - An initialized DeviceNode structure, or NULL if
the required memory could not be allocated. The
caller will have to modify this structure before
passing it to AddBootNode().
Notes
There are a number of fields of the DeviceNode structure that this
function cannot initialize due to a lack of information. You
should fill these in yourself.
ObtainConfigBinding()
Synopsis
void ObtainConfigBinding();
Function
ObtainConfigBinding() gives you permission to bind drivers
to a ConfigDev structure. It exists so that two drivers
at once do not try and bind the same ConfigDev structures
at the same time.
Since most of the data required to bind drivers is statically
kept, so you must lock out other users from accessing the
structures at the same time.
This call is based on the Exec SignalSemaphores, and will
block until it is safe to proceed.
Result
You will have the lock on the CurrentBindings. Please finish
as quickly as you can.
SetCurrentBinding()
Synopsis
void SetCurrentBinding(
struct CurrentBinding * currentBinding,
ULONG bindingSize );
Function
This function will return the contents of the "currentBinding"
structure. The currentBinding structure may be returned with
GetConfigBinding(). This is how arguments are passed to a newly
configured device.
A CurrentBinding structure has the following information:
- the name of the currently loaded driver file
- the product string associated with this driver
- a singly linked list of ConfigDev structures
You may not need this information, but it is recommended that you
at least make sure you can deal with the product code in the
ConfigDev structure.
Result
The size of the CurrentBinding structure set.