History

Removed nasty tabs.

gkostka committed 13 years ago

Commit ead60f11 parent 14dd31728 files · +600 −605Browse files

Showing the changes to blockdev (2 of 28 files). Show all

Unified · Split

2 files
  1. blockdev/filedev/ext4_filedev.c +36 −36
  2. blockdev/filedev/ext4_filedev.h +5 −5
blockdev/filedev/ext4_filedev.c+36−36
@@ -33,14 +33,14 @@ · 32 unmodified lines
3333 #include <string.h>
3434 #include <fcntl.h>
3535
36−/**@brief Default filename.*/
36+/**@brief Default filename.*/
3737 static const char *fname = "ext2";
3838
39−/**@brief Image block size.*/
40−#define EXT4_FILEDEV_BSIZE 512
39+/**@brief Image block size.*/
40+#define EXT4_FILEDEV_BSIZE 512
4141
42−/**@brief Image file descriptor.*/
43−static FILE *dev_file;
42+/**@brief Image file descriptor.*/
43+static FILE *dev_file;
4444
4545 #define DROP_LINUXCACHE_BUFFERS 1
4646
@@ -48,21 +48,21 @@ static FILE *dev_file; · 1 unmodified line
4848 /**********************BLOCKDEV INTERFACE**************************************/
4949 static int filedev_open(struct ext4_blockdev *bdev);
5050 static int filedev_bread(struct ext4_blockdev *bdev, void *buf, uint64_t blk_id,
51− uint32_t blk_cnt);
51+ uint32_t blk_cnt);
5252 static int filedev_bwrite(struct ext4_blockdev *bdev, const void *buf,
53− uint64_t blk_id, uint32_t blk_cnt);
53+ uint64_t blk_id, uint32_t blk_cnt);
5454 static int filedev_close(struct ext4_blockdev *bdev);
5555
5656
5757 /******************************************************************************/
5858 EXT4_BLOCKDEV_STATIC_INSTANCE(
59− _filedev,
60− EXT4_FILEDEV_BSIZE,
61− 0,
62− filedev_open,
63− filedev_bread,
64− filedev_bwrite,
65− filedev_close
59+ _filedev,
60+ EXT4_FILEDEV_BSIZE,
61+ 0,
62+ filedev_open,
63+ filedev_bread,
64+ filedev_bwrite,
65+ filedev_close
6666 );
6767
6868 /******************************************************************************/
@@ -71,34 +71,34 @@ EXT4_BCACHE_STATIC_INSTANCE(__cache, CONFIG_BLOCK_DEV_CACHE_SIZE, 1024); · 2 unmodified lines
7171 /******************************************************************************/
7272 static int filedev_open(struct ext4_blockdev *bdev)
7373 {
74− dev_file = fopen(fname, "r+b");
74+ dev_file = fopen(fname, "r+b");
7575
76− if(!dev_file)
77− return EIO;
76+ if(!dev_file)
77+ return EIO;
7878
79− /*No buffering at file.*/
80− setbuf(dev_file, 0);
79+ /*No buffering at file.*/
80+ setbuf(dev_file, 0);
8181
82− if(fseek(dev_file, 0, SEEK_END))
83− return EFAULT;
82+ if(fseek(dev_file, 0, SEEK_END))
83+ return EFAULT;
8484
85− _filedev.ph_bcnt = ftell(dev_file) / _filedev.ph_bsize;
85+ _filedev.ph_bcnt = ftell(dev_file) / _filedev.ph_bsize;
8686
87− return EOK;
87+ return EOK;
8888 }
8989
9090 /******************************************************************************/
9191
9292 static int filedev_bread(struct ext4_blockdev *bdev, void *buf, uint64_t blk_id,
93− uint32_t blk_cnt)
93+ uint32_t blk_cnt)
9494 {
95− if(fseek(dev_file, blk_id * bdev->ph_bsize, SEEK_SET))
96− return EIO;
95+ if(fseek(dev_file, blk_id * bdev->ph_bsize, SEEK_SET))
96+ return EIO;
9797
98− if(!fread(buf, bdev->ph_bsize * blk_cnt, 1, dev_file))
99− return EIO;
98+ if(!fread(buf, bdev->ph_bsize * blk_cnt, 1, dev_file))
99+ return EIO;
100100
101− return EOK;
101+ return EOK;
102102 }
103103
104104 static void drop_cache(void)
@@ -130,26 +130,26 @@ static int filedev_bwrite(struct ext4_blockdev *bdev, const void *buf, · 25 unmodified lines
130130 /******************************************************************************/
131131 static int filedev_close(struct ext4_blockdev *bdev)
132132 {
133− fclose(dev_file);
134− return EOK;
133+ fclose(dev_file);
134+ return EOK;
135135 }
136136
137137
138138 /******************************************************************************/
139139
140−struct ext4_bcache* ext4_filecache_get(void)
140+struct ext4_bcache* ext4_filecache_get(void)
141141 {
142− return &__cache;
142+ return &__cache;
143143 }
144144 /******************************************************************************/
145−struct ext4_blockdev* ext4_filedev_get(void)
145+struct ext4_blockdev* ext4_filedev_get(void)
146146 {
147− return &_filedev;
147+ return &_filedev;
148148 }
149149 /******************************************************************************/
150150 void ext4_filedev_filename(const char *n)
151151 {
152− fname = n;
152+ fname = n;
153153 }
154154
155155 /******************************************************************************/
blockdev/filedev/ext4_filedev.h+5−5
@@ -34,12 +34,12 @@ · 33 unmodified lines
3434 #include <stdint.h>
3535 #include <stdbool.h>
3636
37−/**@brief Filecache get.*/
38−struct ext4_bcache* ext4_filecache_get(void);
37+/**@brief Filecache get.*/
38+struct ext4_bcache* ext4_filecache_get(void);
3939
40−/**@brief File blockdev get.*/
41−struct ext4_blockdev* ext4_filedev_get(void);
40+/**@brief File blockdev get.*/
41+struct ext4_blockdev* ext4_filedev_get(void);
4242
43−void ext4_filedev_filename(const char *n);
43+void ext4_filedev_filename(const char *n);
4444
4545 #endif /* EXT4_FILEDEV_H_ */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t