VirtualBox

Changeset 16978 in vbox


Ignore:
Timestamp:
Feb 20, 2009 5:35:38 PM (16 years ago)
Author:
vboxsync
Message:

vboxNetAdpComposeMACAddress: readable code, pleease.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetAdp/VBoxNetAdp.c

    r16960 r16978  
    55
    66/*
    7  * Copyright (C) 2008 Sun Microsystems, Inc.
     7 * Copyright (C) 2008-2009 Sun Microsystems, Inc.
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2020 */
    2121
     22/*******************************************************************************
     23*   Header Files                                                               *
     24*******************************************************************************/
    2225#define LOG_GROUP LOG_GROUP_NET_TAP_DRV
    2326#include "VBoxNetAdpInternal.h"
     
    4144#include <sys/param.h>
    4245
     46
    4347/*******************************************************************************
    4448*   Defined Constants And Macros                                               *
     
    4852
    4953
     54
     55/**
     56 * Generate a suitable MAC address.
     57 *
     58 * @param   pThis       The instance.
     59 * @param   pMac        Where to return the MAC address.
     60 */
    5061DECLHIDDEN(void) vboxNetAdpComposeMACAddress(PVBOXNETADP pThis, PRTMAC pMac)
    5162{
    52     /* Note that terminating 0 is included. */
    53     memcpy(pMac->au8, "\0vbox", sizeof(pMac->au8));
    54     pMac->au8[sizeof(pMac->au8) - 1] += pThis->uUnit;
     63#if 0 /* Use a locally administered version of the OUI we use for the guest NICs. */
     64    pMac->au8[0] = 0x08 | 2;
     65    pMac->au8[1] = 0x00;
     66    pMac->au8[2] = 0x27;
     67#else /* this is what \0vb comes down to. It seems to be unassigned atm. */
     68    pMac->au8[0] = 0;
     69    pMac->au8[1] = 0x76;
     70    pMac->au8[2] = 0x62;
     71#endif
     72
     73    pMac->au8[3] = pThis->uUnit >> 16;
     74    pMac->au8[4] = pThis->uUnit >> 8;
     75    pMac->au8[5] = pThis->uUnit;
    5576}
    5677
     
    913934        RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    914935        PVBOXNETADP pThis = &pGlobals->aAdapters[i];
    915    
     936
    916937        RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
    917938        if (vboxNetAdpIsVoid(pThis))
     
    942963    int rc;
    943964    RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    944    
     965
    945966    RTSpinlockAcquire(pThis->hSpinlock, &Tmp);
    946967    if (pThis->enmState != kVBoxNetAdpState_Available || pThis->cBusy)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette