- Main Page
- Related Pages
- Data Structures
- Files

- File List
- Globals

# include/block/copy.h

Go to the documentation of this file.

    00001
    00045 #ifndef BLKDEV_COPY_H_INCLUDED
    00046 #define BLKDEV_COPY_H_INCLUDED
    00047
    00048 #include <workqueue.h>
    00049 #include <block/device.h>
    00050
    00052 #define BLOCK_COPY_NOMEM                1
    00053
    00054 #define BLOCK_COPY_BLOCK_SIZE_MISMATCH  2
    00055
    00059 struct block_copy_request {
    00061         struct block_device *source;
    00063         struct block_device *target;
    00065         block_addr_t source_start;
    00067         block_addr_t target_start;
    00069         uint32_t length;
    00071         uint32_t total_blocks_copied;
    00073         int status;
    00075         int source_status;
    00077         int dest_status;
    00079         void (*completion_callback)(struct block_copy_request *req,
    00080                         uint32_t blocks_copied, void *data);
    00082         void (*progress_callback)(struct block_copy_request *req,
    00083                         uint32_t blocks_copied, void *data);
    00085         void *data;
    00087         struct block_request *read_req;
    00089         struct block_request *write_req;
    00091         struct slist buffer_list;
    00093         uint32_t blocks_allocated;
    00095         size_t block_size;
    00097         size_t blocks_pr_buf;
    00099         struct workqueue_item work;
    00100 };
    00101
    00102 struct block_copy_request *block_copy_alloc(
    00103                 uint32_t nr_blocks,
    00104                 uint32_t block_size,
    00105                 void *data);
    00106
    00107 void block_copy_free(struct block_copy_request *request);
    00108
    00109 int block_copy_set_source(
    00110                 struct block_copy_request *req,
    00111                 struct block_device *dev,
    00112                 block_addr_t lba);
    00113
    00114 int block_copy_set_dest(
    00115                 struct block_copy_request *req,
    00116                 struct block_device *dev,
    00117                 block_addr_t lba);
    00118
    00119 void block_copy_set_completion_callback(
    00120                 struct block_copy_request *req,
    00121                 void (*callback)
    00122                         (struct block_copy_request *, uint32_t, void *));
    00123
    00124 void block_copy_set_progress_callback(
    00125                 struct block_copy_request *req,
    00126                 void (*callback)
    00127                         (struct block_copy_request *, uint32_t, void *));
    00128
    00129 void block_copy_submit(struct block_copy_request *req);
    00130
    00131 #endif /* BLKDEV_COPY_H_INCLUDED */