~ubuntu-branches/ubuntu/hardy/open-iscsi/hardy-updates

« back to all changes in this revision

Viewing changes to usr/transport.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Zobel-Helas
  • Date: 2006-12-03 16:54:21 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061203165421-xhttz5j4l9sowg8u
Tags: 2.0.730-0.2
upload to unstable, as no new bugs arised.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdlib.h>
 
2
#include <string.h>
 
3
#include <stdio.h>
 
4
#include <unistd.h>
 
5
#include <errno.h>
 
6
#include <dirent.h>
 
7
 
 
8
#include "initiator.h"
 
9
#include "transport.h"
 
10
#include "log.h"
 
11
#include "util.h"
 
12
#include "iscsi_sysfs.h"
 
13
 
 
14
struct iscsi_uspace_transport iscsi_tcp = {
 
15
        .name           = "tcp",
 
16
        .rdma           = 0,
 
17
        .ep_connect     = iscsi_io_tcp_connect,
 
18
        .ep_poll        = iscsi_io_tcp_poll,
 
19
        .ep_disconnect  = iscsi_io_tcp_disconnect
 
20
};
 
21
 
 
22
struct iscsi_uspace_transport iscsi_iser = {
 
23
        .name           = "iser",
 
24
        .rdma           = 1,
 
25
        .ep_connect     = ktransport_ep_connect,
 
26
        .ep_poll        = ktransport_ep_poll,
 
27
        .ep_disconnect  = ktransport_ep_disconnect
 
28
};
 
29
 
 
30
struct iscsi_uspace_transport *iscsi_utransports[] = {
 
31
        &iscsi_tcp,
 
32
        &iscsi_iser,
 
33
        NULL
 
34
};
 
35
 
 
36
int set_uspace_transport(iscsi_provider_t *p)
 
37
{
 
38
        struct iscsi_uspace_transport *utransport;
 
39
        int j;
 
40
 
 
41
        for (j = 0; iscsi_utransports[j] != NULL; j++) {
 
42
                utransport = iscsi_utransports[j];
 
43
 
 
44
                if (!strcmp(utransport->name, p->name)) {
 
45
                        p->utransport = utransport;
 
46
                        log_debug(3, "Matched transport %s\n", p->name);
 
47
                        return 0;
 
48
                }
 
49
        }
 
50
 
 
51
        log_error("Could not fund uspace transport for %s\n", p->name);
 
52
        return -ENOSYS;
 
53
}