Hello community,
here is the log from the commit of package open-fcoe
checked in at Mon Nov 24 20:42:02 CET 2008.
--------
--- open-fcoe/open-fcoe.changes 2008-09-24 15:57:55.000000000 +0200
+++ /mounts/work_src_done/STABLE/open-fcoe/open-fcoe.changes 2008-11-24 17:34:17.000000000 +0100
@@ -1,0 +2,9 @@
+Mon Nov 24 17:30:11 CET 2008 - sf@suse.de
+
+- new version 1.0.3 (bnc #438954)
+ - add working tools
+ - add required libraries
+ - add hbaapi
+ - add required headers from dcbd
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
New:
----
clif_cmds.h
clif.h
common.h
dcbd.h
dcb_osdep.h
dcbtool.h
dcb_types.h
includes.h
open-fcoe-multi-arch.diff
os.h
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ open-fcoe.spec ++++++
--- /var/tmp/diff_new_pack.L20139/_old 2008-11-24 20:40:31.000000000 +0100
+++ /var/tmp/diff_new_pack.L20139/_new 2008-11-24 20:40:31.000000000 +0100
@@ -1,5 +1,5 @@
#
-# spec file for package open-fcoe (Version 0.1)
+# spec file for package open-fcoe (Version 1.0.3)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -24,11 +24,22 @@
Group: System/Daemons
PreReq: %fillup_prereq %insserv_prereq
AutoReqProv: on
-Version: 0.1
+BuildRequires: xorg-x11-devel
+Version: 1.0.3
Release: 1
Summary: Open-FCoE userspace management tools
Source: %{name}.tar.bz2
+Source1: dcb_types.h
+Source2: dcbtool.h
+Source3: clif.h
+Source4: clif_cmds.h
+Source5: common.h
+Source6: dcb_osdep.h
+Source7: includes.h
+Source8: dcbd.h
+Source9: os.h
Patch1: %{name}-init-fixes
+Patch2: %{name}-multi-arch.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@@ -44,12 +55,21 @@
%prep
%setup -n open-fcoe
%patch1 -p1
+%patch2 -p1
%build
-%{__make} CFLAGS="${RPM_OPT_FLAGS}"
+export LIBHBALINUX="%{_builddir}/%{name}/libhbalinux"
+export LDFLAGS="${LDFLAGS} -L${LIBHBALINUX}/hbaapi_src_2.2/"
+export CFLAGS="${RPM_OPT_FLAGS} -fPIC -I${LIBHBALINUX}/include -I${LIBHBALINUX}/hbaapi_src_2.2/"
+export DCB_SRC="%{_builddir}/%{name}"
+mkdir include
+cp %{S:1} %{S:2} %{S:3} %{S:4} %{S:5} %{S:6} %{S:7} %{S:8} %{S:9} include/
+make libdir=%{_libdir}
%install
-%{__make} DESTDIR=${RPM_BUILD_ROOT} install
+export LIBHBALINUX="%{_builddir}/%{name}/libhbalinux"
+export DCB_SRC="%{_builddir}/%{name}/include/"
+%{__make} DESTDIR=${RPM_BUILD_ROOT} libdir=%{_libdir} install
%post
%{fillup_and_insserv open-fcoe}
@@ -64,11 +84,21 @@
%defattr(-,root,root)
%attr(755,root,root)/sbin/*
%attr(755,root,root)/etc/init.d/*
+%dir %{_libdir}/%{name}-%{version}
+%{_libdir}/%{name}-%{version}/*
%dir /etc/fcoe
+%config /etc/hba.conf
%config /etc/fcoe/open-fcoe.conf
+%config /etc/fcoe/fcoemon.conf
%{_mandir}/man8/*
%doc README
%changelog
+* Mon Nov 24 2008 sf@suse.de
+- new version 1.0.3 (bnc #438954)
+ - add working tools
+ - add required libraries
+ - add hbaapi
+ - add required headers from dcbd
* Wed Sep 24 2008 hare@suse.de
- Initial package (FATE#303914)
++++++ clif_cmds.h ++++++
/*******************************************************************************
Intel Data Center Bridging (DCB) Software
Copyright(c) 2007-2008 Intel Corporation.
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information:
e1000-eedc Mailing List
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*******************************************************************************/
#ifndef CLIF_CMDS_H
#define CLIF_CMDS_H
#include
#include
#include "dcbd.h"
/* Client interface versions */
/* Version 2
* DCBX subtype field added to peer commands
* Priority Group feature adds 'number of TC's supported'
* Priority Flow Control feature adds 'number of TC's supported'
* BCN feature is added
*/
#define CLIF_EV_VERSION 2
#define CLIF_MSG_VERSION 2
#define CLIF_RSP_VERSION CLIF_MSG_VERSION
/* Client interface global command codes */
#define UNKNOWN_CMD '.'
#define PING_CMD 'P'
#define LEVEL_CMD 'L'
#define ATTACH_CMD 'A'
#define DETACH_CMD 'D'
#define DCB_CMD 'C'
#define EVENT_MSG 'E'
#define CMD_RESPONSE 'R'
/* Client interface DCB command codes */
#define CMD_GET_CONFIG 1
#define CMD_SET_CONFIG 2
#define CMD_GET_OPER 3
#define CMD_GET_PEER 4
/* Client interface Feature codes */
#define FEATURE_DCB 1
#define FEATURE_PG 2
#define FEATURE_PFC 3
#define FEATURE_BCN 4
#define FEATURE_APP 5
#define FEATURE_LLINK 6
#define FEATURE_DCBX 0xfe
#define FEATURE_PG_DESC 0xff
/* Client interface DCB event message field offsets */
#define EV_MSG_OFF 0
#define EV_LEVEL_OFF 1
#define EV_GENMSG_OFF 2 /* for unformatted non-DCB event messages */
#define EV_VERSION_OFF 2 /* for DCB event messages */
#define EV_PORT_LEN_OFF 3
#define EV_PORT_LEN_LEN 2
#define EV_PORT_ID_OFF (EV_PORT_LEN_OFF + EV_PORT_LEN_LEN)
/* DCB event message offsets (after port id field) */
#define EV_FEATURE_OFF 0
#define EV_SUBTYPE_OFF 2
#define EV_OP_MODE_CHG_OFF 4
#define EV_OP_CFG_CHG_OFF 5
/* Client interface DCB command message field offsets */
#define CLIF_CMD_OFF 0
#define CLIF_CMD_LEN 1
#define DCB_VER_OFF (CLIF_CMD_OFF + CLIF_CMD_LEN)
#define DCB_VER_LEN 1
#define DCB_CMD_OFF (DCB_VER_OFF + DCB_VER_LEN)
#define DCB_CMD_LEN 2
#define DCB_FEATURE_OFF (DCB_CMD_OFF + DCB_CMD_LEN)
#define DCB_FEATURE_LEN 2
#define DCB_SUBTYPE_OFF (DCB_FEATURE_OFF + DCB_FEATURE_LEN)
#define DCB_SUBTYPE_LEN 2
#define DCB_PORTLEN_OFF (DCB_SUBTYPE_OFF + DCB_SUBTYPE_LEN)
#define DCB_PORTLEN_LEN 2
#define DCB_PORT_OFF (DCB_PORTLEN_OFF + DCB_PORTLEN_LEN)
/* DCBX configuration commands do not need to have a port field */
#define DCBX_CFG_OFF (DCB_FEATURE_OFF + DCB_FEATURE_LEN)
/* Client interface DCB command response message field offsets */
#define CLIF_RSP_MSG_OFF 0
#define CLIF_RSP_MSG_LEN 1
#define CLIF_STAT_OFF (CLIF_RSP_MSG_OFF + CLIF_RSP_MSG_LEN)
#define CLIF_STAT_LEN 2
#define CLIF_RSP_OFF (CLIF_STAT_OFF + CLIF_STAT_LEN)
/* Offset into the DCB protocol data section of the client
* interface message.
* GetConfig and SetConfig commands */
#define CFG_ENABLE 0
#define CFG_ADVERTISE 1
#define CFG_WILLING 2
#define CFG_LEN 3
/* Offset into the DCB protocol data section of the client
* interface message.
* GetOper commands */
#define OPER_OPER_VER 0
#define OPER_MAX_VER 2
#define OPER_ERROR 4
#define OPER_OPER_MODE 6
#define OPER_SYNCD 7
#define OPER_LEN 8
/* Offset into the DCB protocol data section of the client
* interface message.
* GetPeer command */
#define PEER_ENABLE 0
#define PEER_WILLING 1
#define PEER_OPER_VER 2
#define PEER_MAX_VER 4
#define PEER_ERROR 6
#define PEER_SUBTYPE 7
#define PEER_LEN 8
/* DCB status data offset */
#define DCB_STATE 0
/* DCB State configuration data length */
#define CFG_DCB_DLEN 1
/* DCBX Version configuration data offset */
#define DCBX_VERSION 0
/* DCBX configuration data length
* Does not include the Operational version */
#define CFG_DCBX_DLEN 1
/* Priority Flow Control configuration data offsets */
#define PFC_UP(i) (i)
#define PFC_NUM_TC (PFC_UP(8))
/* Priority Flow Control configuration data length */
#define CFG_PFC_DLEN (PFC_NUM_TC+1)
/* Priority Groups configuration data offsets */
#define PG_UP2TC(i) (i)
#define PG_PG_PCNT(i) (PG_UP2TC(8) + (2*i))
#define PG_UP_PGID(i) (PG_PG_PCNT(8) + i)
#define PG_UP_PCNT(i) (PG_UP_PGID(8) + (2*i))
#define PG_UP_STRICT(i) (PG_UP_PCNT(8) + i)
#define PG_UP_NUM_TC (PG_UP_STRICT(8))
/* Priority Groups configuration data length */
#define CFG_PG_DLEN (PG_UP_NUM_TC+1)
/* Application configuration data offsets */
#define APP_LEN 0
#define APP_DATA 2
/* Priority group description data offsets */
#define PG_DESC_PGID 0
#define PG_DESC_LEN 1
#define PG_DESC_DATA 3
#define PG_DESC_GET_DLEN 1
#define PG_DESC_SET_DLEN 3
/* BCN configuration data offsets */
#define BCN_UP_RP(i) (i)
#define BCN_UP_RP_OP BCN_UP_RP(8)
#define BCN_UP_RP_RTAG_OP BCN_UP_RP_OP+2
#define BCN_UP_CP BCN_UP_RP_RTAG_OP+2
#define BCN_BCNA(i) BCN_UP_CP+2+(i)*2
#define BCN_ALPHA BCN_BCNA(8)
#define BCN_BETA BCN_ALPHA+8
#define BCN_GD BCN_BETA+8
#define BCN_GI BCN_GD+8
#define BCN_TMAX BCN_GI+8
#define BCN_RI BCN_TMAX+8
#define BCN_TD BCN_RI+8
#define BCN_RMIN BCN_TD+4
#define BCN_W BCN_RMIN+4
#define BCN_RD BCN_W+2
#define BCN_RU BCN_RD+2
#define BCN_WRTT BCN_RU+2
#define BCN_CP_SF BCN_WRTT+2
/* CP_SF needs 8 bytes */
/* Logical link data offsets */
#define LLINK_STATUS 0
#define LLINK_DLEN 1
#define CLIF_NOT_SUPPLIED 'x'
#define CHANGED "changed"
#define NOCHANGE "no change"
/* max buffer length needed for a field with an unsigned char length */
#define MAX_U8_BUF 256
/* max buffer length for a clif message */
#define MAX_CLIF_MSGBUF 1024
void process_clif_cmd( struct dcbd_data *dd,
struct sockaddr_un *from,
socklen_t fromlen,
char *ibuf, int ilen, char *rbuf, int *rlen);
#endif /* CLIF_CMDS_H */
++++++ clif.h ++++++
/*******************************************************************************
Intel Data Center Bridging (DCB) Software
Copyright(c) 2007-2008 Intel Corporation.
Substantially modified from:
hostapd-0.5.7
Copyright (c) 2002-2007, Jouni Malinen and
contributors
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information:
e1000-eedc Mailing List
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*******************************************************************************/
#ifndef CLIF_H
#define CLIF_H
#ifdef __cplusplus
extern "C" {
#endif
/* dcbd client interface access */
/**
* clif_open - Open a client interface to the dcbd
* @clif_path: Path for UNIX domain sockets; ignored if UDP sockets are used.
* Returns: Pointer to abstract client interface data or %NULL on failure
*
* This function is used to open a client interface to the dcbd.
* clif_path is usually /var/run/dcbd. This path
* is configured in dcbd and other programs using the client
* interface need to use matching path configuration.
*/
struct clif *clif_open(const char *clif_path);
/**
* clif_close - Close a client interface to dcbd
* @clif: Control interface data from clif_open()
*
* This function is used to close a client interface.
*/
void clif_close(struct clif *clif);
/**
* clif_request - Send a command to dcbd
* @clif: Control interface data from clif_open()
* @cmd: Command; usually, ASCII text, e.g., "PING"
* @cmd_len: Length of the cmd in bytes
* @reply: Buffer for the response
* @reply_len: Reply buffer length
* @msg_cb: Callback function for unsolicited messages or %NULL if not used
* Returns: 0 on success, -1 on error (send or receive failed), -2 on timeout
*
* This function is used to send commands to dcbd. Received
* response will be written to reply and reply_len is set to the actual length
* of the reply. This function will block for up to two seconds while waiting
* for the reply. If unsolicited messages are received, the blocking time may
* be longer.
*
* msg_cb can be used to register a callback function that will be called for
* unsolicited messages received while waiting for the command response. These
* messages may be received if clif_request() is called at the same time as
* dcbd is sending such a message. This can happen only if
* the program has used clif_attach() to register itself as a monitor for
* event messages. Alternatively to msg_cb, programs can register two client
* interface connections and use one of them for commands and the other one for
* receiving event messages, in other words, call clif_attach() only for
* the client interface connection that will be used for event messages.
*/
#define CMD_RESPONSE_TIMEOUT 2
int clif_request(struct clif *clif, const char *cmd, size_t cmd_len,
char *reply, size_t *reply_len,
void (*msg_cb)(char *msg, size_t len));
/**
* clif_attach - Register as an event monitor for the client interface
* @clif: Control interface data from clif_open()
* Returns: 0 on success, -1 on failure, -2 on timeout
*
* This function registers the client interface connection as a monitor for
* dcbd events. After a success clif_attach() call, the
* client interface connection starts receiving event messages that can be
* read with clif_recv().
*/
int clif_attach(struct clif *clif);
/**
* clif_detach - Unregister event monitor from the client interface
* @clif: Control interface data from clif_open()
* Returns: 0 on success, -1 on failure, -2 on timeout
*
* This function unregisters the client interface connection as a monitor for
* dcbd events, i.e., cancels the registration done with
* clif_attach().
*/
int clif_detach(struct clif *clif);
/**
* clif_recv - Receive a pending client interface message
* @clif: Control interface data from clif_open()
* @reply: Buffer for the message data
* @reply_len: Length of the reply buffer
* Returns: 0 on success, -1 on failure
*
* This function will receive a pending client interface message. This
* function will block if no messages are available. The received response will
* be written to reply and reply_len is set to the actual length of the reply.
* clif_recv() is only used for event messages, i.e., clif_attach()
* must have been used to register the client interface as an event monitor.
*/
int clif_recv(struct clif *clif, char *reply, size_t *reply_len);
/**
* clif_pending - Check whether there are pending event messages
* @clif: Control interface data from clif_open()
* Returns: 1 if there are pending messages, 0 if no, or -1 on error
*
* This function will check whether there are any pending client interface
* message available to be received with clif_recv(). clif_pending() is
* only used for event messages, i.e., clif_attach() must have been used to
* register the client interface as an event monitor.
*/
int clif_pending(struct clif *clif);
/**
* clif_get_fd - Get file descriptor used by the client interface
* @clif: Control interface data from clif_open()
* Returns: File descriptor used for the connection
*
* This function can be used to get the file descriptor that is used for the
* client interface connection. The returned value can be used, e.g., with
* select() while waiting for multiple events.
*
* The returned file descriptor must not be used directly for sending or
* receiving packets; instead, the library functions clif_request() and
* clif_recv() must be used for this.
*/
int clif_get_fd(struct clif *clif);
#ifdef __cplusplus
}
#endif
#endif /* CLIF_H */
++++++ common.h ++++++
/*******************************************************************************
Intel Data Center Bridging (DCB) Software
Copyright(c) 2007-2008 Intel Corporation.
Substantially modified from:
hostapd-0.5.7
Copyright (c) 2002-2007, Jouni Malinen and
contributors
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information:
e1000-eedc Mailing List
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*******************************************************************************/
#ifndef COMMON_H
#define COMMON_H
#include "dcb_osdep.h"
#include "os.h"
#ifdef __linux__
#include
#include
#endif /* __linux__ */
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
#include
#include
#define __BYTE_ORDER _BYTE_ORDER
#define __LITTLE_ENDIAN _LITTLE_ENDIAN
#define __BIG_ENDIAN _BIG_ENDIAN
#define bswap_16 bswap16
#define bswap_32 bswap32
#define bswap_64 bswap64
#endif /* defined(__FreeBSD__) || defined(__NetBSD__) ||
* defined(__DragonFly__) */
#ifdef CONFIG_TI_COMPILER
#define __BIG_ENDIAN 4321
#define __LITTLE_ENDIAN 1234
#ifdef __big_endian__
#define __BYTE_ORDER __BIG_ENDIAN
#else
#define __BYTE_ORDER __LITTLE_ENDIAN
#endif
#endif /* CONFIG_TI_COMPILER */
#if defined(__CYGWIN__) || defined(CONFIG_NATIVE_WINDOWS)
static inline unsigned short wpa_swap_16(unsigned short v)
{
return ((v & 0xff) << 8) | (v >> 8);
}
static inline unsigned int wpa_swap_32(unsigned int v)
{
return ((v & 0xff) << 24) | ((v & 0xff00) << 8) |
((v & 0xff0000) >> 8) | (v >> 24);
}
#define le_to_host16(n) (n)
#define host_to_le16(n) (n)
#define be_to_host16(n) wpa_swap_16(n)
#define host_to_be16(n) wpa_swap_16(n)
#define le_to_host32(n) (n)
#define be_to_host32(n) wpa_swap_32(n)
#define host_to_be32(n) wpa_swap_32(n)
#else /* __CYGWIN__ */
#ifndef __BYTE_ORDER
#ifndef __LITTLE_ENDIAN
#ifndef __BIG_ENDIAN
#define __LITTLE_ENDIAN 1234
#define __BIG_ENDIAN 4321
#if defined(sparc)
#define __BYTE_ORDER __BIG_ENDIAN
#endif
#endif /* __BIG_ENDIAN */
#endif /* __LITTLE_ENDIAN */
#endif /* __BYTE_ORDER */
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define le_to_host16(n) (n)
#define host_to_le16(n) (n)
#define be_to_host16(n) bswap_16(n)
#define host_to_be16(n) bswap_16(n)
#define le_to_host32(n) (n)
#define be_to_host32(n) bswap_32(n)
#define host_to_be32(n) bswap_32(n)
#define le_to_host64(n) (n)
#define host_to_le64(n) (n)
#define be_to_host64(n) bswap_64(n)
#define host_to_be64(n) bswap_64(n)
#elif __BYTE_ORDER == __BIG_ENDIAN
#define le_to_host16(n) bswap_16(n)
#define host_to_le16(n) bswap_16(n)
#define be_to_host16(n) (n)
#define host_to_be16(n) (n)
#define le_to_host32(n) bswap_32(n)
#define be_to_host32(n) (n)
#define host_to_be32(n) (n)
#define le_to_host64(n) bswap_64(n)
#define host_to_le64(n) bswap_64(n)
#define be_to_host64(n) (n)
#define host_to_be64(n) (n)
#ifndef WORDS_BIGENDIAN
#define WORDS_BIGENDIAN
#endif
#else
#error Could not determine CPU byte order
#endif
#endif /* __CYGWIN__ */
/* Macros for handling unaligned 16-bit variables */
#define WPA_GET_BE16(a) ((u16) (((a)[0] << 8) | (a)[1]))
#define WPA_PUT_BE16(a, val) \
do { \
(a)[0] = ((u16) (val)) >> 8; \
(a)[1] = ((u16) (val)) & 0xff; \
} while (0)
#define WPA_GET_LE16(a) ((u16) (((a)[1] << 8) | (a)[0]))
#define WPA_PUT_LE16(a, val) \
do { \
(a)[1] = ((u16) (val)) >> 8; \
(a)[0] = ((u16) (val)) & 0xff; \
} while (0)
#define WPA_GET_BE24(a) ((((u32) (a)[0]) << 16) | (((u32) (a)[1]) << 8) | \
((u32) (a)[2]))
#define WPA_PUT_BE24(a, val) \
do { \
(a)[0] = (u8) (((u32) (val)) >> 16); \
(a)[1] = (u8) (((u32) (val)) >> 8); \
(a)[2] = (u8) (((u32) (val)) & 0xff); \
} while (0)
#define WPA_GET_BE32(a) ((((u32) (a)[0]) << 24) | (((u32) (a)[1]) << 16) | \
(((u32) (a)[2]) << 8) | ((u32) (a)[3]))
#define WPA_PUT_BE32(a, val) \
do { \
(a)[0] = (u8) (((u32) (val)) >> 24); \
(a)[1] = (u8) (((u32) (val)) >> 16); \
(a)[2] = (u8) (((u32) (val)) >> 8); \
(a)[3] = (u8) (((u32) (val)) & 0xff); \
} while (0)
#define WPA_PUT_BE64(a, val) \
do { \
(a)[0] = (u8) (((u64) (val)) >> 56); \
(a)[1] = (u8) (((u64) (val)) >> 48); \
(a)[2] = (u8) (((u64) (val)) >> 40); \
(a)[3] = (u8) (((u64) (val)) >> 32); \
(a)[4] = (u8) (((u64) (val)) >> 24); \
(a)[5] = (u8) (((u64) (val)) >> 16); \
(a)[6] = (u8) (((u64) (val)) >> 8); \
(a)[7] = (u8) (((u64) (val)) & 0xff); \
} while (0)
#ifndef ETH_ALEN
#define ETH_ALEN 6
#endif
int hwaddr_aton(const char *txt, u8 *addr);
int hexstr2bin(const char *hex, u8 *buf, size_t len);
void inc_byte_array(u8 *counter, size_t len);
void wpa_get_ntp_timestamp(u8 *buf);
#ifdef __GNUC__
#define PRINTF_FORMAT(a,b) __attribute__ ((format (printf, (a), (b))))
#define STRUCT_PACKED __attribute__ ((packed))
#else
#define PRINTF_FORMAT(a,b)
#define STRUCT_PACKED
#endif
/* Debugging function - conditional printf and hex dump. Driver wrappers can
* use these for debugging purposes. */
enum { MSG_MSGDUMP, MSG_DEBUG, MSG_INFO, MSG_WARNING, MSG_ERROR, MSG_DCB };
#ifdef CONFIG_NO_STDOUT_DEBUG
#define wpa_debug_print_timestamp() do { } while (0)
#define wpa_printf(args...) do { } while (0)
#define wpa_hexdump(l,t,b,le) do { } while (0)
#define wpa_hexdump_key(l,t,b,le) do { } while (0)
#define wpa_hexdump_ascii(l,t,b,le) do { } while (0)
#define wpa_hexdump_ascii_key(l,t,b,le) do { } while (0)
#define wpa_debug_open_file(void) do { } while (0)
#define wpa_debug_close_file(void) do { } while (0)
#else /* CONFIG_NO_STDOUT_DEBUG */
int wpa_debug_open_file(void);
void wpa_debug_close_file(void);
/**
* wpa_debug_printf_timestamp - Print timestamp for debug output
*
* This function prints a timestamp in .<microsoconds>
* format if debug output has been configured to include timestamps in debug
* messages.
*/
void wpa_debug_print_timestamp(void);
/**
* wpa_printf - conditional printf
* @level: priority level (MSG_*) of the message
* @fmt: printf format string, followed by optional arguments
*
* This function is used to print conditional debugging and error messages. The
* output may be directed to stdout, stderr, and/or syslog based on
* configuration.
*
* Note: New line '\n' is added to the end of the text when printing to stdout.
*/
void wpa_printf(int level, char *fmt, ...)
PRINTF_FORMAT(2, 3);
/**
* wpa_hexdump - conditional hex dump
* @level: priority level (MSG_*) of the message
* @title: title of for the message
* @buf: data buffer to be dumped
* @len: length of the buf
*
* This function is used to print conditional debugging and error messages. The
* output may be directed to stdout, stderr, and/or syslog based on
* configuration. The contents of buf is printed out has hex dump.
*/
void wpa_hexdump(int level, const char *title, const u8 *buf, size_t len);
/**
* wpa_hexdump_key - conditional hex dump, hide keys
* @level: priority level (MSG_*) of the message
* @title: title of for the message
* @buf: data buffer to be dumped
* @len: length of the buf
*
* This function is used to print conditional debugging and error messages. The
* output may be directed to stdout, stderr, and/or syslog based on
* configuration. The contents of buf is printed out has hex dump. This works
* like wpa_hexdump(), but by default, does not include secret keys (passwords,
* etc.) in debug output.
*/
void wpa_hexdump_key(int level, const char *title, const u8 *buf, size_t len);
/**
* wpa_hexdump_ascii - conditional hex dump
* @level: priority level (MSG_*) of the message
* @title: title of for the message
* @buf: data buffer to be dumped
* @len: length of the buf
*
* This function is used to print conditional debugging and error messages. The
* output may be directed to stdout, stderr, and/or syslog based on
* configuration. The contents of buf is printed out has hex dump with both
* the hex numbers and ASCII characters (for printable range) are shown. 16
* bytes per line will be shown.
*/
void wpa_hexdump_ascii(int level, const char *title, const u8 *buf,
size_t len);
/**
* wpa_hexdump_ascii_key - conditional hex dump, hide keys
* @level: priority level (MSG_*) of the message
* @title: title of for the message
* @buf: data buffer to be dumped
* @len: length of the buf
*
* This function is used to print conditional debugging and error messages. The
* output may be directed to stdout, stderr, and/or syslog based on
* configuration. The contents of buf is printed out has hex dump with both
* the hex numbers and ASCII characters (for printable range) are shown. 16
* bytes per line will be shown. This works like wpa_hexdump_ascii(), but by
* default, does not include secret keys (passwords, etc.) in debug output.
*/
void wpa_hexdump_ascii_key(int level, const char *title, const u8 *buf,
size_t len);
#endif /* CONFIG_NO_STDOUT_DEBUG */
#define wpa_msg(args...) do { } while (0)
#define wpa_msg_register_cb(f) do { } while (0)
int wpa_snprintf_hex(char *buf, size_t buf_size, const u8 *data, size_t len);
int wpa_snprintf_hex_uppercase(char *buf, size_t buf_size, const u8 *data,
size_t len);
#define WPA_ASSERT(a) do { } while (0)
#ifdef CONFIG_ANSI_C_EXTRA
#if !defined(_MSC_VER) || _MSC_VER < 1400
/* snprintf - used in number of places; sprintf() is _not_ a good replacement
* due to possible buffer overflow; see, e.g.,
* http://www.ijs.si/software/snprintf/ for portable implementation of
* snprintf. */
int snprintf(char *str, size_t size, const char *format, ...);
/* vsnprintf - only used for wpa_msg() in wpa_supplicant.c */
int vsnprintf(char *str, size_t size, const char *format, va_list ap);
#endif /* !defined(_MSC_VER) || _MSC_VER < 1400 */
/* getopt - only used in main.c */
int getopt(int argc, char *const argv[], const char *optstring);
extern char *optarg;
extern int optind;
#ifndef CONFIG_NO_SOCKLEN_T_TYPEDEF
#ifndef __socklen_t_defined
typedef int socklen_t;
#endif
#endif
/* inline - define as __inline or just define it to be empty, if needed */
#ifdef CONFIG_NO_INLINE
#define inline
#else
#define inline __inline
#endif
#ifndef __func__
#define __func__ "__func__ not defined"
#endif
#ifndef bswap_16
#define bswap_16(a) ((((u16) (a) << 8) & 0xff00) | (((u16) (a) >> 8) & 0xff))
#endif
#ifndef bswap_32
#define bswap_32(a) ((((u32) (a) << 24) & 0xff000000) | \
(((u32) (a) << 8) & 0xff0000) | \
(((u32) (a) >> 8) & 0xff00) | \
(((u32) (a) >> 24) & 0xff))
#endif
#ifndef MSG_DONTWAIT
#define MSG_DONTWAIT 0
#endif
#endif /* CONFIG_ANSI_C_EXTRA */
#define wpa_zalloc(s) os_zalloc((s))
#define wpa_unicode2ascii_inplace(s) do { } while (0)
#define wpa_strdup_tchar(s) strdup((s))
const char * wpa_ssid_txt(u8 *ssid, size_t ssid_len);
#define TRUE 1
#define FALSE 0
#endif /* COMMON_H */
++++++ dcbd.h ++++++
/*******************************************************************************
Intel Data Center Bridging (DCB) Software
Copyright(c) 2007-2008 Intel Corporation.
Substantially modified from:
hostapd-0.5.7
Copyright (c) 2002-2007, Jouni Malinen and
contributors
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information:
e1000-eedc Mailing List
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*******************************************************************************/
#ifndef DCBD_H
#define DCBD_H
#ifndef IFNAMSIZ
#define IFNAMSIZ 16
#endif
#define MAX_NAME_LEN 16
#define PID_FILE "/var/run/dcbd.pid"
#define CLIF_IFACE_DIR "/var/run/dcbd"
#define CLIF_IFACE_IFNAME "clif"
#define DEFAULT_CFG_FILE "/etc/sysconfig/dcbd/dcbd.conf"
#define DEFAULT_DCBX_VERSION 1
extern char *cfg_file_name;
#undef DCBTRACE
/*#define DCBTRACE*/
#ifdef DCBTRACE
#define TRACE(s) printf("%s\n", s);
#define TRACE1(s,d) printf("%s %d\n", s, d);
#define TRACE2(s,c) printf("%s %s \n", s, c );
#define TRACE3(s,e) printf("%s %c", s, e);
#else
#define TRACE(s)
#define TRACE1(s, d)
#define TRACE2(s, c)
#define TRACE3(s, e)
#endif
struct ctrl_dst;
struct dcbd_data {
char iface[IFNAMSIZ+1];
char *ctrl_interface;
gid_t ctrl_interface_gid;
int ctrl_interface_gid_set;
int ctrl_sock;
struct ctrl_dst *ctrl_dst;
};
struct dcbd_user_data {
struct dcbd_data *dcbdd; /* client i/f data */
};
void send_event(int level, char *ebuf);
#endif /* DCBD_H */
++++++ dcb_osdep.h ++++++
/*******************************************************************************
Intel Data Center Bridging (DCB) Software
Copyright(c) 2007-2008 Intel Corporation.
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information:
e1000-eedc Mailing List
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*******************************************************************************/
#ifndef _DCB_OSDEP_H_
#define _DCB_OSDEP_H_
#include "includes.h"
#include
#include
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef char boolean_t; /* Boolean type used in shared code */
typedef boolean_t BOOLEAN;
#define TRUE 1
#define FALSE 0
#define IN
typedef unsigned long ULONG;
#define OutputDebugString(string) printf("%s.\n", string);
#endif
++++++ dcbtool.h ++++++
/*******************************************************************************
Intel Data Center Bridging (DCB) Software
Copyright(c) 2007-2008 Intel Corporation.
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information:
e1000-eedc Mailing List
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*******************************************************************************/
#ifndef _DCBTOOL_H
#define _DCBTOOL_H
typedef enum {
cmd_success = 0,
cmd_failed,
cmd_device_not_found,
cmd_invalid,
cmd_bad_params,
cmd_peer_not_present,
cmd_ctrl_vers_not_compatible,
cmd_not_capable
} cmd_status;
#define SHOW_NO_OUTPUT 0x00
#define SHOW_OUTPUT 0x01
#define SHOW_RAW 0x02
#define SHOW_RAW_ONLY 0x04
int clif_command(struct clif *clif, char *cmd, int raw);
void print_raw_message(char *msg, int print);
void print_message(char *msg, int print);
void print_event_msg(char *buf);
void print_cmd_response(char *buf);
void print_dcb_cmd_response(char *buf, cmd_status status);
int handle_dcb_cmds(struct clif *clif, int argc, char *argv[], int raw);
#endif /* _DCBTOOL_H */
++++++ dcb_types.h ++++++
/*******************************************************************************
Intel Data Center Bridging (DCB) Software
Copyright(c) 2007-2008 Intel Corporation.
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information:
e1000-eedc Mailing List
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*******************************************************************************/
#ifndef _DCB_CLIENT_IF_TYPES_H_
#define _DCB_CLIENT_IF_TYPES_H_
#include "dcb_osdep.h"
#define MAX_USER_PRIORITIES 8
#define MAX_BANDWIDTH_GROUPS 8
#define MAX_TRAFFIC_CLASSES 8
#define SHORT_STRING 20
#define MAX_DESCRIPTION_LEN 100
#define LINK_STRICT_PGID 15
#define DEF_BCN_DERVD_WEIGHT 16 /* 1 = 0.125 unitless */
#define MIN_BCN_DERVD_WEIGHT 1
#define MAX_BCN_DERVD_WEIGHT 64
#define DEF_BCN_INC_GAIN 0.53 /* unitless gain */
#define DEF_BCN_DEC_GAIN 0.00026 /* unitless gain */
#define DEF_BCN_MAX_DEC 0.5 /* unitless gain */
#define DEF_BCN_MAX_INC 0.1 /* unitless gain */
#define MIN_BCN_DELTA 0.0 /* unitless gain */
#define MAX_BCN_DELTA 1.0
#define DEF_BCN_RATE_UNIT 1 /* 1 = 1 Mbps */
#define MIN_BCN_RATE_UNIT 1
#define MAX_BCN_RATE_UNIT 100
#define DEF_BCN_INITIAL_RATE 5000 /* 1 = 1 Mbps */
#define MIN_BCN_INITIAL_RATE 0
#define MAX_BCN_INITIAL_RATE 10000
#define DEF_BCN_DRIFT_TIMER 100 /* 1 = 1 usec */
#define MIN_BCN_DRIFT_TIMER 1
#define MAX_BCN_DRIFT_TIMER 10000
#define DEF_BCN_DRIFT_INC 1 /* 1 = 1 Mbps */
#define MIN_BCN_DRIFT_INC 1
#define MAX_BCN_DRIFT_INC 100
#define DEF_BCN_BKOFF_TMR_RNG 100 /* 1 = 1 usec */
#define MIN_BCN_BKOFF_TMR_RNG 1
#define MAX_BCN_BKOFF_TMR_RNG 1000000
#define DEF_BCN_RESTRT_RATE 100 /* 1 = 1 Mbps */
#define MIN_BCN_RESTRT_RATE 1
#define MAX_BCN_RESTRT_RATE 1000
#define DEF_BCN_RTT_AVG_WEIGHT 9 /* unitless weighting */
#define MIN_BCN_RTT_AVG_WEIGHT 0
#define MAX_BCN_RTT_AVG_WEIGHT 10
#define BCN_ADDR_OPTION_LEN 8 /* 8 hex digits */
#define BCN_ADDR_OPTION_BYTES 34 /* bytes for 8 hex digits plus NULL */
#define BCN_CP_SAMP_INTERVAL 140000
/* DCBX subtypes */
typedef enum {
dcbx_subtype1 = 1,
dcbx_subtype2,
} dcbx_subtype;
/* PFC configuration */
typedef enum {
pfc_disabled = 0x000,
pfc_enabled,
pfc_invalid,
} pfc_type;
/* Peer DCB TLV States */
typedef enum {
DCB_PEER_NONE = 0x000,
DCB_PEER_PRESENT,
DCB_PEER_EXPIRED,
DCB_PEER_RESET,
} peer_dcb_tlv_state;
typedef pfc_type dcb_pfc_type;\
typedef enum {
dcb_none = 0x0000,
dcb_group,
dcb_link,
dcb_invalid,
} dcb_strict_priority_type;
typedef u64 dcb_stat_count;
typedef pfc_type dcb_pfc_list_type[MAX_USER_PRIORITIES];
typedef struct dcb_user_priority_attribs {
u8 tcmap;
u8 pgid;
u8 percent_of_pg_cap;
dcb_strict_priority_type strict_priority;
} dcb_user_priority_attribs_type;
typedef struct dcb_traffic_attribs {
u8 pg_percent[MAX_BANDWIDTH_GROUPS]; /* percent of link */
dcb_user_priority_attribs_type up[MAX_USER_PRIORITIES];
} dcb_traffic_attribs_type;
typedef struct dcb_stats{
u64 in_frames;
u64 out_frames;
u64 in_octets;
u64 out_octets;
u64 in_overflow_discards;
u64 out_overflow_discards;
} dcb_stats_type;
typedef struct dcb_pfc_stats_type{
u64 in_pauses;
u64 out_pauses;
u64 transitions;
} dcb_pfc_stats_type;
/* Define protocol and feature version that we support */
#define DCB_MAX_VERSION 0
#define DCB_PG_MAX_VERSION 0
#define DCB_PFC_MAX_VERSION 0
#define DCB_APPTLV_MAX_VERSION 0
#define DCB_BCN_MAX_VERSION 0
#define DCB_LLINK_MAX_VERSION 0
#define DCB_START_SEQ_NUMBER 0
/* Definitions for dcb protocol event Flags. */
#define DCB_LOCAL_CHANGE_PG 0x00000001
#define DCB_LOCAL_CHANGE_PFC 0x00000002
#define DCB_LOCAL_CHANGE_APPTLV 0x00000004
#define DCB_REMOTE_CHANGE_PG 0x00000008
#define DCB_REMOTE_CHANGE_PFC 0x00000010
#define DCB_REMOTE_CHANGE_APPTLV 0x00000020
#define DCB_LOCAL_CHANGE_BCN 0x00000040
#define DCB_REMOTE_CHANGE_BCN 0x00000080
#define DCB_LOCAL_CHANGE_LLINK 0x00000100
#define DCB_REMOTE_CHANGE_LLINK 0x00000200
#define DCB_EVENT_FLAGS 0x00000FFF
/* Maximum APP TLVs supported */
#define DCB_MAX_APPTLV 1
#define DCB_MAX_LLKTLV 1
/* DCB SubTypes */
#define DEFAULT_SUBTYPE 0
#define APP_FCOE_STYPE 0
#define APP_FCOE_STYPE_LEN 1
#define LLINK_FCOE_STYPE 0
/* Max TLV length */
#define DCB_MAX_TLV_LENGTH 507
/* Definitions for different data store. */
#define LOCAL_STORE 0x00000001
#define PEER_STORE 0x00000002
#define OPER_STORE 0x00000004
#define DATA_STORE_FLAGS 0x0000000F
#define MAX_DEVICE_NAME_LEN 256 /* NDIS supports 256 */
#define MAC_ADDR_LEN 6
#define LLDP_RXPKT_LEN 2300
/* DCB Feature and control states */
#define DCB_NSTATES 3
#define DCB_CLOSED 0 /* closed */
#define DCB_INIT 1 /* Initialization */
#define DCB_LISTEN 2 /* listening for peer */
/* Flags */
#define DCB_SET_FLAGS(_FlagsVar, _BitsToSet) \
(_FlagsVar) = (_FlagsVar) | (_BitsToSet)
#define DCB_TEST_FLAGS(_FlagsVar, _Mask, _BitsToCheck) \
(((_FlagsVar) & (_Mask)) == (_BitsToCheck))
/* Field Error_Flag for feature Oper_state_config */
typedef struct feature_protocol_attribs {
boolean_t Enable;
boolean_t Willing;
boolean_t Advertise;
boolean_t Advertise_prev;
boolean_t OperMode;
/* PeerWilling: Only used for Local data. */
boolean_t PeerWilling;
boolean_t Error;
boolean_t Syncd;
u32 Oper_version;
u32 Max_version;
u32 FeatureSeqNo;
boolean_t TLVPresent; /* for Peer data */
boolean_t tlv_sent; /* for local config */
u8 dcbx_st;
u16 State;
u8 Error_Flag; /* bitmap for returned oper_state errors */
} feature_protocol_attribs;
typedef struct control_protocol_attribs {
u32 Oper_version;
u32 Max_version;
u32 SeqNo;
u32 AckNo;
u32 MyAckNo;
peer_dcb_tlv_state RxDCBTLVState; /* for Peer data */
u16 State;
} control_protocol_attribs;
typedef struct pg_attribs {
feature_protocol_attribs protocol;
dcb_traffic_attribs_type tx;
dcb_traffic_attribs_type rx;
u8 num_tcs;
} pg_attribs;
typedef struct pfc_attribs {
feature_protocol_attribs protocol;
dcb_pfc_list_type admin;
u8 num_tcs;
} pfc_attribs;
typedef char dcb_descript[MAX_DESCRIPTION_LEN];
typedef struct pg_info {
u8 max_pgid_desc;
dcb_descript pgid_desc[MAX_BANDWIDTH_GROUPS];
} pg_info;
typedef struct bcn_cfg {
u8 bcna[BCN_ADDR_OPTION_LEN];/* CM-Tag BCNA field */
struct {
boolean_t cp_admin; /* CP admin mode */
boolean_t rp_admin; /* RP admin mode */
boolean_t rp_oper; /* RP Operational mode */
boolean_t rem_tag_oper; /* Remove CM tag Operational mode */
}bcn_up_settings[MAX_USER_PRIORITIES]; /* Index is user priority */
double rp_alpha; /* RP max decrease factor */
double rp_beta; /* RP max increase factor */
double rp_gd; /* RP decrement coefficient */
double rp_gi; /* RP increment coefficient */
u32 rp_tmax; /* RP max time to backoff after BCN0 */
u32 cp_sf; /* CP sampling interval fixed - Not used by driver */
u32 rp_c; /* RP link capacity */
u32 rp_ri; /* RP initial rate */
u16 rp_td; /* RP drift interval */
u16 rp_rmin; /* RP default rate after 1st BCN0 */
u8 rp_w; /* RP derivate rate */
u8 rp_rd; /* RP drift factor */
u8 rp_ru; /* RP rate unit */
u8 rp_wrtt; /* RP RTT moving average weight */
} bcn_cfg;
typedef struct bcn_attribs {
feature_protocol_attribs protocol;
bcn_cfg bcn;
} bcn_attribs;
typedef struct app_attribs {
feature_protocol_attribs protocol;
u32 Length;
u8 AppData[DCB_MAX_TLV_LENGTH];
} app_attribs;
typedef struct llink_cfg {
u8 llink_status;
} llink_cfg;
typedef struct llink_attribs {
feature_protocol_attribs protocol;
llink_cfg llink;
} llink_attribs;
typedef struct full_dcb_attribs {
pg_attribs pg;
pfc_attribs pfc;
pg_info descript;
app_attribs app[DCB_MAX_APPTLV];
bcn_attribs bcn;
llink_attribs llink[DCB_MAX_LLKTLV];
} full_dcb_attribs;
typedef struct full_dcb_attrib_ptrs {
pg_attribs *pg;
pfc_attribs *pfc;
pg_info *pgid;
app_attribs *app;
u8 app_subtype;
bcn_attribs *bcn;
llink_attribs *llink;
u8 llink_subtype;
} full_dcb_attrib_ptrs;
typedef struct feature_support {
/* non-zero indicates support */
u8 pg; /* priority groups */
u8 pfc; /* priority flow control */
u8 bcn; /* backward congestion notification */
/* non-zero indicates support */
u8 up2tc_mappable; /* abilty to map priorities to traffic classes */
u8 gsp; /* group strict priority */
/* Each bit represents a number of traffic classes supported by the hw.
* If 4 or 8 traffic classes can be configured, then the value is 0x88.
*/
u8 traffic_classes;
u8 pfc_traffic_classes;
} feature_support;
#endif /* DCB_CLIENT_IF_TYPES_H_ */
++++++ includes.h ++++++
/*******************************************************************************
Intel Data Center Bridging (DCB) Software
Copyright(c) 2007-2008 Intel Corporation.
Substantially modified from:
hostapd-0.5.7
Copyright (c) 2002-2007, Jouni Malinen and
contributors
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information:
e1000-eedc Mailing List
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*******************************************************************************/
#ifndef INCLUDES_H
#define INCLUDES_H
/* Include possible build time configuration before including anything else */
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
/* NDEBUG */
#include
#endif /* INCLUDES_H */
++++++ open-fcoe-multi-arch.diff ++++++
Index: open-fcoe/usr/tools/fcoeadm/Makefile
===================================================================
--- open-fcoe.orig/usr/tools/fcoeadm/Makefile
+++ open-fcoe/usr/tools/fcoeadm/Makefile
@@ -2,6 +2,7 @@
# set the following corresepondingly to your preferred locations
DESTDIR ?=
+#LIBDIR = $(libdir)/openfcoe-1.0.3/
#
# Installation directory of the tools
@@ -11,24 +12,6 @@ SBINDIR = $(EXEC_PREFIX)sbin
PREFIX = /usr/
MANDIR = $(PREFIX)share/man
-#
-# List of legal build component names
-#
-LEGAL_ARCH = i386 i486 i586 i686 x86_64
-LEGAL_OS = linux Linux
-
-#
-#
-# Validating OS and the machine architecture.
-#
-ifneq "$(filter-out $(LEGAL_ARCH), $(shell uname -i))" ""
- $(error bad build architecture $(shell uname -i))
-else
-ifneq "$(filter-out $(LEGAL_OS), $(shell uname -s))" ""
- $(error bad build OS $(shell uname -s))
-else
-
-
CC = gcc
LD = gcc
INSTALL = install
@@ -43,13 +26,7 @@ CFLAGS += -D$(OSNAME)
CFLAGS += -I.
CFLAGS += -I$(LIBHBALINUX)/include
CFLAGS += -I$(LIBHBALINUX)/hbaapi_src_2.2
-
-ifeq ($(shell uname -i),x86_64)
- CFLAGS += -m64
-else
- CFLAGS += -m32
- LDFLAGS += -melf_i386
-endif
+LDFLAGS += -L$(LIBHBALINUX)/hbaapi_src_2.2
PROGRAMS = fcoeadm
@@ -66,9 +43,9 @@ clean:
fcoeadm: version.o fcoeadm_display.o fcoeadm.o
@echo ' LINK' $@
- @$(LD) -o $@ $(LDFLAGS) -ldl -lHBAAPI $^
+ $(LD) -o $@ $(LDFLAGS) -Wl,-rpath -Wl,$(LIBDIR) -ldl -lHBAAPI $^
-install: all install_doc
+install: install_doc
@$(if $(PROGRAMS), $(foreach i, $(PROGRAMS), \
$(INSTALL) -v -m 775 $(i) $(DESTDIR)$(SBINDIR) ; ))
@@ -94,5 +71,3 @@ version.c: FORCE
.PHONY: FORCE
-endif
-endif
Index: open-fcoe/usr/tools/fcoemon/Makefile
===================================================================
--- open-fcoe.orig/usr/tools/fcoemon/Makefile
+++ open-fcoe/usr/tools/fcoemon/Makefile
@@ -12,23 +12,6 @@ SBINDIR = $(EXEC_PREFIX)sbin
PREFIX = /usr/
MANDIR = $(PREFIX)share/man
-#
-# List of legal build component names
-#
-LEGAL_ARCH = i386 i486 i586 i686 x86_64
-LEGAL_OS = linux Linux
-
-#
-#
-# Validating OS and the machine architecture.
-#
-ifneq "$(filter-out $(LEGAL_ARCH), $(shell uname -i))" ""
- $(error bad build architecture $(shell uname -i))
-else
-ifneq "$(filter-out $(LEGAL_OS), $(shell uname -s))" ""
- $(error bad build OS $(shell uname -s))
-else
-
CC = gcc
LD = gcc
INSTALL = install
@@ -44,13 +27,6 @@ CFLAGS += -I.
CFLAGS += -I$(LIBHBALINUX)/include
CFLAGS += -I$(DCB_SRC)/include
-ifeq ($(shell uname -i),x86_64)
- CFLAGS += -m64
-else
- CFLAGS += -m32
- LDFLAGS += -melf_i386
-endif
-
PROGRAMS = fcoemon
default: all
@@ -106,5 +82,3 @@ version.c: FORCE
.PHONY: FORCE
-endif
-endif
Index: open-fcoe/libhbalinux/Makefile.hbaapi
===================================================================
--- open-fcoe.orig/libhbalinux/Makefile.hbaapi
+++ open-fcoe/libhbalinux/Makefile.hbaapi
@@ -1,53 +1,51 @@
#
# Makefile for hbaapi_src_2.2
#
-
+DESTDIR=$(DESTDIR)
+LIBDIR = $(libdir)
CC = cc
LD = ld
RM = rm
CHMOD = chmod
CHOWN = chown
-LDCONFIG = ldconfig
+LDCONFIG = /sbin/ldconfig
INSTALL = install
+LIB = libHBAAPI.so.1.0.0
DATE=`date "+%D-%T"`
CFLAGS += -DBUILD_DATE="\"${DATE}\""
CFLAGS += -fPIC -DVENDOR='"Intel Corporation"' \
-DREVISION='"Rev 2.2"' -DREVNUM=2 -DMINREVNUM=2 \
-DLICENSE='"Subject to SNIA Public License"'
+#LDFLAGS += -G
-ifeq ($(shell uname -i),x86_64)
- LDFLAGS += -G
+ifeq ("$(LIBDIR)","/usr/lib64")
HBA_ID="org.openfc64"
- HBAAPI_INSTALL_DIR = /usr/lib64
- LIBHBALINUX_INSTALL_DIR = /usr/local/lib64
else
- CFLAGS += -m32
- LDFLAGS += -melf_i386 -G
HBA_ID="org.openfc"
- HBAAPI_INSTALL_DIR = /usr/lib
- LIBHBALINUX_INSTALL_DIR = /usr/local/lib
endif
-all: libHBAAPI.so
+all: $(LIB)
+
-libHBAAPI.so: HBAAPILIB.c hbaapi.h vendorhbaapi.h
+libHBAAPI.so.1.0.0: HBAAPILIB.c hbaapi.h vendorhbaapi.h
@echo ' CC PIC' $<
- @$(CC) $(CFLAGS) -c HBAAPILIB.c
+ $(CC) $(CFLAGS) -c HBAAPILIB.c
@echo ' LINK' $<
- @$(LD) $(LDFLAGS) HBAAPILIB.o -o libHBAAPI.so
+ $(CC) $(LDFLAGS) -shared HBAAPILIB.o -Wl,-soname=libHBAAPI.so.1 -o $@
+ ln -s $@ libHBAAPI.so
+ ln -s $@ libHBAAPI.so.1
clean:
@$(RM) -f *.o *.so > /dev/null 2>&1
-install: libHBAAPI.so
+install:
@echo ' INSTALL' $<
- @$(INSTALL) libHBAAPI.so $(HBAAPI_INSTALL_DIR)
- @echo "$(HBA_ID) $(LIBHBALINUX_INSTALL_DIR)/libhbalinux.so" > /etc/hba.conf
- @$(CHMOD) 644 /etc/hba.conf
- @$(CHOWN) root.root /etc/hba.conf
- @$(LDCONFIG)
+ @$(INSTALL) -D $(LIB) $(DESTDIR)$(LIBDIR)
+ $(INSTALL) *.so.1 $(DESTDIR)$(LIBDIR)
+ @echo $(HBA_ID) $(LIBDIR)$(LIB) > $(DESTDIR)/etc/hba.conf
+ @$(CHMOD) 644 $(DESTDIR)/etc/hba.conf
uninstall:
- @$(RM) -f $(HBAAPI_INSTALL_DIR)/libHBAAPI.so > /dev/null 2>&1
- @$(RM) -f /etc/hba.conf > /dev/null 2>&1
+ @$(RM) -f $(LIBDIR)$(LIB) > /dev/null 2>&1
+ @$(RM) -f $(DESTDIR)/etc/hba.conf > /dev/null 2>&1
Index: open-fcoe/libhbalinux/src/Makefile
===================================================================
--- open-fcoe.orig/libhbalinux/src/Makefile
+++ open-fcoe/libhbalinux/src/Makefile
@@ -5,13 +5,8 @@
#
# The target shared library to be built
#
-LIB = libhbalinux.so
-#
-# List of legal build component names
-#
-LEGAL_ARCH = i386 i486 i586 i686 x86_64
-LEGAL_OS = linux Linux
+LIB = libhbalinux.so.1.0.0
#
# Default build directory
@@ -26,29 +21,6 @@ RM = rm
SED = sed
INSTALL = install
-#
-#
-# Validating OS and the machine architecture.
-#
-ifneq "$(filter-out $(LEGAL_ARCH), $(shell uname -i))" ""
- $(error bad build architecture $(shell uname -i))
-else
-ifneq "$(filter-out $(LEGAL_OS), $(shell uname -s))" ""
- $(error bad build OS $(shell uname -s))
-else
-
-ifeq ($(shell uname -i),x86_64)
- CFLAGS += -m64
- .LIBPATTERNS = /usr/lib64/lib%.so /usr/lib64/lib%.a
- INSTALL_DIR := /usr/local/lib64
-else
- .LIBPATTERNS = /usr/lib/lib%.so \
- /usr/lib/lib%.a \
- /usr/local/lib/lib%.a \
- /usr/local/lib/lib%.so
- INSTALL_DIR := /usr/local/lib
-endif
-
LIBRARIES = -lrt -lpciaccess
#
@@ -83,13 +55,13 @@ SOURCES += \
all: $(LIB)
-LIB_SO := $(filter %.so, $(LIB))
+LIB_SO := $(filter %.so.1.0.0, $(LIB))
PICS := $(basename $(SOURCES))
PICS := $(PICS:%=$(BUILD_DIR)/%.o)
$(LIB_SO): $(PICS)
@echo ' LINK' $@; \
- $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ $(LIBRARIES)
+ $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname=libhbalinux.so.1 -shared -o $@ $^ $(LIBRARIES)
$(BUILD_DIR)/%.o: %.c
@echo ' CC PIC' $<; \
@@ -101,14 +73,12 @@ $(BUILD_DIR)/%.o: %.c
clean:
@$(RM) -f *.o *.d $(LIB) > /dev/null 2>&1
-install: libhbalinux.so
+install: $(LIB)
@echo ' INSTALL' $<
- @$(INSTALL) libhbalinux.so $(INSTALL_DIR)
+ @$(INSTALL) $(LIB) $(INSTALL_DIR)
uninstall:
- @$(RM) -f $(INSTALL_DIR)/libhbalinux.so > /dev/null 2>&1
+ @$(RM) -f $(INSTALL_DIR)/$(LIB) > /dev/null 2>&1
-include $(PICS:%.o=%.d)
-endif
-endif
Index: open-fcoe/usr/Makefile
===================================================================
--- open-fcoe.orig/usr/Makefile
+++ open-fcoe/usr/Makefile
@@ -1,23 +1,8 @@
# File: /open-fcoe/usr/Makefile
-#
-# List of legal build component names
-#
-LEGAL_ARCH = i386 i486 i586 i686 x86_64
-LEGAL_OS = linux Linux
-
-#
-# Validating OS and the machine architecture.
-#
-ifneq "$(filter-out $(LEGAL_ARCH), $(shell uname -i))" ""
- $(error bad build architecture $(shell uname -i))
-else
-ifneq "$(filter-out $(LEGAL_OS), $(shell uname -s))" ""
- $(error bad build OS $(shell uname -s))
-else
-
# set the following corresepondingly to your preferred locations
DESTDIR ?=
+#LIBDIR=$(libdir)/open-fcoe-1.0.3
ETCDIR = /etc
INITDDIR = $(ETCDIR)/init.d
@@ -30,13 +15,13 @@ RM = rm
default: all
all:
- @$(foreach i, $(wildcard tools/*), $(MAKE) -C $(i) ; )
+ $(foreach i, $(wildcard tools/*), $(MAKE) -C $(i) LIBDIR=$(LIBDIR); )
clean:
@$(foreach i, $(wildcard tools/*), $(MAKE) -C $(i) clean ; )
install: install_initd
- @$(foreach i, $(wildcard tools/*), $(MAKE) -C $(i) install ; )
+ $(foreach i, $(wildcard tools/*), $(MAKE) -C $(i) install ; )
uninstall: uninstall_initd
@$(foreach i, $(wildcard tools/*), $(MAKE) -C $(i) uninstall ; )
@@ -70,5 +55,3 @@ install_initd_suse:
uninstall_initd:
@$(RM) -vf $(DESTDIR)$(ETCDIR)/fcoe/open-fcoe.conf
@$(RM) -vf $(DESTDIR)$(INITDDIR)/open-fcoe
-endif
-endif
Index: open-fcoe/Makefile
===================================================================
--- open-fcoe.orig/Makefile
+++ open-fcoe/Makefile
@@ -4,9 +4,11 @@
# set the following corresepondingly to your preferred locations
DESTDIR ?=
+LIBDIR = $(libdir)/open-fcoe-1.0.3
prefix = /usr
exec_prefix = /
+
sbindir = $(exec_prefix)/sbin
bindir = $(exec_prefix)/bin
mandir = $(prefix)/share/man
@@ -15,18 +17,19 @@ initddir = $(etcdir)/init.d
MANPAGES = doc/fcoeadm.8 doc/fcoemon.8
PROGRAMS = usr/fcoeadm usr/fcoemon
+LIBS = libhbalinux/hbaapi_src_2.2/libHBAAPI.so libhbalinux/src/libhbalinux.so
INSTALL = install
default: all
all:
$(MAKE) -C libhbalinux
- $(MAKE) -C usr
+ $(MAKE) -C usr LIBDIR=$(LIBDIR)
clean:
$(MAKE) -C usr clean
-install: all install_usr
+install: install_usr
@echo
@echo -------------------------------------------------
@echo Please check README file for detailed information.
@@ -34,11 +37,11 @@ install: all install_usr
@echo -e "\t$(DESTDIR)$(etcdir)/fcoe/open-fcoe.conf"
@echo
-install_usr: install_programs install_doc install_initd
+install_usr: install_programs install_doc install_initd install_libs
-install_programs: $(PROGRAMS)
+install_programs:
$(INSTALL) -d $(DESTDIR)$(sbindir)
- $(INSTALL) -m 755 $^ $(DESTDIR)$(sbindir)
+ $(MAKE) -C usr install
install_initd:
$(INSTALL) -d $(DESTDIR)$(initddir)
@@ -51,3 +54,8 @@ install_initd:
install_doc: $(MANPAGES)
$(INSTALL) -d $(DESTDIR)$(mandir)/man8
$(INSTALL) -m 644 $^ $(DESTDIR)$(mandir)/man8
+
+install_libs:
+ @echo LIBDIR: $(DESTTDIR)$(LIBDIR)
+ $(INSTALL) -d $(DESTDIR)$(LIBDIR)
+ $(MAKE) -C libhbalinux install LIBDIR=$(LIBDIR)
Index: open-fcoe/libhbalinux/Makefile
===================================================================
--- open-fcoe.orig/libhbalinux/Makefile
+++ open-fcoe/libhbalinux/Makefile
@@ -12,7 +12,7 @@ all:
install:
(cd $(HBAAPI); $(MAKE) -f ../Makefile.hbaapi install)
- $(MAKE) HBAAPI=$(HBAAPI) -C src install
+ $(MAKE) HBAAPI=$(HBAAPI) -C src install INSTALL_DIR=$(DESTDIR)$(LIBDIR)
uninstall:
(cd $(HBAAPI); $(MAKE) -f ../Makefile.hbaapi uninstall)
Index: open-fcoe/libhbalinux/hbaapi_src_2.2/makefile.unix
===================================================================
--- open-fcoe.orig/libhbalinux/hbaapi_src_2.2/makefile.unix
+++ open-fcoe/libhbalinux/hbaapi_src_2.2/makefile.unix
@@ -25,7 +25,7 @@
#************************************************************************
# GNU Make is probably required for this makefile
#************************************************************************
-
+LIB = libHBAAPI.so.1.0.0
CC = gcc
BUILD_DATE := $(shell date "+%Y/%m/%d %T %Z")
REVNUM := 2
@@ -60,20 +60,20 @@ hbatest: hbaapi.h
libHBAAPI.so: HBAAPILIB.c hbaapi.h vendorhbaapi.h
${VERS}
- ${CC} HBAAPILIB.c version.o ${CFLAGS} -DBUILD_DATE=\"'${BUILD_DATE}'\" -G -o libHBAAPI.so
+ ${CC} HBAAPILIB.c version.o ${CFLAGS} -DBUILD_DATE=\"'${BUILD_DATE}'\" -G -Wl,-soname=libHBAAPI.so.1 -o libHBAAPI.so.1.0.0
@rm version.o
test: FORCE
${CC} -DBUILD_DATE=\"'${BUILD_DATE}'\" test.c -o test
-hbasample: hbaapi.h libHBAAPI.so vendorhbaapi.h
+hbasample: hbaapi.h $(LIB) vendorhbaapi.h
${CC} hbasample.c -G -o hbasample.so
hbaapitest.o: hbaapitest.c
${CC} -c hbaapitest.c
hbaapitest: hbaapitest.o libHBAAPI.so
- ${CC} hbaapitest.o -ldl libHBAAPI.so -o hbaapitest
+ ${CC} hbaapitest.o -ldl $(LIB) -o hbaapitest
FORCE:
@@ -86,4 +86,4 @@ tarball:
../makefile.nt ../makefile.unix ../readme.txt \
.)
tar cf - hbaapi_src_$(REVNUM).$(MINREVNUM) | gzip -9 > hbaapi_src_$(REVNUM).$(MINREVNUM).tgz
- rm -rf hbaapi_src_$(REVNUM).$(MINREVNUM)
\ No newline at end of file
+ rm -rf hbaapi_src_$(REVNUM).$(MINREVNUM)
++++++ open-fcoe.tar.bz2 ++++++
++++ 29668 lines of diff (skipped)
++++++ os.h ++++++
/*
* wpa_supplicant/hostapd / OS specific functions
* Copyright (c) 2005-2006, Jouni Malinen
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Alternatively, this software may be distributed under the terms of BSD
* license.
*
* See README and COPYING for more details.
*/
#ifndef OS_H
#define OS_H
typedef long os_time_t;
/**
* os_sleep - Sleep (sec, usec)
* @sec: Number of seconds to sleep
* @usec: Number of microseconds to sleep
*/
void os_sleep(os_time_t sec, os_time_t usec);
struct os_time {
os_time_t sec;
os_time_t usec;
};
/**
* os_get_time - Get current time (sec, usec)
* @t: Pointer to buffer for the time
* Returns: 0 on success, -1 on failure
*/
int os_get_time(struct os_time *t);
/* Helper macros for handling struct os_time */
#define os_time_before(a, b) \
((a)->sec < (b)->sec || \
((a)->sec == (b)->sec && (a)->usec < (b)->usec))
#define os_time_sub(a, b, res) do { \
(res)->sec = (a)->sec - (b)->sec; \
(res)->usec = (a)->usec - (b)->usec; \
if ((res)->usec < 0) { \
(res)->sec--; \
(res)->usec += 1000000; \
} \
} while (0)
/**
* os_mktime - Convert broken-down time into seconds since 1970-01-01
* @year: Four digit year
* @month: Month (1 .. 12)
* @day: Day of month (1 .. 31)
* @hour: Hour (0 .. 23)
* @min: Minute (0 .. 59)
* @sec: Second (0 .. 60)
* @t: Buffer for returning calendar time representation (seconds since
* 1970-01-01 00:00:00)
* Returns: 0 on success, -1 on failure
*/
int os_mktime(int year, int month, int day, int hour, int min, int sec,
os_time_t *t);
/**
* os_daemonize - Run in the background (detach from the controlling terminal)
* @pid_file: File name to write the process ID to or %NULL to skip this
* Returns: 0 on success, -1 on failure
*/
int os_daemonize(const char *pid_file);
/**
* os_daemonize_terminate - Stop running in the background (remove pid file)
* @pid_file: File name to write the process ID to or %NULL to skip this
*/
void os_daemonize_terminate(const char *pid_file);
/**
* os_get_random - Get cryptographically strong pseudo random data
* @buf: Buffer for pseudo random data
* @len: Length of the buffer
* Returns: 0 on success, -1 on failure
*/
int os_get_random(unsigned char *buf, size_t len);
/**
* os_random - Get pseudo random value (not necessarily very strong)
* Returns: Pseudo random value
*/
unsigned long os_random(void);
/**
* os_rel2abs_path - Get an absolute path for a file
* @rel_path: Relative path to a file
* Returns: Absolute path for the file or %NULL on failure
*
* This function tries to convert a relative path of a file to an absolute path
* in order for the file to be found even if current working directory has
* changed. The returned value is allocated and caller is responsible for
* freeing it. It is acceptable to just return the same path in an allocated
* buffer, e.g., return strdup(rel_path). This function is only used to find
* configuration files when os_daemonize() may have changed the current working
* directory and relative path would be pointing to a different location.
*/
char * os_rel2abs_path(const char *rel_path);
/**
* os_program_init - Program initialization (called at start)
* Returns: 0 on success, -1 on failure
*
* This function is called when a programs starts. If there are any OS specific
* processing that is needed, it can be placed here. It is also acceptable to
* just return 0 if not special processing is needed.
*/
int os_program_init(void);
/**
* os_program_deinit - Program deinitialization (called just before exit)
*
* This function is called just before a program exists. If there are any OS
* specific processing, e.g., freeing resourced allocated in os_program_init(),
* it should be done here. It is also acceptable for this function to do
* nothing.
*/
void os_program_deinit(void);
/**
* os_setenv - Set environment variable
* @name: Name of the variable
* @value: Value to set to the variable
* @overwrite: Whether existing variable should be overwritten
* Returns: 0 on success, -1 on error
*
* This function is only used for wpa_cli action scripts. OS wrapper does not
* need to implement this if such functionality is not needed.
*/
int os_setenv(const char *name, const char *value, int overwrite);
/**
* os_unsetenv - Delete environent variable
* @name: Name of the variable
* Returns: 0 on success, -1 on error
*
* This function is only used for wpa_cli action scripts. OS wrapper does not
* need to implement this if such functionality is not needed.
*/
int os_unsetenv(const char *name);
/**
* os_readfile - Read a file to an allocated memory buffer
* @name: Name of the file to read
* @len: For returning the length of the allocated buffer
* Returns: Pointer to the allocated buffer or %NULL on failure
*
* This function allocates memory and reads the given file to this buffer. Both
* binary and text files can be read with this function. The caller is
* responsible for freeing the returned buffer with os_free().
*/
char * os_readfile(const char *name, size_t *len);
/**
* os_zalloc - Allocate and zero memory
* @size: Number of bytes to allocate
* Returns: Pointer to allocated and zeroed memory or %NULL on failure
*
* Caller is responsible for freeing the returned buffer with os_free().
*/
void * os_zalloc(size_t size);
/*
* The following functions are wrapper for standard ANSI C or POSIX functions.
* By default, they are just defined to use the standard function name and no
* os_*.c implementation is needed for them. This avoids extra function calls
* by allowing the C pre-processor take care of the function name mapping.
*
* If the target system uses a C library that does not provide these functions,
* build_config.h can be used to define the wrappers to use a different
* function name. This can be done on function-by-function basis since the
* defines here are only used if build_config.h does not define the os_* name.
* If needed, os_*.c file can be used to implement the functions that are not
* included in the C library on the target system. Alternatively,
* OS_NO_C_LIB_DEFINES can be defined to skip all defines here in which case
* these functions need to be implemented in os_*.c file for the target system.
*/
#ifdef OS_NO_C_LIB_DEFINES
/**
* os_malloc - Allocate dynamic memory
* @size: Size of the buffer to allocate
* Returns: Allocated buffer or %NULL on failure
*
* Caller is responsible for freeing the returned buffer with os_free().
*/
void *os_malloc(size_t size);
/**
* os_realloc - Re-allocate dynamic memory
* @ptr: Old buffer from os_malloc() or os_realloc()
* @size: Size of the new buffer
* Returns: Allocated buffer or %NULL on failure
*
* Caller is responsible for freeing the returned buffer with os_free().
* If re-allocation fails, %NULL is returned and the original buffer (ptr) is
* not freed and caller is still responsible for freeing it.
*/
void *os_realloc(void *ptr, size_t size);
/**
* os_free - Free dynamic memory
* @ptr: Old buffer from os_malloc() or os_realloc(); can be %NULL
*/
void os_free(void *ptr);
/**
* os_memcpy - Copy memory area
* @dest: Destination
* @src: Source
* @n: Number of bytes to copy
* Returns: dest
*
* The memory areas src and dst must not overlap. os_memmove() can be used with
* overlapping memory.
*/
void *os_memcpy(void *dest, const void *src, size_t n);
/**
* os_memmove - Copy memory area
* @dest: Destination
* @src: Source
* @n: Number of bytes to copy
* Returns: dest
*
* The memory areas src and dst may overlap.
*/
void *os_memmove(void *dest, const void *src, size_t n);
/**
* os_memset - Fill memory with a constant byte
* @s: Memory area to be filled
* @c: Constant byte
* @n: Number of bytes started from s to fill with c
* Returns: s
*/
void *os_memset(void *s, int c, size_t n);
/**
* os_memcmp - Compare memory areas
* @s1: First buffer
* @s2: Second buffer
* @n: Maximum numbers of octets to compare
* Returns: An integer less than, equal to, or greater than zero if s1 is
* found to be less than, to match, or be greater than s2. Only first n
* characters will be compared.
*/
int os_memcmp(const void *s1, const void *s2, size_t n);
/**
* os_strdup - Duplicate a string
* @s: Source string
* Returns: Allocated buffer with the string copied into it or %NULL on failure
*
* Caller is responsible for freeing the returned buffer with os_free().
*/
char *os_strdup(const char *s);
/**
* os_strlen - Calculate the length of a string
* @s: '\0' terminated string
* Returns: Number of characters in s (not counting the '\0' terminator)
*/
size_t os_strlen(const char *s);
/**
* os_strcasecmp - Compare two strings ignoring case
* @s1: First string
* @s2: Second string
* Returns: An integer less than, equal to, or greater than zero if s1 is
* found to be less than, to match, or be greatred than s2
*/
int os_strcasecmp(const char *s1, const char *s2);
/**
* os_strncasecmp - Compare two strings ignoring case
* @s1: First string
* @s2: Second string
* @n: Maximum numbers of characters to compare
* Returns: An integer less than, equal to, or greater than zero if s1 is
* found to be less than, to match, or be greater than s2. Only first n
* characters will be compared.
*/
int os_strncasecmp(const char *s1, const char *s2, size_t n);
/**
* os_strchr - Locate the first occurrence of a character in string
* @s: String
* @c: Character to search for
* Returns: Pointer to the matched character or %NULL if not found
*/
char *os_strchr(const char *s, int c);
/**
* os_strrchr - Locate the last occurrence of a character in string
* @s: String
* @c: Character to search for
* Returns: Pointer to the matched character or %NULL if not found
*/
char *os_strrchr(const char *s, int c);
/**
* os_strcmp - Compare two strings
* @s1: First string
* @s2: Second string
* Returns: An integer less than, equal to, or greater than zero if s1 is
* found to be less than, to match, or be greatred than s2
*/
int os_strcmp(const char *s1, const char *s2);
/**
* os_strncmp - Compare two strings
* @s1: First string
* @s2: Second string
* @n: Maximum numbers of characters to compare
* Returns: An integer less than, equal to, or greater than zero if s1 is
* found to be less than, to match, or be greater than s2. Only first n
* characters will be compared.
*/
int os_strncmp(const char *s1, const char *s2, size_t n);
/**
* os_strncpy - Copy a string
* @dest: Destination
* @src: Source
* @n: Maximum number of characters to copy
* Returns: dest
*/
char *os_strncpy(char *dest, const char *src, size_t n);
/**
* os_strstr - Locate a substring
* @haystack: String (haystack) to search from
* @needle: Needle to search from haystack
* Returns: Pointer to the beginning of the substring or %NULL if not found
*/
char *os_strstr(const char *haystack, const char *needle);
/**
* os_snprintf - Print to a memory buffer
* @str: Memory buffer to print into
* @size: Maximum length of the str buffer
* @format: printf format
* Returns: Number of characters printed (not including trailing '\0').
*
* If the output buffer is truncated, number of characters which would have
* been written is returned. Since some C libraries return -1 in such a case,
* the caller must be prepared on that value, too, to indicate truncation.
*
* Note: Some C library implementations of snprintf() may not guarantee null
* termination in case the output is truncated. The OS wrapper function of
* os_snprintf() should provide this guarantee, i.e., to null terminate the
* output buffer if a C library version of the function is used and if that
* function does not guarantee null termination.
*
* If the target system does not include snprintf(), see, e.g.,
* http://www.ijs.si/software/snprintf/ for an example of a portable
* implementation of snprintf.
*/
int os_snprintf(char *str, size_t size, const char *format, ...);
#else /* OS_NO_C_LIB_DEFINES */
#ifndef os_malloc
#define os_malloc(s) malloc((s))
#endif
#ifndef os_realloc
#define os_realloc(p, s) realloc((p), (s))
#endif
#ifndef os_free
#define os_free(p) free((p))
#endif
#ifndef os_memcpy
#define os_memcpy(d, s, n) memcpy((d), (s), (n))
#endif
#ifndef os_memmove
#define os_memmove(d, s, n) memmove((d), (s), (n))
#endif
#ifndef os_memset
#define os_memset(s, c, n) memset(s, c, n)
#endif
#ifndef os_memcmp
#define os_memcmp(s1, s2, n) memcmp((s1), (s2), (n))
#endif
#ifndef os_strdup
#define os_strdup(s) strdup(s)
#endif
#ifndef os_strlen
#define os_strlen(s) strlen(s)
#endif
#ifndef os_strcasecmp
#define os_strcasecmp(s1, s2) strcasecmp((s1), (s2))
#endif
#ifndef os_strncasecmp
#define os_strncasecmp(s1, s2, n) strncasecmp((s1), (s2), (n))
#endif
#ifndef os_strchr
#define os_strchr(s, c) strchr((s), (c))
#endif
#ifndef os_strcmp
#define os_strcmp(s1, s2) strcmp((s1), (s2))
#endif
#ifndef os_strncmp
#define os_strncmp(s1, s2, n) strncmp((s1), (s2), (n))
#endif
#ifndef os_strncpy
#define os_strncpy(d, s, n) strncpy((d), (s), (n))
#endif
#ifndef os_strrchr
#define os_strrchr(s, c) strrchr((s), (c))
#endif
#ifndef os_strstr
#define os_strstr(h, n) strstr((h), (n))
#endif
#ifndef os_snprintf
#define os_snprintf snprintf
#endif
#endif /* OS_NO_C_LIB_DEFINES */
#ifdef OS_REJECT_C_LIB_FUNCTIONS
#define malloc OS_DO_NOT_USE_malloc
#define realloc OS_DO_NOT_USE_realloc
#define free OS_DO_NOT_USE_free
#define memcpy OS_DO_NOT_USE_memcpy
#define memmove OS_DO_NOT_USE_memmove
#define memset OS_DO_NOT_USE_memset
#define memcmp OS_DO_NOT_USE_memcmp
#undef strdup
#define strdup OS_DO_NOT_USE_strdup
#define strlen OS_DO_NOT_USE_strlen
#define strcasecmp OS_DO_NOT_USE_strcasecmp
#define strncasecmp OS_DO_NOT_USE_strncasecmp
#undef strchr
#define strchr OS_DO_NOT_USE_strchr
#undef strcmp
#define strcmp OS_DO_NOT_USE_strcmp
#undef strncmp
#define strncmp OS_DO_NOT_USE_strncmp
#undef strncpy
#define strncpy OS_DO_NOT_USE_strncpy
#define strrchr OS_DO_NOT_USE_strrchr
#define strstr OS_DO_NOT_USE_strstr
#undef snprintf
#define snprintf OS_DO_NOT_USE_snprintf
#define strcpy OS_DO_NOT_USE_strcpy
#endif /* OS_REJECT_C_LIB_FUNCTIONS */
#endif /* OS_H */
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org