Skip to content

Commit e2b0fa4

Browse files
committed
Use same indent for all c-code
Signed-off-by: Alexey Gladkov <[email protected]>
1 parent c218074 commit e2b0fa4

File tree

28 files changed

+493
-448
lines changed

28 files changed

+493
-448
lines changed

.astylerc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
lineend=linux
2+
style=linux
3+
indent=tab=8
4+
indent-switches
5+
indent-cases
6+
min-conditional-indent=0
7+
max-instatement-indent=120
8+
align-pointer=name
9+
max-code-length=130

Makefile.in

+5
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,11 @@ check-unit:
196196

197197
check: check-unit
198198

199+
.PHONY: indent-c
200+
indent-c:
201+
@find . \! -path './external/*' -name '*.[ch]' \
202+
-exec astyle -n --quiet --options=.astylerc '{}' '+'
203+
199204
release:
200205
$(Q)git archive -o $(PKGFILE).tar --prefix=$(PREFIX)/ HEAD
201206
$(Q)git submodule update --init --checkout --depth=1 --force

datasrc/do_mounts.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ int create_dev(const char *name, dev_t dev);
2525
dev_t name_to_dev_t(const char *name);
2626

2727
const char *mount_block(const char *source, const char *target,
28-
const char *type, unsigned long flags,
29-
const void *data);
28+
const char *type, unsigned long flags,
29+
const void *data);
3030

3131
int mount_root(int argc, char *argv[], dev_t root_dev,
32-
const char *root_dev_name);
32+
const char *root_dev_name);
3333

3434
int mount_mtd_root(int argc, char *argv[], const char *root_dev_name,
35-
const char *type, unsigned long flags);
35+
const char *type, unsigned long flags);
3636

3737
int do_mounts(int argc, char *argv[]);
3838

@@ -47,7 +47,7 @@ static inline dev_t bstat(const char *name)
4747
return st.st_rdev;
4848
}
4949

50-
int load_ramdisk_compressed(const char *devpath, FILE * wfd,
51-
off_t ramdisk_start);
50+
int load_ramdisk_compressed(const char *devpath, FILE *wfd,
51+
off_t ramdisk_start);
5252

5353
#endif /* DO_MOUNTS_H */

datasrc/do_mounts_md.c

+39-39
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ static unsigned int mdp_major(void)
108108
n = strtol(line, &p, 10);
109109
if (errno == ERANGE || n < INT_MIN || n > INT_MAX) {
110110
fprintf(stderr,
111-
"Error: mdp device numner is out of range.\n");
111+
"Error: mdp device numner is out of range.\n");
112112
exit(1);
113113
}
114114
major_no = (unsigned int) n;
@@ -127,7 +127,7 @@ static unsigned int mdp_major(void)
127127

128128
if (!found) {
129129
fprintf(stderr,
130-
"Error: mdp devices detected but no mdp device found!\n");
130+
"Error: mdp devices detected but no mdp device found!\n");
131131
exit(1);
132132
}
133133

@@ -173,58 +173,58 @@ static int md_setup(char *str)
173173
str1 = str;
174174
if (minor_num < 0) {
175175
fprintf(stderr, "md: md=%d, Minor device number must be positive.\n",
176-
minor_num);
176+
minor_num);
177177
return 0;
178178
}
179179
if (minor_num >= MAX_MD_DEVS) {
180180
fprintf(stderr, "md: md=%d, Minor device number too high.\n",
181-
minor_num);
181+
minor_num);
182182
return 0;
183183
}
184184
for (ent = 0; ent < md_setup_ents; ent++)
185185
if (md_setup_args[ent].minor == (unsigned) minor_num &&
186186
md_setup_args[ent].partitioned == partitioned) {
187187
fprintf(stderr,
188-
"md: md=%s%d, Specified more than once. "
189-
"Replacing previous definition.\n",
190-
partitioned ? "d" : "", minor_num);
188+
"md: md=%s%d, Specified more than once. "
189+
"Replacing previous definition.\n",
190+
partitioned ? "d" : "", minor_num);
191191
break;
192192
}
193193
if (ent >= MAX_MD_DEVS) {
194194
fprintf(stderr, "md: md=%s%d - too many md initialisations\n",
195-
partitioned ? "d" : "", minor_num);
195+
partitioned ? "d" : "", minor_num);
196196
return 0;
197197
}
198198
if (ent >= md_setup_ents)
199199
md_setup_ents++;
200200
switch (get_option(&str, &level)) { /* RAID level */
201-
case 2: /* could be 0 or -1.. */
202-
if (level == 0 || level == LEVEL_LINEAR) {
203-
if (get_option(&str, &factor) != 2 || /* Chunk Size */
204-
get_option(&str, &fault) != 2) {
205-
fprintf(stderr,
206-
"md: Too few arguments supplied to md=.\n");
207-
return 0;
201+
case 2: /* could be 0 or -1.. */
202+
if (level == 0 || level == LEVEL_LINEAR) {
203+
if (get_option(&str, &factor) != 2 || /* Chunk Size */
204+
get_option(&str, &fault) != 2) {
205+
fprintf(stderr,
206+
"md: Too few arguments supplied to md=.\n");
207+
return 0;
208+
}
209+
md_setup_args[ent].level = level;
210+
md_setup_args[ent].chunk = 1 << (factor + 12);
211+
if (level == LEVEL_LINEAR)
212+
pername = "linear";
213+
else
214+
pername = "raid0";
215+
break;
208216
}
209-
md_setup_args[ent].level = level;
210-
md_setup_args[ent].chunk = 1 << (factor + 12);
211-
if (level == LEVEL_LINEAR)
212-
pername = "linear";
213-
else
214-
pername = "raid0";
215-
break;
216-
}
217217
/* FALL THROUGH */
218-
case 1: /* the first device is numeric */
219-
str = str1;
218+
case 1: /* the first device is numeric */
219+
str = str1;
220220
/* FALL THROUGH */
221-
case 0:
222-
md_setup_args[ent].level = LEVEL_NONE;
223-
pername = "super-block";
221+
case 0:
222+
md_setup_args[ent].level = LEVEL_NONE;
223+
pername = "super-block";
224224
}
225225

226226
fprintf(stderr, "md: Will configure md%s%d (%s) from %s, below.\n",
227-
partitioned ? "_d" : "", minor_num, pername, str);
227+
partitioned ? "_d" : "", minor_num, pername, str);
228228
md_setup_args[ent].device_names = str;
229229
md_setup_args[ent].partitioned = partitioned;
230230
md_setup_args[ent].minor = (unsigned) minor_num;
@@ -254,7 +254,7 @@ static void md_setup_drive(void)
254254
devname = md_setup_args[ent].device_names;
255255

256256
snprintf(name, sizeof name,
257-
"/dev/md%s%d", partitioned ? "_d" : "", dev_minor);
257+
"/dev/md%s%d", partitioned ? "_d" : "", dev_minor);
258258

259259
if (stat(name, &st_chk) == 0)
260260
continue;
@@ -274,7 +274,7 @@ static void md_setup_drive(void)
274274
dev = name_to_dev_t(devname);
275275
if (!dev) {
276276
fprintf(stderr, "md: Unknown device name: %s\n",
277-
devname);
277+
devname);
278278
break;
279279
}
280280

@@ -288,19 +288,19 @@ static void md_setup_drive(void)
288288
continue;
289289

290290
fprintf(stderr, "md: Loading md%s%d: %s\n",
291-
partitioned ? "_d" : "", dev_minor,
292-
md_setup_args[ent].device_names);
291+
partitioned ? "_d" : "", dev_minor,
292+
md_setup_args[ent].device_names);
293293

294294
fd = open(name, 0, 0);
295295
if (fd < 0) {
296296
fprintf(stderr, "md: open failed - cannot start "
297-
"array %s\n", name);
297+
"array %s\n", name);
298298
continue;
299299
}
300300
if (ioctl(fd, SET_ARRAY_INFO, 0) == -EBUSY) {
301301
fprintf(stderr,
302-
"md: Ignoring md=%d, already autodetected. (Use raid=noautodetect)\n",
303-
dev_minor);
302+
"md: Ignoring md=%d, already autodetected. (Use raid=noautodetect)\n",
303+
dev_minor);
304304
close(fd);
305305
continue;
306306
}
@@ -328,7 +328,7 @@ static void md_setup_drive(void)
328328
dinfo.number = i;
329329
dinfo.raid_disk = i;
330330
dinfo.state =
331-
(1 << MD_DISK_ACTIVE) | (1 << MD_DISK_SYNC);
331+
(1 << MD_DISK_ACTIVE) | (1 << MD_DISK_SYNC);
332332
dinfo.major = (int) major(dev);
333333
dinfo.minor = (int) minor(dev);
334334
err = ioctl(fd, ADD_NEW_DISK, &dinfo);
@@ -348,7 +348,7 @@ static void md_setup_drive(void)
348348
err = ioctl(fd, RUN_ARRAY, 0);
349349
if (err)
350350
fprintf(stderr, "md: starting md%d failed\n",
351-
dev_minor);
351+
dev_minor);
352352
else {
353353
/* reread the partition table.
354354
* I (neilb) and not sure why this is needed, but I
@@ -394,7 +394,7 @@ static void md_run_setup(void)
394394
create_dev("/dev/md0", makedev(MD_MAJOR, 0));
395395
if (raid_noautodetect)
396396
fprintf(stderr,
397-
"md: Skipping autodetection of RAID arrays. (raid=noautodetect)\n");
397+
"md: Skipping autodetection of RAID arrays. (raid=noautodetect)\n");
398398
else {
399399
int fd = open("/dev/md0", 0, 0);
400400
if (fd >= 0) {

datasrc/environ/environ.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ static unsigned int shell = 0;
2020
static void __attribute__ ((noreturn))
2121
show_usage(int ret)
2222
{
23-
fprintf(stderr, "Usage: environ [-c|-q|-s|-h] [-p PREFIX] [-i include0,include1,...] [-u unset0,unset1,...] [-f filename] [command [arg]...]\n");
23+
fprintf(stderr,
24+
"Usage: environ [-c|-q|-s|-h] [-p PREFIX] [-i include0,include1,...] [-u unset0,unset1,...] [-f filename] [command [arg]...]\n");
2425
exit(ret);
2526
}
2627

datasrc/halt/halt.c

+12-12
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ static void do_shutdown(const char *fl, const char *pw, const char *tm);
7575
void usage(void)
7676
{
7777
fprintf(stderr, "usage: %s [-n] [-w] [-d] [-f] [-h] [-i]%s%s\n",
78-
progname,
79-
strcmp(progname, "halt") ? "" : " [-p]",
80-
strcmp(progname, "reboot") ? "" : " [-k]");
78+
progname,
79+
strcmp(progname, "halt") ? "" : " [-p]",
80+
strcmp(progname, "reboot") ? "" : " [-k]");
8181
fprintf(stderr, "\t-n: don't sync before halting the system\n");
8282
fprintf(stderr, "\t-w: only write a wtmp reboot record and exit.\n");
8383
fprintf(stderr, "\t-d: don't write a wtmp record.\n");
@@ -118,9 +118,9 @@ int get_runlevel(void)
118118

119119
/* This should not happen but warn the user! */
120120
fprintf(stderr, "WARNING: could not determine runlevel"
121-
" - doing soft %s\n", progname);
121+
" - doing soft %s\n", progname);
122122
fprintf(stderr, " (it's better to use shutdown instead of %s"
123-
" from the command line)\n", progname);
123+
" from the command line)\n", progname);
124124

125125
return -1;
126126
}
@@ -217,7 +217,7 @@ int main(int argc, char **argv)
217217
default:
218218
usage();
219219
}
220-
}
220+
}
221221
if (argc != optind) usage();
222222

223223
if (geteuid() != 0) {
@@ -238,11 +238,11 @@ int main(int argc, char **argv)
238238
*/
239239
if (c != '6' && do_reboot && do_kexec) {
240240
fprintf(stderr, "ERROR: using -k at this"
241-
" runlevel requires also -f\n"
242-
" (You probably want instead to reboot"
243-
" normally and let your reboot\n"
244-
" script, usually /etc/init.d/reboot,"
245-
" specify -k)\n");
241+
" runlevel requires also -f\n"
242+
" (You probably want instead to reboot"
243+
" normally and let your reboot\n"
244+
" script, usually /etc/init.d/reboot,"
245+
" specify -k)\n");
246246
exit(1);
247247
}
248248

@@ -251,7 +251,7 @@ int main(int argc, char **argv)
251251
*/
252252
if (c != '0' && c != '6')
253253
do_shutdown(do_reboot ? "-r" : "-h",
254-
do_poweroff ? "-P" : (do_reboot ? NULL : "-H"), tm);
254+
do_poweroff ? "-P" : (do_reboot ? NULL : "-H"), tm);
255255
}
256256

257257
/*

0 commit comments

Comments
 (0)