~ubuntu-branches/ubuntu/precise/tgt/precise

« back to all changes in this revision

Viewing changes to usr/target.c

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2011-08-08 04:45:03 UTC
  • mfrom: (1.2.3 upstream) (6.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110808044503-kxrg8b262tbfiw7m
Tags: 1:1.0.17-1ubuntu1
* Merge from debian remaining changes: 
  - debian/usptart: Add upstart job.
  - Dropped:
    - debian/patches/CVE-2011-0001.patch: No longer needed, use debian instead.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1061
1061
 
1062
1062
        err = target->bst->bs_cmd_done(cmd);
1063
1063
 
1064
 
        dprintf("%d %p %p %u %u %d\n", cmd_mmapio(cmd), scsi_get_out_buffer(cmd),
 
1064
        dprintf("%p %p %u %u %d\n", scsi_get_out_buffer(cmd),
1065
1065
                scsi_get_in_buffer(cmd), scsi_get_out_length(cmd),
1066
1066
                scsi_get_in_length(cmd), err);
1067
1067
 
1086
1086
 
1087
1087
        err = target->bst->bs_cmd_done(cmd);
1088
1088
 
1089
 
        dprintf("%d %p %p %u %u %d\n", cmd_mmapio(cmd), scsi_get_out_buffer(cmd),
 
1089
        dprintf("%p %p %u %u %d\n", scsi_get_out_buffer(cmd),
1090
1090
                scsi_get_in_buffer(cmd), scsi_get_out_length(cmd),
1091
1091
                scsi_get_in_length(cmd), err);
1092
1092
}
1795
1795
                                 lu->path ? : "None",
1796
1796
                                 open_flags_to_str(strflags, lu->bsoflags));
1797
1797
 
1798
 
                if (!strcmp(tgt_drivers[target->lid]->name, "iscsi")) {
 
1798
                if (!strcmp(tgt_drivers[target->lid]->name, "iscsi") ||
 
1799
                    !strcmp(tgt_drivers[target->lid]->name, "iser")) {
1799
1800
                        int i, aid;
1800
1801
 
1801
1802
                        shprintf(total, buf, rest, _TAB1
1963
1964
        return 0;
1964
1965
}
1965
1966
 
 
1967
int tgt_portal_create(int lld, char *args)
 
1968
{
 
1969
        char *portals = NULL;
 
1970
 
 
1971
        portals = strstr(args, "portal=");
 
1972
        if (!portals) {
 
1973
                eprintf("invalid option when creating portals: %s\n", args);
 
1974
                return TGTADM_INVALID_REQUEST;
 
1975
        }
 
1976
 
 
1977
        if (tgt_drivers[lld]->portal_create) {
 
1978
                if (tgt_drivers[lld]->portal_create(portals)) {
 
1979
                        eprintf("failed to create portal %s\n", portals);
 
1980
                        return TGTADM_INVALID_REQUEST;
 
1981
                }
 
1982
        } else {
 
1983
                eprintf("can not create portals for for this lld type\n");
 
1984
                return TGTADM_INVALID_REQUEST;
 
1985
        }
 
1986
 
 
1987
        dprintf("succeed to create new portals %s\n", portals);
 
1988
 
 
1989
        return 0;
 
1990
}
 
1991
 
 
1992
int tgt_portal_destroy(int lld, char *args)
 
1993
{
 
1994
        char *portals = NULL;
 
1995
 
 
1996
        portals = strstr(args, "portal=");
 
1997
        if (!portals) {
 
1998
                eprintf("invalid option when destroying portals: %s\n", args);
 
1999
                return TGTADM_INVALID_REQUEST;
 
2000
        }
 
2001
 
 
2002
        if (tgt_drivers[lld]->portal_destroy) {
 
2003
                if (tgt_drivers[lld]->portal_destroy(portals)) {
 
2004
                        eprintf("failed to destroy portal %s\n", portals);
 
2005
                        return TGTADM_INVALID_REQUEST;
 
2006
                }
 
2007
        } else {
 
2008
                eprintf("can not destroy portals for for this lld type\n");
 
2009
                return TGTADM_INVALID_REQUEST;
 
2010
        }
 
2011
 
 
2012
        dprintf("succeed to destroy portals %s\n", portals);
 
2013
 
 
2014
        return 0;
 
2015
}
 
2016
 
1966
2017
int account_show(char *buf, int rest)
1967
2018
{
1968
2019
        int total = 0, max = rest;
1987
2038
        {TGT_SYSTEM_READY, "ready"},
1988
2039
};
1989
2040
 
1990
 
static char *system_state_name(enum scsi_target_state state)
 
2041
static char *system_state_name(enum tgt_system_state state)
1991
2042
{
1992
2043
        int i;
1993
2044
        char *name = NULL;