iPXE
Functions
dummy_sanboot.c File Reference

Dummy SAN device. More...

#include <errno.h>
#include <ipxe/sanboot.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
static int dummy_san_hook (unsigned int drive, struct uri **uris, unsigned int count, unsigned int flags)
 Hook dummy SAN device.
static void dummy_san_unhook (unsigned int drive)
 Unhook dummy SAN device.
static int dummy_san_boot (unsigned int drive __unused, const char *filename __unused)
 Boot from dummy SAN device.
static int dummy_install (struct acpi_header *acpi)
 Install ACPI table.
static int dummy_san_describe (void)
 Describe dummy SAN device.
 PROVIDE_SANBOOT (dummy, san_hook, dummy_san_hook)
 PROVIDE_SANBOOT (dummy, san_unhook, dummy_san_unhook)
 PROVIDE_SANBOOT (dummy, san_boot, dummy_san_boot)
 PROVIDE_SANBOOT (dummy, san_describe, dummy_san_describe)

Detailed Description

Dummy SAN device.

Definition in file dummy_sanboot.c.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
static int dummy_san_hook ( unsigned int  drive,
struct uri **  uris,
unsigned int  count,
unsigned int  flags 
) [static]

Hook dummy SAN device.

Parameters:
driveDrive number
urisList of URIs
countNumber of URIs
flagsFlags
Return values:
driveDrive number, or negative error

Definition at line 44 of file dummy_sanboot.c.

References alloc_sandev(), DBGC, san_device::drive, drive, ENOMEM, rc, register_sandev(), sandev_put(), strerror(), and unregister_sandev().

                                                                     {
        struct san_device *sandev;
        int rc;

        /* Allocate SAN device */
        sandev = alloc_sandev ( uris, count, 0 );
        if ( ! sandev ) {
                rc = -ENOMEM;
                goto err_alloc;
        }

        /* Register SAN device */
        if ( ( rc = register_sandev ( sandev, drive, flags ) ) != 0 ) {
                DBGC ( sandev, "SAN %#02x could not register: %s\n",
                       sandev->drive, strerror ( rc ) );
                goto err_register;
        }

        return drive;

        unregister_sandev ( sandev );
 err_register:
        sandev_put ( sandev );
 err_alloc:
        return rc;
}
static void dummy_san_unhook ( unsigned int  drive) [static]

Unhook dummy SAN device.

Parameters:
driveDrive number

Definition at line 77 of file dummy_sanboot.c.

References DBG, sandev_find(), sandev_put(), and unregister_sandev().

                                                    {
        struct san_device *sandev;

        /* Find drive */
        sandev = sandev_find ( drive );
        if ( ! sandev ) {
                DBG ( "SAN %#02x does not exist\n", drive );
                return;
        }

        /* Unregister SAN device */
        unregister_sandev ( sandev );

        /* Drop reference to drive */
        sandev_put ( sandev );
}
static int dummy_san_boot ( unsigned int drive  __unused,
const char *filename  __unused 
) [static]

Boot from dummy SAN device.

Parameters:
driveDrive number
filenameFilename (or NULL to use default)
Return values:
rcReturn status code

Definition at line 101 of file dummy_sanboot.c.

References EOPNOTSUPP.

                                                            {

        return -EOPNOTSUPP;
}
static int dummy_install ( struct acpi_header acpi) [static]

Install ACPI table.

Parameters:
acpiACPI description header
Return values:
rcReturn status code

Definition at line 113 of file dummy_sanboot.c.

References acpi_name(), DBGC, DBGC_HDA, le32_to_cpu, acpi_header::length, and acpi_header::signature.

Referenced by dummy_san_describe().

                                                      {

        DBGC ( acpi, "ACPI table %s:\n", acpi_name ( acpi->signature ) );
        DBGC_HDA ( acpi, 0, acpi, le32_to_cpu ( acpi->length ) );
        return 0;
}
static int dummy_san_describe ( void  ) [static]

Describe dummy SAN device.

Return values:
rcReturn status code

Definition at line 125 of file dummy_sanboot.c.

References acpi_install(), and dummy_install().

                                       {

        return acpi_install ( dummy_install );
}
PROVIDE_SANBOOT ( dummy  ,
san_hook  ,
dummy_san_hook   
)
PROVIDE_SANBOOT ( dummy  ,
san_boot  ,
dummy_san_boot   
)