summaryrefslogtreecommitdiff
path: root/usr/src/lib/libuuid/common
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/lib/libuuid/common')
-rw-r--r--usr/src/lib/libuuid/common/etheraddr.c55
-rw-r--r--usr/src/lib/libuuid/common/uuid.c11
2 files changed, 22 insertions, 44 deletions
diff --git a/usr/src/lib/libuuid/common/etheraddr.c b/usr/src/lib/libuuid/common/etheraddr.c
index 6b2011150e..08030e79cf 100644
--- a/usr/src/lib/libuuid/common/etheraddr.c
+++ b/usr/src/lib/libuuid/common/etheraddr.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -33,7 +33,6 @@
#include <uuid/uuid.h>
#include <sys/sockio.h>
#include <libdlpi.h>
-#include <libdllink.h>
#include <sys/utsname.h>
#include <netdb.h>
@@ -42,12 +41,7 @@
#include "etheraddr.h"
-/*
- * debugging flag
- */
-static int debug = 0;
-
-static void get_etheraddr(void *arg, const char *linkname);
+static boolean_t get_etheraddr(const char *linkname, void *arg);
/*
* get an individual arp entry
@@ -114,50 +108,35 @@ get_ethernet_address(uuid_node_t *node)
* Try to get physical (ethernet) address from network interfaces.
*/
state.wa_addrvalid = B_FALSE;
- if (dladm_walk(get_etheraddr, &state) == 0 && state.wa_addrvalid) {
+ dlpi_walk(get_etheraddr, &state, 0);
+ if (state.wa_addrvalid)
bcopy(state.wa_etheraddr, node, state.wa_etheraddrlen);
- }
return (state.wa_addrvalid ? 0 : -1);
}
/*
- * Get the physical address via dlpi and update the flag to true upon success.
+ * Get the physical address via DLPI and update the flag to true upon success.
*/
-static void
-get_etheraddr(void *arg, const char *linkname)
+static boolean_t
+get_etheraddr(const char *linkname, void *arg)
{
int retval;
dlpi_handle_t dh;
walker_arg_t *statep = arg;
- if (!(statep->wa_addrvalid)) {
- if (debug)
- (void) printf("get_etheraddr: opening %s\n", linkname);
- if ((retval = dlpi_open(linkname, &dh, 0)) != DLPI_SUCCESS) {
- if (debug) {
- (void) fprintf(stderr, "get_etheraddr: "
- "cannot open link: \"%s\" %s\n",
- linkname, retval);
- }
- return;
- }
+ if (dlpi_open(linkname, &dh, 0) != DLPI_SUCCESS)
+ return (B_FALSE);
- if (debug) {
- (void) printf("get_etheraddr: getting ethernet address"
- " from link: %s\n", linkname);
- }
- statep->wa_etheraddrlen = DLPI_PHYSADDR_MAX;
- retval = dlpi_get_physaddr(dh, DL_CURR_PHYS_ADDR,
- statep->wa_etheraddr, &(statep->wa_etheraddrlen));
- if (debug) {
- (void) fprintf(stderr, "get_etheraddr: "
- "dlpi_get_physaddr: \"%s\" %s\n", linkname, retval);
- }
+ statep->wa_etheraddrlen = DLPI_PHYSADDR_MAX;
+ retval = dlpi_get_physaddr(dh, DL_CURR_PHYS_ADDR,
+ statep->wa_etheraddr, &(statep->wa_etheraddrlen));
- if (retval == DLPI_SUCCESS)
- statep->wa_addrvalid = B_TRUE;
+ dlpi_close(dh);
- dlpi_close(dh);
+ if (retval == DLPI_SUCCESS) {
+ statep->wa_addrvalid = B_TRUE;
+ return (B_TRUE);
}
+ return (B_FALSE);
}
diff --git a/usr/src/lib/libuuid/common/uuid.c b/usr/src/lib/libuuid/common/uuid.c
index c494f847d6..db3dd1105f 100644
--- a/usr/src/lib/libuuid/common/uuid.c
+++ b/usr/src/lib/libuuid/common/uuid.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -273,9 +272,9 @@ _read_state(int fd, uint16_t *clockseq,
*timestamp = 0;
*clockseq = 0;
- if (read(fd, &vol_state, sizeof (uuid_state_t)) <
- sizeof (uuid_state_t)) {
+ if (read(fd, &vol_state, sizeof (vol_state)) < sizeof (vol_state)) {
/* This file is being accessed the first time */
+ return;
}
*node = vol_state.node;