OpenWrt – Diff between revs 2 and 3

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 2 Rev 3
Line 25... Line 25...
25 #include <string.h> 25 #include <string.h>
26 #include <unistd.h> 26 #include <unistd.h>
27 #include <stdlib.h> 27 #include <stdlib.h>
28 #include <stdio.h> 28 #include <stdio.h>
29 #include <stdint.h> 29 #include <stdint.h>
30 #include <stdbool.h> -  
31 #include <ctype.h> 30 #include <ctype.h>
32 #include <fcntl.h> 31 #include <fcntl.h>
33 #include <stdint.h> 32 #include <stdint.h>
Line 34... Line 33...
34   33  
Line 58... Line 57...
58 int verbose = 0; 57 int verbose = 0;
59 int active = 1; 58 int active = 1;
60 int heads = -1; 59 int heads = -1;
61 int sectors = -1; 60 int sectors = -1;
62 int kb_align = 0; 61 int kb_align = 0;
63 bool ignore_null_sized_partition = false; -  
64 struct partinfo parts[4]; 62 struct partinfo parts[4];
65 char *filename = NULL; 63 char *filename = NULL;
Line 66... Line 64...
66   64  
Line 140... Line 138...
140 int i, fd, ret = -1, start, len; 138 int i, fd, ret = -1, start, len;
Line 141... Line 139...
141   139  
142 memset(pte, 0, sizeof(struct pte) * 4); 140 memset(pte, 0, sizeof(struct pte) * 4);
143 for (i = 0; i < nr; i++) { 141 for (i = 0; i < nr; i++) {
144 if (!parts[i].size) { -  
145 if (ignore_null_sized_partition) -  
146 continue; 142 if (!parts[i].size) {
147 fprintf(stderr, "Invalid size in partition %d!\n", i); 143 fprintf(stderr, "Invalid size in partition %d!\n", i);
148 return -1; 144 return -1;
Line 149... Line 145...
149 } 145 }
Line 198... Line 194...
198 return ret; 194 return ret;
199 } 195 }
Line 200... Line 196...
200   196  
201 static void usage(char *prog) 197 static void usage(char *prog)
202 { 198 {
203 fprintf(stderr, "Usage: %s [-v] [-n] -h <heads> -s <sectors> -o <outputfile> [-a 0..4] [-l <align kB>] [[-t <type>] -p <size>...] \n", prog); 199 fprintf(stderr, "Usage: %s [-v] -h <heads> -s <sectors> -o <outputfile> [-a 0..4] [-l <align kB>] [[-t <type>] -p <size>...] \n", prog);
204 exit(EXIT_FAILURE); 200 exit(EXIT_FAILURE);
Line 205... Line 201...
205 } 201 }
206   202  
207 int main (int argc, char **argv) 203 int main (int argc, char **argv)
208 { 204 {
209 char type = 0x83; 205 char type = 0x83;
210 int ch; 206 int ch;
Line 211... Line 207...
211 int part = 0; 207 int part = 0;
212 uint32_t signature = 0x5452574F; /* 'OWRT' */ 208 uint32_t signature = 0x5452574F; /* 'OWRT' */
213   209  
214 while ((ch = getopt(argc, argv, "h:s:p:a:t:o:vnl:S:")) != -1) { 210 while ((ch = getopt(argc, argv, "h:s:p:a:t:o:vl:S:")) != -1) {
215 switch (ch) { 211 switch (ch) {
216 case 'o': 212 case 'o':
217 filename = optarg; 213 filename = optarg;
218 break; 214 break;
219 case 'v': -  
220 verbose++; -  
221 break; -  
222 case 'n': 215 case 'v':
223 ignore_null_sized_partition = true; 216 verbose++;
224 break; 217 break;
225 case 'h': 218 case 'h':
226 heads = (int)strtoul(optarg, NULL, 0); 219 heads = (int)strtoul(optarg, NULL, 0);