1/*-
2 * Copyright (c) 2001 Dag-Erling Co�dan Sm�rgrav
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 11 unchanged lines hidden (view full) ---
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * $FreeBSD: head/sys/fs/pseudofs/pseudofs_fileno.c 109623 2003-01-21 08:56:16Z alfred $
29 */
30
31#include <sys/param.h>
32#include <sys/kernel.h>
33#include <sys/systm.h>
34#include <sys/lock.h>
35#include <sys/malloc.h>
36#include <sys/mutex.h>
--- 40 unchanged lines hidden (view full) ---
77 * Initialize fileno bitmap
78 */
79void
80pfs_fileno_init(struct pfs_info *pi)
81{
82 struct pfs_bitmap *pb;
83
84 MALLOC(pb, struct pfs_bitmap *, sizeof *pb,
85 M_PFSFILENO, M_ZERO);
86
87 mtx_lock(&pi->pi_mutex);
88
89 pb->pb_bitmap[0] = 07;
90 pb->pb_used = 3;
91 pi->pi_bitmap = pb;
92 pi->pi_root->pn_fileno = 2;
93
--- 45 unchanged lines hidden (view full) ---
139 for (ppb = NULL, pb = pi->pi_bitmap; pb; ppb = pb, pb = pb->pb_next)
140 if (pb->pb_used != PFS_BITMAP_BITS)
141 break;
142
143 /* out of pages? */
144 if (pb == NULL) {
145 mtx_unlock(&pi->pi_mutex);
146 MALLOC(pb, struct pfs_bitmap *, sizeof *pb,
147 M_PFSFILENO, M_ZERO);
148 mtx_lock(&pi->pi_mutex);
149 /* protect against possible race */
150 while (ppb->pb_next)
151 ppb = ppb->pb_next;
152 pb->pb_offset = ppb->pb_offset + PFS_BITMAP_BITS;
153 ppb->pb_next = pb;
154 }
155
--- 129 unchanged lines hidden ---
2 * Copyright (c) 2001 Dag-Erling Co�dan Sm�rgrav
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
--- 11 unchanged lines hidden (view full) ---
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * $FreeBSD: head/sys/fs/pseudofs/pseudofs_fileno.c 109623 2003-01-21 08:56:16Z alfred $
29 */
30
31#include <sys/param.h>
32#include <sys/kernel.h>
33#include <sys/systm.h>
34#include <sys/lock.h>
35#include <sys/malloc.h>
36#include <sys/mutex.h>
--- 40 unchanged lines hidden (view full) ---
77 * Initialize fileno bitmap
78 */
79void
80pfs_fileno_init(struct pfs_info *pi)
81{
82 struct pfs_bitmap *pb;
83
84 MALLOC(pb, struct pfs_bitmap *, sizeof *pb,
85 M_PFSFILENO, M_ZERO);
86
87 mtx_lock(&pi->pi_mutex);
88
89 pb->pb_bitmap[0] = 07;
90 pb->pb_used = 3;
91 pi->pi_bitmap = pb;
92 pi->pi_root->pn_fileno = 2;
93
--- 45 unchanged lines hidden (view full) ---
139 for (ppb = NULL, pb = pi->pi_bitmap; pb; ppb = pb, pb = pb->pb_next)
140 if (pb->pb_used != PFS_BITMAP_BITS)
141 break;
142
143 /* out of pages? */
144 if (pb == NULL) {
145 mtx_unlock(&pi->pi_mutex);
146 MALLOC(pb, struct pfs_bitmap *, sizeof *pb,
147 M_PFSFILENO, M_ZERO);
148 mtx_lock(&pi->pi_mutex);
149 /* protect against possible race */
150 while (ppb->pb_next)
151 ppb = ppb->pb_next;
152 pb->pb_offset = ppb->pb_offset + PFS_BITMAP_BITS;
153 ppb->pb_next = pb;
154 }
155
--- 129 unchanged lines hidden ---