• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.5.8/xnu-1228.15.4/bsd/kern/

Lines Matching defs:index

108  *	if index is -1, return a free slot if avaliable
109 * else see whether the index is free
114 bdevsw_isfree(int index)
117 if (index == -1) {
119 for(index=0; index < nblkdev; index++, devsw++) {
126 /* NB: Not used below unless index is in range */
127 devsw = &bdevsw[index];
130 if ((index < 0) || (index >= nblkdev) ||
136 return(index);
140 * if index is -1, find a free slot to add
145 bdevsw_add(int index, struct bdevsw * bsw)
149 if (index == -1) {
150 devsw = &bdevsw[1]; /* Start at slot 1 - this is a hack to fix the index=1 hack */
152 for(index=1; index < nblkdev; index++, devsw++) {
159 devsw = &bdevsw[index];
160 if ((index < 0) || (index >= nblkdev) ||
166 bdevsw[index] = *bsw;
167 return(index);
174 bdevsw_remove(int index, struct bdevsw * bsw)
178 devsw = &bdevsw[index];
179 if ((index < 0) || (index >= nblkdev) ||
185 bdevsw[index] = nobdev;
186 return(index);
190 * if index is -1, return a free slot if avaliable
191 * else see whether the index is free
195 cdevsw_isfree(int index)
199 if (index == -1) {
201 for(index=0; index < nchrdev; index++, devsw++) {
208 devsw = &cdevsw[index];
209 if ((index < 0) || (index >= nchrdev) ||
215 return(index);
219 * if index is -1, find a free slot to add
224 * devices that call this function with absolute index values,
226 * before them. Therefore, if index is negative, we start
227 * looking for a free slot at the absolute value of index,
233 cdevsw_add(int index, struct cdevsw * csw)
237 if (index < 0) {
238 if (index == -1)
239 index = 0; /* historical behaviour; XXX broken */
241 index = -index; /* start at least this far up in the table */
242 devsw = &cdevsw[index];
243 for(; index < nchrdev; index++, devsw++) {
250 devsw = &cdevsw[index];
251 if ((index < 0) || (index >= nchrdev) ||
257 cdevsw[index] = *csw;
258 return(index);
261 * if the index has the same bsw, then remove
265 cdevsw_remove(int index, struct cdevsw * csw)
269 devsw = &cdevsw[index];
270 if ((index < 0) || (index >= nchrdev) ||
276 cdevsw[index] = nocdev;
277 return(index);
287 cdevsw_add_with_bdev(int index, struct cdevsw * csw, int bdev)
289 index = cdevsw_add(index, csw);
290 if (index < 0) {
291 return (index);
293 if (cdev_set_bdev(index, bdev) < 0) {
294 cdevsw_remove(index, csw);
297 return (index);