pci_virtio_rnd.c (b0de25cb23668fa4535078d18a0618eee442c000) pci_virtio_rnd.c (7bb0eb348e1119aed76a61d633a9106b6b9912f1)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2014 Nahanni Systems Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 165 unchanged lines hidden (view full) ---

174 if (len <= 0) {
175 WPRINTF(("vtrnd: /dev/random not ready, read(): %d", len));
176 close(fd);
177 return (1);
178 }
179
180 sc = calloc(1, sizeof(struct pci_vtrnd_softc));
181
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2014 Nahanni Systems Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 165 unchanged lines hidden (view full) ---

174 if (len <= 0) {
175 WPRINTF(("vtrnd: /dev/random not ready, read(): %d", len));
176 close(fd);
177 return (1);
178 }
179
180 sc = calloc(1, sizeof(struct pci_vtrnd_softc));
181
182#ifndef __FreeBSD__
183 pthread_mutex_init(&sc->vrsc_mtx, NULL);
184#endif
185
182 vi_softc_linkup(&sc->vrsc_vs, &vtrnd_vi_consts, sc, pi, &sc->vrsc_vq);
183 sc->vrsc_vs.vs_mtx = &sc->vrsc_mtx;
184
185 sc->vrsc_vq.vq_qsize = VTRND_RINGSZ;
186
187 /* keep /dev/random opened while emulating */
188 sc->vrsc_fd = fd;
189

--- 22 unchanged lines hidden ---
186 vi_softc_linkup(&sc->vrsc_vs, &vtrnd_vi_consts, sc, pi, &sc->vrsc_vq);
187 sc->vrsc_vs.vs_mtx = &sc->vrsc_mtx;
188
189 sc->vrsc_vq.vq_qsize = VTRND_RINGSZ;
190
191 /* keep /dev/random opened while emulating */
192 sc->vrsc_fd = fd;
193

--- 22 unchanged lines hidden ---