summaryrefslogtreecommitdiff
path: root/usr/src/lib/libwanbootutil/common/wbio.c
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2018-02-09 13:08:29 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2018-02-09 13:08:29 +0000
commitd83cbb191355d6a52016dd865bb4fef130dec639 (patch)
tree0c98660ab8ed273be1184efc5c280dc8eef82c9d /usr/src/lib/libwanbootutil/common/wbio.c
parentbe9ad087cc97e02e3d356d4b868c94adf56bd327 (diff)
parentbf5d9f18edeb77c14df996d367853599bdd43fd1 (diff)
downloadillumos-joyent-d83cbb191355d6a52016dd865bb4fef130dec639.tar.gz
[illumos-gate merge]
commit bf5d9f18edeb77c14df996d367853599bdd43fd1 9070 Remove wanboot from gate commit a356818ef9fb10d29d03bcf84f6535092a4efff2 9069 libfru: comparison between pointer and zero character constant commit cd93da824a7d319a89427338e9055f8e3426b6fe 9066 xdf devices attach hybrid VTOC/EFI label commit 52f65ab3eff266df424267250ad3b11a31d31b05 9043 ipadm(1M) is misrendering the create-addr subcommand description commit 41fe9d1ace0a37efcfd9dcbbe786427bf2e9a4b6 8933 libefi: Add definitions and utilities for EFI drivers commit 4c5582ef5befe9f7cecf33c219b1c314562dff33 8989 Allow IKEV2 pf_key(7P) key management cookies to be updated after set Conflicts: usr/src/cmd/cmd-inet/usr.lib/wanboot/wanboot-cgi/Makefile (deleted) usr/src/cmd/cmd-inet/usr.lib/wanboot/p12split/Makefile (deleted) usr/src/lib/libwanboot/Makefile.com (deleted) usr/src/lib/Makefile usr/src/test/os-tests/tests/pf_key/kmc-update.sh usr/src/uts/common/net/pfkeyv2.h
Diffstat (limited to 'usr/src/lib/libwanbootutil/common/wbio.c')
-rw-r--r--usr/src/lib/libwanbootutil/common/wbio.c94
1 files changed, 0 insertions, 94 deletions
diff --git a/usr/src/lib/libwanbootutil/common/wbio.c b/usr/src/lib/libwanbootutil/common/wbio.c
deleted file mode 100644
index a03b0a00bb..0000000000
--- a/usr/src/lib/libwanbootutil/common/wbio.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#include <unistd.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include "wbio.h"
-
-/*
- * Write `buflen' bytes from `buffer' to the file represented by `fd'.
- * Returns -1 if all `buflen' bytes cannot be written, otherwise returns 0.
- */
-int
-wbio_nwrite(int fd, const void *buffer, size_t buflen)
-{
- size_t nwritten;
- ssize_t nbytes;
- const char *buf = buffer;
-
- for (nwritten = 0; nwritten < buflen; nwritten += nbytes) {
- nbytes = write(fd, &buf[nwritten], buflen - nwritten);
- if (nbytes <= 0)
- return (-1);
- }
-
- return (0);
-}
-
-/*
- * Read `buflen' bytes into `buffer' from the file represented by `fd'.
- * Returns -1 if all `buflen' bytes cannot be read, otherwise returns 0.
- */
-int
-wbio_nread(int fd, void *buffer, size_t buflen)
-{
- size_t nread;
- ssize_t nbytes;
- char *buf = buffer;
-
- for (nread = 0; nread < buflen; nread += nbytes) {
- nbytes = read(fd, &buf[nread], buflen - nread);
- if (nbytes <= 0)
- return (-1);
- }
-
- return (0);
-}
-
-/*
- * Read a random number of `buflen' bytes into `buffer' from /dev/urandom.
- * Returns -1 if all `buflen' bytes cannot be read, otherwise returns 0.
- */
-int
-wbio_nread_rand(void *buffer, size_t buflen)
-{
- int fd;
-
- if ((fd = open("/dev/urandom", O_RDONLY)) == -1) {
- return (-1);
- }
-
- if (wbio_nread(fd, buffer, buflen) != 0) {
- (void) close(fd);
- return (-1);
- }
-
- (void) close(fd);
- return (0);
-}