#include <kref.h>
#include <slab.h>
#include <pagemap.h>
+#include <kthread.h>
/* All block IO is done assuming a certain size sector, which is the smallest
* possible unit of transfer between the kernel and the block layer. This can
/* Buffer Head Requests. For now, just use these for dealing with non-file IO
* on a block device. Tell it what size you think blocks are. */
-struct buffer_head *get_buffer(struct block_device *bdev, unsigned long blk_num,
- unsigned int blk_sz);
-void dirty_buffer(struct buffer_head *bh);
-void put_buffer(struct buffer_head *bh);
+struct buffer_head *bdev_get_buffer(struct block_device *bdev,
+ unsigned long blk_num, unsigned int blk_sz);
+void bdev_dirty_buffer(struct buffer_head *bh);
+void bdev_put_buffer(struct buffer_head *bh);
/* This encapsulates the work of a request (instead of having a variety of
* slightly-different functions for things like read/write and scatter-gather
* another array of BH pointers if you want more. The BHs do not need to be
* linked or otherwise associated with a page mapping. */
#define NR_INLINE_BH (PGSIZE >> SECTOR_SZ_LOG)
+struct block_request;
struct block_request {
unsigned int flags;
+ void (*callback)(struct block_request *breq);
+ void *data;
+ struct semaphore sem;
struct buffer_head **bhs; /* BHs describing the IOs */
unsigned int nr_bhs;
struct buffer_head *local_bhs[NR_INLINE_BH];
void block_init(void);
struct block_device *get_bdev(char *path);
void free_bhs(struct page *page);
-/* This function will probably be the one that blocks */
-int make_request(struct block_device *bdev, struct block_request *req);
+int bdev_submit_request(struct block_device *bdev, struct block_request *breq);
+void generic_breq_done(struct block_request *breq);
+void sleep_on_breq(struct block_request *breq);
#endif /* ROS_KERN_BLOCKDEV_H */