Subversion Repositories HelenOS

Rev

Rev 3588 | Rev 4345 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3588 Rev 3598
Line 294... Line 294...
294
 
294
 
295
/** Instantiate a block in memory and get a reference to it.
295
/** Instantiate a block in memory and get a reference to it.
296
 *
296
 *
297
 * @param dev_handle        Device handle of the block device.
297
 * @param dev_handle        Device handle of the block device.
298
 * @param boff          Block offset.
298
 * @param boff          Block offset.
-
 
299
 * @param flags         If BLOCK_FLAGS_NOREAD is specified, block_get()
-
 
300
 *              will not read the contents of the block from the
-
 
301
 *              device.
299
 *
302
 *
300
 * @return          Block structure.
303
 * @return          Block structure.
301
 */
304
 */
302
block_t *block_get(dev_handle_t dev_handle, bn_t boff)
305
block_t *block_get(dev_handle_t dev_handle, bn_t boff, int flags)
303
{
306
{
304
    devcon_t *devcon;
307
    devcon_t *devcon;
305
    cache_t *cache;
308
    cache_t *cache;
306
    block_t *b;
309
    block_t *b;
307
    link_t *l;
310
    link_t *l;
Line 383... Line 386...
383
             * The block is dirty and needs to be written back to
386
             * The block is dirty and needs to be written back to
384
             * the device before we can read in the new contents.
387
             * the device before we can read in the new contents.
385
             */
388
             */
386
            abort();    /* TODO: block_write() */
389
            abort();    /* TODO: block_write() */
387
        }
390
        }
-
 
391
        if (!(flags & BLOCK_FLAGS_NOREAD)) {
388
        /*
392
            /*
389
         * The block contains old or no data. We need to read the new
393
             * The block contains old or no data. We need to read
390
         * contents from the device.
394
             * the new contents from the device.
391
         */
395
             */
392
        rc = block_read(dev_handle, &bufpos, &buflen, &pos, b->data,
396
            rc = block_read(dev_handle, &bufpos, &buflen, &pos,
393
            cache->block_size, cache->block_size);
397
                b->data, cache->block_size, cache->block_size);
394
        assert(rc == EOK);
398
            assert(rc == EOK);
-
 
399
        }
395
 
400
 
396
        futex_up(&b->lock);
401
        futex_up(&b->lock);
397
    }
402
    }
398
    return b;
403
    return b;
399
}
404
}