• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/xnu-2422.115.4/bsd/kern/

Lines Matching refs:index

119  *	if index is -1, return a free slot if avaliable
120 * else see whether the index is free
123 * if index is negative, we start
124 * looking for a free slot at the absolute value of index,
128 bdevsw_isfree(int index)
132 if (index < 0) {
133 if (index == -1)
134 index = 1; /* start at 1 to avoid collision with volfs (Radar 2842228) */
136 index = -index; /* start at least this far up in the table */
137 devsw = &bdevsw[index];
138 for(; index < nblkdev; index++, devsw++) {
145 devsw = &bdevsw[index];
146 if ((index < 0) || (index >= nblkdev) ||
152 return(index);
156 * if index is -1, find a free slot to add
160 * if index is negative, we start
161 * looking for a free slot at the absolute value of index,
165 bdevsw_add(int index, struct bdevsw * bsw)
167 index = bdevsw_isfree(index);
168 if (index < 0) {
171 bdevsw[index] = *bsw;
172 return(index);
179 bdevsw_remove(int index, struct bdevsw * bsw)
183 devsw = &bdevsw[index];
184 if ((index < 0) || (index >= nblkdev) ||
190 bdevsw[index] = nobdev;
191 return(index);
195 * if index is -1, return a free slot if avaliable
196 * else see whether the index is free
199 * if index is negative, we start
200 * looking for a free slot at the absolute value of index,
204 cdevsw_isfree(int index)
208 if (index < 0) {
209 if (index == -1)
210 index = 0;
212 index = -index; /* start at least this far up in the table */
213 devsw = &cdevsw[index];
214 for(; index < nchrdev; index++, devsw++) {
221 devsw = &cdevsw[index];
222 if ((index < 0) || (index >= nchrdev) ||
228 return(index);
232 * if index is -1, find a free slot to add
236 * if index is negative, we start
237 * looking for a free slot at the absolute value of index,
241 * devices that call this function with absolute index values,
246 cdevsw_add(int index, struct cdevsw * csw)
248 index = cdevsw_isfree(index);
249 if (index < 0) {
252 cdevsw[index] = *csw;
253 return(index);
260 cdevsw_remove(int index, struct cdevsw * csw)
264 devsw = &cdevsw[index];
265 if ((index < 0) || (index >= nchrdev) ||
271 cdevsw[index] = nocdev;
272 cdevsw_flags[index] = 0;
273 return(index);
283 cdevsw_add_with_bdev(int index, struct cdevsw * csw, int bdev)
285 index = cdevsw_add(index, csw);
286 if (index < 0) {
287 return (index);
289 if (cdev_set_bdev(index, bdev) < 0) {
290 cdevsw_remove(index, csw);
293 return (index);
297 cdevsw_setkqueueok(int index, struct cdevsw *csw, int use_offset)
302 devsw = &cdevsw[index];
303 if ((index < 0) || (index >= nchrdev) ||
314 cdevsw_flags[index] = flags;