diff options
author | Diego Elio Pettenò <flameeyes@gentoo.org> | 2008-06-14 08:18:53 +0000 |
---|---|---|
committer | Diego Elio Pettenò <flameeyes@gentoo.org> | 2008-06-14 08:18:53 +0000 |
commit | 021f1e47f51ac1110ba10679dc7d809351dbdbe5 (patch) | |
tree | b5685ea454696a1b1e7d31158e432df08cb07355 /sys-block | |
parent | Stable for HPPA (bug #225905). (diff) | |
download | gentoo-2-021f1e47f51ac1110ba10679dc7d809351dbdbe5.tar.gz gentoo-2-021f1e47f51ac1110ba10679dc7d809351dbdbe5.tar.bz2 gentoo-2-021f1e47f51ac1110ba10679dc7d809351dbdbe5.zip |
Version bump (bug #223093), and apply patch to fix building with glibc 2.8 (bug #225719).
(Portage version: 2.1.5.5)
Diffstat (limited to 'sys-block')
-rw-r--r-- | sys-block/iscsitarget/ChangeLog | 10 | ||||
-rw-r--r-- | sys-block/iscsitarget/files/iscsitarget-0.4.16+glibc-2.8-lists.patch | 432 | ||||
-rw-r--r-- | sys-block/iscsitarget/iscsitarget-0.4.16.ebuild | 61 |
3 files changed, 502 insertions, 1 deletions
diff --git a/sys-block/iscsitarget/ChangeLog b/sys-block/iscsitarget/ChangeLog index d6e562f71108..b6f99a4a24ba 100644 --- a/sys-block/iscsitarget/ChangeLog +++ b/sys-block/iscsitarget/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for sys-block/iscsitarget # Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-block/iscsitarget/ChangeLog,v 1.12 2008/04/12 14:04:51 nixnut Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-block/iscsitarget/ChangeLog,v 1.13 2008/06/14 08:18:53 flameeyes Exp $ + +*iscsitarget-0.4.16 (14 Jun 2008) + + 14 Jun 2008; Diego Pettenò <flameeyes@gentoo.org> + +files/iscsitarget-0.4.16+glibc-2.8-lists.patch, + +iscsitarget-0.4.16.ebuild: + Version bump (bug #223093), and apply patch to fix building with glibc 2.8 + (bug #225719). 12 Apr 2008; nixnut <nixnut@gentoo.org> iscsitarget-0.4.15-r1.ebuild: Stable on ppc wrt bug 214805 diff --git a/sys-block/iscsitarget/files/iscsitarget-0.4.16+glibc-2.8-lists.patch b/sys-block/iscsitarget/files/iscsitarget-0.4.16+glibc-2.8-lists.patch new file mode 100644 index 000000000000..e02ce18c0f4f --- /dev/null +++ b/sys-block/iscsitarget/files/iscsitarget-0.4.16+glibc-2.8-lists.patch @@ -0,0 +1,432 @@ +From: Arne Redlich <agr@powerkom-dd.de> +Subject: [PATCH 1/6] Replace qelem based lists with list_head based ones +Newsgroups: gmane.linux.iscsi.iscsi-target.devel +To: fujita.tomonori@lab.ntt.co.jp +Cc: iscsitarget-devel@lists.sourceforge.net, + Vladislav Bolkhovitin <vst@vlnb.net> +Date: Sat, 31 May 2008 16:09:08 +0200 + +When building against glibc >= 2.8, __USE_GNU has to be #define'd, which +in turn leads to our struct qelem conflicting with the version provided by +glibc (also enabled by this #define). So let's get rid of struct qelem and +use the familiar list_head-based lists. + +This patch also fixes a few issues: +- list_length_is_one(list) also returned true if list is actually empty +- plain_account_add(): if the outgoing account is to be overwritten, the + retrieval of the old account presently only works due to "black magic" + (i.e., because the struct qelem is the first member of struct user). + +Merely compile tested! +--- + usr/iscsid.h | 11 +++---- + usr/isns.c | 22 +++++++------- + usr/misc.h | 92 ++++++++++++++++++++++++++++++++++++++++++-------------- + usr/plain.c | 24 +++++++------- + usr/session.c | 4 +- + usr/target.c | 6 ++-- + 6 files changed, 102 insertions(+), 57 deletions(-) + +diff --git a/usr/iscsid.h b/usr/iscsid.h +index ba13ecf..a664b0d 100644 +--- a/usr/iscsid.h ++++ b/usr/iscsid.h +@@ -7,7 +7,6 @@ + #ifndef ISCSID_H + #define ISCSID_H + +-#include <search.h> + #include <sys/types.h> + + #include "types.h" +@@ -32,7 +31,7 @@ struct PDU { + #define KEY_STATE_DONE 2 + + struct session { +- struct qelem slist; ++ struct list_head slist; + + char *initiator; + struct target *target; +@@ -122,9 +121,9 @@ struct connection { + #define INCOMING_BUFSIZE 8192 + + struct target { +- struct qelem tlist; ++ struct list_head tlist; + +- struct qelem sessions_list; ++ struct list_head sessions_list; + + u32 tid; + char name[ISCSI_NAME_LEN]; +@@ -133,7 +132,7 @@ struct target { + int max_nr_sessions; + int nr_sessions; + +- struct qelem isns_head; ++ struct list_head isns_head; + }; + + /* chap.c */ +@@ -180,7 +179,7 @@ extern void session_create(struct connection *conn); + extern void session_remove(struct session *session); + + /* target.c */ +-extern struct qelem targets_list; ++extern struct list_head targets_list; + extern int target_add(u32 *, char *); + extern int target_del(u32); + extern u32 target_find_by_name(const char *name); +diff --git a/usr/isns.c b/usr/isns.c +index 08c72de..30ac8d2 100644 +--- a/usr/isns.c ++++ b/usr/isns.c +@@ -44,12 +44,12 @@ struct isns_io { + struct isns_qry_mgmt { + char name[ISCSI_NAME_LEN]; + uint16_t transaction; +- struct qelem qlist; ++ struct list_head qlist; + }; + + struct isns_initiator { + char name[ISCSI_NAME_LEN]; +- struct qelem ilist; ++ struct list_head ilist; + }; + + static LIST_HEAD(qry_list); +@@ -246,7 +246,7 @@ static int isns_scn_register(void) + memset(buf, 0, sizeof(buf)); + tlv = (struct isns_tlv *) hdr->pdu; + +- target = list_entry(targets_list.q_forw, struct target, tlist); ++ target = list_entry(targets_list.next, struct target, tlist); + + length += isns_tlv_set(&tlv, ISNS_ATTR_ISCSI_NAME, + strlen(target->name), target->name); +@@ -293,7 +293,7 @@ static int isns_attr_query(char *name) + mgmt = malloc(sizeof(*mgmt)); + if (!mgmt) + return 0; +- insque(&mgmt->qlist, &qry_list); ++ list_add(&mgmt->qlist, &qry_list); + + memset(buf, 0, sizeof(buf)); + tlv = (struct isns_tlv *) hdr->pdu; +@@ -302,7 +302,7 @@ static int isns_attr_query(char *name) + snprintf(mgmt->name, sizeof(mgmt->name), name); + else { + mgmt->name[0] = '\0'; +- target = list_entry(targets_list.q_forw, struct target, tlist); ++ target = list_entry(targets_list.next, struct target, tlist); + name = target->name; + } + +@@ -345,7 +345,7 @@ static int isns_deregister(void) + memset(buf, 0, sizeof(buf)); + tlv = (struct isns_tlv *) hdr->pdu; + +- target = list_entry(targets_list.q_forw, struct target, tlist); ++ target = list_entry(targets_list.next, struct target, tlist); + + length += isns_tlv_set(&tlv, ISNS_ATTR_ISCSI_NAME, + strlen(target->name), target->name); +@@ -385,7 +385,7 @@ int isns_target_register(char *name) + memset(buf, 0, sizeof(buf)); + tlv = (struct isns_tlv *) hdr->pdu; + +- target = list_entry(targets_list.q_back, struct target, tlist); ++ target = list_entry(targets_list.prev, struct target, tlist); + length += isns_tlv_set(&tlv, ISNS_ATTR_ISCSI_NAME, + strlen(target->name), target->name); + +@@ -436,8 +436,8 @@ static void free_all_acl(struct target *target) + struct isns_initiator *ini; + + while (!list_empty(&target->isns_head)) { +- ini = list_entry(target->isns_head.q_forw, typeof(*ini), ilist); +- remque(&ini->ilist); ++ ini = list_entry(target->isns_head.next, typeof(*ini), ilist); ++ list_del(&ini->ilist); + } + } + +@@ -636,7 +636,7 @@ static void qry_rsp_handle(struct isns_hdr *hdr) + + list_for_each_entry_safe(mgmt, n, &qry_list, qlist) { + if (mgmt->transaction == transaction) { +- remque(&mgmt->qlist); ++ list_del(&mgmt->qlist); + goto found; + } + } +@@ -688,7 +688,7 @@ found: + if (!ini) + goto free_qry_mgmt; + snprintf(ini->name, sizeof(ini->name), name); +- insque(&ini->ilist, &target->isns_head); ++ list_add(&ini->ilist, &target->isns_head); + } else + name = NULL; + break; +diff --git a/usr/misc.h b/usr/misc.h +index c467aab..71e69d6 100644 +--- a/usr/misc.h ++++ b/usr/misc.h +@@ -5,11 +5,6 @@ + #ifndef MISC_H + #define MISC_H + +-struct qelem { +- struct qelem *q_forw; +- struct qelem *q_back; +-}; +- + /* stolen list stuff from Linux kernel */ + + #undef offsetof +@@ -19,41 +14,92 @@ struct qelem { + #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) + #endif + ++#define container_of(ptr, type, member) ({ \ ++ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ ++ (type *)( (char *)__mptr - offsetof(type,member) );}) ++ ++struct list_head { ++ struct list_head *next, *prev; ++}; ++ + #define LIST_HEAD_INIT(name) { &(name), &(name) } +-#define LIST_HEAD(name) \ +- struct qelem name = LIST_HEAD_INIT(name) + +-#define INIT_LIST_HEAD(ptr) do { \ +- (ptr)->q_forw = (ptr); (ptr)->q_back = (ptr); \ +-} while (0) ++#define LIST_HEAD(name) \ ++ struct list_head name = LIST_HEAD_INIT(name) + +-static inline int list_empty(const struct qelem *head) ++static inline void INIT_LIST_HEAD(struct list_head *list) + { +- return head->q_forw == head; ++ list->next = list; ++ list->prev = list; + } + +-static inline int list_length_is_one(const struct qelem *head) ++#define list_first_entry(ptr, type, member) \ ++ list_entry((ptr)->next, type, member) ++ ++static inline int list_empty(const struct list_head *head) + { +- return head->q_forw == head->q_back; ++ return head->next == head; + } + +-#define container_of(ptr, type, member) ({ \ +- const typeof( ((type *)0)->member ) *__mptr = (ptr); \ +- (type *)( (char *)__mptr - offsetof(type,member) );}) ++static inline int list_length_is_one(const struct list_head *head) ++{ ++ return (head->next == head->prev && !list_empty(head)); ++} + + #define list_entry(ptr, type, member) \ + container_of(ptr, type, member) + ++#define list_for_each(pos, head) \ ++ for (pos = (head)->next; pos != (head); pos = pos->next) ++ + #define list_for_each_entry(pos, head, member) \ +- for (pos = list_entry((head)->q_forw, typeof(*pos), member); \ +- &pos->member != (head); \ +- pos = list_entry(pos->member.q_forw, typeof(*pos), member)) ++ for (pos = list_entry((head)->next, typeof(*pos), member); \ ++ &pos->member != (head); \ ++ pos = list_entry(pos->member.next, typeof(*pos), member)) + + #define list_for_each_entry_safe(pos, n, head, member) \ +- for (pos = list_entry((head)->q_forw, typeof(*pos), member), \ +- n = list_entry(pos->member.q_forw, typeof(*pos), member); \ ++ for (pos = list_entry((head)->next, typeof(*pos), member), \ ++ n = list_entry(pos->member.next, typeof(*pos), member); \ + &pos->member != (head); \ +- pos = n, n = list_entry(n->member.q_forw, typeof(*n), member)) ++ pos = n, n = list_entry(n->member.next, typeof(*n), member)) ++ ++static inline void __list_add(struct list_head *new, ++ struct list_head *prev, ++ struct list_head *next) ++{ ++ next->prev = new; ++ new->next = next; ++ new->prev = prev; ++ prev->next = new; ++} ++ ++static inline void list_add(struct list_head *new, struct list_head *head) ++{ ++ __list_add(new, head, head->next); ++} ++ ++static inline void list_add_tail(struct list_head *new, struct list_head *head) ++{ ++ __list_add(new, head->prev, head); ++} ++ ++static inline void __list_del(struct list_head * prev, struct list_head * next) ++{ ++ next->prev = prev; ++ prev->next = next; ++} ++ ++static inline void list_del(struct list_head *entry) ++{ ++ __list_del(entry->prev, entry->next); ++ entry->next = entry->prev = NULL; ++} ++ ++static inline void list_del_init(struct list_head *entry) ++{ ++ __list_del(entry->prev, entry->next); ++ INIT_LIST_HEAD(entry); ++} + + #ifndef IPV6_V6ONLY + #define IPV6_V6ONLY 26 +diff --git a/usr/plain.c b/usr/plain.c +index e653fbf..4210e11 100644 +--- a/usr/plain.c ++++ b/usr/plain.c +@@ -31,7 +31,7 @@ + */ + + struct user { +- struct qelem ulist; ++ struct list_head ulist; + + u32 tid; + char *name; +@@ -62,18 +62,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 LIST_HEAD(discovery_users_in); ++static LIST_HEAD(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 list_head trgt_acct_in[1 << HASH_ORDER]; ++static struct list_head trgt_acct_out[1 << HASH_ORDER]; + +-static struct qelem *account_list_get(u32 tid, int dir) ++static struct list_head *account_list_get(u32 tid, int dir) + { +- struct qelem *list = NULL; ++ struct list_head *list = NULL; + + if (tid) { + list = (dir == AUTH_DIR_INCOMING) ? +@@ -125,7 +125,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 list_head *list = account_list_get(tid, dir); + struct user *user = NULL; + + list_for_each_entry(user, list, ulist) { +@@ -160,7 +160,7 @@ static void account_destroy(struct user *user) + { + if (!user) + return; +- remque(&user->ulist); ++ list_del(&user->ulist); + free(user->name); + free(user->password); + free(user); +@@ -196,7 +196,7 @@ static int plain_account_add(u32 tid, int dir, char *name, char *pass) + { + int err = -ENOMEM; + struct user *user; +- struct qelem *list; ++ struct list_head *list; + + if (!name || !pass) + return -EINVAL; +@@ -220,11 +220,11 @@ 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_first_entry(list, struct user, ulist); + account_destroy(old); + } + +- insque(user, list); ++ list_add(&user->ulist, list); + + /* update the file here. */ + return 0; +diff --git a/usr/session.c b/usr/session.c +index cbd681c..0a9714e 100644 +--- a/usr/session.c ++++ b/usr/session.c +@@ -29,7 +29,7 @@ static struct session *session_alloc(u32 tid) + + session->target = target; + INIT_LIST_HEAD(&session->slist); +- insque(&session->slist, &target->sessions_list); ++ list_add(&session->slist, &target->sessions_list); + + return session; + } +@@ -157,7 +157,7 @@ void session_remove(struct session *session) + ki->session_destroy(session->target->tid, session->sid.id64); + + if (session->target) { +- remque(&session->slist); ++ list_del(&session->slist); + /* session->target->nr_sessions--; */ + } + +diff --git a/usr/target.c b/usr/target.c +index 467cbc4..ad94e6d 100644 +--- a/usr/target.c ++++ b/usr/target.c +@@ -14,7 +14,7 @@ + + #include "iscsid.h" + +-struct qelem targets_list = LIST_HEAD_INIT(targets_list); ++LIST_HEAD(targets_list); + + void target_list_build(struct connection *conn, char *addr, char *name) + { +@@ -83,7 +83,7 @@ int target_del(u32 tid) + if ((err = ki->target_destroy(tid)) < 0) + return err; + +- remque(&target->tlist); ++ list_del(&target->tlist); + + if (!list_empty(&target->sessions_list)) { + fprintf(stderr, "%s still have sessions %d\n", __FUNCTION__, tid); +@@ -122,7 +122,7 @@ int target_add(u32 *tid, char *name) + INIT_LIST_HEAD(&target->sessions_list); + INIT_LIST_HEAD(&target->isns_head); + target->tid = *tid; +- insque(&target->tlist, &targets_list); ++ list_add(&target->tlist, &targets_list); + + isns_target_register(name); + diff --git a/sys-block/iscsitarget/iscsitarget-0.4.16.ebuild b/sys-block/iscsitarget/iscsitarget-0.4.16.ebuild new file mode 100644 index 000000000000..4e774b99465d --- /dev/null +++ b/sys-block/iscsitarget/iscsitarget-0.4.16.ebuild @@ -0,0 +1,61 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-block/iscsitarget/iscsitarget-0.4.16.ebuild,v 1.1 2008/06/14 08:18:53 flameeyes Exp $ + +inherit linux-mod eutils flag-o-matic + +DESCRIPTION="Open Source iSCSI target with professional features" +HOMEPAGE="http://iscsitarget.sourceforge.net/" +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~ppc ~x86" +IUSE="" + +DEPEND="dev-libs/openssl" + +MODULE_NAMES="iscsi_trgt(kernel/iscsi:${S}/kernel)" +CONFIG_CHECK="CRYPTO_CRC32C" +ERROR_CFG="iscsitarget needs support for CRC32C in your kernel." + +src_unpack() { + unpack ${A} + cd "${S}" + epatch "${FILESDIR}"/${PN}-0.4.15-isns-set-scn-flag.patch #180619 + epatch "${FILESDIR}"/${PN}-0.4.15-build.patch + epatch "${FILESDIR}"/${P}+glibc-2.8-lists.patch + convert_to_m "${S}"/Makefile +} + +src_compile() { + local save_CFLAGS="${CFLAGS}" + append-flags -D_GNU_SOURCE + emake usr || die "failed to build userspace" + CFLAGS="${save_CFLAGS}" + + unset ARCH + emake KSRC="${KERNEL_DIR}" kernel || die "failed to build module" +} + +src_install() { + einfo "Installing userspace" + dosbin usr/ietd usr/ietadm || die "dosbin failed" + insinto /etc + doins etc/ietd.conf etc/initiators.{allow,deny} || die "doins failed" + # Upstream's provided Gentoo init script is out of date compared to + # their Debian init script. And isn't that nice. + #newinitd etc/initd/initd.gentoo ietd || die + newinitd "${FILESDIR}"/ietd-init.d ietd || die "newinitd failed" + newconfd "${FILESDIR}"/ietd-conf.d ietd || die "newconfd failed" + + # Lock down perms, per bug 198209 + fperms 0640 /etc/ietd.conf /etc/initiators.{allow,deny} + + doman doc/manpages/*.[1-9] || die "manpages failed" + dodoc ChangeLog README || die "docs failed" + + einfo "Installing kernel module" + unset ARCH + linux-mod_src_install || die "modules failed" +} |