本文整理汇总了C++中NLA_ALIGN函数的典型用法代码示例。如果您正苦于以下问题:C++ NLA_ALIGN函数的具体用法?C++ NLA_ALIGN怎么用?C++ NLA_ALIGN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NLA_ALIGN函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: nla_next
static struct nlattr *
nla_next(struct nlattr *nla, size_t *rem)
{
*rem -= (size_t)NLA_ALIGN(nla->nla_len);
return (void *)((char *)nla + NLA_ALIGN(nla->nla_len));
}
开发者ID:jaredmcneill,项目名称:netbsd-src,代码行数:7,代码来源:if-linux.c
示例2: set_hw_app0
int set_hw_app0(char *ifname, appgroup_attribs *app_data)
{
struct nlmsghdr *nlh;
struct rtattr *rta_parent, *rta_child;
printf("set_hw_app0: %s\n", ifname);
nlh = start_msg(RTM_SETDCB, DCB_CMD_SAPP);
if (NULL == nlh)
return -EIO;
add_rta(nlh, DCB_ATTR_IFNAME, (void *)ifname, strlen(ifname) + 1);
rta_parent = add_rta(nlh, DCB_ATTR_APP, NULL, 0);
rta_child = add_rta(nlh, DCB_APP_ATTR_IDTYPE,
(void *)&app_data->dcb_app_idtype, sizeof(__u8));
rta_parent->rta_len += NLA_ALIGN(rta_child->rta_len);
rta_child = add_rta(nlh, DCB_APP_ATTR_ID,
(void *)&app_data->dcb_app_id, sizeof(__u16));
rta_parent->rta_len += NLA_ALIGN(rta_child->rta_len);
rta_child = add_rta(nlh, DCB_APP_ATTR_PRIORITY,
(void *)&app_data->dcb_app_priority, sizeof(__u8));
rta_parent->rta_len += NLA_ALIGN(rta_child->rta_len);
if (send_msg(nlh))
return -EIO;
return(recv_msg(DCB_CMD_SAPP, DCB_ATTR_APP));
}
开发者ID:openSUSE,项目名称:lldpad,代码行数:31,代码来源:nltest.c
示例3: cputimer_get
void cputimer_get(int tid, long long int *times, xbt_cpu_timer_t timer)
{
struct msgtemplate msg;
int rep_len;
struct nlattr *na;
struct taskstats *stats;
netlink_sock_send(timer->_id, TASKSTATS_CMD_GET, TASKSTATS_CMD_ATTR_PID, &tid, sizeof(__u32), timer);
rep_len = recv(timer->_nl_sd, &msg, sizeof(msg), 0);
xbt_assert(rep_len >= 0, "error while receiving the answer from netlink socket: %s", strerror(errno));
xbt_assert((msg.n.nlmsg_type != NLMSG_ERROR && NLMSG_OK((&msg.n), rep_len)),
"received a fatal error from the netlink socket: %s", strerror(errno));
rep_len = GENLMSG_PAYLOAD(&msg.n);
na = (struct nlattr *) GENLMSG_DATA(&msg);
int len = 0;
int aggr_len, len2;
while (len < rep_len) {
len += NLA_ALIGN(na->nla_len);
switch (na->nla_type) {
case TASKSTATS_TYPE_AGGR_PID:
aggr_len = NLA_PAYLOAD(na->nla_len);
len2 = 0;
/* For nested attributes, na follows */
na = (struct nlattr *) NLA_DATA(na);
while (len2 < aggr_len) {
switch (na->nla_type) {
case TASKSTATS_TYPE_PID:
break;
case TASKSTATS_TYPE_STATS:
/* here we collect info */
stats = (struct taskstats *) NLA_DATA(na);
//times[0] = (long long int)stats->ac_etime;
times[1] = (long long int) stats->ac_utime; /* User CPU time [usec] */
times[2] = (long long int) stats->ac_stime; /* SYstem CPU time [usec] */
break;
default:
XBT_ERROR("Unknown nested" " nla_type %d\n", na->nla_type);
break;
}
len2 += NLA_ALIGN(na->nla_len);
na = (struct nlattr *) ((char *) na + len2);
}
break;
default:
XBT_ERROR("Unknown nla_type %d\n", na->nla_type);
break;
}
na = (struct nlattr *) ((char *) GENLMSG_DATA(&msg) + len);
}
}
开发者ID:abronan,项目名称:simterpose,代码行数:54,代码来源:cputimer.c
示例4: parse_groups
static void
parse_groups(struct nlattr *na, int tot_len)
{
int len;
int grp_len;
int aggr_len;
struct nlattr *grp_na;
int find = 0;
char group_name[GENL_NAMSIZ] = {0};
int group_id = -1;
len = 0;
while (len < tot_len) {
len += NLA_ALIGN(na->nla_len);
printf("grp #%02d\n", na->nla_type);
#if 0
if (na->nla_type > 1) {
/* only one group supported for now */
//na = (struct nlattr *) ((char *) na + len);
//continue;
printf("!!multi group, loop to find!!\n");
}
#endif
aggr_len = NLA_PAYLOAD_LEN(na->nla_len);
grp_na = (struct nlattr *) NLA_DATA(na);
grp_len = 0;
while (grp_len < aggr_len) {
grp_len += NLA_ALIGN(grp_na->nla_len);
switch (grp_na->nla_type) {
case CTRL_ATTR_MCAST_GRP_ID:
group_id = *(uint32_t *) NLA_DATA(grp_na);
printf("grp id = %d\n", nl_grp_id);
break;
case CTRL_ATTR_MCAST_GRP_NAME:
strcpy(group_name, (char *)NLA_DATA(grp_na));
printf("grp name %s\n", group_name);
break;
default:
printf("Unknown grp nested attr %d\n", grp_na->nla_type);
break;
}
grp_na = (struct nlattr *) ((char *) grp_na + grp_len);
}
if (-1 != group_id && strlen(group_name) > 0) {
if (0 == strcmp(group_name, nl_grp_name)) {
printf("find grp name:%s, id=%d\n", group_name, group_id);
nl_grp_id = group_id;
break;
}
}
na = (struct nlattr *) ((char *) na + len);
}
}
开发者ID:caiyuchao,项目名称:program,代码行数:53,代码来源:netlink.c
示例5: parse_attr
static int parse_attr(struct nlattr *tb[], int maxtype, struct nlattr *nla,
const struct nla_policy *policy, int len)
{
int nested_len = nla_len(nla) - NLA_ALIGN(len);
if (nested_len < 0)
return -EINVAL;
if (nested_len >= nla_attr_size(0))
return nla_parse(tb, maxtype, nla_data(nla) + NLA_ALIGN(len),
nested_len, policy);
memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1));
return 0;
}
开发者ID:12rafael,项目名称:jellytimekernel,代码行数:13,代码来源:sch_netem.c
示例6: wait_taskstats
static struct taskstats *
wait_taskstats (void)
{
static struct msgtemplate msg;
int rep_len;
for (;;) {
while ((rep_len = recv (netlink_socket, &msg, sizeof(msg), 0)) < 0 && errno == EINTR);
if (msg.n.nlmsg_type == NLMSG_ERROR ||
!NLMSG_OK((&msg.n), rep_len)) {
/* process died before we got to it or somesuch */
/* struct nlmsgerr *err = NLMSG_DATA(&msg);
fprintf (stderr, "fatal reply error, errno %d\n", err->error); */
return NULL;
}
int rep_len = GENLMSG_PAYLOAD(&msg.n);
struct nlattr *na = (struct nlattr *) GENLMSG_DATA(&msg);
int len = 0;
while (len < rep_len) {
len += NLA_ALIGN(na->nla_len);
switch (na->nla_type) {
case TASKSTATS_TYPE_AGGR_PID: {
int aggr_len = NLA_PAYLOAD(na->nla_len);
int len2 = 0;
/* For nested attributes, na follows */
na = (struct nlattr *) NLA_DATA(na);
/* find the record we care about */
while (na->nla_type != TASKSTATS_TYPE_STATS) {
len2 += NLA_ALIGN(na->nla_len);
if (len2 >= aggr_len)
goto next_attr;
na = (struct nlattr *) ((char *) na + len2);
}
return (struct taskstats *) NLA_DATA(na);
}
}
next_attr:
na = (struct nlattr *) (GENLMSG_DATA(&msg) + len);
}
}
return NULL;
}
开发者ID:sesam,项目名称:bootchart,代码行数:48,代码来源:collector.c
示例7: flashnode_fill_isid
static int flashnode_fill_isid(struct flashnode_rec *fnode, struct iovec *iov)
{
struct iscsi_flashnode_param_info *fnode_param;
struct nlattr *attr;
int len;
uint8_t isid[6];
len = sizeof(struct iscsi_flashnode_param_info) + 6;
iov->iov_base = iscsi_nla_alloc(ISCSI_FLASHNODE_ISID, len);
if (!iov->iov_base)
return 1;
attr = iov->iov_base;
iov->iov_len = NLA_ALIGN(attr->nla_len);
fnode_param = (struct iscsi_flashnode_param_info *)ISCSI_NLA_DATA(attr);
fnode_param->param = ISCSI_FLASHNODE_ISID;
fnode_param->len = 6;
sscanf(fnode->sess.isid, "%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx",
&isid[0], &isid[1], &isid[2], &isid[3], &isid[4], &isid[5]);
memcpy(fnode_param->value, isid, fnode_param->len);
return 0;
}
开发者ID:Nimain,项目名称:open-iscsi,代码行数:25,代码来源:flashnode.c
示例8: get_family_id
/*
* Probe the controller in genetlink to find the family id
* for the TASKSTATS family
*/
static int get_family_id(int sd)
{
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} ans;
int id = 0, rc;
struct nlattr *na;
int rep_len;
char name[100];
strcpy(name, TASKSTATS_GENL_NAME);
rc = send_cmd (sd, GENL_ID_CTRL, getpid(), CTRL_CMD_GETFAMILY,
CTRL_ATTR_FAMILY_NAME, (void *)name,
strlen(TASKSTATS_GENL_NAME)+1);
rep_len = recv(sd, &ans, sizeof(ans), 0);
if (ans.n.nlmsg_type == NLMSG_ERROR ||
(rep_len < 0) || !NLMSG_OK((&ans.n), rep_len))
return -1;
na = (struct nlattr *) GENLMSG_DATA(&ans);
na = (struct nlattr *) ((char *) na + NLA_ALIGN(na->nla_len));
if (na->nla_type == CTRL_ATTR_FAMILY_ID) {
id = *(__u16 *) NLA_DATA(na);
}
return id;
}
开发者ID:sesam,项目名称:bootchart,代码行数:34,代码来源:collector.c
示例9: test_nfacct_del
static void test_nfacct_del(struct netlink_info *netlink, const char *name)
{
struct nfgenmsg *hdr;
size_t len, name_len;
name_len = strlen(name) + 1;
len = NLMSG_ALIGN(sizeof(struct nfgenmsg)) +
NLA_ALIGN(sizeof(struct nlattr)) +
name_len;
hdr = g_malloc0(len);
hdr->nfgen_family = AF_UNSPEC;
hdr->version = NFNETLINK_V0;
hdr->res_id = 0;
append_attr_str(NLA_DATA(hdr), NFACCT_NAME, name_len, name);
netlink_send(netlink,
NFNL_SUBSYS_ACCT << 8 | NFNL_MSG_ACCT_DEL,
NLM_F_ACK, hdr, len,
test_nfacct_callback, NULL, NULL);
g_free(hdr);
}
开发者ID:HoraceWeebler,项目名称:connman,代码行数:25,代码来源:netlink-test.c
示例10: NLA_ALIGN
/**
* Return next attribute in a stream of attributes.
* @arg nla Attribute of any kind.
* @arg remaining Variable to count remaining bytes in stream.
*
* Calculates the offset to the next attribute based on the attribute
* given. The attribute provided is assumed to be accessible, the
* caller is responsible to use nla_ok() beforehand. The offset (length
* of specified attribute including padding) is then subtracted from
* the remaining bytes variable and a pointer to the next attribute is
* returned.
*
* nla_next() can be called as long as remainig is >0.
*
* @return Pointer to next attribute.
*/
struct nlattr *nla_next(const struct nlattr *nla, int *remaining)
{
int totlen = NLA_ALIGN(nla->nla_len);
*remaining -= totlen;
return (struct nlattr *) ((char *) nla + totlen);
}
开发者ID:HongweiBi,项目名称:libnl,代码行数:23,代码来源:attr.c
示例11: get_family_id
/*
* Probe the controller in genetlink to find the family id
* for the TASKSTATS family
*/
static int get_family_id(xbt_cpu_timer_t timer)
{
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} ans;
int id = 0;
struct nlattr *na;
int rep_len;
char name[100];
int sd = timer->_nl_sd;
strcpy(name, TASKSTATS_GENL_NAME);
netlink_sock_send(GENL_ID_CTRL, CTRL_CMD_GETFAMILY,
CTRL_ATTR_FAMILY_NAME, (void *) name, strlen(TASKSTATS_GENL_NAME) + 1, timer);
rep_len = recv(sd, &ans, sizeof(ans), 0);
xbt_assert(rep_len >= 0, "Answer to request on the family id is zero-sized");
xbt_assert(ans.n.nlmsg_type != NLMSG_ERROR && NLMSG_OK((&ans.n), rep_len),
"Error while retrieving the family id thru netlink: %s", strerror(errno));
na = (struct nlattr *) GENLMSG_DATA(&ans);
na = (struct nlattr *) ((char *) na + NLA_ALIGN(na->nla_len));
if (na->nla_type == CTRL_ATTR_FAMILY_ID) {
id = *(__u16 *) NLA_DATA(na);
}
return id;
}
开发者ID:abronan,项目名称:simterpose,代码行数:36,代码来源:cputimer.c
示例12: NlAttrLenPad
/*
* ---------------------------------------------------------------------------
* Returns alligned length of the attribute.
* ---------------------------------------------------------------------------
*/
UINT32
NlAttrLenPad(const PNL_ATTR nla, UINT32 maxlen)
{
UINT32 len = NLA_ALIGN(nla->nlaLen);
return len <= maxlen ? len : nla->nlaLen;
}
开发者ID:18SUN,项目名称:ovs,代码行数:12,代码来源:Netlink.c
示例13: nl_build_attr_linkinfo
int
nl_build_attr_linkinfo(struct nl_client *cl, struct vn_if *ifp)
{
char *link_info_buf;
int len;
struct nlattr *nla = (struct nlattr *)
((char *)cl->cl_buf + cl->cl_buf_offset);
len = NLA_HDRLEN + NLA_HDRLEN +
NLA_ALIGN(strlen(ifp->if_kind) + 1);
if (cl->cl_buf_offset + len > cl->cl_buf_len)
return -ENOMEM;
nla->nla_len = len;
nla->nla_type = IFLA_LINKINFO;
link_info_buf = (char *)nla + NLA_HDRLEN;
nla = (struct nlattr *)link_info_buf;
nla->nla_len = len - NLA_HDRLEN;
nla->nla_type = IFLA_INFO_KIND;
link_info_buf += NLA_HDRLEN;
strcpy(link_info_buf, ifp->if_kind);
cl->cl_buf_offset += len;
return 0;
}
开发者ID:avallark,项目名称:contrail-vrouter,代码行数:29,代码来源:nl_util.c
示例14: get_family_id
int get_family_id(int sd)
{
struct msgtemplate msg;
int len;
int recv_len;
int rc;
struct nlattr *na;
rc = send_cmd(sd, GENL_ID_CTRL, CTRL_CMD_GETFAMILY,
CTRL_ATTR_FAMILY_NAME, SAMPLE_NETLINK_NL_FAMILY_NAME,
strlen(SAMPLE_NETLINK_NL_FAMILY_NAME)+1, NLM_F_REQUEST);
if (rc < 0) {
printf("Error sending family cmd (%d:%s)\n",
errno, strerror(errno));
return -1;
}
recv_len = recv(sd, &msg, sizeof(msg), 0);
if (msg.n.nlmsg_type == NLMSG_ERROR) {
printf("Error: recv family error msg\n");
return -1;
}
if (recv_len < 0) {
printf("Error: recv family (%d)\n", recv_len);
return -1;
}
if (!NLMSG_OK((&msg.n), recv_len)) {
printf("Error: recv family msg nok\n");
return -1;
}
len = 0;
recv_len = GENLMSG_PAYLOAD(&msg.n);
na = (struct nlattr *) GENLMSG_DATA(&msg);
while (len < recv_len) {
len += NLA_ALIGN(na->nla_len);
switch (na->nla_type) {
case CTRL_ATTR_FAMILY_ID:
nl_family_id = *(uint16_t *) NLA_DATA(na);
printf("family id:%d\n", nl_family_id);
break;
case CTRL_ATTR_MCAST_GROUPS:
parse_groups(NLA_DATA(na),
NLA_PAYLOAD_LEN(na->nla_len));
break;
case CTRL_ATTR_FAMILY_NAME:
case CTRL_ATTR_VERSION:
case CTRL_ATTR_HDRSIZE:
case CTRL_ATTR_MAXATTR:
case CTRL_ATTR_OPS:
printf("Unused family attr %d\n", na->nla_type);
break;
default:
printf("Unknown family attr %d\n", na->nla_type);
break;
}
na = (struct nlattr *) (GENLMSG_DATA(&msg) + len);
}
return nl_family_id;
}
开发者ID:caiyuchao,项目名称:program,代码行数:60,代码来源:netlink.c
示例15: nla_put_string
static inline int nla_put_string(struct nlattr *nla, int type, const char *str)
{
int attrlen = strlen(str) + 1;
nla->nla_len = NLA_HDRLEN + attrlen;
nla->nla_type = type;
memcpy(nla_data(nla), str, attrlen);
return NLA_HDRLEN + NLA_ALIGN(attrlen);
}
开发者ID:c00134744,项目名称:tipc-utils,代码行数:10,代码来源:tipc-config.c
示例16: nl_parse_gen_ctrl
struct nl_response *
nl_parse_gen_ctrl(struct nl_client *cl)
{
int len;
struct nlattr *nla;
struct genl_ctrl_message *msg;
char *buf = cl->cl_buf + cl->cl_buf_offset;
struct nl_response *resp = &cl->resp;
msg = (struct genl_ctrl_message *)cl->cl_resp_buf;
resp->nl_data = (uint8_t *)(msg);
memset(msg, 0, sizeof(*msg));
msg->family_id = -1;
len = cl->cl_msg_len - (cl->cl_buf_offset - cl->cl_msg_start);
nla = (struct nlattr *)buf;
while (len > 0 && len > NLA_HDRLEN) {
if (len < NLA_ALIGN(nla->nla_len))
return nl_set_resp_err(cl, -EINVAL);
switch (nla->nla_type) {
case CTRL_ATTR_FAMILY_NAME:
strncpy(msg->family_name, NLA_DATA(nla), sizeof(msg->family_name) - 1);
break;
case CTRL_ATTR_FAMILY_ID:
msg->family_id = *(unsigned short *)NLA_DATA(nla);
break;
default:
break;
}
cl->cl_buf_offset += NLA_ALIGN(nla->nla_len);
len -= NLA_ALIGN(nla->nla_len);
nla = (struct nlattr *)((char *)nla + NLA_ALIGN(nla->nla_len));
}
return resp;
}
开发者ID:avallark,项目名称:contrail-vrouter,代码行数:41,代码来源:nl_util.c
示例17: parse_nl_attrs
void
parse_nl_attrs ()
{
unsigned int n_attrs = 0;
struct nlattr *na;
unsigned int data_len = GENLMSG_DATALEN (&ans.n);
reset_nl_attrs ();
na = (struct nlattr *) GENLMSG_DATA (&ans);
nl_attr[na->nla_type] = na;
data_len -= NLA_ALIGN (na->nla_len);
while (data_len > 0)
{
n_attrs++;
na = (struct nlattr *) GENLMSG_NLA_NEXT (na);
nl_attr[na->nla_type] = na;
data_len -= NLA_ALIGN (na->nla_len);
}
}
开发者ID:slankdev,项目名称:libslankdev,代码行数:21,代码来源:indent.c
示例18: chap_fill_param_uint
static int chap_fill_param_uint(struct iovec *iov, int param,
uint32_t param_val, int param_len)
{
struct iscsi_param_info *param_info;
struct nlattr *attr;
int len;
uint8_t val8 = 0;
uint16_t val16 = 0;
uint32_t val32 = 0;
char *val = NULL;
len = sizeof(struct iscsi_param_info) + param_len;
iov->iov_base = iscsi_nla_alloc(param, len);
if (!iov->iov_base)
return 1;
attr = iov->iov_base;
iov->iov_len = NLA_ALIGN(attr->nla_len);
param_info = (struct iscsi_param_info *)ISCSI_NLA_DATA(attr);
param_info->param = param;
param_info->len = param_len;
switch (param_len) {
case 1:
val8 = (uint8_t)param_val;
val = (char *)&val8;
break;
case 2:
val16 = (uint16_t)param_val;
val = (char *)&val16;
break;
case 4:
val32 = (uint32_t)param_val;
val = (char *)&val32;
break;
default:
goto free;
}
memcpy(param_info->value, val, param_len);
return 0;
free:
free(iov->iov_base);
iov->iov_base = NULL;
iov->iov_len = 0;
return 1;
}
开发者ID:chris-se,项目名称:open-iscsi,代码行数:52,代码来源:host.c
示例19: getpid
/*
* Probe the controller in genetlink to find the family id
*/
int ResetManager::get_family_id(int sk, const char *family_name)
{
struct nlattr *na;
int rep_len;
int id = -1;
GENERIC_NETLINK_PACKET family_req, ans;
/* Get family name */
family_req.n.nlmsg_type = GENL_ID_CTRL;
family_req.n.nlmsg_flags = NLM_F_REQUEST;
family_req.n.nlmsg_seq = 0;
family_req.n.nlmsg_pid = getpid();
family_req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
family_req.g.cmd = CTRL_CMD_GETFAMILY;
family_req.g.version = 0x1;
na = (struct nlattr *) GENLMSG_DATA(&family_req);
na->nla_type = CTRL_ATTR_FAMILY_NAME;
na->nla_len = strlen(family_name) + 1 + NLA_HDRLEN;
strcpy((char *)NLA_DATA(na), family_name);
family_req.n.nlmsg_len += NLMSG_ALIGN(na->nla_len);
if (sendto_fd(sk, (char *) &family_req, family_req.n.nlmsg_len) < 0) {
return -1;
}
rep_len = recv(sk, &ans, sizeof(ans), 0);
if (rep_len < 0){
LOGE("no response\n");
return -1;
}
/* Validate response message */
else if (!NLMSG_OK((&ans.n), (unsigned int)rep_len)){
LOGE("invalid reply message\n");
return -1;
}
else if (ans.n.nlmsg_type == NLMSG_ERROR) { /* error */
LOGE("received error\n");
return -1;
}
na = (struct nlattr *) GENLMSG_DATA(&ans);
na = (struct nlattr *) ((char *) na + NLA_ALIGN(na->nla_len));
if (na->nla_type == CTRL_ATTR_FAMILY_ID) {
id = *(__u16 *) NLA_DATA(na);
}
return id;
}
开发者ID:AwaisKing,项目名称:mt6577_aosp_source,代码行数:53,代码来源:ResetManager.cpp
示例20: flashnode_fill_ipv6_addr
static int flashnode_fill_ipv6_addr(struct flashnode_rec *fnode,
struct iovec *iov, int param_type)
{
struct iscsi_flashnode_param_info *fnode_param;
struct nlattr *attr;
int len;
int rc;
len = sizeof(struct iscsi_flashnode_param_info) + 16;
iov->iov_base = iscsi_nla_alloc(param_type, len);
if (!iov->iov_base)
return 1;
attr = iov->iov_base;
iov->iov_len = NLA_ALIGN(attr->nla_len);
fnode_param = (struct iscsi_flashnode_param_info *)ISCSI_NLA_DATA(attr);
fnode_param->param = param_type;
fnode_param->len = 16;
switch (param_type) {
case ISCSI_FLASHNODE_IPADDR:
rc = inet_pton(AF_INET6, (char *)fnode->conn[0].ipaddress,
fnode_param->value);
break;
case ISCSI_FLASHNODE_REDIRECT_IPADDR:
rc = inet_pton(AF_INET6, (char *)fnode->conn[0].redirect_ipaddr,
fnode_param->value);
break;
case ISCSI_FLASHNODE_LINK_LOCAL_IPV6:
rc = inet_pton(AF_INET6, (char *)fnode->conn[0].link_local_ipv6,
fnode_param->value);
break;
default:
goto free;
}
if (rc <= 0)
goto free;
return 0;
free:
free(iov->iov_base);
iov->iov_base = NULL;
iov->iov_len = 0;
return 1;
}
开发者ID:Nimain,项目名称:open-iscsi,代码行数:48,代码来源:flashnode.c
注:本文中的NLA_ALIGN函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论