static int _hostfs_mount(
    oe_device_t* device,
    const char* source,
    const char* target,
    const char* filesystemtype,
    unsigned long flags,
    const void* data)
{
    int ret = -1;
    device_t* fs = _cast_device(device);

    /* Fail if required parameters are null. */
    if (!fs || !source || !target)
        OE_RAISE_ERRNO(OE_EINVAL);

    /* Fail if this file system is already mounted. */
    if (fs->is_mounted)
        OE_RAISE_ERRNO(OE_EBUSY);

    /* Cross check the file system type. */
    if (oe_strcmp(filesystemtype, OE_DEVICE_NAME_HOST_FILE_SYSTEM) != 0)
        OE_RAISE_ERRNO(OE_EINVAL);

    /* The data parameter is not supported for host file systems. */
    if (data)
        OE_RAISE_ERRNO(OE_EINVAL);

    /* Remember whether this is a read-only mount. */
    if ((flags & OE_MS_RDONLY))
        fs->mount.flags = flags;

    /* ---------------------------------------------------------------------
     * Only support absolute paths. Hostfs is treated as an external
     * filesystem. As such, it does not make sense to resolve relative paths
     * using the enclave's current working directory.
     * ---------------------------------------------------------------------
     */
    if (source && source[0] != '/')
        OE_RAISE_ERRNO(OE_EINVAL);

    /* Save the source parameter (will be needed to form host paths). */
    oe_strlcpy(fs->mount.source, source, sizeof(fs->mount.source));

    /* Save the target parameter (checked by the umount2() function). */
    oe_strlcpy(fs->mount.target, target, sizeof(fs->mount.target));

    /* Set the flag indicating that this file system is mounted. */
    fs->is_mounted = true;

    ret = 0;

done:
    return ret;
}
static int _hostfs_mount(
    oe_device_t* device,
    const char* source,
    const char* target,
    const char* filesystemtype,
    unsigned long flags,
    const void* data)
{
    int ret = -1;
    device_t* fs = _cast_device(device);

     
    if (!fs || !source || !target)
        OE_RAISE_ERRNO(OE_EINVAL);

     
    if (fs->is_mounted)
        OE_RAISE_ERRNO(OE_EBUSY);

     
    if (oe_strcmp(filesystemtype, OE_DEVICE_NAME_HOST_FILE_SYSTEM) != 0)
        OE_RAISE_ERRNO(OE_EINVAL);

     
    if (data)
        OE_RAISE_ERRNO(OE_EINVAL);

     
    if ((flags & OE_MS_RDONLY))
        fs->mount.flags = flags;

     
    if (source && source[0] != '/')
        OE_RAISE_ERRNO(OE_EINVAL);

     
    oe_strlcpy(fs->mount.source, source, sizeof(fs->mount.source));

     
    oe_strlcpy(fs->mount.target, target, sizeof(fs->mount.target));

     
    fs->is_mounted = true;

    ret = 0;

done:
    return ret;
}