Support offsets with io_raw too. carl-attic
authorCarl Hetherington <cth@carlh.net>
Thu, 12 Jan 2017 13:50:46 +0000 (13:50 +0000)
committerCarl Hetherington <cth@carlh.net>
Thu, 12 Jan 2017 13:50:46 +0000 (13:50 +0000)
blockdev/windows/io_raw.c
blockdev/windows/io_raw.h

index 9178243134c1a618bc9c6ec76bd7d54cd6f6351d..323699d1a084fc2c43909afb28d6b30d6d2bd586 100644 (file)
@@ -39,6 +39,7 @@
 
 /**@brief   Default filename.*/
 static const char *fname = "ext2";
+static uint64_t offset = 0;
 
 /**@brief   IO block size.*/
 #define EXT4_IORAW_BSIZE 512
@@ -93,7 +94,7 @@ static int io_raw_open(struct ext4_blockdev *bdev)
        _filedev.bdif->ph_bsize = pdg.BytesPerSector;
        _filedev.bdif->ph_bcnt = disk_size / pdg.BytesPerSector;
 
-       _filedev.part_offset = 0;
+       _filedev.part_offset = offset;
        _filedev.part_size = disk_size;
 
        return EOK;
@@ -159,6 +160,7 @@ static int io_raw_close(struct ext4_blockdev *bdev)
 struct ext4_blockdev *ext4_io_raw_dev_get(void) { return &_filedev; }
 /******************************************************************************/
 void ext4_io_raw_filename(const char *n) { fname = n; }
+void ext4_io_raw_offset(uint64_t o) { offset = o; }
 
 /******************************************************************************/
 #endif
index 0953873073820d57ac933b7342ecbf559a0e3ef6..77b135e572f4cfb89ac1ff1332a4d45d5a05bc90 100644 (file)
 /**@brief   IO raw blockdev get.*/
 struct ext4_blockdev *ext4_io_raw_dev_get(void);
 
-/**@brief   Set filrname to open.*/
+/**@brief   Set filename to open.*/
 void ext4_io_raw_filename(const char *n);
+/**@brief   Set offset to work at within device (in bytes) */
+void ext4_io_raw_offset(uint64_t o);
 
 
 #endif /* IO_RAW_H_ */