Sync with IET revisions 156-159: fix for compilation on glibc 2.8

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@644 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2009-01-27 18:50:33 +00:00
parent 9ab503a347
commit 467b075b57
6 changed files with 26 additions and 25 deletions

View File

@@ -22,6 +22,7 @@ SRCS_ADM = iscsi_adm.c param.c
OBJS_ADM = $(SRCS_ADM:.c=.o)
CFLAGS += -O2 -fno-inline -Wall -Wstrict-prototypes -g -I../include
CFLAGS += -D_GNU_SOURCE # required for glibc >= 2.8
PROGRAMS = iscsi-scstd
# iscsi-scst-adm
LIBS = -lcrypto

View File

@@ -42,7 +42,7 @@ struct PDU {
#define KEY_STATE_DONE 2
struct session {
struct qelem slist;
struct __qelem slist;
char *initiator;
struct target *target;
@@ -132,9 +132,9 @@ struct connection {
#define INCOMING_BUFSIZE 8192
struct target {
struct qelem tlist;
struct __qelem tlist;
struct qelem sessions_list;
struct __qelem sessions_list;
u32 tid;
char name[ISCSI_NAME_LEN];
@@ -143,7 +143,7 @@ struct target {
int max_nr_sessions;
int nr_sessions;
struct qelem isns_head;
struct __qelem isns_head;
};
extern struct config_operations plain_ops;
@@ -197,7 +197,7 @@ extern void session_create(struct connection *conn);
extern void session_remove(struct session *session);
/* target.c */
extern struct qelem targets_list;
extern struct __qelem targets_list;
extern int target_add(u32 *, char *);
extern int target_del(u32);
extern u32 target_find_by_name(const char *name);

View File

@@ -46,12 +46,12 @@ struct isns_io {
struct isns_qry_mgmt {
char name[ISCSI_NAME_LEN];
uint16_t transaction;
struct qelem qlist;
struct __qelem qlist;
};
struct isns_initiator {
char name[ISCSI_NAME_LEN];
struct qelem ilist;
struct __qelem ilist;
};
static LIST_HEAD(qry_list);

View File

@@ -16,9 +16,9 @@
#ifndef MISC_H
#define MISC_H
struct qelem {
struct qelem *q_forw;
struct qelem *q_back;
struct __qelem {
struct __qelem *q_forw;
struct __qelem *q_back;
};
/* stolen list stuff from Linux kernel */
@@ -32,20 +32,20 @@ struct qelem {
#define LIST_HEAD_INIT(name) { &(name), &(name) }
#define LIST_HEAD(name) \
struct qelem name = LIST_HEAD_INIT(name)
struct __qelem name = LIST_HEAD_INIT(name)
#define INIT_LIST_HEAD(ptr) do { \
(ptr)->q_forw = (ptr); (ptr)->q_back = (ptr); \
} while (0)
static inline int list_empty(const struct qelem *head)
static inline int list_empty(const struct __qelem *head)
{
return head->q_forw == head;
}
static inline int list_length_is_one(const struct qelem *head)
static inline int list_length_is_one(const struct __qelem *head)
{
return head->q_forw == head->q_back;
return (!list_empty(head) && head->q_forw == head->q_back);
}
#define container_of(ptr, type, member) ({ \

View File

@@ -41,7 +41,7 @@
*/
struct user {
struct qelem ulist;
struct __qelem ulist;
u32 tid;
char *name;
@@ -72,18 +72,18 @@ static struct iscsi_key user_keys[] = {
{NULL,},
};
static struct qelem discovery_users_in = LIST_HEAD_INIT(discovery_users_in);
static struct qelem discovery_users_out = LIST_HEAD_INIT(discovery_users_out);
static struct __qelem discovery_users_in = LIST_HEAD_INIT(discovery_users_in);
static struct __qelem discovery_users_out = LIST_HEAD_INIT(discovery_users_out);
#define HASH_ORDER 4
#define acct_hash(x) ((x) & ((1 << HASH_ORDER) - 1))
static struct qelem trgt_acct_in[1 << HASH_ORDER];
static struct qelem trgt_acct_out[1 << HASH_ORDER];
static struct __qelem trgt_acct_in[1 << HASH_ORDER];
static struct __qelem trgt_acct_out[1 << HASH_ORDER];
static struct qelem *account_list_get(u32 tid, int dir)
static struct __qelem *account_list_get(u32 tid, int dir)
{
struct qelem *list = NULL;
struct __qelem *list = NULL;
if (tid) {
list = (dir == AUTH_DIR_INCOMING) ?
@@ -139,7 +139,7 @@ static int plain_account_init(char *filename)
/* Return the first account if the length of name is zero */
static struct user *account_lookup_by_name(u32 tid, int dir, char *name)
{
struct qelem *list = account_list_get(tid, dir);
struct __qelem *list = account_list_get(tid, dir);
struct user *user = NULL;
list_for_each_entry(user, list, ulist) {
@@ -210,7 +210,7 @@ static int plain_account_add(u32 tid, int dir, char *name, char *pass)
{
int err = -ENOMEM;
struct user *user;
struct qelem *list;
struct __qelem *list;
if (!name || !pass)
return -EINVAL;
@@ -241,7 +241,7 @@ static int plain_account_add(u32 tid, int dir, char *name, char *pass)
" Replacing the old one.\n",
tid ? "target" : "discovery");
old = (struct user *) list->q_forw;
old = list_entry(list->q_forw, struct user, ulist);
account_destroy(old);
}

View File

@@ -24,7 +24,7 @@
#include "iscsid.h"
struct qelem targets_list = LIST_HEAD_INIT(targets_list);
struct __qelem targets_list = LIST_HEAD_INIT(targets_list);
void target_list_build(struct connection *conn, char *addr, char *name)
{