cregit-Linux how code gets into the kernel

Release 4.7 drivers/net/ethernet/cisco/enic/vnic_vic.c

/*
 * Copyright 2010 Cisco Systems, Inc.  All rights reserved.
 *
 * This program is free software; you may redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 *
 */

#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/slab.h>

#include "vnic_vic.h"


struct vic_provinfo *vic_provinfo_alloc(gfp_t flags, const u8 *oui, const u8 type) { struct vic_provinfo *vp; if (!oui) return NULL; vp = kzalloc(VIC_PROVINFO_MAX_DATA, flags); if (!vp) return NULL; memcpy(vp->oui, oui, sizeof(vp->oui)); vp->type = type; vp->length = htonl(sizeof(vp->num_tlvs)); return vp; }

Contributors

PersonTokensPropCommitsCommitProp
scott feldmanscott feldman7484.09%125.00%
vasanthy kollurivasanthy kolluri89.09%125.00%
dan carpenterdan carpenter44.55%125.00%
roopa prabhuroopa prabhu22.27%125.00%
Total88100.00%4100.00%


void vic_provinfo_free(struct vic_provinfo *vp) { kfree(vp); }

Contributors

PersonTokensPropCommitsCommitProp
scott feldmanscott feldman15100.00%1100.00%
Total15100.00%1100.00%


int vic_provinfo_add_tlv(struct vic_provinfo *vp, u16 type, u16 length, const void *value) { struct vic_provinfo_tlv *tlv; if (!vp || !value) return -EINVAL; if (ntohl(vp->length) + offsetof(struct vic_provinfo_tlv, value) + length > VIC_PROVINFO_MAX_TLV_DATA) return -ENOMEM; tlv = (struct vic_provinfo_tlv *)((u8 *)vp->tlv + ntohl(vp->length) - sizeof(vp->num_tlvs)); tlv->type = htons(type); tlv->length = htons(length); memcpy(tlv->value, value, length); vp->num_tlvs = htonl(ntohl(vp->num_tlvs) + 1); vp->length = htonl(ntohl(vp->length) + offsetof(struct vic_provinfo_tlv, value) + length); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
scott feldmanscott feldman15593.37%133.33%
roopa prabhuroopa prabhu116.63%266.67%
Total166100.00%3100.00%


size_t vic_provinfo_size(struct vic_provinfo *vp) { return vp ? ntohl(vp->length) + sizeof(*vp) - sizeof(vp->num_tlvs) : 0; }

Contributors

PersonTokensPropCommitsCommitProp
scott feldmanscott feldman35100.00%1100.00%
Total35100.00%1100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
scott feldmanscott feldman29592.19%120.00%
roopa prabhuroopa prabhu134.06%240.00%
vasanthy kollurivasanthy kolluri82.50%120.00%
dan carpenterdan carpenter41.25%120.00%
Total320100.00%5100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
{% endraw %}