aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/vm
diff options
context:
space:
mode:
authorLadinu Chandrasinghe <ladinu.pub@gmail.com>2009-09-22 19:43:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 10:39:28 -0400
commitb7ed698cc9d556306a4088c238e2ea9311ea2cb3 (patch)
treeb0aadfcf2d2c1c1454bdf8f194f7ff94e5d21c46 /Documentation/vm
parent912e837aef72a3dd263dafc3717d92bbc1211a53 (diff)
Documentation/: fix warnings from -Wmissing-prototypes in HOSTCFLAGS
Fix up -Wmissing-prototypes in compileable userspace code, mainly under Documentation/. Signed-off-by: Ladinu Chandrasinghe <ladinu.pub@gmail.com> Signed-off-by: Trevor Keith <tsrk@tsrk.net> Cc: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/vm')
-rw-r--r--Documentation/vm/page-types.c52
-rw-r--r--Documentation/vm/slabinfo.c68
2 files changed, 60 insertions, 60 deletions
diff --git a/Documentation/vm/page-types.c b/Documentation/vm/page-types.c
index 0833f44ba16b..3eda8ea00852 100644
--- a/Documentation/vm/page-types.c
+++ b/Documentation/vm/page-types.c
@@ -158,12 +158,12 @@ static uint64_t page_flags[HASH_SIZE];
158 type __min2 = (y); \ 158 type __min2 = (y); \
159 __min1 < __min2 ? __min1 : __min2; }) 159 __min1 < __min2 ? __min1 : __min2; })
160 160
161unsigned long pages2mb(unsigned long pages) 161static unsigned long pages2mb(unsigned long pages)
162{ 162{
163 return (pages * page_size) >> 20; 163 return (pages * page_size) >> 20;
164} 164}
165 165
166void fatal(const char *x, ...) 166static void fatal(const char *x, ...)
167{ 167{
168 va_list ap; 168 va_list ap;
169 169
@@ -178,7 +178,7 @@ void fatal(const char *x, ...)
178 * page flag names 178 * page flag names
179 */ 179 */
180 180
181char *page_flag_name(uint64_t flags) 181static char *page_flag_name(uint64_t flags)
182{ 182{
183 static char buf[65]; 183 static char buf[65];
184 int present; 184 int present;
@@ -197,7 +197,7 @@ char *page_flag_name(uint64_t flags)
197 return buf; 197 return buf;
198} 198}
199 199
200char *page_flag_longname(uint64_t flags) 200static char *page_flag_longname(uint64_t flags)
201{ 201{
202 static char buf[1024]; 202 static char buf[1024];
203 int i, n; 203 int i, n;
@@ -221,7 +221,7 @@ char *page_flag_longname(uint64_t flags)
221 * page list and summary 221 * page list and summary
222 */ 222 */
223 223
224void show_page_range(unsigned long offset, uint64_t flags) 224static void show_page_range(unsigned long offset, uint64_t flags)
225{ 225{
226 static uint64_t flags0; 226 static uint64_t flags0;
227 static unsigned long index; 227 static unsigned long index;
@@ -241,12 +241,12 @@ void show_page_range(unsigned long offset, uint64_t flags)
241 count = 1; 241 count = 1;
242} 242}
243 243
244void show_page(unsigned long offset, uint64_t flags) 244static void show_page(unsigned long offset, uint64_t flags)
245{ 245{
246 printf("%lu\t%s\n", offset, page_flag_name(flags)); 246 printf("%lu\t%s\n", offset, page_flag_name(flags));
247} 247}
248 248
249void show_summary(void) 249static void show_summary(void)
250{ 250{
251 int i; 251 int i;
252 252
@@ -272,7 +272,7 @@ void show_summary(void)
272 * page flag filters 272 * page flag filters
273 */ 273 */
274 274
275int bit_mask_ok(uint64_t flags) 275static int bit_mask_ok(uint64_t flags)
276{ 276{
277 int i; 277 int i;
278 278
@@ -289,7 +289,7 @@ int bit_mask_ok(uint64_t flags)
289 return 1; 289 return 1;
290} 290}
291 291
292uint64_t expand_overloaded_flags(uint64_t flags) 292static uint64_t expand_overloaded_flags(uint64_t flags)
293{ 293{
294 /* SLOB/SLUB overload several page flags */ 294 /* SLOB/SLUB overload several page flags */
295 if (flags & BIT(SLAB)) { 295 if (flags & BIT(SLAB)) {
@@ -308,7 +308,7 @@ uint64_t expand_overloaded_flags(uint64_t flags)
308 return flags; 308 return flags;
309} 309}
310 310
311uint64_t well_known_flags(uint64_t flags) 311static uint64_t well_known_flags(uint64_t flags)
312{ 312{
313 /* hide flags intended only for kernel hacker */ 313 /* hide flags intended only for kernel hacker */
314 flags &= ~KPF_HACKERS_BITS; 314 flags &= ~KPF_HACKERS_BITS;
@@ -325,7 +325,7 @@ uint64_t well_known_flags(uint64_t flags)
325 * page frame walker 325 * page frame walker
326 */ 326 */
327 327
328int hash_slot(uint64_t flags) 328static int hash_slot(uint64_t flags)
329{ 329{
330 int k = HASH_KEY(flags); 330 int k = HASH_KEY(flags);
331 int i; 331 int i;
@@ -352,7 +352,7 @@ int hash_slot(uint64_t flags)
352 exit(EXIT_FAILURE); 352 exit(EXIT_FAILURE);
353} 353}
354 354
355void add_page(unsigned long offset, uint64_t flags) 355static void add_page(unsigned long offset, uint64_t flags)
356{ 356{
357 flags = expand_overloaded_flags(flags); 357 flags = expand_overloaded_flags(flags);
358 358
@@ -371,7 +371,7 @@ void add_page(unsigned long offset, uint64_t flags)
371 total_pages++; 371 total_pages++;
372} 372}
373 373
374void walk_pfn(unsigned long index, unsigned long count) 374static void walk_pfn(unsigned long index, unsigned long count)
375{ 375{
376 unsigned long batch; 376 unsigned long batch;
377 unsigned long n; 377 unsigned long n;
@@ -404,7 +404,7 @@ void walk_pfn(unsigned long index, unsigned long count)
404 } 404 }
405} 405}
406 406
407void walk_addr_ranges(void) 407static void walk_addr_ranges(void)
408{ 408{
409 int i; 409 int i;
410 410
@@ -428,7 +428,7 @@ void walk_addr_ranges(void)
428 * user interface 428 * user interface
429 */ 429 */
430 430
431const char *page_flag_type(uint64_t flag) 431static const char *page_flag_type(uint64_t flag)
432{ 432{
433 if (flag & KPF_HACKERS_BITS) 433 if (flag & KPF_HACKERS_BITS)
434 return "(r)"; 434 return "(r)";
@@ -437,7 +437,7 @@ const char *page_flag_type(uint64_t flag)
437 return " "; 437 return " ";
438} 438}
439 439
440void usage(void) 440static void usage(void)
441{ 441{
442 int i, j; 442 int i, j;
443 443
@@ -482,7 +482,7 @@ void usage(void)
482 "(r) raw mode bits (o) overloaded bits\n"); 482 "(r) raw mode bits (o) overloaded bits\n");
483} 483}
484 484
485unsigned long long parse_number(const char *str) 485static unsigned long long parse_number(const char *str)
486{ 486{
487 unsigned long long n; 487 unsigned long long n;
488 488
@@ -494,16 +494,16 @@ unsigned long long parse_number(const char *str)
494 return n; 494 return n;
495} 495}
496 496
497void parse_pid(const char *str) 497static void parse_pid(const char *str)
498{ 498{
499 opt_pid = parse_number(str); 499 opt_pid = parse_number(str);
500} 500}
501 501
502void parse_file(const char *name) 502static void parse_file(const char *name)
503{ 503{
504} 504}
505 505
506void add_addr_range(unsigned long offset, unsigned long size) 506static void add_addr_range(unsigned long offset, unsigned long size)
507{ 507{
508 if (nr_addr_ranges >= MAX_ADDR_RANGES) 508 if (nr_addr_ranges >= MAX_ADDR_RANGES)
509 fatal("too much addr ranges\n"); 509 fatal("too much addr ranges\n");
@@ -513,7 +513,7 @@ void add_addr_range(unsigned long offset, unsigned long size)
513 nr_addr_ranges++; 513 nr_addr_ranges++;
514} 514}
515 515
516void parse_addr_range(const char *optarg) 516static void parse_addr_range(const char *optarg)
517{ 517{
518 unsigned long offset; 518 unsigned long offset;
519 unsigned long size; 519 unsigned long size;
@@ -547,7 +547,7 @@ void parse_addr_range(const char *optarg)
547 add_addr_range(offset, size); 547 add_addr_range(offset, size);
548} 548}
549 549
550void add_bits_filter(uint64_t mask, uint64_t bits) 550static void add_bits_filter(uint64_t mask, uint64_t bits)
551{ 551{
552 if (nr_bit_filters >= MAX_BIT_FILTERS) 552 if (nr_bit_filters >= MAX_BIT_FILTERS)
553 fatal("too much bit filters\n"); 553 fatal("too much bit filters\n");
@@ -557,7 +557,7 @@ void add_bits_filter(uint64_t mask, uint64_t bits)
557 nr_bit_filters++; 557 nr_bit_filters++;
558} 558}
559 559
560uint64_t parse_flag_name(const char *str, int len) 560static uint64_t parse_flag_name(const char *str, int len)
561{ 561{
562 int i; 562 int i;
563 563
@@ -577,7 +577,7 @@ uint64_t parse_flag_name(const char *str, int len)
577 return parse_number(str); 577 return parse_number(str);
578} 578}
579 579
580uint64_t parse_flag_names(const char *str, int all) 580static uint64_t parse_flag_names(const char *str, int all)
581{ 581{
582 const char *p = str; 582 const char *p = str;
583 uint64_t flags = 0; 583 uint64_t flags = 0;
@@ -596,7 +596,7 @@ uint64_t parse_flag_names(const char *str, int all)
596 return flags; 596 return flags;
597} 597}
598 598
599void parse_bits_mask(const char *optarg) 599static void parse_bits_mask(const char *optarg)
600{ 600{
601 uint64_t mask; 601 uint64_t mask;
602 uint64_t bits; 602 uint64_t bits;
@@ -621,7 +621,7 @@ void parse_bits_mask(const char *optarg)
621} 621}
622 622
623 623
624struct option opts[] = { 624static struct option opts[] = {
625 { "raw" , 0, NULL, 'r' }, 625 { "raw" , 0, NULL, 'r' },
626 { "pid" , 1, NULL, 'p' }, 626 { "pid" , 1, NULL, 'p' },
627 { "file" , 1, NULL, 'f' }, 627 { "file" , 1, NULL, 'f' },
diff --git a/Documentation/vm/slabinfo.c b/Documentation/vm/slabinfo.c
index df3227605d59..92e729f4b676 100644
--- a/Documentation/vm/slabinfo.c
+++ b/Documentation/vm/slabinfo.c
@@ -87,7 +87,7 @@ int page_size;
87 87
88regex_t pattern; 88regex_t pattern;
89 89
90void fatal(const char *x, ...) 90static void fatal(const char *x, ...)
91{ 91{
92 va_list ap; 92 va_list ap;
93 93
@@ -97,7 +97,7 @@ void fatal(const char *x, ...)
97 exit(EXIT_FAILURE); 97 exit(EXIT_FAILURE);
98} 98}
99 99
100void usage(void) 100static void usage(void)
101{ 101{
102 printf("slabinfo 5/7/2007. (c) 2007 sgi.\n\n" 102 printf("slabinfo 5/7/2007. (c) 2007 sgi.\n\n"
103 "slabinfo [-ahnpvtsz] [-d debugopts] [slab-regexp]\n" 103 "slabinfo [-ahnpvtsz] [-d debugopts] [slab-regexp]\n"
@@ -131,7 +131,7 @@ void usage(void)
131 ); 131 );
132} 132}
133 133
134unsigned long read_obj(const char *name) 134static unsigned long read_obj(const char *name)
135{ 135{
136 FILE *f = fopen(name, "r"); 136 FILE *f = fopen(name, "r");
137 137
@@ -151,7 +151,7 @@ unsigned long read_obj(const char *name)
151/* 151/*
152 * Get the contents of an attribute 152 * Get the contents of an attribute
153 */ 153 */
154unsigned long get_obj(const char *name) 154static unsigned long get_obj(const char *name)
155{ 155{
156 if (!read_obj(name)) 156 if (!read_obj(name))
157 return 0; 157 return 0;
@@ -159,7 +159,7 @@ unsigned long get_obj(const char *name)
159 return atol(buffer); 159 return atol(buffer);
160} 160}
161 161
162unsigned long get_obj_and_str(const char *name, char **x) 162static unsigned long get_obj_and_str(const char *name, char **x)
163{ 163{
164 unsigned long result = 0; 164 unsigned long result = 0;
165 char *p; 165 char *p;
@@ -178,7 +178,7 @@ unsigned long get_obj_and_str(const char *name, char **x)
178 return result; 178 return result;
179} 179}
180 180
181void set_obj(struct slabinfo *s, const char *name, int n) 181static void set_obj(struct slabinfo *s, const char *name, int n)
182{ 182{
183 char x[100]; 183 char x[100];
184 FILE *f; 184 FILE *f;
@@ -192,7 +192,7 @@ void set_obj(struct slabinfo *s, const char *name, int n)
192 fclose(f); 192 fclose(f);
193} 193}
194 194
195unsigned long read_slab_obj(struct slabinfo *s, const char *name) 195static unsigned long read_slab_obj(struct slabinfo *s, const char *name)
196{ 196{
197 char x[100]; 197 char x[100];
198 FILE *f; 198 FILE *f;
@@ -215,7 +215,7 @@ unsigned long read_slab_obj(struct slabinfo *s, const char *name)
215/* 215/*
216 * Put a size string together 216 * Put a size string together
217 */ 217 */
218int store_size(char *buffer, unsigned long value) 218static int store_size(char *buffer, unsigned long value)
219{ 219{
220 unsigned long divisor = 1; 220 unsigned long divisor = 1;
221 char trailer = 0; 221 char trailer = 0;
@@ -247,7 +247,7 @@ int store_size(char *buffer, unsigned long value)
247 return n; 247 return n;
248} 248}
249 249
250void decode_numa_list(int *numa, char *t) 250static void decode_numa_list(int *numa, char *t)
251{ 251{
252 int node; 252 int node;
253 int nr; 253 int nr;
@@ -272,7 +272,7 @@ void decode_numa_list(int *numa, char *t)
272 } 272 }
273} 273}
274 274
275void slab_validate(struct slabinfo *s) 275static void slab_validate(struct slabinfo *s)
276{ 276{
277 if (strcmp(s->name, "*") == 0) 277 if (strcmp(s->name, "*") == 0)
278 return; 278 return;
@@ -280,7 +280,7 @@ void slab_validate(struct slabinfo *s)
280 set_obj(s, "validate", 1); 280 set_obj(s, "validate", 1);
281} 281}
282 282
283void slab_shrink(struct slabinfo *s) 283static void slab_shrink(struct slabinfo *s)
284{ 284{
285 if (strcmp(s->name, "*") == 0) 285 if (strcmp(s->name, "*") == 0)
286 return; 286 return;
@@ -290,7 +290,7 @@ void slab_shrink(struct slabinfo *s)
290 290
291int line = 0; 291int line = 0;
292 292
293void first_line(void) 293static void first_line(void)
294{ 294{
295 if (show_activity) 295 if (show_activity)
296 printf("Name Objects Alloc Free %%Fast Fallb O\n"); 296 printf("Name Objects Alloc Free %%Fast Fallb O\n");
@@ -302,7 +302,7 @@ void first_line(void)
302/* 302/*
303 * Find the shortest alias of a slab 303 * Find the shortest alias of a slab
304 */ 304 */
305struct aliasinfo *find_one_alias(struct slabinfo *find) 305static struct aliasinfo *find_one_alias(struct slabinfo *find)
306{ 306{
307 struct aliasinfo *a; 307 struct aliasinfo *a;
308 struct aliasinfo *best = NULL; 308 struct aliasinfo *best = NULL;
@@ -318,18 +318,18 @@ struct aliasinfo *find_one_alias(struct slabinfo *find)
318 return best; 318 return best;
319} 319}
320 320
321unsigned long slab_size(struct slabinfo *s) 321static unsigned long slab_size(struct slabinfo *s)
322{ 322{
323 return s->slabs * (page_size << s->order); 323 return s->slabs * (page_size << s->order);
324} 324}
325 325
326unsigned long slab_activity(struct slabinfo *s) 326static unsigned long slab_activity(struct slabinfo *s)
327{ 327{
328 return s->alloc_fastpath + s->free_fastpath + 328 return s->alloc_fastpath + s->free_fastpath +
329 s->alloc_slowpath + s->free_slowpath; 329 s->alloc_slowpath + s->free_slowpath;
330} 330}
331 331
332void slab_numa(struct slabinfo *s, int mode) 332static void slab_numa(struct slabinfo *s, int mode)
333{ 333{
334 int node; 334 int node;
335 335
@@ -374,7 +374,7 @@ void slab_numa(struct slabinfo *s, int mode)
374 line++; 374 line++;
375} 375}
376 376
377void show_tracking(struct slabinfo *s) 377static void show_tracking(struct slabinfo *s)
378{ 378{
379 printf("\n%s: Kernel object allocation\n", s->name); 379 printf("\n%s: Kernel object allocation\n", s->name);
380 printf("-----------------------------------------------------------------------\n"); 380 printf("-----------------------------------------------------------------------\n");
@@ -392,7 +392,7 @@ void show_tracking(struct slabinfo *s)
392 392
393} 393}
394 394
395void ops(struct slabinfo *s) 395static void ops(struct slabinfo *s)
396{ 396{
397 if (strcmp(s->name, "*") == 0) 397 if (strcmp(s->name, "*") == 0)
398 return; 398 return;
@@ -405,14 +405,14 @@ void ops(struct slabinfo *s)
405 printf("\n%s has no kmem_cache operations\n", s->name); 405 printf("\n%s has no kmem_cache operations\n", s->name);
406} 406}
407 407
408const char *onoff(int x) 408static const char *onoff(int x)
409{ 409{
410 if (x) 410 if (x)
411 return "On "; 411 return "On ";
412 return "Off"; 412 return "Off";
413} 413}
414 414
415void slab_stats(struct slabinfo *s) 415static void slab_stats(struct slabinfo *s)
416{ 416{
417 unsigned long total_alloc; 417 unsigned long total_alloc;
418 unsigned long total_free; 418 unsigned long total_free;
@@ -477,7 +477,7 @@ void slab_stats(struct slabinfo *s)
477 s->deactivate_to_tail, (s->deactivate_to_tail * 100) / total); 477 s->deactivate_to_tail, (s->deactivate_to_tail * 100) / total);
478} 478}
479 479
480void report(struct slabinfo *s) 480static void report(struct slabinfo *s)
481{ 481{
482 if (strcmp(s->name, "*") == 0) 482 if (strcmp(s->name, "*") == 0)
483 return; 483 return;
@@ -518,7 +518,7 @@ void report(struct slabinfo *s)
518 slab_stats(s); 518 slab_stats(s);
519} 519}
520 520
521void slabcache(struct slabinfo *s) 521static void slabcache(struct slabinfo *s)
522{ 522{
523 char size_str[20]; 523 char size_str[20];
524 char dist_str[40]; 524 char dist_str[40];
@@ -593,7 +593,7 @@ void slabcache(struct slabinfo *s)
593/* 593/*
594 * Analyze debug options. Return false if something is amiss. 594 * Analyze debug options. Return false if something is amiss.
595 */ 595 */
596int debug_opt_scan(char *opt) 596static int debug_opt_scan(char *opt)
597{ 597{
598 if (!opt || !opt[0] || strcmp(opt, "-") == 0) 598 if (!opt || !opt[0] || strcmp(opt, "-") == 0)
599 return 1; 599 return 1;
@@ -642,7 +642,7 @@ int debug_opt_scan(char *opt)
642 return 1; 642 return 1;
643} 643}
644 644
645int slab_empty(struct slabinfo *s) 645static int slab_empty(struct slabinfo *s)
646{ 646{
647 if (s->objects > 0) 647 if (s->objects > 0)
648 return 0; 648 return 0;
@@ -657,7 +657,7 @@ int slab_empty(struct slabinfo *s)
657 return 1; 657 return 1;
658} 658}
659 659
660void slab_debug(struct slabinfo *s) 660static void slab_debug(struct slabinfo *s)
661{ 661{
662 if (strcmp(s->name, "*") == 0) 662 if (strcmp(s->name, "*") == 0)
663 return; 663 return;
@@ -717,7 +717,7 @@ void slab_debug(struct slabinfo *s)
717 set_obj(s, "trace", 1); 717 set_obj(s, "trace", 1);
718} 718}
719 719
720void totals(void) 720static void totals(void)
721{ 721{
722 struct slabinfo *s; 722 struct slabinfo *s;
723 723
@@ -976,7 +976,7 @@ void totals(void)
976 b1, b2, b3); 976 b1, b2, b3);
977} 977}
978 978
979void sort_slabs(void) 979static void sort_slabs(void)
980{ 980{
981 struct slabinfo *s1,*s2; 981 struct slabinfo *s1,*s2;
982 982
@@ -1005,7 +1005,7 @@ void sort_slabs(void)
1005 } 1005 }
1006} 1006}
1007 1007
1008void sort_aliases(void) 1008static void sort_aliases(void)
1009{ 1009{
1010 struct aliasinfo *a1,*a2; 1010 struct aliasinfo *a1,*a2;
1011 1011
@@ -1030,7 +1030,7 @@ void sort_aliases(void)
1030 } 1030 }
1031} 1031}
1032 1032
1033void link_slabs(void) 1033static void link_slabs(void)
1034{ 1034{
1035 struct aliasinfo *a; 1035 struct aliasinfo *a;
1036 struct slabinfo *s; 1036 struct slabinfo *s;
@@ -1048,7 +1048,7 @@ void link_slabs(void)
1048 } 1048 }
1049} 1049}
1050 1050
1051void alias(void) 1051static void alias(void)
1052{ 1052{
1053 struct aliasinfo *a; 1053 struct aliasinfo *a;
1054 char *active = NULL; 1054 char *active = NULL;
@@ -1079,7 +1079,7 @@ void alias(void)
1079} 1079}
1080 1080
1081 1081
1082void rename_slabs(void) 1082static void rename_slabs(void)
1083{ 1083{
1084 struct slabinfo *s; 1084 struct slabinfo *s;
1085 struct aliasinfo *a; 1085 struct aliasinfo *a;
@@ -1102,12 +1102,12 @@ void rename_slabs(void)
1102 } 1102 }
1103} 1103}
1104 1104
1105int slab_mismatch(char *slab) 1105static int slab_mismatch(char *slab)
1106{ 1106{
1107 return regexec(&pattern, slab, 0, NULL, 0); 1107 return regexec(&pattern, slab, 0, NULL, 0);
1108} 1108}
1109 1109
1110void read_slab_dir(void) 1110static void read_slab_dir(void)
1111{ 1111{
1112 DIR *dir; 1112 DIR *dir;
1113 struct dirent *de; 1113 struct dirent *de;
@@ -1209,7 +1209,7 @@ void read_slab_dir(void)
1209 fatal("Too many aliases\n"); 1209 fatal("Too many aliases\n");
1210} 1210}
1211 1211
1212void output_slabs(void) 1212static void output_slabs(void)
1213{ 1213{
1214 struct slabinfo *slab; 1214 struct slabinfo *slab;
1215 1215