tzeropart.c - plan9port - [fork] Plan 9 from user space | |
git clone git://src.adamsgaard.dk/plan9port | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
tzeropart.c (707B) | |
--- | |
1 #include "stdinc.h" | |
2 #include "dat.h" | |
3 #include "fns.h" | |
4 | |
5 void | |
6 zeropart(Part *part, int blocksize) | |
7 { | |
8 ZBlock *b; | |
9 u64int addr; | |
10 int w; | |
11 | |
12 fprint(2, "clearing %s\n", part->name); | |
13 b = alloczblock(MaxIoSize, 1, blocksize); | |
14 | |
15 w = 0; | |
16 for(addr = PartBlank; addr + MaxIoSize <= part->size; addr += Ma… | |
17 if(writepart(part, addr, b->data, MaxIoSize) < 0) | |
18 sysfatal("can't initialize %s, writing block %d … | |
19 w++; | |
20 } | |
21 | |
22 for(; addr + blocksize <= part->size; addr += blocksize) | |
23 if(writepart(part, addr, b->data, blocksize) < 0) | |
24 sysfatal("can't initialize %s: %r", part->name); | |
25 | |
26 if(flushpart(part) < 0) | |
27 sysfatal("can't flush writes to %s: %r", part->name); | |
28 | |
29 freezblock(b); | |
30 } |