diff options
254 files changed, 2027 insertions, 2027 deletions
@@ -41,7 +41,7 @@ Using busybox: | |||
41 | The behavior of busybox is determined by the name it's called under: as | 41 | The behavior of busybox is determined by the name it's called under: as |
42 | "cp" it behaves like cp, as "sed" it behaves like sed, and so on. Called | 42 | "cp" it behaves like cp, as "sed" it behaves like sed, and so on. Called |
43 | as "busybox" it takes the second argument as the name of the applet to | 43 | as "busybox" it takes the second argument as the name of the applet to |
44 | run (I.E. "./busybox ls -l /proc"). | 44 | run (I.E. "./busybox ls -l /proc"). |
45 | 45 | ||
46 | The "standalone shell" mode is an easy way to try out busybox; this is a | 46 | The "standalone shell" mode is an easy way to try out busybox; this is a |
47 | command shell that calls the builtin applets without needing them to be | 47 | command shell that calls the builtin applets without needing them to be |
diff --git a/applets/busybox.c b/applets/busybox.c index db78b7ccd..be1f19ad2 100644 --- a/applets/busybox.c +++ b/applets/busybox.c | |||
@@ -108,7 +108,7 @@ int busybox_main(int argc, char **argv) | |||
108 | } | 108 | } |
109 | 109 | ||
110 | /* Deal with --help. (Also print help when called with no arguments) */ | 110 | /* Deal with --help. (Also print help when called with no arguments) */ |
111 | 111 | ||
112 | if (argc==1 || !strcmp(argv[1],"--help") ) { | 112 | if (argc==1 || !strcmp(argv[1],"--help") ) { |
113 | if (argc>2) { | 113 | if (argc>2) { |
114 | run_applet_by_name(bb_applet_name=argv[2], 2, argv); | 114 | run_applet_by_name(bb_applet_name=argv[2], 2, argv); |
@@ -144,7 +144,7 @@ int busybox_main(int argc, char **argv) | |||
144 | exit(0); | 144 | exit(0); |
145 | } | 145 | } |
146 | } else run_applet_by_name(bb_applet_name=argv[1], argc-1, argv+1); | 146 | } else run_applet_by_name(bb_applet_name=argv[1], argc-1, argv+1); |
147 | 147 | ||
148 | bb_error_msg_and_die("applet not found"); | 148 | bb_error_msg_and_die("applet not found"); |
149 | } | 149 | } |
150 | 150 | ||
diff --git a/archival/Config.in b/archival/Config.in index e7d5debb0..7810c354d 100644 --- a/archival/Config.in +++ b/archival/Config.in | |||
@@ -47,10 +47,10 @@ config CONFIG_BUNZIP2 | |||
47 | is generally considerably better than that achieved by more | 47 | is generally considerably better than that achieved by more |
48 | conventional LZ77/LZ78-based compressors, and approaches the | 48 | conventional LZ77/LZ78-based compressors, and approaches the |
49 | performance of the PPM family of statistical compressors. | 49 | performance of the PPM family of statistical compressors. |
50 | 50 | ||
51 | The BusyBox bunzip2 applet is limited to de-compression only. | 51 | The BusyBox bunzip2 applet is limited to de-compression only. |
52 | On an x86 system, this applet adds about 11K. | 52 | On an x86 system, this applet adds about 11K. |
53 | 53 | ||
54 | Unless you have a specific application which requires bunzip2, you | 54 | Unless you have a specific application which requires bunzip2, you |
55 | should probably say N here. | 55 | should probably say N here. |
56 | 56 | ||
@@ -73,7 +73,7 @@ config CONFIG_DPKG | |||
73 | default n | 73 | default n |
74 | help | 74 | help |
75 | dpkg is a medium-level tool to install, build, remove and manage Debian packages. | 75 | dpkg is a medium-level tool to install, build, remove and manage Debian packages. |
76 | 76 | ||
77 | This implementation of dpkg has a number of limitations, you should use the | 77 | This implementation of dpkg has a number of limitations, you should use the |
78 | official dpkg if possible. | 78 | official dpkg if possible. |
79 | 79 | ||
@@ -82,9 +82,9 @@ config CONFIG_DPKG_DEB | |||
82 | default n | 82 | default n |
83 | help | 83 | help |
84 | dpkg-deb packs, unpacks and provides information about Debian archives. | 84 | dpkg-deb packs, unpacks and provides information about Debian archives. |
85 | 85 | ||
86 | This implementation of dpkg-deb cannot pack archives. | 86 | This implementation of dpkg-deb cannot pack archives. |
87 | 87 | ||
88 | Unless you have a specific application which requires dpkg-deb, you should | 88 | Unless you have a specific application which requires dpkg-deb, you should |
89 | probably say N here. | 89 | probably say N here. |
90 | 90 | ||
@@ -228,10 +228,10 @@ config CONFIG_UNLZMA | |||
228 | compression algorithm, and range coding. Compression | 228 | compression algorithm, and range coding. Compression |
229 | is generally considerably better than that achieved by the bzip2 | 229 | is generally considerably better than that achieved by the bzip2 |
230 | compressors. | 230 | compressors. |
231 | 231 | ||
232 | The BusyBox unlzma applet is limited to de-compression only. | 232 | The BusyBox unlzma applet is limited to de-compression only. |
233 | On an x86 system, this applet adds about 4K. | 233 | On an x86 system, this applet adds about 4K. |
234 | 234 | ||
235 | Unless you have a specific application which requires unlzma, you | 235 | Unless you have a specific application which requires unlzma, you |
236 | should probably say N here. | 236 | should probably say N here. |
237 | 237 | ||
@@ -272,7 +272,7 @@ config CONFIG_FEATURE_DEB_TAR_GZ | |||
272 | depends on CONFIG_DPKG || CONFIG_DPKG_DEB | 272 | depends on CONFIG_DPKG || CONFIG_DPKG_DEB |
273 | help | 273 | help |
274 | This is the default compression method inside the debian ar file. | 274 | This is the default compression method inside the debian ar file. |
275 | 275 | ||
276 | If you want compatibility with standard .deb's you should say yes here. | 276 | If you want compatibility with standard .deb's you should say yes here. |
277 | 277 | ||
278 | config CONFIG_FEATURE_DEB_TAR_BZ2 | 278 | config CONFIG_FEATURE_DEB_TAR_BZ2 |
@@ -282,7 +282,7 @@ config CONFIG_FEATURE_DEB_TAR_BZ2 | |||
282 | help | 282 | help |
283 | This allows dpkg and dpkg-deb to extract deb's that are compressed internally | 283 | This allows dpkg and dpkg-deb to extract deb's that are compressed internally |
284 | with bzip2 instead of gzip. | 284 | with bzip2 instead of gzip. |
285 | 285 | ||
286 | You only want this if you are creating your own custom debian packages that | 286 | You only want this if you are creating your own custom debian packages that |
287 | use an internal control.tar.bz2 or data.tar.bz2. | 287 | use an internal control.tar.bz2 or data.tar.bz2. |
288 | 288 | ||
@@ -293,7 +293,7 @@ config CONFIG_FEATURE_DEB_TAR_LZMA | |||
293 | help | 293 | help |
294 | This allows dpkg and dpkg-deb to extract deb's that are compressed | 294 | This allows dpkg and dpkg-deb to extract deb's that are compressed |
295 | internally with lzma instead of gzip. | 295 | internally with lzma instead of gzip. |
296 | 296 | ||
297 | You only want this if you are creating your own custom debian | 297 | You only want this if you are creating your own custom debian |
298 | packages that use an internal control.tar.lzma or data.tar.lzma. | 298 | packages that use an internal control.tar.lzma or data.tar.lzma. |
299 | 299 | ||
diff --git a/archival/ar.c b/archival/ar.c index 983b5ae2c..05cb231aa 100644 --- a/archival/ar.c +++ b/archival/ar.c | |||
@@ -61,12 +61,12 @@ extern int ar_main(int argc, char **argv) | |||
61 | { | 61 | { |
62 | archive_handle_t *archive_handle; | 62 | archive_handle_t *archive_handle; |
63 | unsigned long opt; | 63 | unsigned long opt; |
64 | static const char msg_unsupported_err[] = | 64 | static const char msg_unsupported_err[] = |
65 | "Archive %s not supported. Install binutils 'ar'."; | 65 | "Archive %s not supported. Install binutils 'ar'."; |
66 | char magic[8]; | 66 | char magic[8]; |
67 | 67 | ||
68 | archive_handle = init_handle(); | 68 | archive_handle = init_handle(); |
69 | 69 | ||
70 | /* Prepend '-' to the first argument if required */ | 70 | /* Prepend '-' to the first argument if required */ |
71 | bb_opt_complementally = "--:p:t:x:-1:?:p--tx:t--px:x--pt"; | 71 | bb_opt_complementally = "--:p:t:x:-1:?:p--tx:t--px:x--pt"; |
72 | opt = bb_getopt_ulflags(argc, argv, "ptxovcr"); | 72 | opt = bb_getopt_ulflags(argc, argv, "ptxovcr"); |
diff --git a/archival/dpkg.c b/archival/dpkg.c index 5f9f3a76b..7ed17d711 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c | |||
@@ -850,7 +850,7 @@ static void write_status_file(deb_file_t **deb_file) | |||
850 | } | 850 | } |
851 | 851 | ||
852 | tmp_string += 8; | 852 | tmp_string += 8; |
853 | tmp_string += strspn(tmp_string, " \n\t"); | 853 | tmp_string += strspn(tmp_string, " \n\t"); |
854 | package_name = bb_xstrndup(tmp_string, strcspn(tmp_string, "\n\0")); | 854 | package_name = bb_xstrndup(tmp_string, strcspn(tmp_string, "\n\0")); |
855 | write_flag = FALSE; | 855 | write_flag = FALSE; |
856 | tmp_string = strstr(control_buffer, "Status:"); | 856 | tmp_string = strstr(control_buffer, "Status:"); |
@@ -989,8 +989,8 @@ static int package_satisfies_dependency(int package, int depend_type) | |||
989 | return 0; | 989 | return 0; |
990 | 990 | ||
991 | switch (depend_type) { | 991 | switch (depend_type) { |
992 | case EDGE_PRE_DEPENDS: return get_status(status_num, 3) == search_name_hashtable("installed"); | 992 | case EDGE_PRE_DEPENDS: return get_status(status_num, 3) == search_name_hashtable("installed"); |
993 | case EDGE_DEPENDS: return get_status(status_num, 1) == search_name_hashtable("install"); | 993 | case EDGE_DEPENDS: return get_status(status_num, 1) == search_name_hashtable("install"); |
994 | } | 994 | } |
995 | return 0; | 995 | return 0; |
996 | } | 996 | } |
@@ -1078,7 +1078,7 @@ static int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count) | |||
1078 | } | 1078 | } |
1079 | } | 1079 | } |
1080 | i++; | 1080 | i++; |
1081 | } | 1081 | } |
1082 | 1082 | ||
1083 | 1083 | ||
1084 | /* Check dependendcies */ | 1084 | /* Check dependendcies */ |
@@ -1114,8 +1114,8 @@ static int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count) | |||
1114 | * things which are broken but unrelated to the | 1114 | * things which are broken but unrelated to the |
1115 | * packages that are currently being installed | 1115 | * packages that are currently being installed |
1116 | */ | 1116 | */ |
1117 | if (state_status == search_name_hashtable("installed")) | 1117 | if (state_status == search_name_hashtable("installed")) |
1118 | continue; | 1118 | continue; |
1119 | #endif | 1119 | #endif |
1120 | 1120 | ||
1121 | /* This code is tested only for EDGE_DEPENDS, since I | 1121 | /* This code is tested only for EDGE_DEPENDS, since I |
@@ -1125,13 +1125,13 @@ static int check_deps(deb_file_t **deb_file, int deb_start, int dep_max_count) | |||
1125 | for (j = 0; j < package_node->num_of_edges; j++) { | 1125 | for (j = 0; j < package_node->num_of_edges; j++) { |
1126 | const edge_t *package_edge = package_node->edge[j]; | 1126 | const edge_t *package_edge = package_node->edge[j]; |
1127 | unsigned int package_num; | 1127 | unsigned int package_num; |
1128 | 1128 | ||
1129 | if ( package_edge->type == EDGE_OR_PRE_DEPENDS || | 1129 | if ( package_edge->type == EDGE_OR_PRE_DEPENDS || |
1130 | package_edge->type == EDGE_OR_DEPENDS ) { /* start an EDGE_OR_ list */ | 1130 | package_edge->type == EDGE_OR_DEPENDS ) { /* start an EDGE_OR_ list */ |
1131 | number_of_alternatives = package_edge->version; | 1131 | number_of_alternatives = package_edge->version; |
1132 | root_of_alternatives = package_edge; | 1132 | root_of_alternatives = package_edge; |
1133 | continue; | 1133 | continue; |
1134 | } else if ( number_of_alternatives == 0 ) { /* not in the middle of an EDGE_OR_ list */ | 1134 | } else if ( number_of_alternatives == 0 ) { /* not in the middle of an EDGE_OR_ list */ |
1135 | number_of_alternatives = 1; | 1135 | number_of_alternatives = 1; |
1136 | root_of_alternatives = NULL; | 1136 | root_of_alternatives = NULL; |
1137 | } | 1137 | } |
@@ -1329,7 +1329,7 @@ static void free_array(char **array) | |||
1329 | */ | 1329 | */ |
1330 | static void list_packages(void) | 1330 | static void list_packages(void) |
1331 | { | 1331 | { |
1332 | int i; | 1332 | int i; |
1333 | 1333 | ||
1334 | printf(" Name Version\n"); | 1334 | printf(" Name Version\n"); |
1335 | printf("+++-==============-==============\n"); | 1335 | printf("+++-==============-==============\n"); |
@@ -1715,7 +1715,7 @@ int dpkg_main(int argc, char **argv) | |||
1715 | 1715 | ||
1716 | if (package_num == -1) { | 1716 | if (package_num == -1) { |
1717 | bb_error_msg("Invalid control file in %s", argv[optind]); | 1717 | bb_error_msg("Invalid control file in %s", argv[optind]); |
1718 | optind++; | 1718 | optind++; |
1719 | continue; | 1719 | continue; |
1720 | } | 1720 | } |
1721 | deb_file[deb_count]->package = (unsigned int) package_num; | 1721 | deb_file[deb_count]->package = (unsigned int) package_num; |
diff --git a/archival/gzip.c b/archival/gzip.c index 3aa077fbd..1f268dd26 100644 --- a/archival/gzip.c +++ b/archival/gzip.c | |||
@@ -1031,7 +1031,7 @@ static void fill_window(void) | |||
1031 | */ | 1031 | */ |
1032 | #define FLUSH_BLOCK(eof) \ | 1032 | #define FLUSH_BLOCK(eof) \ |
1033 | flush_block(block_start >= 0L ? (char*)&window[(unsigned)block_start] : \ | 1033 | flush_block(block_start >= 0L ? (char*)&window[(unsigned)block_start] : \ |
1034 | (char*)NULL, (long)strstart - block_start, (eof)) | 1034 | (char*)NULL, (long)strstart - block_start, (eof)) |
1035 | 1035 | ||
1036 | /* =========================================================================== | 1036 | /* =========================================================================== |
1037 | * Same as above, but achieves better compression. We use a lazy | 1037 | * Same as above, but achieves better compression. We use a lazy |
diff --git a/archival/libunarchive/decompress_bunzip2.c b/archival/libunarchive/decompress_bunzip2.c index 597ec85a3..af3731b15 100644 --- a/archival/libunarchive/decompress_bunzip2.c +++ b/archival/libunarchive/decompress_bunzip2.c | |||
@@ -51,9 +51,9 @@ | |||
51 | 51 | ||
52 | /* Constants for Huffman coding */ | 52 | /* Constants for Huffman coding */ |
53 | #define MAX_GROUPS 6 | 53 | #define MAX_GROUPS 6 |
54 | #define GROUP_SIZE 50 /* 64 would have been more efficient */ | 54 | #define GROUP_SIZE 50 /* 64 would have been more efficient */ |
55 | #define MAX_HUFCODE_BITS 20 /* Longest Huffman code allowed */ | 55 | #define MAX_HUFCODE_BITS 20 /* Longest Huffman code allowed */ |
56 | #define MAX_SYMBOLS 258 /* 256 literals + RUNA + RUNB */ | 56 | #define MAX_SYMBOLS 258 /* 256 literals + RUNA + RUNB */ |
57 | #define SYMBOL_RUNA 0 | 57 | #define SYMBOL_RUNA 0 |
58 | #define SYMBOL_RUNB 1 | 58 | #define SYMBOL_RUNB 1 |
59 | 59 | ||
diff --git a/archival/libunarchive/decompress_unlzma.c b/archival/libunarchive/decompress_unlzma.c index 977cb48d0..62811ddfc 100644 --- a/archival/libunarchive/decompress_unlzma.c +++ b/archival/libunarchive/decompress_unlzma.c | |||
@@ -50,9 +50,9 @@ typedef struct { | |||
50 | #define LZMA_LEN_CHOICE_2 (LZMA_LEN_CHOICE + 1) | 50 | #define LZMA_LEN_CHOICE_2 (LZMA_LEN_CHOICE + 1) |
51 | #define LZMA_LEN_LOW (LZMA_LEN_CHOICE_2 + 1) | 51 | #define LZMA_LEN_LOW (LZMA_LEN_CHOICE_2 + 1) |
52 | #define LZMA_LEN_MID (LZMA_LEN_LOW \ | 52 | #define LZMA_LEN_MID (LZMA_LEN_LOW \ |
53 | + (1 << (LZMA_NUM_POS_BITS_MAX + LZMA_LEN_NUM_LOW_BITS))) | 53 | + (1 << (LZMA_NUM_POS_BITS_MAX + LZMA_LEN_NUM_LOW_BITS))) |
54 | #define LZMA_LEN_HIGH (LZMA_LEN_MID \ | 54 | #define LZMA_LEN_HIGH (LZMA_LEN_MID \ |
55 | +(1 << (LZMA_NUM_POS_BITS_MAX + LZMA_LEN_NUM_MID_BITS))) | 55 | +(1 << (LZMA_NUM_POS_BITS_MAX + LZMA_LEN_NUM_MID_BITS))) |
56 | #define LZMA_NUM_LEN_PROBS (LZMA_LEN_HIGH + (1 << LZMA_LEN_NUM_HIGH_BITS)) | 56 | #define LZMA_NUM_LEN_PROBS (LZMA_LEN_HIGH + (1 << LZMA_LEN_NUM_HIGH_BITS)) |
57 | 57 | ||
58 | #define LZMA_NUM_STATES 12 | 58 | #define LZMA_NUM_STATES 12 |
@@ -76,11 +76,11 @@ typedef struct { | |||
76 | #define LZMA_IS_REP_G2 (LZMA_IS_REP_G1 + LZMA_NUM_STATES) | 76 | #define LZMA_IS_REP_G2 (LZMA_IS_REP_G1 + LZMA_NUM_STATES) |
77 | #define LZMA_IS_REP_0_LONG (LZMA_IS_REP_G2 + LZMA_NUM_STATES) | 77 | #define LZMA_IS_REP_0_LONG (LZMA_IS_REP_G2 + LZMA_NUM_STATES) |
78 | #define LZMA_POS_SLOT (LZMA_IS_REP_0_LONG \ | 78 | #define LZMA_POS_SLOT (LZMA_IS_REP_0_LONG \ |
79 | + (LZMA_NUM_STATES << LZMA_NUM_POS_BITS_MAX)) | 79 | + (LZMA_NUM_STATES << LZMA_NUM_POS_BITS_MAX)) |
80 | #define LZMA_SPEC_POS (LZMA_POS_SLOT \ | 80 | #define LZMA_SPEC_POS (LZMA_POS_SLOT \ |
81 | +(LZMA_NUM_LEN_TO_POS_STATES << LZMA_NUM_POS_SLOT_BITS)) | 81 | +(LZMA_NUM_LEN_TO_POS_STATES << LZMA_NUM_POS_SLOT_BITS)) |
82 | #define LZMA_ALIGN (LZMA_SPEC_POS \ | 82 | #define LZMA_ALIGN (LZMA_SPEC_POS \ |
83 | + LZMA_NUM_FULL_DISTANCES - LZMA_END_POS_MODEL_INDEX) | 83 | + LZMA_NUM_FULL_DISTANCES - LZMA_END_POS_MODEL_INDEX) |
84 | #define LZMA_LEN_CODER (LZMA_ALIGN + (1 << LZMA_NUM_ALIGN_BITS)) | 84 | #define LZMA_LEN_CODER (LZMA_ALIGN + (1 << LZMA_NUM_ALIGN_BITS)) |
85 | #define LZMA_REP_LEN_CODER (LZMA_LEN_CODER + LZMA_NUM_LEN_PROBS) | 85 | #define LZMA_REP_LEN_CODER (LZMA_LEN_CODER + LZMA_NUM_LEN_PROBS) |
86 | #define LZMA_LITERAL (LZMA_REP_LEN_CODER + LZMA_NUM_LEN_PROBS) | 86 | #define LZMA_LITERAL (LZMA_REP_LEN_CODER + LZMA_NUM_LEN_PROBS) |
diff --git a/archival/libunarchive/get_header_ar.c b/archival/libunarchive/get_header_ar.c index ebb6f8cbe..e3a71951f 100644 --- a/archival/libunarchive/get_header_ar.c +++ b/archival/libunarchive/get_header_ar.c | |||
@@ -26,15 +26,15 @@ extern char get_header_ar(archive_handle_t *archive_handle) | |||
26 | file_header_t *typed = archive_handle->file_header; | 26 | file_header_t *typed = archive_handle->file_header; |
27 | union { | 27 | union { |
28 | char raw[60]; | 28 | char raw[60]; |
29 | struct { | 29 | struct { |
30 | char name[16]; | 30 | char name[16]; |
31 | char date[12]; | 31 | char date[12]; |
32 | char uid[6]; | 32 | char uid[6]; |
33 | char gid[6]; | 33 | char gid[6]; |
34 | char mode[8]; | 34 | char mode[8]; |
35 | char size[10]; | 35 | char size[10]; |
36 | char magic[2]; | 36 | char magic[2]; |
37 | } formated; | 37 | } formated; |
38 | } ar; | 38 | } ar; |
39 | #ifdef CONFIG_FEATURE_AR_LONG_FILENAMES | 39 | #ifdef CONFIG_FEATURE_AR_LONG_FILENAMES |
40 | static char *ar_long_names; | 40 | static char *ar_long_names; |
@@ -102,7 +102,7 @@ extern char get_header_ar(archive_handle_t *archive_handle) | |||
102 | #endif | 102 | #endif |
103 | } else { | 103 | } else { |
104 | /* short filenames */ | 104 | /* short filenames */ |
105 | typed->name = bb_xstrndup(ar.formated.name, 16); | 105 | typed->name = bb_xstrndup(ar.formated.name, 16); |
106 | } | 106 | } |
107 | 107 | ||
108 | typed->name[strcspn(typed->name, " /")] = '\0'; | 108 | typed->name[strcspn(typed->name, " /")] = '\0'; |
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c index 659b75d9b..26dfad55f 100644 --- a/archival/libunarchive/get_header_tar.c +++ b/archival/libunarchive/get_header_tar.c | |||
@@ -20,7 +20,7 @@ | |||
20 | * References: | 20 | * References: |
21 | * GNU tar and star man pages, | 21 | * GNU tar and star man pages, |
22 | * Opengroup's ustar interchange format, | 22 | * Opengroup's ustar interchange format, |
23 | * http://www.opengroup.org/onlinepubs/007904975/utilities/pax.html | 23 | * http://www.opengroup.org/onlinepubs/007904975/utilities/pax.html |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <stdio.h> | 26 | #include <stdio.h> |
diff --git a/archival/rpm.c b/archival/rpm.c index 32d506de0..a80f799a6 100644 --- a/archival/rpm.c +++ b/archival/rpm.c | |||
@@ -43,7 +43,7 @@ | |||
43 | #define RPM_STRING_ARRAY_TYPE 8 | 43 | #define RPM_STRING_ARRAY_TYPE 8 |
44 | #define RPM_I18NSTRING_TYPE 9 | 44 | #define RPM_I18NSTRING_TYPE 9 |
45 | 45 | ||
46 | #define RPMTAG_NAME 1000 | 46 | #define RPMTAG_NAME 1000 |
47 | #define RPMTAG_VERSION 1001 | 47 | #define RPMTAG_VERSION 1001 |
48 | #define RPMTAG_RELEASE 1002 | 48 | #define RPMTAG_RELEASE 1002 |
49 | #define RPMTAG_SUMMARY 1004 | 49 | #define RPMTAG_SUMMARY 1004 |
diff --git a/archival/tar.c b/archival/tar.c index a4b13b5de..ab4d1f266 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
@@ -91,7 +91,7 @@ struct HardLinkInfo { | |||
91 | struct TarBallInfo { | 91 | struct TarBallInfo { |
92 | char *fileName; /* File name of the tarball */ | 92 | char *fileName; /* File name of the tarball */ |
93 | int tarFd; /* Open-for-write file descriptor | 93 | int tarFd; /* Open-for-write file descriptor |
94 | for the tarball */ | 94 | for the tarball */ |
95 | struct stat statBuf; /* Stat info for the tarball, letting | 95 | struct stat statBuf; /* Stat info for the tarball, letting |
96 | us know the inode and device that the | 96 | us know the inode and device that the |
97 | tarball lives, so we can avoid trying | 97 | tarball lives, so we can avoid trying |
@@ -569,7 +569,7 @@ static char get_header_tar_Z(archive_handle_t *archive_handle) | |||
569 | 569 | ||
570 | /* do the decompression, and cleanup */ | 570 | /* do the decompression, and cleanup */ |
571 | if (bb_xread_char(archive_handle->src_fd) != 0x1f || | 571 | if (bb_xread_char(archive_handle->src_fd) != 0x1f || |
572 | bb_xread_char(archive_handle->src_fd) != 0x9d) | 572 | bb_xread_char(archive_handle->src_fd) != 0x9d) |
573 | { | 573 | { |
574 | bb_error_msg_and_die("Invalid magic"); | 574 | bb_error_msg_and_die("Invalid magic"); |
575 | } | 575 | } |
@@ -699,7 +699,7 @@ static const struct option tar_long_options[] = { | |||
699 | # ifdef CONFIG_FEATURE_TAR_COMPRESS | 699 | # ifdef CONFIG_FEATURE_TAR_COMPRESS |
700 | { "compress", 0, NULL, 'Z' }, | 700 | { "compress", 0, NULL, 'Z' }, |
701 | # endif | 701 | # endif |
702 | { 0, 0, 0, 0 } | 702 | { 0, 0, 0, 0 } |
703 | }; | 703 | }; |
704 | #else | 704 | #else |
705 | #define tar_long_options 0 | 705 | #define tar_long_options 0 |
@@ -713,7 +713,7 @@ int tar_main(int argc, char **argv) | |||
713 | const char *tar_filename = "-"; | 713 | const char *tar_filename = "-"; |
714 | unsigned long opt; | 714 | unsigned long opt; |
715 | llist_t *excludes = NULL; | 715 | llist_t *excludes = NULL; |
716 | 716 | ||
717 | /* Initialise default values */ | 717 | /* Initialise default values */ |
718 | tar_handle = init_handle(); | 718 | tar_handle = init_handle(); |
719 | tar_handle->flags = ARCHIVE_CREATE_LEADING_DIRS | ARCHIVE_PRESERVE_DATE | ARCHIVE_EXTRACT_UNCONDITIONAL; | 719 | tar_handle->flags = ARCHIVE_CREATE_LEADING_DIRS | ARCHIVE_PRESERVE_DATE | ARCHIVE_EXTRACT_UNCONDITIONAL; |
@@ -743,7 +743,7 @@ int tar_main(int argc, char **argv) | |||
743 | } | 743 | } |
744 | if((opt & CTX_EXTRACT) && tar_handle->action_data != data_extract_to_stdout) | 744 | if((opt & CTX_EXTRACT) && tar_handle->action_data != data_extract_to_stdout) |
745 | tar_handle->action_data = data_extract_all; | 745 | tar_handle->action_data = data_extract_all; |
746 | 746 | ||
747 | if (opt & TAR_OPT_2STDOUT) | 747 | if (opt & TAR_OPT_2STDOUT) |
748 | tar_handle->action_data = data_extract_to_stdout; | 748 | tar_handle->action_data = data_extract_to_stdout; |
749 | 749 | ||
@@ -843,9 +843,9 @@ int tar_main(int argc, char **argv) | |||
843 | int zipMode = 0; | 843 | int zipMode = 0; |
844 | 844 | ||
845 | if (ENABLE_FEATURE_TAR_GZIP && get_header_ptr == get_header_tar_gz) | 845 | if (ENABLE_FEATURE_TAR_GZIP && get_header_ptr == get_header_tar_gz) |
846 | zipMode = 1; | 846 | zipMode = 1; |
847 | if (ENABLE_FEATURE_TAR_BZIP2 && get_header_ptr == get_header_tar_bz2) | 847 | if (ENABLE_FEATURE_TAR_BZIP2 && get_header_ptr == get_header_tar_bz2) |
848 | zipMode = 2; | 848 | zipMode = 2; |
849 | 849 | ||
850 | if ((tar_handle->action_header == header_list) || | 850 | if ((tar_handle->action_header == header_list) || |
851 | (tar_handle->action_header == header_verbose_list)) | 851 | (tar_handle->action_header == header_verbose_list)) |
diff --git a/archival/unzip.c b/archival/unzip.c index caac716cc..f602db12d 100644 --- a/archival/unzip.c +++ b/archival/unzip.c | |||
@@ -66,8 +66,8 @@ typedef union { | |||
66 | unsigned short method; /* 4-5 */ | 66 | unsigned short method; /* 4-5 */ |
67 | unsigned short modtime; /* 6-7 */ | 67 | unsigned short modtime; /* 6-7 */ |
68 | unsigned short moddate; /* 8-9 */ | 68 | unsigned short moddate; /* 8-9 */ |
69 | unsigned int crc32 ATTRIBUTE_PACKED; /* 10-13 */ | 69 | unsigned int crc32 ATTRIBUTE_PACKED; /* 10-13 */ |
70 | unsigned int cmpsize ATTRIBUTE_PACKED; /* 14-17 */ | 70 | unsigned int cmpsize ATTRIBUTE_PACKED; /* 14-17 */ |
71 | unsigned int ucmpsize ATTRIBUTE_PACKED; /* 18-21 */ | 71 | unsigned int ucmpsize ATTRIBUTE_PACKED; /* 18-21 */ |
72 | unsigned short filename_len; /* 22-23 */ | 72 | unsigned short filename_len; /* 22-23 */ |
73 | unsigned short extra_len; /* 24-25 */ | 73 | unsigned short extra_len; /* 24-25 */ |
diff --git a/console-tools/openvt.c b/console-tools/openvt.c index d9f49bbea..6bdf608c7 100644 --- a/console-tools/openvt.c +++ b/console-tools/openvt.c | |||
@@ -39,7 +39,7 @@ int openvt_main(int argc, char **argv) | |||
39 | 39 | ||
40 | 40 | ||
41 | if (argc < 3) | 41 | if (argc < 3) |
42 | bb_show_usage(); | 42 | bb_show_usage(); |
43 | 43 | ||
44 | /* check for Illegal vt number: < 1 or > 12 */ | 44 | /* check for Illegal vt number: < 1 or > 12 */ |
45 | sprintf(vtname, VC_FORMAT,(int)bb_xgetlarg(argv[1], 10, 1, 12)); | 45 | sprintf(vtname, VC_FORMAT,(int)bb_xgetlarg(argv[1], 10, 1, 12)); |
@@ -56,7 +56,7 @@ int openvt_main(int argc, char **argv) | |||
56 | if (setsid() < 0) { | 56 | if (setsid() < 0) { |
57 | #endif | 57 | #endif |
58 | 58 | ||
59 | bb_perror_msg_and_die("Unable to set new session"); | 59 | bb_perror_msg_and_die("Unable to set new session"); |
60 | } | 60 | } |
61 | close(0); /* so that new vt becomes stdin */ | 61 | close(0); /* so that new vt becomes stdin */ |
62 | 62 | ||
diff --git a/console-tools/setkeycodes.c b/console-tools/setkeycodes.c index 169d0bb0a..efb6e658f 100644 --- a/console-tools/setkeycodes.c +++ b/console-tools/setkeycodes.c | |||
@@ -45,7 +45,7 @@ setkeycodes_main(int argc, char** argv) | |||
45 | if (argc % 2 != 1 || argc < 2) { | 45 | if (argc % 2 != 1 || argc < 2) { |
46 | bb_show_usage(); | 46 | bb_show_usage(); |
47 | } | 47 | } |
48 | 48 | ||
49 | fd = get_console_fd(); | 49 | fd = get_console_fd(); |
50 | 50 | ||
51 | while (argc > 2) { | 51 | while (argc > 2) { |
diff --git a/coreutils/Config.in b/coreutils/Config.in index 3b742dc6c..29f73adea 100644 --- a/coreutils/Config.in +++ b/coreutils/Config.in | |||
@@ -457,8 +457,8 @@ config CONFIG_FEATURE_STAT_FORMAT | |||
457 | default n | 457 | default n |
458 | depends on CONFIG_STAT | 458 | depends on CONFIG_STAT |
459 | help | 459 | help |
460 | Without this, stat will not support the '-c format' option where | 460 | Without this, stat will not support the '-c format' option where |
461 | users can pass a custom format string for output. This adds about | 461 | users can pass a custom format string for output. This adds about |
462 | 7k to a nonstatic build on amd64. | 462 | 7k to a nonstatic build on amd64. |
463 | 463 | ||
464 | config CONFIG_STTY | 464 | config CONFIG_STTY |
diff --git a/coreutils/cal.c b/coreutils/cal.c index 93c5692d0..9368dccf9 100644 --- a/coreutils/cal.c +++ b/coreutils/cal.c | |||
@@ -45,10 +45,10 @@ | |||
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | #define THURSDAY 4 /* for reformation */ | 47 | #define THURSDAY 4 /* for reformation */ |
48 | #define SATURDAY 6 /* 1 Jan 1 was a Saturday */ | 48 | #define SATURDAY 6 /* 1 Jan 1 was a Saturday */ |
49 | 49 | ||
50 | #define FIRST_MISSING_DAY 639787 /* 3 Sep 1752 */ | 50 | #define FIRST_MISSING_DAY 639787 /* 3 Sep 1752 */ |
51 | #define NUMBER_MISSING_DAYS 11 /* 11 day correction */ | 51 | #define NUMBER_MISSING_DAYS 11 /* 11 day correction */ |
52 | 52 | ||
53 | #define MAXDAYS 42 /* max slots in a month array */ | 53 | #define MAXDAYS 42 /* max slots in a month array */ |
54 | #define SPACE -1 /* used in day array */ | 54 | #define SPACE -1 /* used in day array */ |
diff --git a/coreutils/date.c b/coreutils/date.c index e9ec51044..2d411ab31 100644 --- a/coreutils/date.c +++ b/coreutils/date.c | |||
@@ -91,23 +91,23 @@ static struct tm *date_conv_ftime(struct tm *tm_time, const char *t_string) | |||
91 | &t.tm_min) == 2) { | 91 | &t.tm_min) == 2) { |
92 | /* no adjustments needed */ | 92 | /* no adjustments needed */ |
93 | } else if (t = *tm_time, sscanf(t_string, "%d.%d-%d:%d:%d", &t.tm_mon, | 93 | } else if (t = *tm_time, sscanf(t_string, "%d.%d-%d:%d:%d", &t.tm_mon, |
94 | &t.tm_mday, &t.tm_hour, | 94 | &t.tm_mday, &t.tm_hour, |
95 | &t.tm_min, &t.tm_sec) == 5) { | 95 | &t.tm_min, &t.tm_sec) == 5) { |
96 | /* Adjust dates from 1-12 to 0-11 */ | 96 | /* Adjust dates from 1-12 to 0-11 */ |
97 | t.tm_mon -= 1; | 97 | t.tm_mon -= 1; |
98 | } else if (t = *tm_time, sscanf(t_string, "%d.%d-%d:%d", &t.tm_mon, | 98 | } else if (t = *tm_time, sscanf(t_string, "%d.%d-%d:%d", &t.tm_mon, |
99 | &t.tm_mday, | 99 | &t.tm_mday, |
100 | &t.tm_hour, &t.tm_min) == 4) { | 100 | &t.tm_hour, &t.tm_min) == 4) { |
101 | /* Adjust dates from 1-12 to 0-11 */ | 101 | /* Adjust dates from 1-12 to 0-11 */ |
102 | t.tm_mon -= 1; | 102 | t.tm_mon -= 1; |
103 | } else if (t = *tm_time, sscanf(t_string, "%d.%d.%d-%d:%d:%d", &t.tm_year, | 103 | } else if (t = *tm_time, sscanf(t_string, "%d.%d.%d-%d:%d:%d", &t.tm_year, |
104 | &t.tm_mon, &t.tm_mday, | 104 | &t.tm_mon, &t.tm_mday, |
105 | &t.tm_hour, &t.tm_min, | 105 | &t.tm_hour, &t.tm_min, |
106 | &t.tm_sec) == 6) { | 106 | &t.tm_sec) == 6) { |
107 | t.tm_year -= 1900; /* Adjust years */ | 107 | t.tm_year -= 1900; /* Adjust years */ |
108 | t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */ | 108 | t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */ |
109 | } else if (t = *tm_time, sscanf(t_string, "%d.%d.%d-%d:%d", &t.tm_year, | 109 | } else if (t = *tm_time, sscanf(t_string, "%d.%d.%d-%d:%d", &t.tm_year, |
110 | &t.tm_mon, &t.tm_mday, | 110 | &t.tm_mon, &t.tm_mday, |
111 | &t.tm_hour, &t.tm_min) == 5) { | 111 | &t.tm_hour, &t.tm_min) == 5) { |
112 | t.tm_year -= 1900; /* Adjust years */ | 112 | t.tm_year -= 1900; /* Adjust years */ |
113 | t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */ | 113 | t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */ |
@@ -119,9 +119,9 @@ static struct tm *date_conv_ftime(struct tm *tm_time, const char *t_string) | |||
119 | } | 119 | } |
120 | 120 | ||
121 | #define DATE_OPT_RFC2822 0x01 | 121 | #define DATE_OPT_RFC2822 0x01 |
122 | #define DATE_OPT_SET 0x02 | 122 | #define DATE_OPT_SET 0x02 |
123 | #define DATE_OPT_UTC 0x04 | 123 | #define DATE_OPT_UTC 0x04 |
124 | #define DATE_OPT_DATE 0x08 | 124 | #define DATE_OPT_DATE 0x08 |
125 | #define DATE_OPT_REFERENCE 0x10 | 125 | #define DATE_OPT_REFERENCE 0x10 |
126 | #ifdef CONFIG_FEATURE_DATE_ISOFMT | 126 | #ifdef CONFIG_FEATURE_DATE_ISOFMT |
127 | # define DATE_OPT_TIMESPEC 0x20 | 127 | # define DATE_OPT_TIMESPEC 0x20 |
diff --git a/coreutils/expr.c b/coreutils/expr.c index 969d9fff5..a243e75af 100644 --- a/coreutils/expr.c +++ b/coreutils/expr.c | |||
@@ -365,7 +365,7 @@ static VALUE *eval6 (void) | |||
365 | else { | 365 | else { |
366 | v = xmalloc (sizeof(VALUE)); | 366 | v = xmalloc (sizeof(VALUE)); |
367 | v->type = string; | 367 | v->type = string; |
368 | v->u.s = bb_xstrndup(l->u.s + i1->u.i - 1, i2->u.i); | 368 | v->u.s = bb_xstrndup(l->u.s + i1->u.i - 1, i2->u.i); |
369 | } | 369 | } |
370 | freev (l); | 370 | freev (l); |
371 | freev (i1); | 371 | freev (i1); |
diff --git a/coreutils/install.c b/coreutils/install.c index a4a96151d..c3d4f8c82 100644 --- a/coreutils/install.c +++ b/coreutils/install.c | |||
@@ -44,7 +44,7 @@ static const struct option install_long_options[] = { | |||
44 | { "preserve-timestamps", 0, NULL, 'p' }, | 44 | { "preserve-timestamps", 0, NULL, 'p' }, |
45 | { "strip", 0, NULL, 's' }, | 45 | { "strip", 0, NULL, 's' }, |
46 | { "group", 0, NULL, 'g' }, | 46 | { "group", 0, NULL, 'g' }, |
47 | { "mode", 0, NULL, 'm' }, | 47 | { "mode", 0, NULL, 'm' }, |
48 | { "owner", 0, NULL, 'o' }, | 48 | { "owner", 0, NULL, 'o' }, |
49 | { 0, 0, 0, 0 } | 49 | { 0, 0, 0, 0 } |
50 | }; | 50 | }; |
diff --git a/coreutils/libcoreutils/getopt_mk_fifo_nod.c b/coreutils/libcoreutils/getopt_mk_fifo_nod.c index 7e54fed3e..090fefaee 100644 --- a/coreutils/libcoreutils/getopt_mk_fifo_nod.c +++ b/coreutils/libcoreutils/getopt_mk_fifo_nod.c | |||
@@ -33,7 +33,7 @@ extern mode_t getopt_mk_fifo_nod(int argc, char **argv) | |||
33 | 33 | ||
34 | bb_getopt_ulflags(argc, argv, "m:", &smode); | 34 | bb_getopt_ulflags(argc, argv, "m:", &smode); |
35 | if(smode) { | 35 | if(smode) { |
36 | if (bb_parse_mode(smode, &mode)) | 36 | if (bb_parse_mode(smode, &mode)) |
37 | umask(0); | 37 | umask(0); |
38 | } | 38 | } |
39 | return mode; | 39 | return mode; |
diff --git a/coreutils/ls.c b/coreutils/ls.c index 5042c1298..46ab865dd 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -173,7 +173,7 @@ static int show_color = 0; | |||
173 | static const struct option ls_color_opt[] = | 173 | static const struct option ls_color_opt[] = |
174 | { | 174 | { |
175 | {"color", optional_argument, NULL, 1}, | 175 | {"color", optional_argument, NULL, 1}, |
176 | {NULL, 0, NULL, 0} | 176 | {NULL, 0, NULL, 0} |
177 | }; | 177 | }; |
178 | 178 | ||
179 | #define COLOR(mode) ("\000\043\043\043\042\000\043\043"\ | 179 | #define COLOR(mode) ("\000\043\043\043\042\000\043\043"\ |
@@ -318,7 +318,7 @@ static int count_dirs(struct dnode **dn, int nfiles, int notsubdirs) | |||
318 | dirs = 0; | 318 | dirs = 0; |
319 | for (i = 0; i < nfiles; i++) { | 319 | for (i = 0; i < nfiles; i++) { |
320 | if (S_ISDIR(dn[i]->dstat.st_mode) | 320 | if (S_ISDIR(dn[i]->dstat.st_mode) |
321 | && (notsubdirs || | 321 | && (notsubdirs || |
322 | ((dn[i]->name[0] != '.') || (dn[i]->name[1] | 322 | ((dn[i]->name[0] != '.') || (dn[i]->name[1] |
323 | && ((dn[i]->name[1] != '.') | 323 | && ((dn[i]->name[1] != '.') |
324 | || dn[i]->name[2]))))) | 324 | || dn[i]->name[2]))))) |
@@ -747,7 +747,7 @@ static int list_single(struct dnode *dn) | |||
747 | { | 747 | { |
748 | char context[80]; | 748 | char context[80]; |
749 | int len; | 749 | int len; |
750 | 750 | ||
751 | if (dn->sid) { | 751 | if (dn->sid) { |
752 | /* I assume sid initilized with NULL */ | 752 | /* I assume sid initilized with NULL */ |
753 | len = strlen(dn->sid)+1; | 753 | len = strlen(dn->sid)+1; |
@@ -895,57 +895,57 @@ static const char ls_options[]="Cadil1gnsxAk" \ | |||
895 | 895 | ||
896 | static const unsigned opt_flags[] = { | 896 | static const unsigned opt_flags[] = { |
897 | LIST_SHORT | STYLE_COLUMNS, /* C */ | 897 | LIST_SHORT | STYLE_COLUMNS, /* C */ |
898 | DISP_HIDDEN | DISP_DOT, /* a */ | 898 | DISP_HIDDEN | DISP_DOT, /* a */ |
899 | DISP_NOLIST, /* d */ | 899 | DISP_NOLIST, /* d */ |
900 | LIST_INO, /* i */ | 900 | LIST_INO, /* i */ |
901 | LIST_LONG | STYLE_LONG, /* l - remember LS_DISP_HR in mask! */ | 901 | LIST_LONG | STYLE_LONG, /* l - remember LS_DISP_HR in mask! */ |
902 | LIST_SHORT | STYLE_SINGLE, /* 1 */ | 902 | LIST_SHORT | STYLE_SINGLE, /* 1 */ |
903 | 0, /* g - ingored */ | 903 | 0, /* g - ingored */ |
904 | LIST_ID_NUMERIC, /* n */ | 904 | LIST_ID_NUMERIC, /* n */ |
905 | LIST_BLOCKS, /* s */ | 905 | LIST_BLOCKS, /* s */ |
906 | DISP_ROWS, /* x */ | 906 | DISP_ROWS, /* x */ |
907 | DISP_HIDDEN, /* A */ | 907 | DISP_HIDDEN, /* A */ |
908 | #ifdef CONFIG_SELINUX | 908 | #ifdef CONFIG_SELINUX |
909 | LIST_CONTEXT, /* k */ | 909 | LIST_CONTEXT, /* k */ |
910 | #else | 910 | #else |
911 | 0, /* k - ingored */ | 911 | 0, /* k - ingored */ |
912 | #endif | 912 | #endif |
913 | #ifdef CONFIG_FEATURE_LS_TIMESTAMPS | 913 | #ifdef CONFIG_FEATURE_LS_TIMESTAMPS |
914 | # ifdef CONFIG_FEATURE_LS_SORTFILES | 914 | # ifdef CONFIG_FEATURE_LS_SORTFILES |
915 | TIME_CHANGE | SORT_CTIME, /* c */ | 915 | TIME_CHANGE | SORT_CTIME, /* c */ |
916 | # else | 916 | # else |
917 | TIME_CHANGE, /* c */ | 917 | TIME_CHANGE, /* c */ |
918 | # endif | 918 | # endif |
919 | LIST_FULLTIME, /* e */ | 919 | LIST_FULLTIME, /* e */ |
920 | # ifdef CONFIG_FEATURE_LS_SORTFILES | 920 | # ifdef CONFIG_FEATURE_LS_SORTFILES |
921 | SORT_MTIME, /* t */ | 921 | SORT_MTIME, /* t */ |
922 | # else | 922 | # else |
923 | 0, /* t - ignored -- is this correct? */ | 923 | 0, /* t - ignored -- is this correct? */ |
924 | # endif | 924 | # endif |
925 | # ifdef CONFIG_FEATURE_LS_SORTFILES | 925 | # ifdef CONFIG_FEATURE_LS_SORTFILES |
926 | TIME_ACCESS | SORT_ATIME, /* u */ | 926 | TIME_ACCESS | SORT_ATIME, /* u */ |
927 | # else | 927 | # else |
928 | TIME_ACCESS, /* u */ | 928 | TIME_ACCESS, /* u */ |
929 | # endif | 929 | # endif |
930 | #endif | 930 | #endif |
931 | #ifdef CONFIG_FEATURE_LS_SORTFILES | 931 | #ifdef CONFIG_FEATURE_LS_SORTFILES |
932 | SORT_SIZE, /* S */ | 932 | SORT_SIZE, /* S */ |
933 | SORT_EXT, /* X */ | 933 | SORT_EXT, /* X */ |
934 | SORT_ORDER_REVERSE, /* r */ | 934 | SORT_ORDER_REVERSE, /* r */ |
935 | SORT_VERSION, /* v */ | 935 | SORT_VERSION, /* v */ |
936 | #endif | 936 | #endif |
937 | #ifdef CONFIG_FEATURE_LS_FILETYPES | 937 | #ifdef CONFIG_FEATURE_LS_FILETYPES |
938 | LIST_FILETYPE | LIST_EXEC, /* F */ | 938 | LIST_FILETYPE | LIST_EXEC, /* F */ |
939 | LIST_FILETYPE, /* p */ | 939 | LIST_FILETYPE, /* p */ |
940 | #endif | 940 | #endif |
941 | #ifdef CONFIG_FEATURE_LS_FOLLOWLINKS | 941 | #ifdef CONFIG_FEATURE_LS_FOLLOWLINKS |
942 | FOLLOW_LINKS, /* L */ | 942 | FOLLOW_LINKS, /* L */ |
943 | #endif | 943 | #endif |
944 | #ifdef CONFIG_FEATURE_LS_RECURSIVE | 944 | #ifdef CONFIG_FEATURE_LS_RECURSIVE |
945 | DISP_RECURSIVE, /* R */ | 945 | DISP_RECURSIVE, /* R */ |
946 | #endif | 946 | #endif |
947 | #ifdef CONFIG_FEATURE_HUMAN_READABLE | 947 | #ifdef CONFIG_FEATURE_HUMAN_READABLE |
948 | LS_DISP_HR, /* h */ | 948 | LS_DISP_HR, /* h */ |
949 | #endif | 949 | #endif |
950 | #ifdef CONFIG_SELINUX | 950 | #ifdef CONFIG_SELINUX |
951 | LIST_MODEBITS|LIST_NLINKS|LIST_CONTEXT|LIST_SIZE|LIST_DATE_TIME, /* K */ | 951 | LIST_MODEBITS|LIST_NLINKS|LIST_CONTEXT|LIST_SIZE|LIST_DATE_TIME, /* K */ |
@@ -1025,7 +1025,7 @@ extern int ls_main(int argc, char **argv) | |||
1025 | for (i = 0; opt_flags[i] != (1U<<31); i++) { | 1025 | for (i = 0; opt_flags[i] != (1U<<31); i++) { |
1026 | if (opt & (1 << i)) { | 1026 | if (opt & (1 << i)) { |
1027 | unsigned int flags = opt_flags[i]; | 1027 | unsigned int flags = opt_flags[i]; |
1028 | 1028 | ||
1029 | if (flags & LIST_MASK_TRIGGER) { | 1029 | if (flags & LIST_MASK_TRIGGER) { |
1030 | all_fmt &= ~LIST_MASK; | 1030 | all_fmt &= ~LIST_MASK; |
1031 | } | 1031 | } |
@@ -1064,11 +1064,11 @@ extern int ls_main(int argc, char **argv) | |||
1064 | #if CONFIG_FEATURE_LS_COLOR_IS_DEFAULT | 1064 | #if CONFIG_FEATURE_LS_COLOR_IS_DEFAULT |
1065 | char *p; | 1065 | char *p; |
1066 | 1066 | ||
1067 | if ((p = getenv ("LS_COLORS")) != NULL && | 1067 | if ((p = getenv ("LS_COLORS")) != NULL && |
1068 | (*p == '\0' || (strcmp(p, "none") == 0))) { | 1068 | (*p == '\0' || (strcmp(p, "none") == 0))) { |
1069 | ; | 1069 | ; |
1070 | } else if (isatty(STDOUT_FILENO)) { | 1070 | } else if (isatty(STDOUT_FILENO)) { |
1071 | show_color = 1; | 1071 | show_color = 1; |
1072 | } | 1072 | } |
1073 | #endif | 1073 | #endif |
1074 | 1074 | ||
diff --git a/coreutils/nice.c b/coreutils/nice.c index b66f9d82d..449184dab 100644 --- a/coreutils/nice.c +++ b/coreutils/nice.c | |||
@@ -77,7 +77,7 @@ int nice_main(int argc, char **argv) | |||
77 | bb_perror_msg_and_die(Xetpriority_msg, 's'); | 77 | bb_perror_msg_and_die(Xetpriority_msg, 's'); |
78 | } | 78 | } |
79 | } | 79 | } |
80 | 80 | ||
81 | execvp(*argv, argv); /* Now exec the desired program. */ | 81 | execvp(*argv, argv); /* Now exec the desired program. */ |
82 | 82 | ||
83 | /* The exec failed... */ | 83 | /* The exec failed... */ |
diff --git a/coreutils/printf.c b/coreutils/printf.c index 697a1c055..1fe68afcb 100644 --- a/coreutils/printf.c +++ b/coreutils/printf.c | |||
@@ -63,12 +63,12 @@ void multiconvert(char *arg, void *result, converter convert) | |||
63 | } | 63 | } |
64 | if(convert(arg,result)) fprintf(stderr, "%s", arg); | 64 | if(convert(arg,result)) fprintf(stderr, "%s", arg); |
65 | } | 65 | } |
66 | 66 | ||
67 | static unsigned long xstrtoul(char *arg) | 67 | static unsigned long xstrtoul(char *arg) |
68 | { | 68 | { |
69 | unsigned long result; | 69 | unsigned long result; |
70 | 70 | ||
71 | multiconvert(arg,&result, (converter)safe_strtoul); | 71 | multiconvert(arg,&result, (converter)safe_strtoul); |
72 | return result; | 72 | return result; |
73 | } | 73 | } |
74 | 74 | ||
diff --git a/coreutils/rmdir.c b/coreutils/rmdir.c index a10e5bb4f..1d6b2cadb 100644 --- a/coreutils/rmdir.c +++ b/coreutils/rmdir.c | |||
@@ -59,7 +59,7 @@ extern int rmdir_main(int argc, char **argv) | |||
59 | /* Path is now just the parent component. Note that dirname | 59 | /* Path is now just the parent component. Note that dirname |
60 | * returns "." if there are no parents. We must distinguish | 60 | * returns "." if there are no parents. We must distinguish |
61 | * this from the case of the original path starting with '.'. | 61 | * this from the case of the original path starting with '.'. |
62 | */ | 62 | */ |
63 | if (do_dot || (*path != '.') || path[1]) { | 63 | if (do_dot || (*path != '.') || path[1]) { |
64 | continue; | 64 | continue; |
65 | } | 65 | } |
diff --git a/coreutils/sort.c b/coreutils/sort.c index ce51bc178..b56a5abb8 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c | |||
@@ -156,7 +156,7 @@ static int compare_keys(const void *xarg, const void *yarg) | |||
156 | 156 | ||
157 | #ifdef CONFIG_FEATURE_SORT_BIG | 157 | #ifdef CONFIG_FEATURE_SORT_BIG |
158 | struct sort_key *key; | 158 | struct sort_key *key; |
159 | 159 | ||
160 | for(key=key_list;!retval && key;key=key->next_key) { | 160 | for(key=key_list;!retval && key;key=key->next_key) { |
161 | flags=(key->flags) ? key->flags : global_flags; | 161 | flags=(key->flags) ? key->flags : global_flags; |
162 | /* Chop out and modify key chunks, handling -dfib */ | 162 | /* Chop out and modify key chunks, handling -dfib */ |
@@ -312,7 +312,7 @@ int sort_main(int argc, char **argv) | |||
312 | #ifdef CONFIG_FEATURE_SORT_BIG | 312 | #ifdef CONFIG_FEATURE_SORT_BIG |
313 | /* if no key, perform alphabetic sort */ | 313 | /* if no key, perform alphabetic sort */ |
314 | if(!key_list) add_key()->range[0]=1; | 314 | if(!key_list) add_key()->range[0]=1; |
315 | /* handle -c */ | 315 | /* handle -c */ |
316 | if(global_flags&FLAG_c) { | 316 | if(global_flags&FLAG_c) { |
317 | int j=(global_flags&FLAG_u) ? -1 : 0; | 317 | int j=(global_flags&FLAG_u) ? -1 : 0; |
318 | for(i=1;i<linecount;i++) | 318 | for(i=1;i<linecount;i++) |
diff --git a/coreutils/stat.c b/coreutils/stat.c index c17b4d5e8..44289fbaa 100644 --- a/coreutils/stat.c +++ b/coreutils/stat.c | |||
@@ -44,9 +44,9 @@ static long flags; | |||
44 | 44 | ||
45 | static char const *file_type(struct stat const *st) | 45 | static char const *file_type(struct stat const *st) |
46 | { | 46 | { |
47 | /* See POSIX 1003.1-2001 XCU Table 4-8 lines 17093-17107 | 47 | /* See POSIX 1003.1-2001 XCU Table 4-8 lines 17093-17107 |
48 | * for some of these formats. | 48 | * for some of these formats. |
49 | * To keep diagnostics grammatical in English, the | 49 | * To keep diagnostics grammatical in English, the |
50 | * returned string must start with a consonant. | 50 | * returned string must start with a consonant. |
51 | */ | 51 | */ |
52 | if (S_ISREG(st->st_mode)) return st->st_size == 0 ? "regular empty file" : "regular file"; | 52 | if (S_ISREG(st->st_mode)) return st->st_size == 0 ? "regular empty file" : "regular file"; |
@@ -131,8 +131,8 @@ static char const *human_fstype(long f_type) | |||
131 | 131 | ||
132 | #ifdef CONFIG_FEATURE_STAT_FORMAT | 132 | #ifdef CONFIG_FEATURE_STAT_FORMAT |
133 | /* print statfs info */ | 133 | /* print statfs info */ |
134 | static void print_statfs(char *pformat, size_t buf_len, char m, | 134 | static void print_statfs(char *pformat, size_t buf_len, char m, |
135 | char const *filename, void const *data) | 135 | char const *filename, void const *data) |
136 | { | 136 | { |
137 | struct statfs const *statfsbuf = data; | 137 | struct statfs const *statfsbuf = data; |
138 | 138 | ||
@@ -190,8 +190,8 @@ static void print_statfs(char *pformat, size_t buf_len, char m, | |||
190 | } | 190 | } |
191 | 191 | ||
192 | /* print stat info */ | 192 | /* print stat info */ |
193 | static void print_stat(char *pformat, size_t buf_len, char m, | 193 | static void print_stat(char *pformat, size_t buf_len, char m, |
194 | char const *filename, void const *data) | 194 | char const *filename, void const *data) |
195 | { | 195 | { |
196 | #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) | 196 | #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) |
197 | struct stat *statbuf = (struct stat *) data; | 197 | struct stat *statbuf = (struct stat *) data; |
@@ -326,9 +326,9 @@ static void print_stat(char *pformat, size_t buf_len, char m, | |||
326 | } | 326 | } |
327 | } | 327 | } |
328 | 328 | ||
329 | static void print_it(char const *masterformat, char const *filename, | 329 | static void print_it(char const *masterformat, char const *filename, |
330 | void (*print_func) (char *, size_t, char, char const *, void const *), | 330 | void (*print_func) (char *, size_t, char, char const *, void const *), |
331 | void const *data) | 331 | void const *data) |
332 | { | 332 | { |
333 | char *b; | 333 | char *b; |
334 | 334 | ||
diff --git a/coreutils/test.c b/coreutils/test.c index 3da2daecd..d7bd5a0de 100644 --- a/coreutils/test.c +++ b/coreutils/test.c | |||
@@ -4,14 +4,14 @@ | |||
4 | * | 4 | * |
5 | * Copyright (c) by a whole pile of folks: | 5 | * Copyright (c) by a whole pile of folks: |
6 | * | 6 | * |
7 | * test(1); version 7-like -- author Erik Baalbergen | 7 | * test(1); version 7-like -- author Erik Baalbergen |
8 | * modified by Eric Gisin to be used as built-in. | 8 | * modified by Eric Gisin to be used as built-in. |
9 | * modified by Arnold Robbins to add SVR3 compatibility | 9 | * modified by Arnold Robbins to add SVR3 compatibility |
10 | * (-x -c -b -p -u -g -k) plus Korn's -L -nt -ot -ef and new -S (socket). | 10 | * (-x -c -b -p -u -g -k) plus Korn's -L -nt -ot -ef and new -S (socket). |
11 | * modified by J.T. Conklin for NetBSD. | 11 | * modified by J.T. Conklin for NetBSD. |
12 | * modified by Herbert Xu to be used as built-in in ash. | 12 | * modified by Herbert Xu to be used as built-in in ash. |
13 | * modified by Erik Andersen <andersen@codepoet.org> to be used | 13 | * modified by Erik Andersen <andersen@codepoet.org> to be used |
14 | * in busybox. | 14 | * in busybox. |
15 | * | 15 | * |
16 | * This program is free software; you can redistribute it and/or modify | 16 | * This program is free software; you can redistribute it and/or modify |
17 | * it under the terms of the GNU General Public License as published by | 17 | * it under the terms of the GNU General Public License as published by |
@@ -28,7 +28,7 @@ | |||
28 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 28 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
29 | * | 29 | * |
30 | * Original copyright notice states: | 30 | * Original copyright notice states: |
31 | * "This program is in the Public Domain." | 31 | * "This program is in the Public Domain." |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <sys/types.h> | 34 | #include <sys/types.h> |
diff --git a/coreutils/uname.c b/coreutils/uname.c index a3e52e39f..f6dc0170f 100644 --- a/coreutils/uname.c +++ b/coreutils/uname.c | |||
@@ -93,7 +93,7 @@ int uname_main(int argc, char **argv) | |||
93 | } | 93 | } |
94 | 94 | ||
95 | #if defined(__sparc__) && defined(__linux__) | 95 | #if defined(__sparc__) && defined(__linux__) |
96 | if ((fake_sparc != NULL) | 96 | if ((fake_sparc != NULL) |
97 | && ((fake_sparc[0] == 'y') | 97 | && ((fake_sparc[0] == 'y') |
98 | || (fake_sparc[0] == 'Y'))) { | 98 | || (fake_sparc[0] == 'Y'))) { |
99 | strcpy(uname_info.name.machine, "sparc"); | 99 | strcpy(uname_info.name.machine, "sparc"); |
diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c index b4bcc72e2..da6490a81 100644 --- a/coreutils/uudecode.c +++ b/coreutils/uudecode.c | |||
@@ -56,7 +56,7 @@ static int read_stduu(FILE *src_stream, FILE *dst_stream) | |||
56 | bb_error_msg_and_die("Short file"); | 56 | bb_error_msg_and_die("Short file"); |
57 | } | 57 | } |
58 | 58 | ||
59 | while (length > 0) { | 59 | while (length > 0) { |
60 | /* Merge four 6 bit chars to three 8 bit chars */ | 60 | /* Merge four 6 bit chars to three 8 bit chars */ |
61 | fputc(((line_ptr[0] - 0x20) & 077) << 2 | ((line_ptr[1] - 0x20) & 077) >> 4, dst_stream); | 61 | fputc(((line_ptr[0] - 0x20) & 077) << 2 | ((line_ptr[1] - 0x20) & 077) >> 4, dst_stream); |
62 | line_ptr++; | 62 | line_ptr++; |
@@ -65,14 +65,14 @@ static int read_stduu(FILE *src_stream, FILE *dst_stream) | |||
65 | break; | 65 | break; |
66 | } | 66 | } |
67 | 67 | ||
68 | fputc(((line_ptr[0] - 0x20) & 077) << 4 | ((line_ptr[1] - 0x20) & 077) >> 2, dst_stream); | 68 | fputc(((line_ptr[0] - 0x20) & 077) << 4 | ((line_ptr[1] - 0x20) & 077) >> 2, dst_stream); |
69 | line_ptr++; | 69 | line_ptr++; |
70 | length--; | 70 | length--; |
71 | if (length == 0) { | 71 | if (length == 0) { |
72 | break; | 72 | break; |
73 | } | 73 | } |
74 | 74 | ||
75 | fputc(((line_ptr[0] - 0x20) & 077) << 6 | ((line_ptr[1] - 0x20) & 077), dst_stream); | 75 | fputc(((line_ptr[0] - 0x20) & 077) << 6 | ((line_ptr[1] - 0x20) & 077), dst_stream); |
76 | line_ptr += 2; | 76 | line_ptr += 2; |
77 | length -= 2; | 77 | length -= 2; |
78 | } | 78 | } |
@@ -130,10 +130,10 @@ static int read_base64(FILE *src_stream, FILE *dst_stream) | |||
130 | /* Merge 6 bit chars to 8 bit */ | 130 | /* Merge 6 bit chars to 8 bit */ |
131 | fputc(translated[0] << 2 | translated[1] >> 4, dst_stream); | 131 | fputc(translated[0] << 2 | translated[1] >> 4, dst_stream); |
132 | if (count > 2) { | 132 | if (count > 2) { |
133 | fputc(translated[1] << 4 | translated[2] >> 2, dst_stream); | 133 | fputc(translated[1] << 4 | translated[2] >> 2, dst_stream); |
134 | } | 134 | } |
135 | if (count > 3) { | 135 | if (count > 3) { |
136 | fputc(translated[2] << 6 | translated[3], dst_stream); | 136 | fputc(translated[2] << 6 | translated[3], dst_stream); |
137 | } | 137 | } |
138 | } | 138 | } |
139 | } | 139 | } |
diff --git a/coreutils/who.c b/coreutils/who.c index 0531326bd..e2ea227eb 100644 --- a/coreutils/who.c +++ b/coreutils/who.c | |||
@@ -33,49 +33,49 @@ extern int who_main(int argc, char **argv) | |||
33 | time_t now, idle; | 33 | time_t now, idle; |
34 | 34 | ||
35 | if (argc > 1) | 35 | if (argc > 1) |
36 | bb_show_usage(); | 36 | bb_show_usage(); |
37 | 37 | ||
38 | setutent(); | 38 | setutent(); |
39 | devlen = sizeof("/dev/") - 1; | 39 | devlen = sizeof("/dev/") - 1; |
40 | printf("USER TTY IDLE FROM HOST\n"); | 40 | printf("USER TTY IDLE FROM HOST\n"); |
41 | 41 | ||
42 | while ((ut = getutent()) != NULL) { | 42 | while ((ut = getutent()) != NULL) { |
43 | char name[40]; | 43 | char name[40]; |
44 | 44 | ||
45 | if (ut->ut_user[0] && ut->ut_type == USER_PROCESS) { | 45 | if (ut->ut_user[0] && ut->ut_type == USER_PROCESS) { |
46 | len = strlen(ut->ut_line); | 46 | len = strlen(ut->ut_line); |
47 | if (ut->ut_line[0] == '/') { | 47 | if (ut->ut_line[0] == '/') { |
48 | strncpy(name, ut->ut_line, len); | 48 | strncpy(name, ut->ut_line, len); |
49 | name[len] = '\0'; | 49 | name[len] = '\0'; |
50 | strcpy(ut->ut_line, ut->ut_line + devlen); | 50 | strcpy(ut->ut_line, ut->ut_line + devlen); |
51 | } else { | 51 | } else { |
52 | strcpy(name, "/dev/"); | 52 | strcpy(name, "/dev/"); |
53 | strncpy(name+devlen, ut->ut_line, len); | 53 | strncpy(name+devlen, ut->ut_line, len); |
54 | name[devlen+len] = '\0'; | 54 | name[devlen+len] = '\0'; |
55 | } | 55 | } |
56 | 56 | ||
57 | printf("%-10s %-8s ", ut->ut_user, ut->ut_line); | 57 | printf("%-10s %-8s ", ut->ut_user, ut->ut_line); |
58 | 58 | ||
59 | if (stat(name, &st) == 0) { | 59 | if (stat(name, &st) == 0) { |
60 | now = time(NULL); | 60 | now = time(NULL); |
61 | idle = now - st.st_atime; | 61 | idle = now - st.st_atime; |
62 | 62 | ||
63 | if (idle < 60) | 63 | if (idle < 60) |
64 | printf("00:00m "); | 64 | printf("00:00m "); |
65 | else if (idle < (60 * 60)) | 65 | else if (idle < (60 * 60)) |
66 | printf("00:%02dm ", (int)(idle / 60)); | 66 | printf("00:%02dm ", (int)(idle / 60)); |
67 | else if (idle < (24 * 60 * 60)) | 67 | else if (idle < (24 * 60 * 60)) |
68 | printf("%02d:%02dm ", (int)(idle / (60 * 60)), | 68 | printf("%02d:%02dm ", (int)(idle / (60 * 60)), |
69 | (int)(idle % (60 * 60)) / 60); | 69 | (int)(idle % (60 * 60)) / 60); |
70 | else if (idle < (24 * 60 * 60 * 365)) | 70 | else if (idle < (24 * 60 * 60 * 365)) |
71 | printf("%03ddays ", (int)(idle / (24 * 60 * 60))); | 71 | printf("%03ddays ", (int)(idle / (24 * 60 * 60))); |
72 | else | 72 | else |
73 | printf("%02dyears ", (int) (idle / (24 * 60 * 60 * 365))); | 73 | printf("%02dyears ", (int) (idle / (24 * 60 * 60 * 365))); |
74 | } else | 74 | } else |
75 | printf("%-8s ", "?"); | 75 | printf("%-8s ", "?"); |
76 | 76 | ||
77 | printf("%-12.12s %s\n", ctime((time_t*)&(ut->ut_tv.tv_sec)) + 4, ut->ut_host); | 77 | printf("%-12.12s %s\n", ctime((time_t*)&(ut->ut_tv.tv_sec)) + 4, ut->ut_host); |
78 | } | 78 | } |
79 | } | 79 | } |
80 | endutent(); | 80 | endutent(); |
81 | 81 | ||
diff --git a/debianutils/mktemp.c b/debianutils/mktemp.c index c0d3a365d..64b82815e 100644 --- a/debianutils/mktemp.c +++ b/debianutils/mktemp.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * Copyright (C) 2000 by Daniel Jacobowitz | 6 | * Copyright (C) 2000 by Daniel Jacobowitz |
7 | * Written by Daniel Jacobowitz <dan@debian.org> | 7 | * Written by Daniel Jacobowitz <dan@debian.org> |
8 | * | 8 | * |
9 | * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. | 9 | * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <stdio.h> | 12 | #include <stdio.h> |
@@ -19,7 +19,7 @@ | |||
19 | extern int mktemp_main(int argc, char **argv) | 19 | extern int mktemp_main(int argc, char **argv) |
20 | { | 20 | { |
21 | unsigned long flags = bb_getopt_ulflags(argc, argv, "dq"); | 21 | unsigned long flags = bb_getopt_ulflags(argc, argv, "dq"); |
22 | 22 | ||
23 | if (optind + 1 != argc) | 23 | if (optind + 1 != argc) |
24 | bb_show_usage(); | 24 | bb_show_usage(); |
25 | 25 | ||
diff --git a/debianutils/run_parts.c b/debianutils/run_parts.c index 90314354c..862db7a05 100644 --- a/debianutils/run_parts.c +++ b/debianutils/run_parts.c | |||
@@ -36,10 +36,10 @@ | |||
36 | * broken compatibility because the BusyBox policy doesn't allow them. | 36 | * broken compatibility because the BusyBox policy doesn't allow them. |
37 | * The supported options are: | 37 | * The supported options are: |
38 | * -t test. Print the name of the files to be executed, without | 38 | * -t test. Print the name of the files to be executed, without |
39 | * execute them. | 39 | * execute them. |
40 | * -a ARG argument. Pass ARG as an argument the program executed. It can | 40 | * -a ARG argument. Pass ARG as an argument the program executed. It can |
41 | * be repeated to pass multiple arguments. | 41 | * be repeated to pass multiple arguments. |
42 | * -u MASK umask. Set the umask of the program executed to MASK. */ | 42 | * -u MASK umask. Set the umask of the program executed to MASK. */ |
43 | 43 | ||
44 | /* TODO | 44 | /* TODO |
45 | * done - convert calls to error in perror... and remove error() | 45 | * done - convert calls to error in perror... and remove error() |
diff --git a/debianutils/start_stop_daemon.c b/debianutils/start_stop_daemon.c index 2ace0cc8b..aa1b3c7a0 100644 --- a/debianutils/start_stop_daemon.c +++ b/debianutils/start_stop_daemon.c | |||
@@ -238,7 +238,7 @@ start_stop_daemon_main(int argc, char **argv) | |||
238 | opt = bb_getopt_ulflags(argc, argv, "KSbqma:n:s:u:x:p:", | 238 | opt = bb_getopt_ulflags(argc, argv, "KSbqma:n:s:u:x:p:", |
239 | &startas, &cmdname, &signame, &userspec, &execname, &pidfile); | 239 | &startas, &cmdname, &signame, &userspec, &execname, &pidfile); |
240 | 240 | ||
241 | 241 | ||
242 | quiet = opt & SSD_OPT_QUIET; | 242 | quiet = opt & SSD_OPT_QUIET; |
243 | 243 | ||
244 | if (signame) { | 244 | if (signame) { |
diff --git a/e2fsprogs/Config.in b/e2fsprogs/Config.in index 225e5aaaf..91e873e3a 100644 --- a/e2fsprogs/Config.in +++ b/e2fsprogs/Config.in | |||
@@ -17,7 +17,7 @@ config CONFIG_E2FSCK | |||
17 | help | 17 | help |
18 | e2fsck is used to check Linux second extended file systems (ext2fs). | 18 | e2fsck is used to check Linux second extended file systems (ext2fs). |
19 | e2fsck also supports ext2 filesystems countaining a journal (ext3). | 19 | e2fsck also supports ext2 filesystems countaining a journal (ext3). |
20 | The normal compat symlinks 'fsck.ext2' and 'fsck.ext3' are also | 20 | The normal compat symlinks 'fsck.ext2' and 'fsck.ext3' are also |
21 | provided. | 21 | provided. |
22 | 22 | ||
23 | config CONFIG_FSCK | 23 | config CONFIG_FSCK |
@@ -25,7 +25,7 @@ config CONFIG_FSCK | |||
25 | default n | 25 | default n |
26 | help | 26 | help |
27 | fsck is used to check and optionally repair one or more filesystems. | 27 | fsck is used to check and optionally repair one or more filesystems. |
28 | In actuality, fsck is simply a front-end for the various file system | 28 | In actuality, fsck is simply a front-end for the various file system |
29 | checkers (fsck.fstype) available under Linux. | 29 | checkers (fsck.fstype) available under Linux. |
30 | 30 | ||
31 | config CONFIG_LSATTR | 31 | config CONFIG_LSATTR |
@@ -38,14 +38,14 @@ config CONFIG_MKE2FS | |||
38 | bool "mke2fs" | 38 | bool "mke2fs" |
39 | default n | 39 | default n |
40 | help | 40 | help |
41 | mke2fs is used to create an ext2/ext3 filesystem. The normal compat | 41 | mke2fs is used to create an ext2/ext3 filesystem. The normal compat |
42 | symlinks 'mkfs.ext2' and 'mkfs.ext3' are also provided. | 42 | symlinks 'mkfs.ext2' and 'mkfs.ext3' are also provided. |
43 | 43 | ||
44 | config CONFIG_TUNE2FS | 44 | config CONFIG_TUNE2FS |
45 | bool "tune2fs" | 45 | bool "tune2fs" |
46 | default n | 46 | default n |
47 | help | 47 | help |
48 | tune2fs allows the system administrator to adjust various tunable | 48 | tune2fs allows the system administrator to adjust various tunable |
49 | filesystem parameters on Linux ext2/ext3 filesystems. | 49 | filesystem parameters on Linux ext2/ext3 filesystems. |
50 | 50 | ||
51 | config CONFIG_E2LABEL | 51 | config CONFIG_E2LABEL |
@@ -53,7 +53,7 @@ config CONFIG_E2LABEL | |||
53 | default n | 53 | default n |
54 | depends on CONFIG_TUNE2FS | 54 | depends on CONFIG_TUNE2FS |
55 | help | 55 | help |
56 | e2label will display or change the filesystem label on the ext2 | 56 | e2label will display or change the filesystem label on the ext2 |
57 | filesystem located on device. | 57 | filesystem located on device. |
58 | 58 | ||
59 | config CONFIG_FINDFS | 59 | config CONFIG_FINDFS |
@@ -61,7 +61,7 @@ config CONFIG_FINDFS | |||
61 | default n | 61 | default n |
62 | depends on CONFIG_TUNE2FS | 62 | depends on CONFIG_TUNE2FS |
63 | help | 63 | help |
64 | findfs will search the disks in the system looking for a filesystem | 64 | findfs will search the disks in the system looking for a filesystem |
65 | which has a label matching label or a UUID equal to uuid. | 65 | which has a label matching label or a UUID equal to uuid. |
66 | 66 | ||
67 | endmenu | 67 | endmenu |
diff --git a/e2fsprogs/blkid/blkid.h b/e2fsprogs/blkid/blkid.h index 3ea94ac80..3bb0e78d8 100644 --- a/e2fsprogs/blkid/blkid.h +++ b/e2fsprogs/blkid/blkid.h | |||
@@ -34,13 +34,13 @@ typedef struct blkid_struct_dev_iterate *blkid_dev_iterate; | |||
34 | * Flags for blkid_get_dev | 34 | * Flags for blkid_get_dev |
35 | * | 35 | * |
36 | * BLKID_DEV_CREATE Create an empty device structure if not found | 36 | * BLKID_DEV_CREATE Create an empty device structure if not found |
37 | * in the cache. | 37 | * in the cache. |
38 | * BLKID_DEV_VERIFY Make sure the device structure corresponds | 38 | * BLKID_DEV_VERIFY Make sure the device structure corresponds |
39 | * with reality. | 39 | * with reality. |
40 | * BLKID_DEV_FIND Just look up a device entry, and return NULL | 40 | * BLKID_DEV_FIND Just look up a device entry, and return NULL |
41 | * if it is not found. | 41 | * if it is not found. |
42 | * BLKID_DEV_NORMAL Get a valid device structure, either from the | 42 | * BLKID_DEV_NORMAL Get a valid device structure, either from the |
43 | * cache or by probing the device. | 43 | * cache or by probing the device. |
44 | */ | 44 | */ |
45 | #define BLKID_DEV_FIND 0x0000 | 45 | #define BLKID_DEV_FIND 0x0000 |
46 | #define BLKID_DEV_CREATE 0x0001 | 46 | #define BLKID_DEV_CREATE 0x0001 |
diff --git a/e2fsprogs/blkid/blkid_getsize.c b/e2fsprogs/blkid/blkid_getsize.c index 9458c08bf..58cc7352a 100644 --- a/e2fsprogs/blkid/blkid_getsize.c +++ b/e2fsprogs/blkid/blkid_getsize.c | |||
@@ -70,7 +70,7 @@ blkid_loff_t blkid_get_dev_size(int fd) | |||
70 | { | 70 | { |
71 | int valid_blkgetsize64 = 1; | 71 | int valid_blkgetsize64 = 1; |
72 | #ifdef __linux__ | 72 | #ifdef __linux__ |
73 | struct utsname ut; | 73 | struct utsname ut; |
74 | #endif | 74 | #endif |
75 | unsigned long long size64; | 75 | unsigned long long size64; |
76 | unsigned long size; | 76 | unsigned long size; |
diff --git a/e2fsprogs/blkid/cache.c b/e2fsprogs/blkid/cache.c index 0dd1b6286..87be1269f 100644 --- a/e2fsprogs/blkid/cache.c +++ b/e2fsprogs/blkid/cache.c | |||
@@ -47,9 +47,9 @@ int blkid_get_cache(blkid_cache *ret_cache, const char *filename) | |||
47 | if (!filename) | 47 | if (!filename) |
48 | filename = BLKID_CACHE_FILE; | 48 | filename = BLKID_CACHE_FILE; |
49 | cache->bic_filename = blkid_strdup(filename); | 49 | cache->bic_filename = blkid_strdup(filename); |
50 | 50 | ||
51 | blkid_read_cache(cache); | 51 | blkid_read_cache(cache); |
52 | 52 | ||
53 | *ret_cache = cache; | 53 | *ret_cache = cache; |
54 | return 0; | 54 | return 0; |
55 | } | 55 | } |
@@ -62,7 +62,7 @@ void blkid_put_cache(blkid_cache cache) | |||
62 | (void) blkid_flush_cache(cache); | 62 | (void) blkid_flush_cache(cache); |
63 | 63 | ||
64 | DBG(DEBUG_CACHE, printf("freeing cache struct\n")); | 64 | DBG(DEBUG_CACHE, printf("freeing cache struct\n")); |
65 | 65 | ||
66 | /* DEB_DUMP_CACHE(cache); */ | 66 | /* DEB_DUMP_CACHE(cache); */ |
67 | 67 | ||
68 | while (!list_empty(&cache->bic_devs)) { | 68 | while (!list_empty(&cache->bic_devs)) { |
@@ -79,7 +79,7 @@ void blkid_put_cache(blkid_cache cache) | |||
79 | 79 | ||
80 | while (!list_empty(&tag->bit_names)) { | 80 | while (!list_empty(&tag->bit_names)) { |
81 | blkid_tag bad = list_entry(tag->bit_names.next, | 81 | blkid_tag bad = list_entry(tag->bit_names.next, |
82 | struct blkid_struct_tag, | 82 | struct blkid_struct_tag, |
83 | bit_names); | 83 | bit_names); |
84 | 84 | ||
85 | DBG(DEBUG_CACHE, printf("warning: unfreed tag %s=%s\n", | 85 | DBG(DEBUG_CACHE, printf("warning: unfreed tag %s=%s\n", |
@@ -90,7 +90,7 @@ void blkid_put_cache(blkid_cache cache) | |||
90 | } | 90 | } |
91 | if (cache->bic_filename) | 91 | if (cache->bic_filename) |
92 | free(cache->bic_filename); | 92 | free(cache->bic_filename); |
93 | 93 | ||
94 | free(cache); | 94 | free(cache); |
95 | } | 95 | } |
96 | 96 | ||
diff --git a/e2fsprogs/blkid/dev.c b/e2fsprogs/blkid/dev.c index 0e2b4e1bc..d2e468304 100644 --- a/e2fsprogs/blkid/dev.c +++ b/e2fsprogs/blkid/dev.c | |||
@@ -73,7 +73,7 @@ extern const char *blkid_dev_devname(blkid_dev dev) | |||
73 | * This series of functions iterate over all devices in a blkid cache | 73 | * This series of functions iterate over all devices in a blkid cache |
74 | */ | 74 | */ |
75 | #define DEV_ITERATE_MAGIC 0x01a5284c | 75 | #define DEV_ITERATE_MAGIC 0x01a5284c |
76 | 76 | ||
77 | struct blkid_struct_dev_iterate { | 77 | struct blkid_struct_dev_iterate { |
78 | int magic; | 78 | int magic; |
79 | blkid_cache cache; | 79 | blkid_cache cache; |
diff --git a/e2fsprogs/blkid/devname.c b/e2fsprogs/blkid/devname.c index b5db29e30..1e016a55d 100644 --- a/e2fsprogs/blkid/devname.c +++ b/e2fsprogs/blkid/devname.c | |||
@@ -54,7 +54,7 @@ blkid_dev blkid_get_dev(blkid_cache cache, const char *devname, int flags) | |||
54 | if (strcmp(tmp->bid_name, devname)) | 54 | if (strcmp(tmp->bid_name, devname)) |
55 | continue; | 55 | continue; |
56 | 56 | ||
57 | DBG(DEBUG_DEVNAME, | 57 | DBG(DEBUG_DEVNAME, |
58 | printf("found devname %s in cache\n", tmp->bid_name)); | 58 | printf("found devname %s in cache\n", tmp->bid_name)); |
59 | dev = tmp; | 59 | dev = tmp; |
60 | break; | 60 | break; |
@@ -113,7 +113,7 @@ static void probe_one(blkid_cache cache, const char *ptname, | |||
113 | dev->bid_devno == devno) | 113 | dev->bid_devno == devno) |
114 | goto set_pri; | 114 | goto set_pri; |
115 | 115 | ||
116 | if (stat(device, &st) == 0 && S_ISBLK(st.st_mode) && | 116 | if (stat(device, &st) == 0 && S_ISBLK(st.st_mode) && |
117 | st.st_rdev == devno) { | 117 | st.st_rdev == devno) { |
118 | devname = blkid_strdup(device); | 118 | devname = blkid_strdup(device); |
119 | break; | 119 | break; |
diff --git a/e2fsprogs/blkid/devno.c b/e2fsprogs/blkid/devno.c index 93a57fd86..7d083e76f 100644 --- a/e2fsprogs/blkid/devno.c +++ b/e2fsprogs/blkid/devno.c | |||
@@ -171,13 +171,13 @@ char *blkid_devno_to_devname(dev_t devno) | |||
171 | 171 | ||
172 | if (!devname) { | 172 | if (!devname) { |
173 | DBG(DEBUG_DEVNO, | 173 | DBG(DEBUG_DEVNO, |
174 | printf("blkid: couldn't find devno 0x%04lx\n", | 174 | printf("blkid: couldn't find devno 0x%04lx\n", |
175 | (unsigned long) devno)); | 175 | (unsigned long) devno)); |
176 | } else { | 176 | } else { |
177 | DBG(DEBUG_DEVNO, | 177 | DBG(DEBUG_DEVNO, |
178 | printf("found devno 0x%04Lx as %s\n", devno, devname)); | 178 | printf("found devno 0x%04Lx as %s\n", devno, devname)); |
179 | } | 179 | } |
180 | 180 | ||
181 | 181 | ||
182 | return devname; | 182 | return devname; |
183 | } | 183 | } |
diff --git a/e2fsprogs/blkid/probe.c b/e2fsprogs/blkid/probe.c index cb21c1070..2aaa50885 100644 --- a/e2fsprogs/blkid/probe.c +++ b/e2fsprogs/blkid/probe.c | |||
@@ -41,7 +41,7 @@ static int check_mdraid(int fd, unsigned char *ret_uuid) | |||
41 | struct mdp_superblock_s *md; | 41 | struct mdp_superblock_s *md; |
42 | blkid_loff_t offset; | 42 | blkid_loff_t offset; |
43 | char buf[4096]; | 43 | char buf[4096]; |
44 | 44 | ||
45 | if (fd < 0) | 45 | if (fd < 0) |
46 | return -BLKID_ERR_PARAM; | 46 | return -BLKID_ERR_PARAM; |
47 | 47 | ||
@@ -83,7 +83,7 @@ static void get_ext2_info(blkid_dev dev, unsigned char *buf) | |||
83 | struct ext2_super_block *es = (struct ext2_super_block *) buf; | 83 | struct ext2_super_block *es = (struct ext2_super_block *) buf; |
84 | const char *label = 0; | 84 | const char *label = 0; |
85 | 85 | ||
86 | DBG(DEBUG_PROBE, printf("ext2_sb.compat = %08X:%08X:%08X\n", | 86 | DBG(DEBUG_PROBE, printf("ext2_sb.compat = %08X:%08X:%08X\n", |
87 | blkid_le32(es->s_feature_compat), | 87 | blkid_le32(es->s_feature_compat), |
88 | blkid_le32(es->s_feature_incompat), | 88 | blkid_le32(es->s_feature_incompat), |
89 | blkid_le32(es->s_feature_ro_compat))); | 89 | blkid_le32(es->s_feature_ro_compat))); |
@@ -95,8 +95,8 @@ static void get_ext2_info(blkid_dev dev, unsigned char *buf) | |||
95 | set_uuid(dev, es->s_uuid); | 95 | set_uuid(dev, es->s_uuid); |
96 | } | 96 | } |
97 | 97 | ||
98 | static int probe_ext3(int fd __BLKID_ATTR((unused)), | 98 | static int probe_ext3(int fd __BLKID_ATTR((unused)), |
99 | blkid_cache cache __BLKID_ATTR((unused)), | 99 | blkid_cache cache __BLKID_ATTR((unused)), |
100 | blkid_dev dev, | 100 | blkid_dev dev, |
101 | const struct blkid_magic *id, unsigned char *buf) | 101 | const struct blkid_magic *id, unsigned char *buf) |
102 | { | 102 | { |
@@ -105,7 +105,7 @@ static int probe_ext3(int fd __BLKID_ATTR((unused)), | |||
105 | es = (struct ext2_super_block *)buf; | 105 | es = (struct ext2_super_block *)buf; |
106 | 106 | ||
107 | /* Distinguish between jbd and ext2/3 fs */ | 107 | /* Distinguish between jbd and ext2/3 fs */ |
108 | if (blkid_le32(es->s_feature_incompat) & | 108 | if (blkid_le32(es->s_feature_incompat) & |
109 | EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) | 109 | EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) |
110 | return -BLKID_ERR_PARAM; | 110 | return -BLKID_ERR_PARAM; |
111 | 111 | ||
@@ -121,8 +121,8 @@ static int probe_ext3(int fd __BLKID_ATTR((unused)), | |||
121 | return 0; | 121 | return 0; |
122 | } | 122 | } |
123 | 123 | ||
124 | static int probe_ext2(int fd __BLKID_ATTR((unused)), | 124 | static int probe_ext2(int fd __BLKID_ATTR((unused)), |
125 | blkid_cache cache __BLKID_ATTR((unused)), | 125 | blkid_cache cache __BLKID_ATTR((unused)), |
126 | blkid_dev dev, | 126 | blkid_dev dev, |
127 | const struct blkid_magic *id, unsigned char *buf) | 127 | const struct blkid_magic *id, unsigned char *buf) |
128 | { | 128 | { |
@@ -132,7 +132,7 @@ static int probe_ext2(int fd __BLKID_ATTR((unused)), | |||
132 | es = (struct ext2_super_block *)buf; | 132 | es = (struct ext2_super_block *)buf; |
133 | 133 | ||
134 | /* Distinguish between jbd and ext2/3 fs */ | 134 | /* Distinguish between jbd and ext2/3 fs */ |
135 | if (blkid_le32(es->s_feature_incompat) & | 135 | if (blkid_le32(es->s_feature_incompat) & |
136 | EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) | 136 | EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) |
137 | return -BLKID_ERR_PARAM; | 137 | return -BLKID_ERR_PARAM; |
138 | 138 | ||
@@ -141,10 +141,10 @@ static int probe_ext2(int fd __BLKID_ATTR((unused)), | |||
141 | return 0; | 141 | return 0; |
142 | } | 142 | } |
143 | 143 | ||
144 | static int probe_jbd(int fd __BLKID_ATTR((unused)), | 144 | static int probe_jbd(int fd __BLKID_ATTR((unused)), |
145 | blkid_cache cache __BLKID_ATTR((unused)), | 145 | blkid_cache cache __BLKID_ATTR((unused)), |
146 | blkid_dev dev, | 146 | blkid_dev dev, |
147 | const struct blkid_magic *id __BLKID_ATTR((unused)), | 147 | const struct blkid_magic *id __BLKID_ATTR((unused)), |
148 | unsigned char *buf) | 148 | unsigned char *buf) |
149 | { | 149 | { |
150 | struct ext2_super_block *es = (struct ext2_super_block *) buf; | 150 | struct ext2_super_block *es = (struct ext2_super_block *) buf; |
@@ -158,10 +158,10 @@ static int probe_jbd(int fd __BLKID_ATTR((unused)), | |||
158 | return 0; | 158 | return 0; |
159 | } | 159 | } |
160 | 160 | ||
161 | static int probe_vfat(int fd __BLKID_ATTR((unused)), | 161 | static int probe_vfat(int fd __BLKID_ATTR((unused)), |
162 | blkid_cache cache __BLKID_ATTR((unused)), | 162 | blkid_cache cache __BLKID_ATTR((unused)), |
163 | blkid_dev dev, | 163 | blkid_dev dev, |
164 | const struct blkid_magic *id __BLKID_ATTR((unused)), | 164 | const struct blkid_magic *id __BLKID_ATTR((unused)), |
165 | unsigned char *buf) | 165 | unsigned char *buf) |
166 | { | 166 | { |
167 | struct vfat_super_block *vs; | 167 | struct vfat_super_block *vs; |
@@ -191,10 +191,10 @@ static int probe_vfat(int fd __BLKID_ATTR((unused)), | |||
191 | return 0; | 191 | return 0; |
192 | } | 192 | } |
193 | 193 | ||
194 | static int probe_msdos(int fd __BLKID_ATTR((unused)), | 194 | static int probe_msdos(int fd __BLKID_ATTR((unused)), |
195 | blkid_cache cache __BLKID_ATTR((unused)), | 195 | blkid_cache cache __BLKID_ATTR((unused)), |
196 | blkid_dev dev, | 196 | blkid_dev dev, |
197 | const struct blkid_magic *id __BLKID_ATTR((unused)), | 197 | const struct blkid_magic *id __BLKID_ATTR((unused)), |
198 | unsigned char *buf) | 198 | unsigned char *buf) |
199 | { | 199 | { |
200 | struct msdos_super_block *ms = (struct msdos_super_block *) buf; | 200 | struct msdos_super_block *ms = (struct msdos_super_block *) buf; |
@@ -223,10 +223,10 @@ static int probe_msdos(int fd __BLKID_ATTR((unused)), | |||
223 | return 0; | 223 | return 0; |
224 | } | 224 | } |
225 | 225 | ||
226 | static int probe_xfs(int fd __BLKID_ATTR((unused)), | 226 | static int probe_xfs(int fd __BLKID_ATTR((unused)), |
227 | blkid_cache cache __BLKID_ATTR((unused)), | 227 | blkid_cache cache __BLKID_ATTR((unused)), |
228 | blkid_dev dev, | 228 | blkid_dev dev, |
229 | const struct blkid_magic *id __BLKID_ATTR((unused)), | 229 | const struct blkid_magic *id __BLKID_ATTR((unused)), |
230 | unsigned char *buf) | 230 | unsigned char *buf) |
231 | { | 231 | { |
232 | struct xfs_super_block *xs; | 232 | struct xfs_super_block *xs; |
@@ -241,8 +241,8 @@ static int probe_xfs(int fd __BLKID_ATTR((unused)), | |||
241 | return 0; | 241 | return 0; |
242 | } | 242 | } |
243 | 243 | ||
244 | static int probe_reiserfs(int fd __BLKID_ATTR((unused)), | 244 | static int probe_reiserfs(int fd __BLKID_ATTR((unused)), |
245 | blkid_cache cache __BLKID_ATTR((unused)), | 245 | blkid_cache cache __BLKID_ATTR((unused)), |
246 | blkid_dev dev, | 246 | blkid_dev dev, |
247 | const struct blkid_magic *id, unsigned char *buf) | 247 | const struct blkid_magic *id, unsigned char *buf) |
248 | { | 248 | { |
@@ -268,10 +268,10 @@ static int probe_reiserfs(int fd __BLKID_ATTR((unused)), | |||
268 | return 0; | 268 | return 0; |
269 | } | 269 | } |
270 | 270 | ||
271 | static int probe_jfs(int fd __BLKID_ATTR((unused)), | 271 | static int probe_jfs(int fd __BLKID_ATTR((unused)), |
272 | blkid_cache cache __BLKID_ATTR((unused)), | 272 | blkid_cache cache __BLKID_ATTR((unused)), |
273 | blkid_dev dev, | 273 | blkid_dev dev, |
274 | const struct blkid_magic *id __BLKID_ATTR((unused)), | 274 | const struct blkid_magic *id __BLKID_ATTR((unused)), |
275 | unsigned char *buf) | 275 | unsigned char *buf) |
276 | { | 276 | { |
277 | struct jfs_super_block *js; | 277 | struct jfs_super_block *js; |
@@ -286,10 +286,10 @@ static int probe_jfs(int fd __BLKID_ATTR((unused)), | |||
286 | return 0; | 286 | return 0; |
287 | } | 287 | } |
288 | 288 | ||
289 | static int probe_romfs(int fd __BLKID_ATTR((unused)), | 289 | static int probe_romfs(int fd __BLKID_ATTR((unused)), |
290 | blkid_cache cache __BLKID_ATTR((unused)), | 290 | blkid_cache cache __BLKID_ATTR((unused)), |
291 | blkid_dev dev, | 291 | blkid_dev dev, |
292 | const struct blkid_magic *id __BLKID_ATTR((unused)), | 292 | const struct blkid_magic *id __BLKID_ATTR((unused)), |
293 | unsigned char *buf) | 293 | unsigned char *buf) |
294 | { | 294 | { |
295 | struct romfs_super_block *ros; | 295 | struct romfs_super_block *ros; |
@@ -340,7 +340,7 @@ static int probe_swap1(int fd, | |||
340 | /* arbitrary sanity check.. is there any garbage down there? */ | 340 | /* arbitrary sanity check.. is there any garbage down there? */ |
341 | if (sws->sws_pad[32] == 0 && sws->sws_pad[33] == 0) { | 341 | if (sws->sws_pad[32] == 0 && sws->sws_pad[33] == 0) { |
342 | if (sws->sws_volume[0]) | 342 | if (sws->sws_volume[0]) |
343 | blkid_set_tag(dev, "LABEL", sws->sws_volume, | 343 | blkid_set_tag(dev, "LABEL", sws->sws_volume, |
344 | sizeof(sws->sws_volume)); | 344 | sizeof(sws->sws_volume)); |
345 | if (sws->sws_uuid[0]) | 345 | if (sws->sws_uuid[0]) |
346 | set_uuid(dev, sws->sws_uuid); | 346 | set_uuid(dev, sws->sws_uuid); |
@@ -354,9 +354,9 @@ static const char | |||
354 | * const udf_magic[] = { "BEA01", "BOOT2", "CD001", "CDW02", "NSR02", | 354 | * const udf_magic[] = { "BEA01", "BOOT2", "CD001", "CDW02", "NSR02", |
355 | "NSR03", "TEA01", 0 }; | 355 | "NSR03", "TEA01", 0 }; |
356 | 356 | ||
357 | static int probe_udf(int fd, blkid_cache cache __BLKID_ATTR((unused)), | 357 | static int probe_udf(int fd, blkid_cache cache __BLKID_ATTR((unused)), |
358 | blkid_dev dev __BLKID_ATTR((unused)), | 358 | blkid_dev dev __BLKID_ATTR((unused)), |
359 | const struct blkid_magic *id __BLKID_ATTR((unused)), | 359 | const struct blkid_magic *id __BLKID_ATTR((unused)), |
360 | unsigned char *buf __BLKID_ATTR((unused))) | 360 | unsigned char *buf __BLKID_ATTR((unused))) |
361 | { | 361 | { |
362 | int j, bs; | 362 | int j, bs; |
@@ -396,10 +396,10 @@ static int probe_udf(int fd, blkid_cache cache __BLKID_ATTR((unused)), | |||
396 | return 1; | 396 | return 1; |
397 | } | 397 | } |
398 | 398 | ||
399 | static int probe_ocfs(int fd __BLKID_ATTR((unused)), | 399 | static int probe_ocfs(int fd __BLKID_ATTR((unused)), |
400 | blkid_cache cache __BLKID_ATTR((unused)), | 400 | blkid_cache cache __BLKID_ATTR((unused)), |
401 | blkid_dev dev, | 401 | blkid_dev dev, |
402 | const struct blkid_magic *id __BLKID_ATTR((unused)), | 402 | const struct blkid_magic *id __BLKID_ATTR((unused)), |
403 | unsigned char *buf) | 403 | unsigned char *buf) |
404 | { | 404 | { |
405 | struct ocfs_volume_header ovh; | 405 | struct ocfs_volume_header ovh; |
@@ -414,17 +414,17 @@ static int probe_ocfs(int fd __BLKID_ATTR((unused)), | |||
414 | blkid_set_tag(dev,"SEC_TYPE","ocfs1",sizeof("ocfs1")); | 414 | blkid_set_tag(dev,"SEC_TYPE","ocfs1",sizeof("ocfs1")); |
415 | else if (major >= 9) | 415 | else if (major >= 9) |
416 | blkid_set_tag(dev,"SEC_TYPE","ntocfs",sizeof("ntocfs")); | 416 | blkid_set_tag(dev,"SEC_TYPE","ntocfs",sizeof("ntocfs")); |
417 | 417 | ||
418 | blkid_set_tag(dev, "LABEL", ovl.label, ocfslabellen(ovl)); | 418 | blkid_set_tag(dev, "LABEL", ovl.label, ocfslabellen(ovl)); |
419 | blkid_set_tag(dev, "MOUNT", ovh.mount, ocfsmountlen(ovh)); | 419 | blkid_set_tag(dev, "MOUNT", ovh.mount, ocfsmountlen(ovh)); |
420 | set_uuid(dev, ovl.vol_id); | 420 | set_uuid(dev, ovl.vol_id); |
421 | return 0; | 421 | return 0; |
422 | } | 422 | } |
423 | 423 | ||
424 | static int probe_ocfs2(int fd __BLKID_ATTR((unused)), | 424 | static int probe_ocfs2(int fd __BLKID_ATTR((unused)), |
425 | blkid_cache cache __BLKID_ATTR((unused)), | 425 | blkid_cache cache __BLKID_ATTR((unused)), |
426 | blkid_dev dev, | 426 | blkid_dev dev, |
427 | const struct blkid_magic *id __BLKID_ATTR((unused)), | 427 | const struct blkid_magic *id __BLKID_ATTR((unused)), |
428 | unsigned char *buf) | 428 | unsigned char *buf) |
429 | { | 429 | { |
430 | struct ocfs2_super_block *osb; | 430 | struct ocfs2_super_block *osb; |
@@ -436,10 +436,10 @@ static int probe_ocfs2(int fd __BLKID_ATTR((unused)), | |||
436 | return 0; | 436 | return 0; |
437 | } | 437 | } |
438 | 438 | ||
439 | static int probe_oracleasm(int fd __BLKID_ATTR((unused)), | 439 | static int probe_oracleasm(int fd __BLKID_ATTR((unused)), |
440 | blkid_cache cache __BLKID_ATTR((unused)), | 440 | blkid_cache cache __BLKID_ATTR((unused)), |
441 | blkid_dev dev, | 441 | blkid_dev dev, |
442 | const struct blkid_magic *id __BLKID_ATTR((unused)), | 442 | const struct blkid_magic *id __BLKID_ATTR((unused)), |
443 | unsigned char *buf) | 443 | unsigned char *buf) |
444 | { | 444 | { |
445 | struct oracle_asm_disk_label *dl; | 445 | struct oracle_asm_disk_label *dl; |
@@ -548,13 +548,13 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev) | |||
548 | diff = now - dev->bid_time; | 548 | diff = now - dev->bid_time; |
549 | 549 | ||
550 | if ((now < dev->bid_time) || | 550 | if ((now < dev->bid_time) || |
551 | (diff < BLKID_PROBE_MIN) || | 551 | (diff < BLKID_PROBE_MIN) || |
552 | (dev->bid_flags & BLKID_BID_FL_VERIFIED && | 552 | (dev->bid_flags & BLKID_BID_FL_VERIFIED && |
553 | diff < BLKID_PROBE_INTERVAL)) | 553 | diff < BLKID_PROBE_INTERVAL)) |
554 | return dev; | 554 | return dev; |
555 | 555 | ||
556 | DBG(DEBUG_PROBE, | 556 | DBG(DEBUG_PROBE, |
557 | printf("need to revalidate %s (time since last check %lu)\n", | 557 | printf("need to revalidate %s (time since last check %lu)\n", |
558 | dev->bid_name, diff)); | 558 | dev->bid_name, diff)); |
559 | 559 | ||
560 | if (((fd = open(dev->bid_name, O_RDONLY)) < 0) || | 560 | if (((fd = open(dev->bid_name, O_RDONLY)) < 0) || |
@@ -571,12 +571,12 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev) | |||
571 | } | 571 | } |
572 | 572 | ||
573 | memset(bufs, 0, sizeof(bufs)); | 573 | memset(bufs, 0, sizeof(bufs)); |
574 | 574 | ||
575 | /* | 575 | /* |
576 | * Iterate over the type array. If we already know the type, | 576 | * Iterate over the type array. If we already know the type, |
577 | * then try that first. If it doesn't work, then blow away | 577 | * then try that first. If it doesn't work, then blow away |
578 | * the type information, and try again. | 578 | * the type information, and try again. |
579 | * | 579 | * |
580 | */ | 580 | */ |
581 | try_again: | 581 | try_again: |
582 | type = 0; | 582 | type = 0; |
@@ -637,7 +637,7 @@ try_again: | |||
637 | blkid_free_dev(dev); | 637 | blkid_free_dev(dev); |
638 | return NULL; | 638 | return NULL; |
639 | } | 639 | } |
640 | 640 | ||
641 | found_type: | 641 | found_type: |
642 | if (dev && type) { | 642 | if (dev && type) { |
643 | dev->bid_devno = st.st_rdev; | 643 | dev->bid_devno = st.st_rdev; |
@@ -646,7 +646,7 @@ found_type: | |||
646 | cache->bic_flags |= BLKID_BIC_FL_CHANGED; | 646 | cache->bic_flags |= BLKID_BIC_FL_CHANGED; |
647 | 647 | ||
648 | blkid_set_tag(dev, "TYPE", type, 0); | 648 | blkid_set_tag(dev, "TYPE", type, 0); |
649 | 649 | ||
650 | DBG(DEBUG_PROBE, printf("%s: devno 0x%04Lx, type %s\n", | 650 | DBG(DEBUG_PROBE, printf("%s: devno 0x%04Lx, type %s\n", |
651 | dev->bid_name, st.st_rdev, type)); | 651 | dev->bid_name, st.st_rdev, type)); |
652 | } | 652 | } |
@@ -696,7 +696,7 @@ int main(int argc, char **argv) | |||
696 | printf("\tlabel is '%s'\n", dev->bid_label); | 696 | printf("\tlabel is '%s'\n", dev->bid_label); |
697 | if (dev->bid_uuid) | 697 | if (dev->bid_uuid) |
698 | printf("\tuuid is %s\n", dev->bid_uuid); | 698 | printf("\tuuid is %s\n", dev->bid_uuid); |
699 | 699 | ||
700 | blkid_free_dev(dev); | 700 | blkid_free_dev(dev); |
701 | return (0); | 701 | return (0); |
702 | } | 702 | } |
diff --git a/e2fsprogs/blkid/probe.h b/e2fsprogs/blkid/probe.h index 10af5d518..530b8efe2 100644 --- a/e2fsprogs/blkid/probe.h +++ b/e2fsprogs/blkid/probe.h | |||
@@ -18,7 +18,7 @@ | |||
18 | 18 | ||
19 | struct blkid_magic; | 19 | struct blkid_magic; |
20 | 20 | ||
21 | typedef int (*blkid_probe_t)(int fd, blkid_cache cache, blkid_dev dev, | 21 | typedef int (*blkid_probe_t)(int fd, blkid_cache cache, blkid_dev dev, |
22 | const struct blkid_magic *id, unsigned char *buf); | 22 | const struct blkid_magic *id, unsigned char *buf); |
23 | 23 | ||
24 | struct blkid_magic { | 24 | struct blkid_magic { |
@@ -222,16 +222,16 @@ struct ocfs_volume_header { | |||
222 | 222 | ||
223 | struct ocfs_volume_label { | 223 | struct ocfs_volume_label { |
224 | unsigned char disk_lock[48]; | 224 | unsigned char disk_lock[48]; |
225 | unsigned char label[64]; | 225 | unsigned char label[64]; |
226 | unsigned char label_len[2]; | 226 | unsigned char label_len[2]; |
227 | unsigned char vol_id[16]; | 227 | unsigned char vol_id[16]; |
228 | unsigned char vol_id_len[2]; | 228 | unsigned char vol_id_len[2]; |
229 | }; | 229 | }; |
230 | 230 | ||
231 | #define ocfsmajor(o) ((__u32)o.major_version[0] \ | 231 | #define ocfsmajor(o) ((__u32)o.major_version[0] \ |
232 | + (((__u32) o.major_version[1]) << 8) \ | 232 | + (((__u32) o.major_version[1]) << 8) \ |
233 | + (((__u32) o.major_version[2]) << 16) \ | 233 | + (((__u32) o.major_version[2]) << 16) \ |
234 | + (((__u32) o.major_version[3]) << 24)) | 234 | + (((__u32) o.major_version[3]) << 24)) |
235 | #define ocfslabellen(o) ((__u32)o.label_len[0] + (((__u32) o.label_len[1]) << 8)) | 235 | #define ocfslabellen(o) ((__u32)o.label_len[0] + (((__u32) o.label_len[1]) << 8)) |
236 | #define ocfsmountlen(o) ((__u32)o.mount_len[0] + (((__u32) o.mount_len[1])<<8)) | 236 | #define ocfsmountlen(o) ((__u32)o.mount_len[0] + (((__u32) o.mount_len[1])<<8)) |
237 | 237 | ||
@@ -334,7 +334,7 @@ _INLINE_ __u64 blkid_swab64(__u64 val) | |||
334 | return (blkid_swab32(val >> 32) | | 334 | return (blkid_swab32(val >> 32) | |
335 | (((__u64) blkid_swab32(val & 0xFFFFFFFFUL)) << 32)); | 335 | (((__u64) blkid_swab32(val & 0xFFFFFFFFUL)) << 32)); |
336 | } | 336 | } |
337 | #endif | 337 | #endif |
338 | 338 | ||
339 | 339 | ||
340 | 340 | ||
diff --git a/e2fsprogs/blkid/read.c b/e2fsprogs/blkid/read.c index 78464145d..08a3162f3 100644 --- a/e2fsprogs/blkid/read.c +++ b/e2fsprogs/blkid/read.c | |||
@@ -302,7 +302,7 @@ static int parse_tag(blkid_cache cache, blkid_dev dev, char **cp) | |||
302 | return ret; | 302 | return ret; |
303 | 303 | ||
304 | /* Some tags are stored directly in the device struct */ | 304 | /* Some tags are stored directly in the device struct */ |
305 | if (!strcmp(name, "DEVNO")) | 305 | if (!strcmp(name, "DEVNO")) |
306 | dev->bid_devno = STRTOULL(value, 0, 0); | 306 | dev->bid_devno = STRTOULL(value, 0, 0); |
307 | else if (!strcmp(name, "PRI")) | 307 | else if (!strcmp(name, "PRI")) |
308 | dev->bid_pri = strtol(value, 0, 0); | 308 | dev->bid_pri = strtol(value, 0, 0); |
@@ -389,7 +389,7 @@ void blkid_read_cache(blkid_cache cache) | |||
389 | cache->bic_filename)); | 389 | cache->bic_filename)); |
390 | goto errout; | 390 | goto errout; |
391 | } | 391 | } |
392 | 392 | ||
393 | DBG(DEBUG_CACHE, printf("reading cache file %s\n", | 393 | DBG(DEBUG_CACHE, printf("reading cache file %s\n", |
394 | cache->bic_filename)); | 394 | cache->bic_filename)); |
395 | 395 | ||
diff --git a/e2fsprogs/blkid/resolve.c b/e2fsprogs/blkid/resolve.c index 625782d44..591b63057 100644 --- a/e2fsprogs/blkid/resolve.c +++ b/e2fsprogs/blkid/resolve.c | |||
@@ -69,7 +69,7 @@ char *blkid_get_devname(blkid_cache cache, const char *token, | |||
69 | 69 | ||
70 | if (!token) | 70 | if (!token) |
71 | return NULL; | 71 | return NULL; |
72 | 72 | ||
73 | if (!cache) { | 73 | if (!cache) { |
74 | if (blkid_get_cache(&c, NULL) < 0) | 74 | if (blkid_get_cache(&c, NULL) < 0) |
75 | return NULL; | 75 | return NULL; |
@@ -125,7 +125,7 @@ int main(int argc, char **argv) | |||
125 | fprintf(stderr, "Couldn't get blkid cache\n"); | 125 | fprintf(stderr, "Couldn't get blkid cache\n"); |
126 | exit(1); | 126 | exit(1); |
127 | } | 127 | } |
128 | 128 | ||
129 | if (argv[2]) { | 129 | if (argv[2]) { |
130 | value = blkid_get_tag_value(cache, argv[1], argv[2]); | 130 | value = blkid_get_tag_value(cache, argv[1], argv[2]); |
131 | printf("%s has tag %s=%s\n", argv[2], argv[1], | 131 | printf("%s has tag %s=%s\n", argv[2], argv[1], |
diff --git a/e2fsprogs/blkid/save.c b/e2fsprogs/blkid/save.c index 3fba2450a..cc406ebfb 100644 --- a/e2fsprogs/blkid/save.c +++ b/e2fsprogs/blkid/save.c | |||
@@ -176,7 +176,7 @@ int main(int argc, char **argv) | |||
176 | exit(1); | 176 | exit(1); |
177 | } | 177 | } |
178 | cache->bic_filename = blkid_strdup(argv[1]); | 178 | cache->bic_filename = blkid_strdup(argv[1]); |
179 | 179 | ||
180 | if ((ret = blkid_flush_cache(cache)) < 0) { | 180 | if ((ret = blkid_flush_cache(cache)) < 0) { |
181 | fprintf(stderr, "error (%d) saving cache\n", ret); | 181 | fprintf(stderr, "error (%d) saving cache\n", ret); |
182 | exit(1); | 182 | exit(1); |
diff --git a/e2fsprogs/blkid/tag.c b/e2fsprogs/blkid/tag.c index 699d0fb46..e2c785cf0 100644 --- a/e2fsprogs/blkid/tag.c +++ b/e2fsprogs/blkid/tag.c | |||
@@ -96,7 +96,7 @@ static blkid_tag blkid_find_head_cache(blkid_cache cache, const char *type) | |||
96 | 96 | ||
97 | /* | 97 | /* |
98 | * Set a tag on an existing device. | 98 | * Set a tag on an existing device. |
99 | * | 99 | * |
100 | * If value is NULL, then delete the tagsfrom the device. | 100 | * If value is NULL, then delete the tagsfrom the device. |
101 | */ | 101 | */ |
102 | int blkid_set_tag(blkid_dev dev, const char *name, | 102 | int blkid_set_tag(blkid_dev dev, const char *name, |
@@ -131,7 +131,7 @@ int blkid_set_tag(blkid_dev dev, const char *name, | |||
131 | t->bit_dev = dev; | 131 | t->bit_dev = dev; |
132 | 132 | ||
133 | list_add_tail(&t->bit_tags, &dev->bid_tags); | 133 | list_add_tail(&t->bit_tags, &dev->bid_tags); |
134 | 134 | ||
135 | if (dev->bid_cache) { | 135 | if (dev->bid_cache) { |
136 | head = blkid_find_head_cache(dev->bid_cache, | 136 | head = blkid_find_head_cache(dev->bid_cache, |
137 | t->bit_name); | 137 | t->bit_name); |
@@ -151,7 +151,7 @@ int blkid_set_tag(blkid_dev dev, const char *name, | |||
151 | list_add_tail(&t->bit_names, &head->bit_names); | 151 | list_add_tail(&t->bit_names, &head->bit_names); |
152 | } | 152 | } |
153 | } | 153 | } |
154 | 154 | ||
155 | /* Link common tags directly to the device struct */ | 155 | /* Link common tags directly to the device struct */ |
156 | if (!strcmp(name, "TYPE")) | 156 | if (!strcmp(name, "TYPE")) |
157 | dev->bid_type = val; | 157 | dev->bid_type = val; |
@@ -159,7 +159,7 @@ int blkid_set_tag(blkid_dev dev, const char *name, | |||
159 | dev->bid_label = val; | 159 | dev->bid_label = val; |
160 | else if (!strcmp(name, "UUID")) | 160 | else if (!strcmp(name, "UUID")) |
161 | dev->bid_uuid = val; | 161 | dev->bid_uuid = val; |
162 | 162 | ||
163 | if (dev->bid_cache) | 163 | if (dev->bid_cache) |
164 | dev->bid_cache->bic_flags |= BLKID_BIC_FL_CHANGED; | 164 | dev->bid_cache->bic_flags |= BLKID_BIC_FL_CHANGED; |
165 | return 0; | 165 | return 0; |
@@ -235,7 +235,7 @@ errout: | |||
235 | * This series of functions iterate over all tags in a device | 235 | * This series of functions iterate over all tags in a device |
236 | */ | 236 | */ |
237 | #define TAG_ITERATE_MAGIC 0x01a5284c | 237 | #define TAG_ITERATE_MAGIC 0x01a5284c |
238 | 238 | ||
239 | struct blkid_struct_tag_iterate { | 239 | struct blkid_struct_tag_iterate { |
240 | int magic; | 240 | int magic; |
241 | blkid_dev dev; | 241 | blkid_dev dev; |
@@ -260,7 +260,7 @@ extern int blkid_tag_next(blkid_tag_iterate iter, | |||
260 | const char **type, const char **value) | 260 | const char **type, const char **value) |
261 | { | 261 | { |
262 | blkid_tag tag; | 262 | blkid_tag tag; |
263 | 263 | ||
264 | *type = 0; | 264 | *type = 0; |
265 | *value = 0; | 265 | *value = 0; |
266 | if (!iter || iter->magic != TAG_ITERATE_MAGIC || | 266 | if (!iter || iter->magic != TAG_ITERATE_MAGIC || |
@@ -303,9 +303,9 @@ extern blkid_dev blkid_find_dev_with_tag(blkid_cache cache, | |||
303 | return NULL; | 303 | return NULL; |
304 | 304 | ||
305 | blkid_read_cache(cache); | 305 | blkid_read_cache(cache); |
306 | 306 | ||
307 | DBG(DEBUG_TAG, printf("looking for %s=%s in cache\n", type, value)); | 307 | DBG(DEBUG_TAG, printf("looking for %s=%s in cache\n", type, value)); |
308 | 308 | ||
309 | try_again: | 309 | try_again: |
310 | pri = -1; | 310 | pri = -1; |
311 | dev = 0; | 311 | dev = 0; |
@@ -313,7 +313,7 @@ try_again: | |||
313 | 313 | ||
314 | if (head) { | 314 | if (head) { |
315 | list_for_each(p, &head->bit_names) { | 315 | list_for_each(p, &head->bit_names) { |
316 | blkid_tag tmp = list_entry(p, struct blkid_struct_tag, | 316 | blkid_tag tmp = list_entry(p, struct blkid_struct_tag, |
317 | bit_names); | 317 | bit_names); |
318 | 318 | ||
319 | if (!strcmp(tmp->bit_val, value) && | 319 | if (!strcmp(tmp->bit_val, value) && |
diff --git a/e2fsprogs/chattr.c b/e2fsprogs/chattr.c index 66838e642..c39003821 100644 --- a/e2fsprogs/chattr.c +++ b/e2fsprogs/chattr.c | |||
@@ -161,8 +161,8 @@ skip_setflags: | |||
161 | iterate_on_dir(name, chattr_dir_proc, NULL); | 161 | iterate_on_dir(name, chattr_dir_proc, NULL); |
162 | } | 162 | } |
163 | 163 | ||
164 | static int chattr_dir_proc(const char *dir_name, struct dirent *de, | 164 | static int chattr_dir_proc(const char *dir_name, struct dirent *de, |
165 | void *private EXT2FS_ATTR((unused))) | 165 | void *private EXT2FS_ATTR((unused))) |
166 | { | 166 | { |
167 | /*if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) {*/ | 167 | /*if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) {*/ |
168 | if (de->d_name[0] == '.' && (de->d_name[1] == '\0' || \ | 168 | if (de->d_name[0] == '.' && (de->d_name[1] == '\0' || \ |
diff --git a/e2fsprogs/e2fsck.c b/e2fsprogs/e2fsck.c index b31b19414..1c97cf4bb 100644 --- a/e2fsprogs/e2fsck.c +++ b/e2fsprogs/e2fsck.c | |||
@@ -11797,8 +11797,8 @@ static int count_tags(struct buffer_head *bh, int size) | |||
11797 | 11797 | ||
11798 | 11798 | ||
11799 | /* Make sure we wrap around the log correctly! */ | 11799 | /* Make sure we wrap around the log correctly! */ |
11800 | #define wrap(journal, var) \ | 11800 | #define wrap(journal, var) \ |
11801 | do { \ | 11801 | do { \ |
11802 | if (var >= (journal)->j_last) \ | 11802 | if (var >= (journal)->j_last) \ |
11803 | var -= ((journal)->j_last - (journal)->j_first); \ | 11803 | var -= ((journal)->j_last - (journal)->j_first); \ |
11804 | } while (0) | 11804 | } while (0) |
diff --git a/e2fsprogs/e2p/feature.c b/e2fsprogs/e2p/feature.c index fe6016102..0a9058384 100644 --- a/e2fsprogs/e2p/feature.c +++ b/e2fsprogs/e2p/feature.c | |||
@@ -1,11 +1,11 @@ | |||
1 | /* | 1 | /* |
2 | * feature.c --- convert between features and strings | 2 | * feature.c --- convert between features and strings |
3 | * | 3 | * |
4 | * Copyright (C) 1999 Theodore Ts'o <tytso@mit.edu> | 4 | * Copyright (C) 1999 Theodore Ts'o <tytso@mit.edu> |
5 | * | 5 | * |
6 | * This file can be redistributed under the terms of the GNU Library General | 6 | * This file can be redistributed under the terms of the GNU Library General |
7 | * Public License | 7 | * Public License |
8 | * | 8 | * |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <stdio.h> | 11 | #include <stdio.h> |
diff --git a/e2fsprogs/e2p/fgetsetversion.c b/e2fsprogs/e2p/fgetsetversion.c index dcf127c26..8227ab3be 100644 --- a/e2fsprogs/e2p/fgetsetversion.c +++ b/e2fsprogs/e2p/fgetsetversion.c | |||
@@ -33,11 +33,11 @@ | |||
33 | #define OPEN_FLAGS (O_RDONLY|O_NONBLOCK) | 33 | #define OPEN_FLAGS (O_RDONLY|O_NONBLOCK) |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | /* | 36 | /* |
37 | To do fsetversion: unsigned long *ptr_version must be set to NULL. | 37 | To do fsetversion: unsigned long *ptr_version must be set to NULL. |
38 | and unsigned long version must be set to a value | 38 | and unsigned long version must be set to a value |
39 | To do fgetversion: unsigned long *ptr_version must NOT be set to NULL | 39 | To do fgetversion: unsigned long *ptr_version must NOT be set to NULL |
40 | and unsigned long version is ignored. | 40 | and unsigned long version is ignored. |
41 | TITO. | 41 | TITO. |
42 | */ | 42 | */ |
43 | 43 | ||
diff --git a/e2fsprogs/e2p/hashstr.c b/e2fsprogs/e2p/hashstr.c index c4b3f9fd5..705f63ae0 100644 --- a/e2fsprogs/e2p/hashstr.c +++ b/e2fsprogs/e2p/hashstr.c | |||
@@ -1,11 +1,11 @@ | |||
1 | /* | 1 | /* |
2 | * feature.c --- convert between features and strings | 2 | * feature.c --- convert between features and strings |
3 | * | 3 | * |
4 | * Copyright (C) 1999 Theodore Ts'o <tytso@mit.edu> | 4 | * Copyright (C) 1999 Theodore Ts'o <tytso@mit.edu> |
5 | * | 5 | * |
6 | * This file can be redistributed under the terms of the GNU Library General | 6 | * This file can be redistributed under the terms of the GNU Library General |
7 | * Public License | 7 | * Public License |
8 | * | 8 | * |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <stdio.h> | 11 | #include <stdio.h> |
diff --git a/e2fsprogs/e2p/ls.c b/e2fsprogs/e2p/ls.c index 71f8f5126..0c91345e1 100644 --- a/e2fsprogs/e2p/ls.c +++ b/e2fsprogs/e2p/ls.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * Universite Pierre et Marie Curie (Paris VI) | 6 | * Universite Pierre et Marie Curie (Paris VI) |
7 | * | 7 | * |
8 | * Copyright (C) 1995, 1996, 1997 Theodore Ts'o <tytso@mit.edu> | 8 | * Copyright (C) 1995, 1996, 1997 Theodore Ts'o <tytso@mit.edu> |
9 | * | 9 | * |
10 | * This file can be redistributed under the terms of the GNU Library General | 10 | * This file can be redistributed under the terms of the GNU Library General |
11 | * Public License | 11 | * Public License |
12 | */ | 12 | */ |
@@ -190,11 +190,11 @@ void list_super2(struct ext2_super_block * sb, FILE *f) | |||
190 | "Block size: %u\n" | 190 | "Block size: %u\n" |
191 | "Fragment size: %u\n", | 191 | "Fragment size: %u\n", |
192 | str, sb->s_inodes_count, sb->s_blocks_count, sb->s_r_blocks_count, | 192 | str, sb->s_inodes_count, sb->s_blocks_count, sb->s_r_blocks_count, |
193 | sb->s_free_blocks_count, sb->s_free_inodes_count, | 193 | sb->s_free_blocks_count, sb->s_free_inodes_count, |
194 | sb->s_first_data_block, EXT2_BLOCK_SIZE(sb), EXT2_FRAG_SIZE(sb)); | 194 | sb->s_first_data_block, EXT2_BLOCK_SIZE(sb), EXT2_FRAG_SIZE(sb)); |
195 | free(str); | 195 | free(str); |
196 | if (sb->s_reserved_gdt_blocks) | 196 | if (sb->s_reserved_gdt_blocks) |
197 | fprintf(f, "Reserved GDT blocks: %u\n", | 197 | fprintf(f, "Reserved GDT blocks: %u\n", |
198 | sb->s_reserved_gdt_blocks); | 198 | sb->s_reserved_gdt_blocks); |
199 | fprintf(f, | 199 | fprintf(f, |
200 | "Blocks per group: %u\n" | 200 | "Blocks per group: %u\n" |
diff --git a/e2fsprogs/e2p/mntopts.c b/e2fsprogs/e2p/mntopts.c index 562a9ccc1..b27f78ed9 100644 --- a/e2fsprogs/e2p/mntopts.c +++ b/e2fsprogs/e2p/mntopts.c | |||
@@ -1,11 +1,11 @@ | |||
1 | /* | 1 | /* |
2 | * mountopts.c --- convert between default mount options and strings | 2 | * mountopts.c --- convert between default mount options and strings |
3 | * | 3 | * |
4 | * Copyright (C) 2002 Theodore Ts'o <tytso@mit.edu> | 4 | * Copyright (C) 2002 Theodore Ts'o <tytso@mit.edu> |
5 | * | 5 | * |
6 | * This file can be redistributed under the terms of the GNU Library General | 6 | * This file can be redistributed under the terms of the GNU Library General |
7 | * Public License | 7 | * Public License |
8 | * | 8 | * |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <stdio.h> | 11 | #include <stdio.h> |
diff --git a/e2fsprogs/e2p/ostype.c b/e2fsprogs/e2p/ostype.c index 1084abde2..46230631e 100644 --- a/e2fsprogs/e2p/ostype.c +++ b/e2fsprogs/e2p/ostype.c | |||
@@ -11,10 +11,10 @@ | |||
11 | #include <string.h> | 11 | #include <string.h> |
12 | 12 | ||
13 | static const char * const os_tab[] = | 13 | static const char * const os_tab[] = |
14 | { "Linux", | 14 | { "Linux", |
15 | "Hurd", | 15 | "Hurd", |
16 | "Masix", | 16 | "Masix", |
17 | "FreeBSD", | 17 | "FreeBSD", |
18 | "Lites", | 18 | "Lites", |
19 | 0 }; | 19 | 0 }; |
20 | 20 | ||
@@ -53,7 +53,7 @@ int e2p_string2os(char *str) | |||
53 | #ifdef TEST_PROGRAM | 53 | #ifdef TEST_PROGRAM |
54 | int main(int argc, char **argv) | 54 | int main(int argc, char **argv) |
55 | { | 55 | { |
56 | char *s; | 56 | char *s; |
57 | int i, os; | 57 | int i, os; |
58 | 58 | ||
59 | for (i=0; i <= EXT2_OS_LITES; i++) { | 59 | for (i=0; i <= EXT2_OS_LITES; i++) { |
diff --git a/e2fsprogs/e2p/parse_num.c b/e2fsprogs/e2p/parse_num.c index 3910e70de..81c160544 100644 --- a/e2fsprogs/e2p/parse_num.c +++ b/e2fsprogs/e2p/parse_num.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * parse_num.c - Parse the number of blocks | 2 | * parse_num.c - Parse the number of blocks |
3 | * | 3 | * |
4 | * Copyright (C) 2004,2005 Theodore Ts'o <tytso@mit.edu> | 4 | * Copyright (C) 2004,2005 Theodore Ts'o <tytso@mit.edu> |
5 | * | 5 | * |
6 | * This file can be redistributed under the terms of the GNU Library General | 6 | * This file can be redistributed under the terms of the GNU Library General |
7 | * Public License | 7 | * Public License |
8 | */ | 8 | */ |
@@ -18,25 +18,25 @@ unsigned long parse_num_blocks(const char *arg, int log_block_size) | |||
18 | 18 | ||
19 | num = strtoull(arg, &p, 0); | 19 | num = strtoull(arg, &p, 0); |
20 | 20 | ||
21 | if (p[0] && p[1]) | 21 | if (p[0] && p[1]) |
22 | return 0; | 22 | return 0; |
23 | 23 | ||
24 | switch (*p) { /* Using fall-through logic */ | 24 | switch (*p) { /* Using fall-through logic */ |
25 | case 'T': case 't': | 25 | case 'T': case 't': |
26 | num <<= 10; | 26 | num <<= 10; |
27 | case 'G': case 'g': | 27 | case 'G': case 'g': |
28 | num <<= 10; | 28 | num <<= 10; |
29 | case 'M': case 'm': | 29 | case 'M': case 'm': |
30 | num <<= 10; | 30 | num <<= 10; |
31 | case 'K': case 'k': | 31 | case 'K': case 'k': |
32 | num >>= log_block_size; | 32 | num >>= log_block_size; |
33 | break; | 33 | break; |
34 | case 's': | 34 | case 's': |
35 | num >>= 1; | 35 | num >>= 1; |
36 | break; | 36 | break; |
37 | case '\0': | 37 | case '\0': |
38 | break; | 38 | break; |
39 | default: | 39 | default: |
40 | return 0; | 40 | return 0; |
41 | } | 41 | } |
42 | return num; | 42 | return num; |
diff --git a/e2fsprogs/e2p/pf.c b/e2fsprogs/e2p/pf.c index 2194ac6bf..da8357a46 100644 --- a/e2fsprogs/e2p/pf.c +++ b/e2fsprogs/e2p/pf.c | |||
@@ -41,7 +41,7 @@ static const struct flags_name flags_array[] = { | |||
41 | { EXT2_ECOMPR_FL, "E", "Compression_Error" }, | 41 | { EXT2_ECOMPR_FL, "E", "Compression_Error" }, |
42 | #endif | 42 | #endif |
43 | { EXT3_JOURNAL_DATA_FL, "j", "Journaled_Data" }, | 43 | { EXT3_JOURNAL_DATA_FL, "j", "Journaled_Data" }, |
44 | { EXT2_INDEX_FL, "I", "Indexed_direcctory" }, | 44 | { EXT2_INDEX_FL, "I", "Indexed_direcctory" }, |
45 | { EXT2_NOTAIL_FL, "t", "No_Tailmerging" }, | 45 | { EXT2_NOTAIL_FL, "t", "No_Tailmerging" }, |
46 | { EXT2_TOPDIR_FL, "T", "Top_of_Directory_Hierarchies" }, | 46 | { EXT2_TOPDIR_FL, "T", "Top_of_Directory_Hierarchies" }, |
47 | { 0, NULL, NULL } | 47 | { 0, NULL, NULL } |
diff --git a/e2fsprogs/e2p/uuid.c b/e2fsprogs/e2p/uuid.c index 9feca4cfa..cb4ec8072 100644 --- a/e2fsprogs/e2p/uuid.c +++ b/e2fsprogs/e2p/uuid.c | |||
@@ -19,7 +19,7 @@ struct uuid { | |||
19 | /* Returns 1 if the uuid is the NULL uuid */ | 19 | /* Returns 1 if the uuid is the NULL uuid */ |
20 | int e2p_is_null_uuid(void *uu) | 20 | int e2p_is_null_uuid(void *uu) |
21 | { | 21 | { |
22 | __u8 *cp; | 22 | __u8 *cp; |
23 | int i; | 23 | int i; |
24 | 24 | ||
25 | for (i=0, cp = uu; i < 16; i++) | 25 | for (i=0, cp = uu; i < 16; i++) |
@@ -42,7 +42,7 @@ static void e2p_unpack_uuid(void *in, struct uuid *uu) | |||
42 | tmp = *ptr++; | 42 | tmp = *ptr++; |
43 | tmp = (tmp << 8) | *ptr++; | 43 | tmp = (tmp << 8) | *ptr++; |
44 | uu->time_mid = tmp; | 44 | uu->time_mid = tmp; |
45 | 45 | ||
46 | tmp = *ptr++; | 46 | tmp = *ptr++; |
47 | tmp = (tmp << 8) | *ptr++; | 47 | tmp = (tmp << 8) | *ptr++; |
48 | uu->time_hi_and_version = tmp; | 48 | uu->time_hi_and_version = tmp; |
diff --git a/e2fsprogs/ext2fs/alloc.c b/e2fsprogs/ext2fs/alloc.c index 7385123b8..d56ef2566 100644 --- a/e2fsprogs/ext2fs/alloc.c +++ b/e2fsprogs/ext2fs/alloc.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * This file may be redistributed under the terms of the GNU Public | 7 | * This file may be redistributed under the terms of the GNU Public |
8 | * License. | 8 | * License. |
9 | * %End-Header% | 9 | * %End-Header% |
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <stdio.h> | 13 | #include <stdio.h> |
@@ -32,7 +32,7 @@ | |||
32 | * | 32 | * |
33 | * Should have a special policy for directories. | 33 | * Should have a special policy for directories. |
34 | */ | 34 | */ |
35 | errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, | 35 | errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, |
36 | int mode EXT2FS_ATTR((unused)), | 36 | int mode EXT2FS_ATTR((unused)), |
37 | ext2fs_inode_bitmap map, ext2_ino_t *ret) | 37 | ext2fs_inode_bitmap map, ext2_ino_t *ret) |
38 | { | 38 | { |
@@ -41,13 +41,13 @@ errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, | |||
41 | ext2_ino_t start_inode; | 41 | ext2_ino_t start_inode; |
42 | 42 | ||
43 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); | 43 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); |
44 | 44 | ||
45 | if (!map) | 45 | if (!map) |
46 | map = fs->inode_map; | 46 | map = fs->inode_map; |
47 | if (!map) | 47 | if (!map) |
48 | return EXT2_ET_NO_INODE_BITMAP; | 48 | return EXT2_ET_NO_INODE_BITMAP; |
49 | 49 | ||
50 | if (dir > 0) | 50 | if (dir > 0) |
51 | dir_group = (dir - 1) / EXT2_INODES_PER_GROUP(fs->super); | 51 | dir_group = (dir - 1) / EXT2_INODES_PER_GROUP(fs->super); |
52 | 52 | ||
53 | start_inode = (dir_group * EXT2_INODES_PER_GROUP(fs->super)) + 1; | 53 | start_inode = (dir_group * EXT2_INODES_PER_GROUP(fs->super)) + 1; |
@@ -62,7 +62,7 @@ errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, | |||
62 | if (i > fs->super->s_inodes_count) | 62 | if (i > fs->super->s_inodes_count) |
63 | i = EXT2_FIRST_INODE(fs->super); | 63 | i = EXT2_FIRST_INODE(fs->super); |
64 | } while (i != start_inode); | 64 | } while (i != start_inode); |
65 | 65 | ||
66 | if (ext2fs_test_inode_bitmap(map, i)) | 66 | if (ext2fs_test_inode_bitmap(map, i)) |
67 | return EXT2_ET_INODE_ALLOC_FAIL; | 67 | return EXT2_ET_INODE_ALLOC_FAIL; |
68 | *ret = i; | 68 | *ret = i; |
@@ -131,7 +131,7 @@ errcode_t ext2fs_alloc_block(ext2_filsys fs, blk_t goal, | |||
131 | retval = io_channel_write_blk(fs->io, block, 1, block_buf); | 131 | retval = io_channel_write_blk(fs->io, block, 1, block_buf); |
132 | if (retval) | 132 | if (retval) |
133 | goto fail; | 133 | goto fail; |
134 | 134 | ||
135 | ext2fs_block_alloc_stats(fs, block, +1); | 135 | ext2fs_block_alloc_stats(fs, block, +1); |
136 | *ret = block; | 136 | *ret = block; |
137 | return 0; | 137 | return 0; |
diff --git a/e2fsprogs/ext2fs/alloc_sb.c b/e2fsprogs/ext2fs/alloc_sb.c index ef40b938f..aa2cd0568 100644 --- a/e2fsprogs/ext2fs/alloc_sb.c +++ b/e2fsprogs/ext2fs/alloc_sb.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * alloc_sb.c --- Allocate the superblock and block group descriptors for a | 2 | * alloc_sb.c --- Allocate the superblock and block group descriptors for a |
3 | * newly initialized filesystem. Used by mke2fs when initializing a filesystem | 3 | * newly initialized filesystem. Used by mke2fs when initializing a filesystem |
4 | * | 4 | * |
5 | * Copyright (C) 1994, 1995, 1996, 2003 Theodore Ts'o. | 5 | * Copyright (C) 1994, 1995, 1996, 2003 Theodore Ts'o. |
@@ -27,20 +27,20 @@ | |||
27 | #include "ext2_fs.h" | 27 | #include "ext2_fs.h" |
28 | #include "ext2fs.h" | 28 | #include "ext2fs.h" |
29 | 29 | ||
30 | int ext2fs_reserve_super_and_bgd(ext2_filsys fs, | 30 | int ext2fs_reserve_super_and_bgd(ext2_filsys fs, |
31 | dgrp_t group, | 31 | dgrp_t group, |
32 | ext2fs_block_bitmap bmap) | 32 | ext2fs_block_bitmap bmap) |
33 | { | 33 | { |
34 | blk_t super_blk, old_desc_blk, new_desc_blk; | 34 | blk_t super_blk, old_desc_blk, new_desc_blk; |
35 | int j, old_desc_blocks, num_blocks; | 35 | int j, old_desc_blocks, num_blocks; |
36 | 36 | ||
37 | num_blocks = ext2fs_super_and_bgd_loc(fs, group, &super_blk, | 37 | num_blocks = ext2fs_super_and_bgd_loc(fs, group, &super_blk, |
38 | &old_desc_blk, &new_desc_blk, 0); | 38 | &old_desc_blk, &new_desc_blk, 0); |
39 | 39 | ||
40 | if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) | 40 | if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) |
41 | old_desc_blocks = fs->super->s_first_meta_bg; | 41 | old_desc_blocks = fs->super->s_first_meta_bg; |
42 | else | 42 | else |
43 | old_desc_blocks = | 43 | old_desc_blocks = |
44 | fs->desc_blocks + fs->super->s_reserved_gdt_blocks; | 44 | fs->desc_blocks + fs->super->s_reserved_gdt_blocks; |
45 | 45 | ||
46 | if (super_blk || (group == 0)) | 46 | if (super_blk || (group == 0)) |
diff --git a/e2fsprogs/ext2fs/alloc_stats.c b/e2fsprogs/ext2fs/alloc_stats.c index 4088f7b87..32aa0b6bc 100644 --- a/e2fsprogs/ext2fs/alloc_stats.c +++ b/e2fsprogs/ext2fs/alloc_stats.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * This file may be redistributed under the terms of the GNU Public | 7 | * This file may be redistributed under the terms of the GNU Public |
8 | * License. | 8 | * License. |
9 | * %End-Header% | 9 | * %End-Header% |
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <stdio.h> | 13 | #include <stdio.h> |
diff --git a/e2fsprogs/ext2fs/alloc_tables.c b/e2fsprogs/ext2fs/alloc_tables.c index 0326321be..10f1f95a4 100644 --- a/e2fsprogs/ext2fs/alloc_tables.c +++ b/e2fsprogs/ext2fs/alloc_tables.c | |||
@@ -36,14 +36,14 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group, | |||
36 | 36 | ||
37 | group_blk = fs->super->s_first_data_block + | 37 | group_blk = fs->super->s_first_data_block + |
38 | (group * fs->super->s_blocks_per_group); | 38 | (group * fs->super->s_blocks_per_group); |
39 | 39 | ||
40 | last_blk = group_blk + fs->super->s_blocks_per_group; | 40 | last_blk = group_blk + fs->super->s_blocks_per_group; |
41 | if (last_blk >= fs->super->s_blocks_count) | 41 | if (last_blk >= fs->super->s_blocks_count) |
42 | last_blk = fs->super->s_blocks_count - 1; | 42 | last_blk = fs->super->s_blocks_count - 1; |
43 | 43 | ||
44 | if (!bmap) | 44 | if (!bmap) |
45 | bmap = fs->block_map; | 45 | bmap = fs->block_map; |
46 | 46 | ||
47 | /* | 47 | /* |
48 | * Allocate the block and inode bitmaps, if necessary | 48 | * Allocate the block and inode bitmaps, if necessary |
49 | */ | 49 | */ |
@@ -59,7 +59,7 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group, | |||
59 | if (!fs->group_desc[group].bg_block_bitmap) { | 59 | if (!fs->group_desc[group].bg_block_bitmap) { |
60 | retval = ext2fs_get_free_blocks(fs, start_blk, last_blk, | 60 | retval = ext2fs_get_free_blocks(fs, start_blk, last_blk, |
61 | 1, bmap, &new_blk); | 61 | 1, bmap, &new_blk); |
62 | if (retval == EXT2_ET_BLOCK_ALLOC_FAIL) | 62 | if (retval == EXT2_ET_BLOCK_ALLOC_FAIL) |
63 | retval = ext2fs_get_free_blocks(fs, group_blk, | 63 | retval = ext2fs_get_free_blocks(fs, group_blk, |
64 | last_blk, 1, bmap, &new_blk); | 64 | last_blk, 1, bmap, &new_blk); |
65 | if (retval) | 65 | if (retval) |
@@ -71,7 +71,7 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group, | |||
71 | if (!fs->group_desc[group].bg_inode_bitmap) { | 71 | if (!fs->group_desc[group].bg_inode_bitmap) { |
72 | retval = ext2fs_get_free_blocks(fs, start_blk, last_blk, | 72 | retval = ext2fs_get_free_blocks(fs, start_blk, last_blk, |
73 | 1, bmap, &new_blk); | 73 | 1, bmap, &new_blk); |
74 | if (retval == EXT2_ET_BLOCK_ALLOC_FAIL) | 74 | if (retval == EXT2_ET_BLOCK_ALLOC_FAIL) |
75 | retval = ext2fs_get_free_blocks(fs, group_blk, | 75 | retval = ext2fs_get_free_blocks(fs, group_blk, |
76 | last_blk, 1, bmap, &new_blk); | 76 | last_blk, 1, bmap, &new_blk); |
77 | if (retval) | 77 | if (retval) |
@@ -96,11 +96,11 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group, | |||
96 | fs->group_desc[group].bg_inode_table = new_blk; | 96 | fs->group_desc[group].bg_inode_table = new_blk; |
97 | } | 97 | } |
98 | 98 | ||
99 | 99 | ||
100 | return 0; | 100 | return 0; |
101 | } | 101 | } |
102 | 102 | ||
103 | 103 | ||
104 | 104 | ||
105 | errcode_t ext2fs_allocate_tables(ext2_filsys fs) | 105 | errcode_t ext2fs_allocate_tables(ext2_filsys fs) |
106 | { | 106 | { |
diff --git a/e2fsprogs/ext2fs/badblocks.c b/e2fsprogs/ext2fs/badblocks.c index 4b76ef032..d82041126 100644 --- a/e2fsprogs/ext2fs/badblocks.c +++ b/e2fsprogs/ext2fs/badblocks.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * badblocks.c --- routines to manipulate the bad block structure | 2 | * badblocks.c --- routines to manipulate the bad block structure |
3 | * | 3 | * |
4 | * Copyright (C) 1994, 1995, 1996 Theodore Ts'o. | 4 | * Copyright (C) 1994, 1995, 1996 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -34,7 +34,7 @@ static errcode_t make_u32_list(int size, int num, __u32 *list, | |||
34 | { | 34 | { |
35 | ext2_u32_list bb; | 35 | ext2_u32_list bb; |
36 | errcode_t retval; | 36 | errcode_t retval; |
37 | 37 | ||
38 | retval = ext2fs_get_mem(sizeof(struct ext2_struct_u32_list), &bb); | 38 | retval = ext2fs_get_mem(sizeof(struct ext2_struct_u32_list), &bb); |
39 | if (retval) | 39 | if (retval) |
40 | return retval; | 40 | return retval; |
@@ -54,7 +54,7 @@ static errcode_t make_u32_list(int size, int num, __u32 *list, | |||
54 | *ret = bb; | 54 | *ret = bb; |
55 | return 0; | 55 | return 0; |
56 | } | 56 | } |
57 | 57 | ||
58 | 58 | ||
59 | /* | 59 | /* |
60 | * This procedure creates an empty u32 list. | 60 | * This procedure creates an empty u32 list. |
@@ -79,7 +79,7 @@ errcode_t ext2fs_badblocks_list_create(ext2_badblocks_list *ret, int size) | |||
79 | errcode_t ext2fs_u32_copy(ext2_u32_list src, ext2_u32_list *dest) | 79 | errcode_t ext2fs_u32_copy(ext2_u32_list src, ext2_u32_list *dest) |
80 | { | 80 | { |
81 | errcode_t retval; | 81 | errcode_t retval; |
82 | 82 | ||
83 | retval = make_u32_list(src->size, src->num, src->list, dest); | 83 | retval = make_u32_list(src->size, src->num, src->list, dest); |
84 | if (retval) | 84 | if (retval) |
85 | return retval; | 85 | return retval; |
@@ -271,11 +271,11 @@ int ext2fs_u32_list_iterate(ext2_u32_iterate iter, __u32 *blk) | |||
271 | 271 | ||
272 | if (bb->magic != EXT2_ET_MAGIC_BADBLOCKS_LIST) | 272 | if (bb->magic != EXT2_ET_MAGIC_BADBLOCKS_LIST) |
273 | return 0; | 273 | return 0; |
274 | 274 | ||
275 | if (iter->ptr < bb->num) { | 275 | if (iter->ptr < bb->num) { |
276 | *blk = bb->list[iter->ptr++]; | 276 | *blk = bb->list[iter->ptr++]; |
277 | return 1; | 277 | return 1; |
278 | } | 278 | } |
279 | *blk = 0; | 279 | *blk = 0; |
280 | return 0; | 280 | return 0; |
281 | } | 281 | } |
diff --git a/e2fsprogs/ext2fs/bb_compat.c b/e2fsprogs/ext2fs/bb_compat.c index 40f734368..5a158b34c 100644 --- a/e2fsprogs/ext2fs/bb_compat.c +++ b/e2fsprogs/ext2fs/bb_compat.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * bb_compat.c --- compatibility badblocks routines | 2 | * bb_compat.c --- compatibility badblocks routines |
3 | * | 3 | * |
4 | * Copyright (C) 1997 Theodore Ts'o. | 4 | * Copyright (C) 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
diff --git a/e2fsprogs/ext2fs/bb_inode.c b/e2fsprogs/ext2fs/bb_inode.c index dd8e7c319..9af117d8f 100644 --- a/e2fsprogs/ext2fs/bb_inode.c +++ b/e2fsprogs/ext2fs/bb_inode.c | |||
@@ -1,12 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * bb_inode.c --- routines to update the bad block inode. | 2 | * bb_inode.c --- routines to update the bad block inode. |
3 | * | 3 | * |
4 | * WARNING: This routine modifies a lot of state in the filesystem; if | 4 | * WARNING: This routine modifies a lot of state in the filesystem; if |
5 | * this routine returns an error, the bad block inode may be in an | 5 | * this routine returns an error, the bad block inode may be in an |
6 | * inconsistent state. | 6 | * inconsistent state. |
7 | * | 7 | * |
8 | * Copyright (C) 1994, 1995 Theodore Ts'o. | 8 | * Copyright (C) 1994, 1995 Theodore Ts'o. |
9 | * | 9 | * |
10 | * %Begin-Header% | 10 | * %Begin-Header% |
11 | * This file may be redistributed under the terms of the GNU Public | 11 | * This file may be redistributed under the terms of the GNU Public |
12 | * License. | 12 | * License. |
@@ -49,7 +49,7 @@ static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr, | |||
49 | e2_blkcnt_t blockcnt, | 49 | e2_blkcnt_t blockcnt, |
50 | blk_t ref_block, int ref_offset, | 50 | blk_t ref_block, int ref_offset, |
51 | void *priv_data); | 51 | void *priv_data); |
52 | 52 | ||
53 | /* | 53 | /* |
54 | * Given a bad blocks bitmap, update the bad blocks inode to reflect | 54 | * Given a bad blocks bitmap, update the bad blocks inode to reflect |
55 | * the map. | 55 | * the map. |
@@ -57,14 +57,14 @@ static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr, | |||
57 | errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list) | 57 | errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list) |
58 | { | 58 | { |
59 | errcode_t retval; | 59 | errcode_t retval; |
60 | struct set_badblock_record rec; | 60 | struct set_badblock_record rec; |
61 | struct ext2_inode inode; | 61 | struct ext2_inode inode; |
62 | 62 | ||
63 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); | 63 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); |
64 | 64 | ||
65 | if (!fs->block_map) | 65 | if (!fs->block_map) |
66 | return EXT2_ET_NO_BLOCK_BITMAP; | 66 | return EXT2_ET_NO_BLOCK_BITMAP; |
67 | 67 | ||
68 | rec.bad_block_count = 0; | 68 | rec.bad_block_count = 0; |
69 | rec.ind_blocks_size = rec.ind_blocks_ptr = 0; | 69 | rec.ind_blocks_size = rec.ind_blocks_ptr = 0; |
70 | rec.max_ind_blocks = 10; | 70 | rec.max_ind_blocks = 10; |
@@ -78,9 +78,9 @@ errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list) | |||
78 | goto cleanup; | 78 | goto cleanup; |
79 | memset(rec.block_buf, 0, fs->blocksize); | 79 | memset(rec.block_buf, 0, fs->blocksize); |
80 | rec.err = 0; | 80 | rec.err = 0; |
81 | 81 | ||
82 | /* | 82 | /* |
83 | * First clear the old bad blocks (while saving the indirect blocks) | 83 | * First clear the old bad blocks (while saving the indirect blocks) |
84 | */ | 84 | */ |
85 | retval = ext2fs_block_iterate2(fs, EXT2_BAD_INO, | 85 | retval = ext2fs_block_iterate2(fs, EXT2_BAD_INO, |
86 | BLOCK_FLAG_DEPTH_TRAVERSE, 0, | 86 | BLOCK_FLAG_DEPTH_TRAVERSE, 0, |
@@ -91,7 +91,7 @@ errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list) | |||
91 | retval = rec.err; | 91 | retval = rec.err; |
92 | goto cleanup; | 92 | goto cleanup; |
93 | } | 93 | } |
94 | 94 | ||
95 | /* | 95 | /* |
96 | * Now set the bad blocks! | 96 | * Now set the bad blocks! |
97 | * | 97 | * |
@@ -108,22 +108,22 @@ errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list) | |||
108 | BLOCK_FLAG_APPEND, 0, | 108 | BLOCK_FLAG_APPEND, 0, |
109 | set_bad_block_proc, &rec); | 109 | set_bad_block_proc, &rec); |
110 | ext2fs_badblocks_list_iterate_end(rec.bb_iter); | 110 | ext2fs_badblocks_list_iterate_end(rec.bb_iter); |
111 | if (retval) | 111 | if (retval) |
112 | goto cleanup; | 112 | goto cleanup; |
113 | if (rec.err) { | 113 | if (rec.err) { |
114 | retval = rec.err; | 114 | retval = rec.err; |
115 | goto cleanup; | 115 | goto cleanup; |
116 | } | 116 | } |
117 | } | 117 | } |
118 | 118 | ||
119 | /* | 119 | /* |
120 | * Update the bad block inode's mod time and block count | 120 | * Update the bad block inode's mod time and block count |
121 | * field. | 121 | * field. |
122 | */ | 122 | */ |
123 | retval = ext2fs_read_inode(fs, EXT2_BAD_INO, &inode); | 123 | retval = ext2fs_read_inode(fs, EXT2_BAD_INO, &inode); |
124 | if (retval) | 124 | if (retval) |
125 | goto cleanup; | 125 | goto cleanup; |
126 | 126 | ||
127 | inode.i_atime = inode.i_mtime = time(0); | 127 | inode.i_atime = inode.i_mtime = time(0); |
128 | if (!inode.i_ctime) | 128 | if (!inode.i_ctime) |
129 | inode.i_ctime = time(0); | 129 | inode.i_ctime = time(0); |
@@ -133,7 +133,7 @@ errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list) | |||
133 | retval = ext2fs_write_inode(fs, EXT2_BAD_INO, &inode); | 133 | retval = ext2fs_write_inode(fs, EXT2_BAD_INO, &inode); |
134 | if (retval) | 134 | if (retval) |
135 | goto cleanup; | 135 | goto cleanup; |
136 | 136 | ||
137 | cleanup: | 137 | cleanup: |
138 | ext2fs_free_mem(&rec.ind_blocks); | 138 | ext2fs_free_mem(&rec.ind_blocks); |
139 | ext2fs_free_mem(&rec.block_buf); | 139 | ext2fs_free_mem(&rec.block_buf); |
@@ -158,7 +158,7 @@ static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr, | |||
158 | struct set_badblock_record *rec = (struct set_badblock_record *) | 158 | struct set_badblock_record *rec = (struct set_badblock_record *) |
159 | priv_data; | 159 | priv_data; |
160 | errcode_t retval; | 160 | errcode_t retval; |
161 | unsigned long old_size; | 161 | unsigned long old_size; |
162 | 162 | ||
163 | if (!*block_nr) | 163 | if (!*block_nr) |
164 | return 0; | 164 | return 0; |
@@ -176,7 +176,7 @@ static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr, | |||
176 | if (rec->ind_blocks_size >= rec->max_ind_blocks) { | 176 | if (rec->ind_blocks_size >= rec->max_ind_blocks) { |
177 | old_size = rec->max_ind_blocks * sizeof(blk_t); | 177 | old_size = rec->max_ind_blocks * sizeof(blk_t); |
178 | rec->max_ind_blocks += 10; | 178 | rec->max_ind_blocks += 10; |
179 | retval = ext2fs_resize_mem(old_size, | 179 | retval = ext2fs_resize_mem(old_size, |
180 | rec->max_ind_blocks * sizeof(blk_t), | 180 | rec->max_ind_blocks * sizeof(blk_t), |
181 | &rec->ind_blocks); | 181 | &rec->ind_blocks); |
182 | if (retval) { | 182 | if (retval) { |
@@ -192,12 +192,12 @@ static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr, | |||
192 | * Mark the block as unused, and update accounting information | 192 | * Mark the block as unused, and update accounting information |
193 | */ | 193 | */ |
194 | ext2fs_block_alloc_stats(fs, *block_nr, -1); | 194 | ext2fs_block_alloc_stats(fs, *block_nr, -1); |
195 | 195 | ||
196 | *block_nr = 0; | 196 | *block_nr = 0; |
197 | return BLOCK_CHANGED; | 197 | return BLOCK_CHANGED; |
198 | } | 198 | } |
199 | 199 | ||
200 | 200 | ||
201 | /* | 201 | /* |
202 | * Helper function for update_bb_inode() | 202 | * Helper function for update_bb_inode() |
203 | * | 203 | * |
@@ -250,12 +250,12 @@ static int set_bad_block_proc(ext2_filsys fs, blk_t *block_nr, | |||
250 | return BLOCK_ABORT; | 250 | return BLOCK_ABORT; |
251 | } | 251 | } |
252 | } | 252 | } |
253 | 253 | ||
254 | /* | 254 | /* |
255 | * Update block counts | 255 | * Update block counts |
256 | */ | 256 | */ |
257 | ext2fs_block_alloc_stats(fs, blk, +1); | 257 | ext2fs_block_alloc_stats(fs, blk, +1); |
258 | 258 | ||
259 | *block_nr = blk; | 259 | *block_nr = blk; |
260 | return BLOCK_CHANGED; | 260 | return BLOCK_CHANGED; |
261 | } | 261 | } |
diff --git a/e2fsprogs/ext2fs/bitmaps.c b/e2fsprogs/ext2fs/bitmaps.c index 7edd28d7b..932c345fa 100644 --- a/e2fsprogs/ext2fs/bitmaps.c +++ b/e2fsprogs/ext2fs/bitmaps.c | |||
@@ -35,7 +35,7 @@ static errcode_t make_bitmap(__u32 start, __u32 end, __u32 real_end, | |||
35 | errcode_t retval; | 35 | errcode_t retval; |
36 | size_t size; | 36 | size_t size; |
37 | 37 | ||
38 | retval = ext2fs_get_mem(sizeof(struct ext2fs_struct_generic_bitmap), | 38 | retval = ext2fs_get_mem(sizeof(struct ext2fs_struct_generic_bitmap), |
39 | &bitmap); | 39 | &bitmap); |
40 | if (retval) | 40 | if (retval) |
41 | return retval; | 41 | return retval; |
@@ -106,7 +106,7 @@ void ext2fs_set_bitmap_padding(ext2fs_generic_bitmap map) | |||
106 | ext2fs_set_bit(j, map->bitmap); | 106 | ext2fs_set_bit(j, map->bitmap); |
107 | 107 | ||
108 | return; | 108 | return; |
109 | } | 109 | } |
110 | 110 | ||
111 | errcode_t ext2fs_allocate_inode_bitmap(ext2_filsys fs, | 111 | errcode_t ext2fs_allocate_inode_bitmap(ext2_filsys fs, |
112 | const char *descr, | 112 | const char *descr, |
@@ -128,11 +128,11 @@ errcode_t ext2fs_allocate_inode_bitmap(ext2_filsys fs, | |||
128 | descr, &bitmap); | 128 | descr, &bitmap); |
129 | if (retval) | 129 | if (retval) |
130 | return retval; | 130 | return retval; |
131 | 131 | ||
132 | bitmap->magic = EXT2_ET_MAGIC_INODE_BITMAP; | 132 | bitmap->magic = EXT2_ET_MAGIC_INODE_BITMAP; |
133 | bitmap->fs = fs; | 133 | bitmap->fs = fs; |
134 | bitmap->base_error_code = EXT2_ET_BAD_INODE_MARK; | 134 | bitmap->base_error_code = EXT2_ET_BAD_INODE_MARK; |
135 | 135 | ||
136 | *ret = bitmap; | 136 | *ret = bitmap; |
137 | return 0; | 137 | return 0; |
138 | } | 138 | } |
@@ -151,9 +151,9 @@ errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs, | |||
151 | 151 | ||
152 | start = fs->super->s_first_data_block; | 152 | start = fs->super->s_first_data_block; |
153 | end = fs->super->s_blocks_count-1; | 153 | end = fs->super->s_blocks_count-1; |
154 | real_end = (EXT2_BLOCKS_PER_GROUP(fs->super) | 154 | real_end = (EXT2_BLOCKS_PER_GROUP(fs->super) |
155 | * fs->group_desc_count)-1 + start; | 155 | * fs->group_desc_count)-1 + start; |
156 | 156 | ||
157 | retval = ext2fs_allocate_generic_bitmap(start, end, real_end, | 157 | retval = ext2fs_allocate_generic_bitmap(start, end, real_end, |
158 | descr, &bitmap); | 158 | descr, &bitmap); |
159 | if (retval) | 159 | if (retval) |
@@ -162,7 +162,7 @@ errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs, | |||
162 | bitmap->magic = EXT2_ET_MAGIC_BLOCK_BITMAP; | 162 | bitmap->magic = EXT2_ET_MAGIC_BLOCK_BITMAP; |
163 | bitmap->fs = fs; | 163 | bitmap->fs = fs; |
164 | bitmap->base_error_code = EXT2_ET_BAD_BLOCK_MARK; | 164 | bitmap->base_error_code = EXT2_ET_BAD_BLOCK_MARK; |
165 | 165 | ||
166 | *ret = bitmap; | 166 | *ret = bitmap; |
167 | return 0; | 167 | return 0; |
168 | } | 168 | } |
@@ -171,7 +171,7 @@ errcode_t ext2fs_fudge_inode_bitmap_end(ext2fs_inode_bitmap bitmap, | |||
171 | ext2_ino_t end, ext2_ino_t *oend) | 171 | ext2_ino_t end, ext2_ino_t *oend) |
172 | { | 172 | { |
173 | EXT2_CHECK_MAGIC(bitmap, EXT2_ET_MAGIC_INODE_BITMAP); | 173 | EXT2_CHECK_MAGIC(bitmap, EXT2_ET_MAGIC_INODE_BITMAP); |
174 | 174 | ||
175 | if (end > bitmap->real_end) | 175 | if (end > bitmap->real_end) |
176 | return EXT2_ET_FUDGE_INODE_BITMAP_END; | 176 | return EXT2_ET_FUDGE_INODE_BITMAP_END; |
177 | if (oend) | 177 | if (oend) |
@@ -184,7 +184,7 @@ errcode_t ext2fs_fudge_block_bitmap_end(ext2fs_block_bitmap bitmap, | |||
184 | blk_t end, blk_t *oend) | 184 | blk_t end, blk_t *oend) |
185 | { | 185 | { |
186 | EXT2_CHECK_MAGIC(bitmap, EXT2_ET_MAGIC_BLOCK_BITMAP); | 186 | EXT2_CHECK_MAGIC(bitmap, EXT2_ET_MAGIC_BLOCK_BITMAP); |
187 | 187 | ||
188 | if (end > bitmap->real_end) | 188 | if (end > bitmap->real_end) |
189 | return EXT2_ET_FUDGE_BLOCK_BITMAP_END; | 189 | return EXT2_ET_FUDGE_BLOCK_BITMAP_END; |
190 | if (oend) | 190 | if (oend) |
diff --git a/e2fsprogs/ext2fs/bitops.c b/e2fsprogs/ext2fs/bitops.c index 207c44d92..e44e10cf4 100644 --- a/e2fsprogs/ext2fs/bitops.c +++ b/e2fsprogs/ext2fs/bitops.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * bitops.c --- Bitmap frobbing code. See bitops.h for the inlined | 2 | * bitops.c --- Bitmap frobbing code. See bitops.h for the inlined |
3 | * routines. | 3 | * routines. |
4 | * | 4 | * |
5 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. | 5 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. |
6 | * | 6 | * |
7 | * %Begin-Header% | 7 | * %Begin-Header% |
diff --git a/e2fsprogs/ext2fs/bitops.h b/e2fsprogs/ext2fs/bitops.h index b6446efa2..4dba050c8 100644 --- a/e2fsprogs/ext2fs/bitops.h +++ b/e2fsprogs/ext2fs/bitops.h | |||
@@ -1,14 +1,14 @@ | |||
1 | /* | 1 | /* |
2 | * bitops.h --- Bitmap frobbing code. The byte swapping routines are | 2 | * bitops.h --- Bitmap frobbing code. The byte swapping routines are |
3 | * also included here. | 3 | * also included here. |
4 | * | 4 | * |
5 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. | 5 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. |
6 | * | 6 | * |
7 | * %Begin-Header% | 7 | * %Begin-Header% |
8 | * This file may be redistributed under the terms of the GNU Public | 8 | * This file may be redistributed under the terms of the GNU Public |
9 | * License. | 9 | * License. |
10 | * %End-Header% | 10 | * %End-Header% |
11 | * | 11 | * |
12 | * i386 bitops operations taken from <asm/bitops.h>, Copyright 1992, | 12 | * i386 bitops operations taken from <asm/bitops.h>, Copyright 1992, |
13 | * Linus Torvalds. | 13 | * Linus Torvalds. |
14 | */ | 14 | */ |
diff --git a/e2fsprogs/ext2fs/block.c b/e2fsprogs/ext2fs/block.c index 7685680df..18be2a5e8 100644 --- a/e2fsprogs/ext2fs/block.c +++ b/e2fsprogs/ext2fs/block.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * block.c --- iterate over all blocks in an inode | 2 | * block.c --- iterate over all blocks in an inode |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -59,7 +59,7 @@ static int block_iterate_ind(blk_t *ind_block, blk_t ref_block, | |||
59 | ret |= BLOCK_ERROR; | 59 | ret |= BLOCK_ERROR; |
60 | return ret; | 60 | return ret; |
61 | } | 61 | } |
62 | ctx->errcode = ext2fs_read_ind_block(ctx->fs, *ind_block, | 62 | ctx->errcode = ext2fs_read_ind_block(ctx->fs, *ind_block, |
63 | ctx->ind_buf); | 63 | ctx->ind_buf); |
64 | if (ctx->errcode) { | 64 | if (ctx->errcode) { |
65 | ret |= BLOCK_ERROR; | 65 | ret |= BLOCK_ERROR; |
@@ -71,7 +71,7 @@ static int block_iterate_ind(blk_t *ind_block, blk_t ref_block, | |||
71 | if (ctx->flags & BLOCK_FLAG_APPEND) { | 71 | if (ctx->flags & BLOCK_FLAG_APPEND) { |
72 | for (i = 0; i < limit; i++, ctx->bcount++, block_nr++) { | 72 | for (i = 0; i < limit; i++, ctx->bcount++, block_nr++) { |
73 | flags = (*ctx->func)(ctx->fs, block_nr, ctx->bcount, | 73 | flags = (*ctx->func)(ctx->fs, block_nr, ctx->bcount, |
74 | *ind_block, offset, | 74 | *ind_block, offset, |
75 | ctx->priv_data); | 75 | ctx->priv_data); |
76 | changed |= flags; | 76 | changed |= flags; |
77 | if (flags & BLOCK_ABORT) { | 77 | if (flags & BLOCK_ABORT) { |
@@ -85,7 +85,7 @@ static int block_iterate_ind(blk_t *ind_block, blk_t ref_block, | |||
85 | if (*block_nr == 0) | 85 | if (*block_nr == 0) |
86 | continue; | 86 | continue; |
87 | flags = (*ctx->func)(ctx->fs, block_nr, ctx->bcount, | 87 | flags = (*ctx->func)(ctx->fs, block_nr, ctx->bcount, |
88 | *ind_block, offset, | 88 | *ind_block, offset, |
89 | ctx->priv_data); | 89 | ctx->priv_data); |
90 | changed |= flags; | 90 | changed |= flags; |
91 | if (flags & BLOCK_ABORT) { | 91 | if (flags & BLOCK_ABORT) { |
@@ -109,7 +109,7 @@ static int block_iterate_ind(blk_t *ind_block, blk_t ref_block, | |||
109 | ref_offset, ctx->priv_data); | 109 | ref_offset, ctx->priv_data); |
110 | return ret; | 110 | return ret; |
111 | } | 111 | } |
112 | 112 | ||
113 | static int block_iterate_dind(blk_t *dind_block, blk_t ref_block, | 113 | static int block_iterate_dind(blk_t *dind_block, blk_t ref_block, |
114 | int ref_offset, struct block_context *ctx) | 114 | int ref_offset, struct block_context *ctx) |
115 | { | 115 | { |
@@ -133,7 +133,7 @@ static int block_iterate_dind(blk_t *dind_block, blk_t ref_block, | |||
133 | ret |= BLOCK_ERROR; | 133 | ret |= BLOCK_ERROR; |
134 | return ret; | 134 | return ret; |
135 | } | 135 | } |
136 | ctx->errcode = ext2fs_read_ind_block(ctx->fs, *dind_block, | 136 | ctx->errcode = ext2fs_read_ind_block(ctx->fs, *dind_block, |
137 | ctx->dind_buf); | 137 | ctx->dind_buf); |
138 | if (ctx->errcode) { | 138 | if (ctx->errcode) { |
139 | ret |= BLOCK_ERROR; | 139 | ret |= BLOCK_ERROR; |
@@ -185,7 +185,7 @@ static int block_iterate_dind(blk_t *dind_block, blk_t ref_block, | |||
185 | ref_offset, ctx->priv_data); | 185 | ref_offset, ctx->priv_data); |
186 | return ret; | 186 | return ret; |
187 | } | 187 | } |
188 | 188 | ||
189 | static int block_iterate_tind(blk_t *tind_block, blk_t ref_block, | 189 | static int block_iterate_tind(blk_t *tind_block, blk_t ref_block, |
190 | int ref_offset, struct block_context *ctx) | 190 | int ref_offset, struct block_context *ctx) |
191 | { | 191 | { |
@@ -209,7 +209,7 @@ static int block_iterate_tind(blk_t *tind_block, blk_t ref_block, | |||
209 | ret |= BLOCK_ERROR; | 209 | ret |= BLOCK_ERROR; |
210 | return ret; | 210 | return ret; |
211 | } | 211 | } |
212 | ctx->errcode = ext2fs_read_ind_block(ctx->fs, *tind_block, | 212 | ctx->errcode = ext2fs_read_ind_block(ctx->fs, *tind_block, |
213 | ctx->tind_buf); | 213 | ctx->tind_buf); |
214 | if (ctx->errcode) { | 214 | if (ctx->errcode) { |
215 | ret |= BLOCK_ERROR; | 215 | ret |= BLOCK_ERROR; |
@@ -259,10 +259,10 @@ static int block_iterate_tind(blk_t *tind_block, blk_t ref_block, | |||
259 | ret |= (*ctx->func)(ctx->fs, tind_block, | 259 | ret |= (*ctx->func)(ctx->fs, tind_block, |
260 | BLOCK_COUNT_TIND, ref_block, | 260 | BLOCK_COUNT_TIND, ref_block, |
261 | ref_offset, ctx->priv_data); | 261 | ref_offset, ctx->priv_data); |
262 | 262 | ||
263 | return ret; | 263 | return ret; |
264 | } | 264 | } |
265 | 265 | ||
266 | errcode_t ext2fs_block_iterate2(ext2_filsys fs, | 266 | errcode_t ext2fs_block_iterate2(ext2_filsys fs, |
267 | ext2_ino_t ino, | 267 | ext2_ino_t ino, |
268 | int flags, | 268 | int flags, |
@@ -338,7 +338,7 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs, | |||
338 | goto abort_exit; | 338 | goto abort_exit; |
339 | } | 339 | } |
340 | } | 340 | } |
341 | 341 | ||
342 | /* | 342 | /* |
343 | * Iterate over normal data blocks | 343 | * Iterate over normal data blocks |
344 | */ | 344 | */ |
@@ -427,7 +427,7 @@ errcode_t ext2fs_block_iterate(ext2_filsys fs, | |||
427 | void *priv_data) | 427 | void *priv_data) |
428 | { | 428 | { |
429 | struct xlate xl; | 429 | struct xlate xl; |
430 | 430 | ||
431 | xl.real_private = priv_data; | 431 | xl.real_private = priv_data; |
432 | xl.func = func; | 432 | xl.func = func; |
433 | 433 | ||
diff --git a/e2fsprogs/ext2fs/bmap.c b/e2fsprogs/ext2fs/bmap.c index e84004476..45d49f929 100644 --- a/e2fsprogs/ext2fs/bmap.c +++ b/e2fsprogs/ext2fs/bmap.c | |||
@@ -25,14 +25,14 @@ | |||
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, | 27 | extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, |
28 | struct ext2_inode *inode, | 28 | struct ext2_inode *inode, |
29 | char *block_buf, int bmap_flags, | 29 | char *block_buf, int bmap_flags, |
30 | blk_t block, blk_t *phys_blk); | 30 | blk_t block, blk_t *phys_blk); |
31 | 31 | ||
32 | #define inode_bmap(inode, nr) ((inode)->i_block[(nr)]) | 32 | #define inode_bmap(inode, nr) ((inode)->i_block[(nr)]) |
33 | 33 | ||
34 | static _BMAP_INLINE_ errcode_t block_ind_bmap(ext2_filsys fs, int flags, | 34 | static _BMAP_INLINE_ errcode_t block_ind_bmap(ext2_filsys fs, int flags, |
35 | blk_t ind, char *block_buf, | 35 | blk_t ind, char *block_buf, |
36 | int *blocks_alloc, | 36 | int *blocks_alloc, |
37 | blk_t nr, blk_t *ret_blk) | 37 | blk_t nr, blk_t *ret_blk) |
38 | { | 38 | { |
@@ -95,17 +95,17 @@ static _BMAP_INLINE_ errcode_t block_ind_bmap(ext2_filsys fs, int flags, | |||
95 | } | 95 | } |
96 | 96 | ||
97 | static _BMAP_INLINE_ errcode_t block_dind_bmap(ext2_filsys fs, int flags, | 97 | static _BMAP_INLINE_ errcode_t block_dind_bmap(ext2_filsys fs, int flags, |
98 | blk_t dind, char *block_buf, | 98 | blk_t dind, char *block_buf, |
99 | int *blocks_alloc, | 99 | int *blocks_alloc, |
100 | blk_t nr, blk_t *ret_blk) | 100 | blk_t nr, blk_t *ret_blk) |
101 | { | 101 | { |
102 | blk_t b; | 102 | blk_t b; |
103 | errcode_t retval; | 103 | errcode_t retval; |
104 | blk_t addr_per_block; | 104 | blk_t addr_per_block; |
105 | 105 | ||
106 | addr_per_block = (blk_t) fs->blocksize >> 2; | 106 | addr_per_block = (blk_t) fs->blocksize >> 2; |
107 | 107 | ||
108 | retval = block_ind_bmap(fs, flags & ~BMAP_SET, dind, block_buf, | 108 | retval = block_ind_bmap(fs, flags & ~BMAP_SET, dind, block_buf, |
109 | blocks_alloc, nr / addr_per_block, &b); | 109 | blocks_alloc, nr / addr_per_block, &b); |
110 | if (retval) | 110 | if (retval) |
111 | return retval; | 111 | return retval; |
@@ -115,17 +115,17 @@ static _BMAP_INLINE_ errcode_t block_dind_bmap(ext2_filsys fs, int flags, | |||
115 | } | 115 | } |
116 | 116 | ||
117 | static _BMAP_INLINE_ errcode_t block_tind_bmap(ext2_filsys fs, int flags, | 117 | static _BMAP_INLINE_ errcode_t block_tind_bmap(ext2_filsys fs, int flags, |
118 | blk_t tind, char *block_buf, | 118 | blk_t tind, char *block_buf, |
119 | int *blocks_alloc, | 119 | int *blocks_alloc, |
120 | blk_t nr, blk_t *ret_blk) | 120 | blk_t nr, blk_t *ret_blk) |
121 | { | 121 | { |
122 | blk_t b; | 122 | blk_t b; |
123 | errcode_t retval; | 123 | errcode_t retval; |
124 | blk_t addr_per_block; | 124 | blk_t addr_per_block; |
125 | 125 | ||
126 | addr_per_block = (blk_t) fs->blocksize >> 2; | 126 | addr_per_block = (blk_t) fs->blocksize >> 2; |
127 | 127 | ||
128 | retval = block_dind_bmap(fs, flags & ~BMAP_SET, tind, block_buf, | 128 | retval = block_dind_bmap(fs, flags & ~BMAP_SET, tind, block_buf, |
129 | blocks_alloc, nr / addr_per_block, &b); | 129 | blocks_alloc, nr / addr_per_block, &b); |
130 | if (retval) | 130 | if (retval) |
131 | return retval; | 131 | return retval; |
@@ -179,7 +179,7 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, | |||
179 | 179 | ||
180 | *phys_blk = inode_bmap(inode, block); | 180 | *phys_blk = inode_bmap(inode, block); |
181 | b = block ? inode_bmap(inode, block-1) : 0; | 181 | b = block ? inode_bmap(inode, block-1) : 0; |
182 | 182 | ||
183 | if ((*phys_blk == 0) && (bmap_flags & BMAP_ALLOC)) { | 183 | if ((*phys_blk == 0) && (bmap_flags & BMAP_ALLOC)) { |
184 | retval = ext2fs_alloc_block(fs, b, block_buf, &b); | 184 | retval = ext2fs_alloc_block(fs, b, block_buf, &b); |
185 | if (retval) | 185 | if (retval) |
@@ -190,7 +190,7 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, | |||
190 | } | 190 | } |
191 | goto done; | 191 | goto done; |
192 | } | 192 | } |
193 | 193 | ||
194 | /* Indirect block */ | 194 | /* Indirect block */ |
195 | block -= EXT2_NDIR_BLOCKS; | 195 | block -= EXT2_NDIR_BLOCKS; |
196 | if (block < addr_per_block) { | 196 | if (block < addr_per_block) { |
@@ -203,17 +203,17 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, | |||
203 | } | 203 | } |
204 | 204 | ||
205 | b = inode_bmap(inode, EXT2_IND_BLOCK-1); | 205 | b = inode_bmap(inode, EXT2_IND_BLOCK-1); |
206 | retval = ext2fs_alloc_block(fs, b, block_buf, &b); | 206 | retval = ext2fs_alloc_block(fs, b, block_buf, &b); |
207 | if (retval) | 207 | if (retval) |
208 | goto done; | 208 | goto done; |
209 | inode_bmap(inode, EXT2_IND_BLOCK) = b; | 209 | inode_bmap(inode, EXT2_IND_BLOCK) = b; |
210 | blocks_alloc++; | 210 | blocks_alloc++; |
211 | } | 211 | } |
212 | retval = block_ind_bmap(fs, bmap_flags, b, block_buf, | 212 | retval = block_ind_bmap(fs, bmap_flags, b, block_buf, |
213 | &blocks_alloc, block, phys_blk); | 213 | &blocks_alloc, block, phys_blk); |
214 | goto done; | 214 | goto done; |
215 | } | 215 | } |
216 | 216 | ||
217 | /* Doubly indirect block */ | 217 | /* Doubly indirect block */ |
218 | block -= addr_per_block; | 218 | block -= addr_per_block; |
219 | if (block < addr_per_block * addr_per_block) { | 219 | if (block < addr_per_block * addr_per_block) { |
@@ -226,13 +226,13 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, | |||
226 | } | 226 | } |
227 | 227 | ||
228 | b = inode_bmap(inode, EXT2_IND_BLOCK); | 228 | b = inode_bmap(inode, EXT2_IND_BLOCK); |
229 | retval = ext2fs_alloc_block(fs, b, block_buf, &b); | 229 | retval = ext2fs_alloc_block(fs, b, block_buf, &b); |
230 | if (retval) | 230 | if (retval) |
231 | goto done; | 231 | goto done; |
232 | inode_bmap(inode, EXT2_DIND_BLOCK) = b; | 232 | inode_bmap(inode, EXT2_DIND_BLOCK) = b; |
233 | blocks_alloc++; | 233 | blocks_alloc++; |
234 | } | 234 | } |
235 | retval = block_dind_bmap(fs, bmap_flags, b, block_buf, | 235 | retval = block_dind_bmap(fs, bmap_flags, b, block_buf, |
236 | &blocks_alloc, block, phys_blk); | 236 | &blocks_alloc, block, phys_blk); |
237 | goto done; | 237 | goto done; |
238 | } | 238 | } |
@@ -254,7 +254,7 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, | |||
254 | inode_bmap(inode, EXT2_TIND_BLOCK) = b; | 254 | inode_bmap(inode, EXT2_TIND_BLOCK) = b; |
255 | blocks_alloc++; | 255 | blocks_alloc++; |
256 | } | 256 | } |
257 | retval = block_tind_bmap(fs, bmap_flags, b, block_buf, | 257 | retval = block_tind_bmap(fs, bmap_flags, b, block_buf, |
258 | &blocks_alloc, block, phys_blk); | 258 | &blocks_alloc, block, phys_blk); |
259 | done: | 259 | done: |
260 | if (buf) | 260 | if (buf) |
diff --git a/e2fsprogs/ext2fs/bmove.c b/e2fsprogs/ext2fs/bmove.c index 0b2ebb183..fb319f8c3 100644 --- a/e2fsprogs/ext2fs/bmove.c +++ b/e2fsprogs/ext2fs/bmove.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * bmove.c --- Move blocks around to make way for a particular | 2 | * bmove.c --- Move blocks around to make way for a particular |
3 | * filesystem structure. | 3 | * filesystem structure. |
4 | * | 4 | * |
5 | * Copyright (C) 1997 Theodore Ts'o. This file may be redistributed | 5 | * Copyright (C) 1997 Theodore Ts'o. This file may be redistributed |
6 | * under the terms of the GNU Public License. | 6 | * under the terms of the GNU Public License. |
@@ -44,7 +44,7 @@ static int process_block(ext2_filsys fs, blk_t *block_nr, | |||
44 | pb = (struct process_block_struct *) priv_data; | 44 | pb = (struct process_block_struct *) priv_data; |
45 | block = orig = *block_nr; | 45 | block = orig = *block_nr; |
46 | ret = 0; | 46 | ret = 0; |
47 | 47 | ||
48 | /* | 48 | /* |
49 | * Let's see if this is one which we need to relocate | 49 | * Let's see if this is one which we need to relocate |
50 | */ | 50 | */ |
@@ -98,7 +98,7 @@ errcode_t ext2fs_move_blocks(ext2_filsys fs, | |||
98 | struct process_block_struct pb; | 98 | struct process_block_struct pb; |
99 | ext2_inode_scan scan; | 99 | ext2_inode_scan scan; |
100 | char *block_buf; | 100 | char *block_buf; |
101 | 101 | ||
102 | retval = ext2fs_open_inode_scan(fs, 0, &scan); | 102 | retval = ext2fs_open_inode_scan(fs, 0, &scan); |
103 | if (retval) | 103 | if (retval) |
104 | return retval; | 104 | return retval; |
@@ -107,7 +107,7 @@ errcode_t ext2fs_move_blocks(ext2_filsys fs, | |||
107 | pb.error = 0; | 107 | pb.error = 0; |
108 | pb.alloc_map = alloc_map ? alloc_map : fs->block_map; | 108 | pb.alloc_map = alloc_map ? alloc_map : fs->block_map; |
109 | pb.flags = flags; | 109 | pb.flags = flags; |
110 | 110 | ||
111 | retval = ext2fs_get_mem(fs->blocksize * 4, &block_buf); | 111 | retval = ext2fs_get_mem(fs->blocksize * 4, &block_buf); |
112 | if (retval) | 112 | if (retval) |
113 | return retval; | 113 | return retval; |
@@ -131,12 +131,12 @@ errcode_t ext2fs_move_blocks(ext2_filsys fs, | |||
131 | retval = ext2fs_get_next_inode(scan, &ino, &inode); | 131 | retval = ext2fs_get_next_inode(scan, &ino, &inode); |
132 | if (retval) | 132 | if (retval) |
133 | return retval; | 133 | return retval; |
134 | 134 | ||
135 | while (ino) { | 135 | while (ino) { |
136 | if ((inode.i_links_count == 0) || | 136 | if ((inode.i_links_count == 0) || |
137 | !ext2fs_inode_has_valid_blocks(&inode)) | 137 | !ext2fs_inode_has_valid_blocks(&inode)) |
138 | goto next; | 138 | goto next; |
139 | 139 | ||
140 | pb.ino = ino; | 140 | pb.ino = ino; |
141 | pb.inode = &inode; | 141 | pb.inode = &inode; |
142 | 142 | ||
diff --git a/e2fsprogs/ext2fs/brel.h b/e2fsprogs/ext2fs/brel.h index be97243ca..a7f977658 100644 --- a/e2fsprogs/ext2fs/brel.h +++ b/e2fsprogs/ext2fs/brel.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * brel.h | 2 | * brel.h |
3 | * | 3 | * |
4 | * Copyright (C) 1996, 1997 Theodore Ts'o. | 4 | * Copyright (C) 1996, 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -47,7 +47,7 @@ struct ext2_block_relocation_table { | |||
47 | * Initialize for iterating over the block relocation entries. | 47 | * Initialize for iterating over the block relocation entries. |
48 | */ | 48 | */ |
49 | errcode_t (*start_iter)(ext2_brel brel); | 49 | errcode_t (*start_iter)(ext2_brel brel); |
50 | 50 | ||
51 | /* | 51 | /* |
52 | * The iterator function for the inode relocation entries. | 52 | * The iterator function for the inode relocation entries. |
53 | * Returns an inode number of 0 when out of entries. | 53 | * Returns an inode number of 0 when out of entries. |
diff --git a/e2fsprogs/ext2fs/brel_ma.c b/e2fsprogs/ext2fs/brel_ma.c index d422bb2e9..4dcfded37 100644 --- a/e2fsprogs/ext2fs/brel_ma.c +++ b/e2fsprogs/ext2fs/brel_ma.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * brel_ma.c | 2 | * brel_ma.c |
3 | * | 3 | * |
4 | * Copyright (C) 1996, 1997 Theodore Ts'o. | 4 | * Copyright (C) 1996, 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * TODO: rewrite to not use a direct array!!! (Fortunately this | 6 | * TODO: rewrite to not use a direct array!!! (Fortunately this |
@@ -48,7 +48,7 @@ errcode_t ext2fs_brel_memarray_create(char *name, blk_t max_block, | |||
48 | { | 48 | { |
49 | ext2_brel brel = 0; | 49 | ext2_brel brel = 0; |
50 | errcode_t retval; | 50 | errcode_t retval; |
51 | struct brel_ma *ma = 0; | 51 | struct brel_ma *ma = 0; |
52 | size_t size; | 52 | size_t size; |
53 | 53 | ||
54 | *new_brel = 0; | 54 | *new_brel = 0; |
@@ -61,18 +61,18 @@ errcode_t ext2fs_brel_memarray_create(char *name, blk_t max_block, | |||
61 | if (retval) | 61 | if (retval) |
62 | goto errout; | 62 | goto errout; |
63 | memset(brel, 0, sizeof(struct ext2_block_relocation_table)); | 63 | memset(brel, 0, sizeof(struct ext2_block_relocation_table)); |
64 | 64 | ||
65 | retval = ext2fs_get_mem(strlen(name)+1, &brel->name); | 65 | retval = ext2fs_get_mem(strlen(name)+1, &brel->name); |
66 | if (retval) | 66 | if (retval) |
67 | goto errout; | 67 | goto errout; |
68 | strcpy(brel->name, name); | 68 | strcpy(brel->name, name); |
69 | 69 | ||
70 | retval = ext2fs_get_mem(sizeof(struct brel_ma), &ma); | 70 | retval = ext2fs_get_mem(sizeof(struct brel_ma), &ma); |
71 | if (retval) | 71 | if (retval) |
72 | goto errout; | 72 | goto errout; |
73 | memset(ma, 0, sizeof(struct brel_ma)); | 73 | memset(ma, 0, sizeof(struct brel_ma)); |
74 | brel->priv_data = ma; | 74 | brel->priv_data = ma; |
75 | 75 | ||
76 | size = (size_t) (sizeof(struct ext2_block_relocate_entry) * | 76 | size = (size_t) (sizeof(struct ext2_block_relocate_entry) * |
77 | (max_block+1)); | 77 | (max_block+1)); |
78 | retval = ext2fs_get_mem(size, &ma->entries); | 78 | retval = ext2fs_get_mem(size, &ma->entries); |
@@ -91,7 +91,7 @@ errcode_t ext2fs_brel_memarray_create(char *name, blk_t max_block, | |||
91 | brel->move = bma_move; | 91 | brel->move = bma_move; |
92 | brel->delete = bma_delete; | 92 | brel->delete = bma_delete; |
93 | brel->free = bma_free; | 93 | brel->free = bma_free; |
94 | 94 | ||
95 | *new_brel = brel; | 95 | *new_brel = brel; |
96 | return 0; | 96 | return 0; |
97 | 97 | ||
@@ -103,7 +103,7 @@ errout: | |||
103 | static errcode_t bma_put(ext2_brel brel, blk_t old, | 103 | static errcode_t bma_put(ext2_brel brel, blk_t old, |
104 | struct ext2_block_relocate_entry *ent) | 104 | struct ext2_block_relocate_entry *ent) |
105 | { | 105 | { |
106 | struct brel_ma *ma; | 106 | struct brel_ma *ma; |
107 | 107 | ||
108 | ma = brel->priv_data; | 108 | ma = brel->priv_data; |
109 | if (old > ma->max_block) | 109 | if (old > ma->max_block) |
@@ -115,7 +115,7 @@ static errcode_t bma_put(ext2_brel brel, blk_t old, | |||
115 | static errcode_t bma_get(ext2_brel brel, blk_t old, | 115 | static errcode_t bma_get(ext2_brel brel, blk_t old, |
116 | struct ext2_block_relocate_entry *ent) | 116 | struct ext2_block_relocate_entry *ent) |
117 | { | 117 | { |
118 | struct brel_ma *ma; | 118 | struct brel_ma *ma; |
119 | 119 | ||
120 | ma = brel->priv_data; | 120 | ma = brel->priv_data; |
121 | if (old > ma->max_block) | 121 | if (old > ma->max_block) |
@@ -135,7 +135,7 @@ static errcode_t bma_start_iter(ext2_brel brel) | |||
135 | static errcode_t bma_next(ext2_brel brel, blk_t *old, | 135 | static errcode_t bma_next(ext2_brel brel, blk_t *old, |
136 | struct ext2_block_relocate_entry *ent) | 136 | struct ext2_block_relocate_entry *ent) |
137 | { | 137 | { |
138 | struct brel_ma *ma; | 138 | struct brel_ma *ma; |
139 | 139 | ||
140 | ma = brel->priv_data; | 140 | ma = brel->priv_data; |
141 | while (++brel->current < ma->max_block) { | 141 | while (++brel->current < ma->max_block) { |
@@ -151,7 +151,7 @@ static errcode_t bma_next(ext2_brel brel, blk_t *old, | |||
151 | 151 | ||
152 | static errcode_t bma_move(ext2_brel brel, blk_t old, blk_t new) | 152 | static errcode_t bma_move(ext2_brel brel, blk_t old, blk_t new) |
153 | { | 153 | { |
154 | struct brel_ma *ma; | 154 | struct brel_ma *ma; |
155 | 155 | ||
156 | ma = brel->priv_data; | 156 | ma = brel->priv_data; |
157 | if ((old > ma->max_block) || (new > ma->max_block)) | 157 | if ((old > ma->max_block) || (new > ma->max_block)) |
@@ -165,7 +165,7 @@ static errcode_t bma_move(ext2_brel brel, blk_t old, blk_t new) | |||
165 | 165 | ||
166 | static errcode_t bma_delete(ext2_brel brel, blk_t old) | 166 | static errcode_t bma_delete(ext2_brel brel, blk_t old) |
167 | { | 167 | { |
168 | struct brel_ma *ma; | 168 | struct brel_ma *ma; |
169 | 169 | ||
170 | ma = brel->priv_data; | 170 | ma = brel->priv_data; |
171 | if (old > ma->max_block) | 171 | if (old > ma->max_block) |
@@ -178,7 +178,7 @@ static errcode_t bma_delete(ext2_brel brel, blk_t old) | |||
178 | 178 | ||
179 | static errcode_t bma_free(ext2_brel brel) | 179 | static errcode_t bma_free(ext2_brel brel) |
180 | { | 180 | { |
181 | struct brel_ma *ma; | 181 | struct brel_ma *ma; |
182 | 182 | ||
183 | if (!brel) | 183 | if (!brel) |
184 | return 0; | 184 | return 0; |
diff --git a/e2fsprogs/ext2fs/check_desc.c b/e2fsprogs/ext2fs/check_desc.c index 2a754c7f6..eab8c7bc8 100644 --- a/e2fsprogs/ext2fs/check_desc.c +++ b/e2fsprogs/ext2fs/check_desc.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * check_desc.c --- Check the group descriptors of an ext2 filesystem | 2 | * check_desc.c --- Check the group descriptors of an ext2 filesystem |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -61,7 +61,7 @@ errcode_t ext2fs_check_desc(ext2_filsys fs) | |||
61 | ((fs->group_desc[i].bg_inode_table + | 61 | ((fs->group_desc[i].bg_inode_table + |
62 | fs->inode_blocks_per_group) >= next)) | 62 | fs->inode_blocks_per_group) >= next)) |
63 | return EXT2_ET_GDESC_BAD_INODE_TABLE; | 63 | return EXT2_ET_GDESC_BAD_INODE_TABLE; |
64 | 64 | ||
65 | block = next; | 65 | block = next; |
66 | } | 66 | } |
67 | return 0; | 67 | return 0; |
diff --git a/e2fsprogs/ext2fs/closefs.c b/e2fsprogs/ext2fs/closefs.c index 23e6332db..da0016b0e 100644 --- a/e2fsprogs/ext2fs/closefs.c +++ b/e2fsprogs/ext2fs/closefs.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * closefs.c --- close an ext2 filesystem | 2 | * closefs.c --- close an ext2 filesystem |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -45,7 +45,7 @@ int ext2fs_bg_has_super(ext2_filsys fs, int group_block) | |||
45 | return 0; | 45 | return 0; |
46 | } | 46 | } |
47 | 47 | ||
48 | int ext2fs_super_and_bgd_loc(ext2_filsys fs, | 48 | int ext2fs_super_and_bgd_loc(ext2_filsys fs, |
49 | dgrp_t group, | 49 | dgrp_t group, |
50 | blk_t *ret_super_blk, | 50 | blk_t *ret_super_blk, |
51 | blk_t *ret_old_desc_blk, | 51 | blk_t *ret_old_desc_blk, |
@@ -63,7 +63,7 @@ int ext2fs_super_and_bgd_loc(ext2_filsys fs, | |||
63 | if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) | 63 | if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG) |
64 | old_desc_blocks = fs->super->s_first_meta_bg; | 64 | old_desc_blocks = fs->super->s_first_meta_bg; |
65 | else | 65 | else |
66 | old_desc_blocks = | 66 | old_desc_blocks = |
67 | fs->desc_blocks + fs->super->s_reserved_gdt_blocks; | 67 | fs->desc_blocks + fs->super->s_reserved_gdt_blocks; |
68 | 68 | ||
69 | if (group == fs->group_desc_count-1) { | 69 | if (group == fs->group_desc_count-1) { |
@@ -100,7 +100,7 @@ int ext2fs_super_and_bgd_loc(ext2_filsys fs, | |||
100 | numblocks--; | 100 | numblocks--; |
101 | } | 101 | } |
102 | } | 102 | } |
103 | 103 | ||
104 | numblocks -= 2 + fs->inode_blocks_per_group; | 104 | numblocks -= 2 + fs->inode_blocks_per_group; |
105 | 105 | ||
106 | if (ret_super_blk) | 106 | if (ret_super_blk) |
@@ -188,7 +188,7 @@ static errcode_t write_backup_super(ext2_filsys fs, dgrp_t group, | |||
188 | struct ext2_super_block *super_shadow) | 188 | struct ext2_super_block *super_shadow) |
189 | { | 189 | { |
190 | dgrp_t sgrp = group; | 190 | dgrp_t sgrp = group; |
191 | 191 | ||
192 | if (sgrp > ((1 << 16) - 1)) | 192 | if (sgrp > ((1 << 16) - 1)) |
193 | sgrp = (1 << 16) - 1; | 193 | sgrp = (1 << 16) - 1; |
194 | #ifdef EXT2FS_ENABLE_SWAPFS | 194 | #ifdef EXT2FS_ENABLE_SWAPFS |
@@ -198,7 +198,7 @@ static errcode_t write_backup_super(ext2_filsys fs, dgrp_t group, | |||
198 | #endif | 198 | #endif |
199 | fs->super->s_block_group_nr = sgrp; | 199 | fs->super->s_block_group_nr = sgrp; |
200 | 200 | ||
201 | return io_channel_write_blk(fs->io, group_block, -SUPERBLOCK_SIZE, | 201 | return io_channel_write_blk(fs->io, group_block, -SUPERBLOCK_SIZE, |
202 | super_shadow); | 202 | super_shadow); |
203 | } | 203 | } |
204 | 204 | ||
@@ -217,7 +217,7 @@ errcode_t ext2fs_flush(ext2_filsys fs) | |||
217 | dgrp_t j; | 217 | dgrp_t j; |
218 | struct ext2_group_desc *s, *t; | 218 | struct ext2_group_desc *s, *t; |
219 | #endif | 219 | #endif |
220 | 220 | ||
221 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); | 221 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); |
222 | 222 | ||
223 | fs_state = fs->super->s_state; | 223 | fs_state = fs->super->s_state; |
@@ -252,7 +252,7 @@ errcode_t ext2fs_flush(ext2_filsys fs) | |||
252 | super_shadow = fs->super; | 252 | super_shadow = fs->super; |
253 | group_shadow = fs->group_desc; | 253 | group_shadow = fs->group_desc; |
254 | #endif | 254 | #endif |
255 | 255 | ||
256 | /* | 256 | /* |
257 | * If this is an external journal device, don't write out the | 257 | * If this is an external journal device, don't write out the |
258 | * block group descriptors or any of the backup superblocks | 258 | * block group descriptors or any of the backup superblocks |
@@ -289,7 +289,7 @@ errcode_t ext2fs_flush(ext2_filsys fs) | |||
289 | blk_t super_blk, old_desc_blk, new_desc_blk; | 289 | blk_t super_blk, old_desc_blk, new_desc_blk; |
290 | int meta_bg; | 290 | int meta_bg; |
291 | 291 | ||
292 | ext2fs_super_and_bgd_loc(fs, i, &super_blk, &old_desc_blk, | 292 | ext2fs_super_and_bgd_loc(fs, i, &super_blk, &old_desc_blk, |
293 | &new_desc_blk, &meta_bg); | 293 | &new_desc_blk, &meta_bg); |
294 | 294 | ||
295 | if (!(fs->flags & EXT2_FLAG_MASTER_SB_ONLY) &&i && super_blk) { | 295 | if (!(fs->flags & EXT2_FLAG_MASTER_SB_ONLY) &&i && super_blk) { |
@@ -300,7 +300,7 @@ errcode_t ext2fs_flush(ext2_filsys fs) | |||
300 | } | 300 | } |
301 | if (fs->flags & EXT2_FLAG_SUPER_ONLY) | 301 | if (fs->flags & EXT2_FLAG_SUPER_ONLY) |
302 | continue; | 302 | continue; |
303 | if ((old_desc_blk) && | 303 | if ((old_desc_blk) && |
304 | (!(fs->flags & EXT2_FLAG_MASTER_SB_ONLY) || (i == 0))) { | 304 | (!(fs->flags & EXT2_FLAG_MASTER_SB_ONLY) || (i == 0))) { |
305 | retval = io_channel_write_blk(fs->io, | 305 | retval = io_channel_write_blk(fs->io, |
306 | old_desc_blk, old_desc_blocks, group_ptr); | 306 | old_desc_blk, old_desc_blocks, group_ptr); |
@@ -365,7 +365,7 @@ errout: | |||
365 | errcode_t ext2fs_close(ext2_filsys fs) | 365 | errcode_t ext2fs_close(ext2_filsys fs) |
366 | { | 366 | { |
367 | errcode_t retval; | 367 | errcode_t retval; |
368 | 368 | ||
369 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); | 369 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); |
370 | 370 | ||
371 | if (fs->flags & EXT2_FLAG_DIRTY) { | 371 | if (fs->flags & EXT2_FLAG_DIRTY) { |
diff --git a/e2fsprogs/ext2fs/cmp_bitmaps.c b/e2fsprogs/ext2fs/cmp_bitmaps.c index 51cc3d0a5..fa45a4331 100644 --- a/e2fsprogs/ext2fs/cmp_bitmaps.c +++ b/e2fsprogs/ext2fs/cmp_bitmaps.c | |||
@@ -30,7 +30,7 @@ errcode_t ext2fs_compare_block_bitmap(ext2fs_block_bitmap bm1, | |||
30 | ext2fs_block_bitmap bm2) | 30 | ext2fs_block_bitmap bm2) |
31 | { | 31 | { |
32 | blk_t i; | 32 | blk_t i; |
33 | 33 | ||
34 | EXT2_CHECK_MAGIC(bm1, EXT2_ET_MAGIC_BLOCK_BITMAP); | 34 | EXT2_CHECK_MAGIC(bm1, EXT2_ET_MAGIC_BLOCK_BITMAP); |
35 | EXT2_CHECK_MAGIC(bm2, EXT2_ET_MAGIC_BLOCK_BITMAP); | 35 | EXT2_CHECK_MAGIC(bm2, EXT2_ET_MAGIC_BLOCK_BITMAP); |
36 | 36 | ||
@@ -52,7 +52,7 @@ errcode_t ext2fs_compare_inode_bitmap(ext2fs_inode_bitmap bm1, | |||
52 | ext2fs_inode_bitmap bm2) | 52 | ext2fs_inode_bitmap bm2) |
53 | { | 53 | { |
54 | ext2_ino_t i; | 54 | ext2_ino_t i; |
55 | 55 | ||
56 | EXT2_CHECK_MAGIC(bm1, EXT2_ET_MAGIC_INODE_BITMAP); | 56 | EXT2_CHECK_MAGIC(bm1, EXT2_ET_MAGIC_INODE_BITMAP); |
57 | EXT2_CHECK_MAGIC(bm2, EXT2_ET_MAGIC_INODE_BITMAP); | 57 | EXT2_CHECK_MAGIC(bm2, EXT2_ET_MAGIC_INODE_BITMAP); |
58 | 58 | ||
diff --git a/e2fsprogs/ext2fs/dblist.c b/e2fsprogs/ext2fs/dblist.c index d5833d728..0cf5698fa 100644 --- a/e2fsprogs/ext2fs/dblist.c +++ b/e2fsprogs/ext2fs/dblist.c | |||
@@ -1,13 +1,13 @@ | |||
1 | /* | 1 | /* |
2 | * dblist.c -- directory block list functions | 2 | * dblist.c -- directory block list functions |
3 | * | 3 | * |
4 | * Copyright 1997 by Theodore Ts'o | 4 | * Copyright 1997 by Theodore Ts'o |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
7 | * This file may be redistributed under the terms of the GNU Public | 7 | * This file may be redistributed under the terms of the GNU Public |
8 | * License. | 8 | * License. |
9 | * %End-Header% | 9 | * %End-Header% |
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <stdio.h> | 13 | #include <stdio.h> |
@@ -33,7 +33,7 @@ errcode_t ext2fs_get_num_dirs(ext2_filsys fs, ext2_ino_t *ret_num_dirs) | |||
33 | ext2_ino_t num_dirs, max_dirs; | 33 | ext2_ino_t num_dirs, max_dirs; |
34 | 34 | ||
35 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); | 35 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); |
36 | 36 | ||
37 | num_dirs = 0; | 37 | num_dirs = 0; |
38 | max_dirs = fs->super->s_inodes_per_group; | 38 | max_dirs = fs->super->s_inodes_per_group; |
39 | for (i = 0; i < fs->group_desc_count; i++) { | 39 | for (i = 0; i < fs->group_desc_count; i++) { |
@@ -88,7 +88,7 @@ static errcode_t make_dblist(ext2_filsys fs, ext2_ino_t size, ext2_ino_t count, | |||
88 | retval = ext2fs_get_mem(len, &dblist->list); | 88 | retval = ext2fs_get_mem(len, &dblist->list); |
89 | if (retval) | 89 | if (retval) |
90 | goto cleanup; | 90 | goto cleanup; |
91 | 91 | ||
92 | if (list) | 92 | if (list) |
93 | memcpy(dblist->list, list, len); | 93 | memcpy(dblist->list, list, len); |
94 | else | 94 | else |
@@ -155,10 +155,10 @@ errcode_t ext2fs_copy_dblist(ext2_dblist src, ext2_dblist *dest) | |||
155 | errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ext2_ino_t ino, blk_t blk, | 155 | errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ext2_ino_t ino, blk_t blk, |
156 | int blockcnt) | 156 | int blockcnt) |
157 | { | 157 | { |
158 | struct ext2_db_entry *new_entry; | 158 | struct ext2_db_entry *new_entry; |
159 | errcode_t retval; | 159 | errcode_t retval; |
160 | unsigned long old_size; | 160 | unsigned long old_size; |
161 | 161 | ||
162 | EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST); | 162 | EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST); |
163 | 163 | ||
164 | if (dblist->count >= dblist->size) { | 164 | if (dblist->count >= dblist->size) { |
@@ -189,7 +189,7 @@ errcode_t ext2fs_set_dir_block(ext2_dblist dblist, ext2_ino_t ino, blk_t blk, | |||
189 | int blockcnt) | 189 | int blockcnt) |
190 | { | 190 | { |
191 | dgrp_t i; | 191 | dgrp_t i; |
192 | 192 | ||
193 | EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST); | 193 | EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST); |
194 | 194 | ||
195 | for (i=0; i < dblist->count; i++) { | 195 | for (i=0; i < dblist->count; i++) { |
@@ -225,7 +225,7 @@ errcode_t ext2fs_dblist_iterate(ext2_dblist dblist, | |||
225 | { | 225 | { |
226 | ext2_ino_t i; | 226 | ext2_ino_t i; |
227 | int ret; | 227 | int ret; |
228 | 228 | ||
229 | EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST); | 229 | EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST); |
230 | 230 | ||
231 | if (!dblist->sorted) | 231 | if (!dblist->sorted) |
@@ -247,7 +247,7 @@ static EXT2_QSORT_TYPE dir_block_cmp(const void *a, const void *b) | |||
247 | 247 | ||
248 | if (db_a->blk != db_b->blk) | 248 | if (db_a->blk != db_b->blk) |
249 | return (int) (db_a->blk - db_b->blk); | 249 | return (int) (db_a->blk - db_b->blk); |
250 | 250 | ||
251 | if (db_a->ino != db_b->ino) | 251 | if (db_a->ino != db_b->ino) |
252 | return (int) (db_a->ino - db_b->ino); | 252 | return (int) (db_a->ino - db_b->ino); |
253 | 253 | ||
diff --git a/e2fsprogs/ext2fs/dblist_dir.c b/e2fsprogs/ext2fs/dblist_dir.c index f2e17a61d..20b1cde46 100644 --- a/e2fsprogs/ext2fs/dblist_dir.c +++ b/e2fsprogs/ext2fs/dblist_dir.c | |||
@@ -2,12 +2,12 @@ | |||
2 | * dblist_dir.c --- iterate by directory entry | 2 | * dblist_dir.c --- iterate by directory entry |
3 | * | 3 | * |
4 | * Copyright 1997 by Theodore Ts'o | 4 | * Copyright 1997 by Theodore Ts'o |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
7 | * This file may be redistributed under the terms of the GNU Public | 7 | * This file may be redistributed under the terms of the GNU Public |
8 | * License. | 8 | * License. |
9 | * %End-Header% | 9 | * %End-Header% |
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <stdio.h> | 13 | #include <stdio.h> |
@@ -54,7 +54,7 @@ errcode_t ext2fs_dblist_dir_iterate(ext2_dblist dblist, | |||
54 | ctx.errcode = 0; | 54 | ctx.errcode = 0; |
55 | 55 | ||
56 | retval = ext2fs_dblist_iterate(dblist, db_dir_proc, &ctx); | 56 | retval = ext2fs_dblist_iterate(dblist, db_dir_proc, &ctx); |
57 | 57 | ||
58 | if (!block_buf) | 58 | if (!block_buf) |
59 | ext2fs_free_mem(&ctx.buf); | 59 | ext2fs_free_mem(&ctx.buf); |
60 | if (retval) | 60 | if (retval) |
@@ -69,7 +69,7 @@ static int db_dir_proc(ext2_filsys fs, struct ext2_db_entry *db_info, | |||
69 | 69 | ||
70 | ctx = (struct dir_context *) priv_data; | 70 | ctx = (struct dir_context *) priv_data; |
71 | ctx->dir = db_info->ino; | 71 | ctx->dir = db_info->ino; |
72 | 72 | ||
73 | return ext2fs_process_dir_block(fs, &db_info->blk, | 73 | return ext2fs_process_dir_block(fs, &db_info->blk, |
74 | db_info->blockcnt, 0, 0, priv_data); | 74 | db_info->blockcnt, 0, 0, priv_data); |
75 | } | 75 | } |
diff --git a/e2fsprogs/ext2fs/dir_iterate.c b/e2fsprogs/ext2fs/dir_iterate.c index 003c0a3bd..df820feaa 100644 --- a/e2fsprogs/ext2fs/dir_iterate.c +++ b/e2fsprogs/ext2fs/dir_iterate.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * dir_iterate.c --- ext2fs directory iteration operations | 2 | * dir_iterate.c --- ext2fs directory iteration operations |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1994, 1995, 1996, 1997 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1994, 1995, 1996, 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -32,7 +32,7 @@ | |||
32 | static int ext2fs_validate_entry(char *buf, int offset, int final_offset) | 32 | static int ext2fs_validate_entry(char *buf, int offset, int final_offset) |
33 | { | 33 | { |
34 | struct ext2_dir_entry *dirent; | 34 | struct ext2_dir_entry *dirent; |
35 | 35 | ||
36 | while (offset < final_offset) { | 36 | while (offset < final_offset) { |
37 | dirent = (struct ext2_dir_entry *)(buf + offset); | 37 | dirent = (struct ext2_dir_entry *)(buf + offset); |
38 | offset += dirent->rec_len; | 38 | offset += dirent->rec_len; |
@@ -59,13 +59,13 @@ errcode_t ext2fs_dir_iterate2(ext2_filsys fs, | |||
59 | { | 59 | { |
60 | struct dir_context ctx; | 60 | struct dir_context ctx; |
61 | errcode_t retval; | 61 | errcode_t retval; |
62 | 62 | ||
63 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); | 63 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); |
64 | 64 | ||
65 | retval = ext2fs_check_directory(fs, dir); | 65 | retval = ext2fs_check_directory(fs, dir); |
66 | if (retval) | 66 | if (retval) |
67 | return retval; | 67 | return retval; |
68 | 68 | ||
69 | ctx.dir = dir; | 69 | ctx.dir = dir; |
70 | ctx.flags = flags; | 70 | ctx.flags = flags; |
71 | if (block_buf) | 71 | if (block_buf) |
@@ -106,7 +106,7 @@ static int xlate_func(ext2_ino_t dir EXT2FS_ATTR((unused)), | |||
106 | return (*xl->func)(dirent, offset, blocksize, buf, xl->real_private); | 106 | return (*xl->func)(dirent, offset, blocksize, buf, xl->real_private); |
107 | } | 107 | } |
108 | 108 | ||
109 | extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, | 109 | extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, |
110 | ext2_ino_t dir, | 110 | ext2_ino_t dir, |
111 | int flags, | 111 | int flags, |
112 | char *block_buf, | 112 | char *block_buf, |
@@ -118,7 +118,7 @@ extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, | |||
118 | void *priv_data) | 118 | void *priv_data) |
119 | { | 119 | { |
120 | struct xlate xl; | 120 | struct xlate xl; |
121 | 121 | ||
122 | xl.real_private = priv_data; | 122 | xl.real_private = priv_data; |
123 | xl.func = func; | 123 | xl.func = func; |
124 | 124 | ||
@@ -151,7 +151,7 @@ int ext2fs_process_dir_block(ext2_filsys fs, | |||
151 | return 0; | 151 | return 0; |
152 | 152 | ||
153 | entry = blockcnt ? DIRENT_OTHER_FILE : DIRENT_DOT_FILE; | 153 | entry = blockcnt ? DIRENT_OTHER_FILE : DIRENT_DOT_FILE; |
154 | 154 | ||
155 | ctx->errcode = ext2fs_read_dir_block(fs, *blocknr, ctx->buf); | 155 | ctx->errcode = ext2fs_read_dir_block(fs, *blocknr, ctx->buf); |
156 | if (ctx->errcode) | 156 | if (ctx->errcode) |
157 | return BLOCK_ABORT; | 157 | return BLOCK_ABORT; |
@@ -177,18 +177,18 @@ int ext2fs_process_dir_block(ext2_filsys fs, | |||
177 | ctx->priv_data); | 177 | ctx->priv_data); |
178 | if (entry < DIRENT_OTHER_FILE) | 178 | if (entry < DIRENT_OTHER_FILE) |
179 | entry++; | 179 | entry++; |
180 | 180 | ||
181 | if (ret & DIRENT_CHANGED) | 181 | if (ret & DIRENT_CHANGED) |
182 | changed++; | 182 | changed++; |
183 | if (ret & DIRENT_ABORT) { | 183 | if (ret & DIRENT_ABORT) { |
184 | do_abort++; | 184 | do_abort++; |
185 | break; | 185 | break; |
186 | } | 186 | } |
187 | next: | 187 | next: |
188 | if (next_real_entry == offset) | 188 | if (next_real_entry == offset) |
189 | next_real_entry += dirent->rec_len; | 189 | next_real_entry += dirent->rec_len; |
190 | 190 | ||
191 | if (ctx->flags & DIRENT_FLAG_INCLUDE_REMOVED) { | 191 | if (ctx->flags & DIRENT_FLAG_INCLUDE_REMOVED) { |
192 | size = ((dirent->name_len & 0xFF) + 11) & ~3; | 192 | size = ((dirent->name_len & 0xFF) + 11) & ~3; |
193 | 193 | ||
194 | if (dirent->rec_len != size) { | 194 | if (dirent->rec_len != size) { |
diff --git a/e2fsprogs/ext2fs/dirblock.c b/e2fsprogs/ext2fs/dirblock.c index 5d66ad194..9f82b5002 100644 --- a/e2fsprogs/ext2fs/dirblock.c +++ b/e2fsprogs/ext2fs/dirblock.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * dirblock.c --- directory block routines. | 2 | * dirblock.c --- directory block routines. |
3 | * | 3 | * |
4 | * Copyright (C) 1995, 1996 Theodore Ts'o. | 4 | * Copyright (C) 1995, 1996 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -28,9 +28,9 @@ errcode_t ext2fs_read_dir_block2(ext2_filsys fs, blk_t block, | |||
28 | unsigned int name_len, rec_len; | 28 | unsigned int name_len, rec_len; |
29 | #ifdef EXT2FS_ENABLE_SWAPFS | 29 | #ifdef EXT2FS_ENABLE_SWAPFS |
30 | unsigned int do_swap; | 30 | unsigned int do_swap; |
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | retval = io_channel_read_blk(fs->io, block, 1, buf); | 33 | retval = io_channel_read_blk(fs->io, block, 1, buf); |
34 | if (retval) | 34 | if (retval) |
35 | return retval; | 35 | return retval; |
36 | #ifdef EXT2FS_ENABLE_SWAPFS | 36 | #ifdef EXT2FS_ENABLE_SWAPFS |
@@ -110,16 +110,16 @@ errcode_t ext2fs_write_dir_block2(ext2_filsys fs, blk_t block, | |||
110 | dirent->rec_len = ext2fs_swab16(dirent->rec_len); | 110 | dirent->rec_len = ext2fs_swab16(dirent->rec_len); |
111 | dirent->name_len = ext2fs_swab16(dirent->name_len); | 111 | dirent->name_len = ext2fs_swab16(dirent->name_len); |
112 | } | 112 | } |
113 | #ifdef WORDS_BIGENDIAN | 113 | #ifdef WORDS_BIGENDIAN |
114 | if (flags & EXT2_DIRBLOCK_V2_STRUCT) | 114 | if (flags & EXT2_DIRBLOCK_V2_STRUCT) |
115 | dirent->name_len = ext2fs_swab16(dirent->name_len); | 115 | dirent->name_len = ext2fs_swab16(dirent->name_len); |
116 | #endif | 116 | #endif |
117 | } | 117 | } |
118 | retval = io_channel_write_blk(fs->io, block, 1, buf); | 118 | retval = io_channel_write_blk(fs->io, block, 1, buf); |
119 | ext2fs_free_mem(&buf); | 119 | ext2fs_free_mem(&buf); |
120 | return retval; | 120 | return retval; |
121 | #else | 121 | #else |
122 | return io_channel_write_blk(fs->io, block, 1, (char *) inbuf); | 122 | return io_channel_write_blk(fs->io, block, 1, (char *) inbuf); |
123 | #endif | 123 | #endif |
124 | } | 124 | } |
125 | 125 | ||
diff --git a/e2fsprogs/ext2fs/dirhash.c b/e2fsprogs/ext2fs/dirhash.c index 4d18593f5..39678a628 100644 --- a/e2fsprogs/ext2fs/dirhash.c +++ b/e2fsprogs/ext2fs/dirhash.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * dirhash.c -- Calculate the hash of a directory entry | 2 | * dirhash.c -- Calculate the hash of a directory entry |
3 | * | 3 | * |
4 | * Copyright (c) 2001 Daniel Phillips | 4 | * Copyright (c) 2001 Daniel Phillips |
5 | * | 5 | * |
6 | * Copyright (c) 2002 Theodore Ts'o. | 6 | * Copyright (c) 2002 Theodore Ts'o. |
7 | * | 7 | * |
8 | * %Begin-Header% | 8 | * %Begin-Header% |
@@ -25,7 +25,7 @@ | |||
25 | * (see Applied Cryptography, 2nd edition, p448). | 25 | * (see Applied Cryptography, 2nd edition, p448). |
26 | * | 26 | * |
27 | * Jeremy Fitzhardinge <jeremy@zip.com.au> 1998 | 27 | * Jeremy Fitzhardinge <jeremy@zip.com.au> 1998 |
28 | * | 28 | * |
29 | * This code is made available under the terms of the GPL | 29 | * This code is made available under the terms of the GPL |
30 | */ | 30 | */ |
31 | #define DELTA 0x9E3779B9 | 31 | #define DELTA 0x9E3779B9 |
@@ -37,10 +37,10 @@ static void TEA_transform(__u32 buf[4], __u32 const in[]) | |||
37 | __u32 a = in[0], b = in[1], c = in[2], d = in[3]; | 37 | __u32 a = in[0], b = in[1], c = in[2], d = in[3]; |
38 | int n = 16; | 38 | int n = 16; |
39 | 39 | ||
40 | do { | 40 | do { |
41 | sum += DELTA; | 41 | sum += DELTA; |
42 | b0 += ((b1 << 4)+a) ^ (b1+sum) ^ ((b1 >> 5)+b); | 42 | b0 += ((b1 << 4)+a) ^ (b1+sum) ^ ((b1 >> 5)+b); |
43 | b1 += ((b0 << 4)+c) ^ (b0+sum) ^ ((b0 >> 5)+d); | 43 | b1 += ((b0 << 4)+c) ^ (b0+sum) ^ ((b0 >> 5)+d); |
44 | } while(--n); | 44 | } while(--n); |
45 | 45 | ||
46 | buf[0] += b0; | 46 | buf[0] += b0; |
@@ -121,7 +121,7 @@ static ext2_dirhash_t dx_hack_hash (const char *name, int len) | |||
121 | __u32 hash0 = 0x12a3fe2d, hash1 = 0x37abe8f9; | 121 | __u32 hash0 = 0x12a3fe2d, hash1 = 0x37abe8f9; |
122 | while (len--) { | 122 | while (len--) { |
123 | __u32 hash = hash1 + (hash0 ^ (*name++ * 7152373)); | 123 | __u32 hash = hash1 + (hash0 ^ (*name++ * 7152373)); |
124 | 124 | ||
125 | if (hash & 0x80000000) hash -= 0x7fffffff; | 125 | if (hash & 0x80000000) hash -= 0x7fffffff; |
126 | hash1 = hash0; | 126 | hash1 = hash0; |
127 | hash0 = hash; | 127 | hash0 = hash; |
@@ -160,11 +160,11 @@ static void str2hashbuf(const char *msg, int len, __u32 *buf, int num) | |||
160 | * Returns the hash of a filename. If len is 0 and name is NULL, then | 160 | * Returns the hash of a filename. If len is 0 and name is NULL, then |
161 | * this function can be used to test whether or not a hash version is | 161 | * this function can be used to test whether or not a hash version is |
162 | * supported. | 162 | * supported. |
163 | * | 163 | * |
164 | * The seed is an 4 longword (32 bits) "secret" which can be used to | 164 | * The seed is an 4 longword (32 bits) "secret" which can be used to |
165 | * uniquify a hash. If the seed is all zero's, then some default seed | 165 | * uniquify a hash. If the seed is all zero's, then some default seed |
166 | * may be used. | 166 | * may be used. |
167 | * | 167 | * |
168 | * A particular hash version specifies whether or not the seed is | 168 | * A particular hash version specifies whether or not the seed is |
169 | * represented, and whether or not the returned hash is 32 bits or 64 | 169 | * represented, and whether or not the returned hash is 32 bits or 64 |
170 | * bits. 32 bit hashes will return 0 for the minor hash. | 170 | * bits. 32 bit hashes will return 0 for the minor hash. |
@@ -178,7 +178,7 @@ errcode_t ext2fs_dirhash(int version, const char *name, int len, | |||
178 | __u32 minor_hash = 0; | 178 | __u32 minor_hash = 0; |
179 | const char *p; | 179 | const char *p; |
180 | int i; | 180 | int i; |
181 | __u32 in[8], buf[4]; | 181 | __u32 in[8], buf[4]; |
182 | 182 | ||
183 | /* Initialize the default seed for the hash checksum functions */ | 183 | /* Initialize the default seed for the hash checksum functions */ |
184 | buf[0] = 0x67452301; | 184 | buf[0] = 0x67452301; |
@@ -195,7 +195,7 @@ errcode_t ext2fs_dirhash(int version, const char *name, int len, | |||
195 | if (i < 4) | 195 | if (i < 4) |
196 | memcpy(buf, seed, sizeof(buf)); | 196 | memcpy(buf, seed, sizeof(buf)); |
197 | } | 197 | } |
198 | 198 | ||
199 | switch (version) { | 199 | switch (version) { |
200 | case EXT2_HASH_LEGACY: | 200 | case EXT2_HASH_LEGACY: |
201 | hash = dx_hack_hash(name, len); | 201 | hash = dx_hack_hash(name, len); |
diff --git a/e2fsprogs/ext2fs/dupfs.c b/e2fsprogs/ext2fs/dupfs.c index f8919c222..2009ef701 100644 --- a/e2fsprogs/ext2fs/dupfs.c +++ b/e2fsprogs/ext2fs/dupfs.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * dupfs.c --- duplicate a ext2 filesystem handle | 2 | * dupfs.c --- duplicate a ext2 filesystem handle |
3 | * | 3 | * |
4 | * Copyright (C) 1997, 1998, 2001, 2003, 2005 by Theodore Ts'o. | 4 | * Copyright (C) 1997, 1998, 2001, 2003, 2005 by Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -25,7 +25,7 @@ errcode_t ext2fs_dup_handle(ext2_filsys src, ext2_filsys *dest) | |||
25 | errcode_t retval; | 25 | errcode_t retval; |
26 | 26 | ||
27 | EXT2_CHECK_MAGIC(src, EXT2_ET_MAGIC_EXT2FS_FILSYS); | 27 | EXT2_CHECK_MAGIC(src, EXT2_ET_MAGIC_EXT2FS_FILSYS); |
28 | 28 | ||
29 | retval = ext2fs_get_mem(sizeof(struct struct_ext2_filsys), &fs); | 29 | retval = ext2fs_get_mem(sizeof(struct struct_ext2_filsys), &fs); |
30 | if (retval) | 30 | if (retval) |
31 | return retval; | 31 | return retval; |
@@ -91,6 +91,6 @@ errcode_t ext2fs_dup_handle(ext2_filsys src, ext2_filsys *dest) | |||
91 | errout: | 91 | errout: |
92 | ext2fs_free(fs); | 92 | ext2fs_free(fs); |
93 | return retval; | 93 | return retval; |
94 | 94 | ||
95 | } | 95 | } |
96 | 96 | ||
diff --git a/e2fsprogs/ext2fs/e2image.h b/e2fsprogs/ext2fs/e2image.h index e12b7d69b..c05d43e22 100644 --- a/e2fsprogs/ext2fs/e2image.h +++ b/e2fsprogs/ext2fs/e2image.h | |||
@@ -1,10 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | * e2image.h --- header file describing the ext2 image format | 2 | * e2image.h --- header file describing the ext2 image format |
3 | * | 3 | * |
4 | * Copyright (C) 2000 Theodore Ts'o. | 4 | * Copyright (C) 2000 Theodore Ts'o. |
5 | * | 5 | * |
6 | * Note: this uses the POSIX IO interfaces, unlike most of the other | 6 | * Note: this uses the POSIX IO interfaces, unlike most of the other |
7 | * functions in this library. So sue me. | 7 | * functions in this library. So sue me. |
8 | * | 8 | * |
9 | * %Begin-Header% | 9 | * %Begin-Header% |
10 | * This file may be redistributed under the terms of the GNU Public | 10 | * This file may be redistributed under the terms of the GNU Public |
@@ -24,7 +24,7 @@ struct ext2_image_hdr { | |||
24 | char fs_uuid[16]; /* UUID of filesystem */ | 24 | char fs_uuid[16]; /* UUID of filesystem */ |
25 | __u32 fs_blocksize; /* Block size of the filesystem */ | 25 | __u32 fs_blocksize; /* Block size of the filesystem */ |
26 | __u32 fs_reserved[8]; | 26 | __u32 fs_reserved[8]; |
27 | 27 | ||
28 | __u32 image_device; /* Device number of image file */ | 28 | __u32 image_device; /* Device number of image file */ |
29 | __u32 image_inode; /* Inode number of image file */ | 29 | __u32 image_inode; /* Inode number of image file */ |
30 | __u32 image_time; /* Time of image creation */ | 30 | __u32 image_time; /* Time of image creation */ |
@@ -37,15 +37,15 @@ struct ext2_image_hdr { | |||
37 | __u32 offset_reserved[8]; | 37 | __u32 offset_reserved[8]; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | 40 | ||
41 | 41 | ||
42 | 42 | ||
43 | 43 | ||
44 | 44 | ||
45 | 45 | ||
46 | 46 | ||
47 | 47 | ||
48 | 48 | ||
49 | 49 | ||
50 | 50 | ||
51 | 51 | ||
diff --git a/e2fsprogs/ext2fs/expanddir.c b/e2fsprogs/ext2fs/expanddir.c index 10a5149cf..c148b93aa 100644 --- a/e2fsprogs/ext2fs/expanddir.c +++ b/e2fsprogs/ext2fs/expanddir.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * expand.c --- expand an ext2fs directory | 2 | * expand.c --- expand an ext2fs directory |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -36,7 +36,7 @@ static int expand_dir_proc(ext2_filsys fs, | |||
36 | static blk_t last_blk = 0; | 36 | static blk_t last_blk = 0; |
37 | char *block; | 37 | char *block; |
38 | errcode_t retval; | 38 | errcode_t retval; |
39 | 39 | ||
40 | if (*blocknr) { | 40 | if (*blocknr) { |
41 | last_blk = *blocknr; | 41 | last_blk = *blocknr; |
42 | return 0; | 42 | return 0; |
@@ -62,7 +62,7 @@ static int expand_dir_proc(ext2_filsys fs, | |||
62 | } | 62 | } |
63 | memset(block, 0, fs->blocksize); | 63 | memset(block, 0, fs->blocksize); |
64 | retval = io_channel_write_blk(fs->io, new_blk, 1, block); | 64 | retval = io_channel_write_blk(fs->io, new_blk, 1, block); |
65 | } | 65 | } |
66 | if (retval) { | 66 | if (retval) { |
67 | es->err = retval; | 67 | es->err = retval; |
68 | return BLOCK_ABORT; | 68 | return BLOCK_ABORT; |
@@ -83,7 +83,7 @@ errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir) | |||
83 | errcode_t retval; | 83 | errcode_t retval; |
84 | struct expand_dir_struct es; | 84 | struct expand_dir_struct es; |
85 | struct ext2_inode inode; | 85 | struct ext2_inode inode; |
86 | 86 | ||
87 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); | 87 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); |
88 | 88 | ||
89 | if (!(fs->flags & EXT2_FLAG_RW)) | 89 | if (!(fs->flags & EXT2_FLAG_RW)) |
@@ -95,11 +95,11 @@ errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir) | |||
95 | retval = ext2fs_check_directory(fs, dir); | 95 | retval = ext2fs_check_directory(fs, dir); |
96 | if (retval) | 96 | if (retval) |
97 | return retval; | 97 | return retval; |
98 | 98 | ||
99 | es.done = 0; | 99 | es.done = 0; |
100 | es.err = 0; | 100 | es.err = 0; |
101 | es.newblocks = 0; | 101 | es.newblocks = 0; |
102 | 102 | ||
103 | retval = ext2fs_block_iterate2(fs, dir, BLOCK_FLAG_APPEND, | 103 | retval = ext2fs_block_iterate2(fs, dir, BLOCK_FLAG_APPEND, |
104 | 0, expand_dir_proc, &es); | 104 | 0, expand_dir_proc, &es); |
105 | 105 | ||
@@ -114,7 +114,7 @@ errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir) | |||
114 | retval = ext2fs_read_inode(fs, dir, &inode); | 114 | retval = ext2fs_read_inode(fs, dir, &inode); |
115 | if (retval) | 115 | if (retval) |
116 | return retval; | 116 | return retval; |
117 | 117 | ||
118 | inode.i_size += fs->blocksize; | 118 | inode.i_size += fs->blocksize; |
119 | inode.i_blocks += (fs->blocksize / 512) * es.newblocks; | 119 | inode.i_blocks += (fs->blocksize / 512) * es.newblocks; |
120 | 120 | ||
diff --git a/e2fsprogs/ext2fs/ext2_fs.h b/e2fsprogs/ext2fs/ext2_fs.h index 7a9890320..400587324 100644 --- a/e2fsprogs/ext2fs/ext2_fs.h +++ b/e2fsprogs/ext2fs/ext2_fs.h | |||
@@ -231,9 +231,9 @@ struct ext2_dx_countlimit { | |||
231 | #define EXT2_IMAGIC_FL 0x00002000 | 231 | #define EXT2_IMAGIC_FL 0x00002000 |
232 | #define EXT3_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */ | 232 | #define EXT3_JOURNAL_DATA_FL 0x00004000 /* file data should be journaled */ |
233 | #define EXT2_NOTAIL_FL 0x00008000 /* file tail should not be merged */ | 233 | #define EXT2_NOTAIL_FL 0x00008000 /* file tail should not be merged */ |
234 | #define EXT2_DIRSYNC_FL 0x00010000 /* Synchronous directory modifications */ | 234 | #define EXT2_DIRSYNC_FL 0x00010000 /* Synchronous directory modifications */ |
235 | #define EXT2_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ | 235 | #define EXT2_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ |
236 | #define EXT3_EXTENTS_FL 0x00080000 /* Inode uses extents */ | 236 | #define EXT3_EXTENTS_FL 0x00080000 /* Inode uses extents */ |
237 | #define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ | 237 | #define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ |
238 | 238 | ||
239 | #define EXT2_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ | 239 | #define EXT2_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ |
@@ -501,12 +501,12 @@ struct ext2_super_block { | |||
501 | __u32 s_last_orphan; /* start of list of inodes to delete */ | 501 | __u32 s_last_orphan; /* start of list of inodes to delete */ |
502 | __u32 s_hash_seed[4]; /* HTREE hash seed */ | 502 | __u32 s_hash_seed[4]; /* HTREE hash seed */ |
503 | __u8 s_def_hash_version; /* Default hash version to use */ | 503 | __u8 s_def_hash_version; /* Default hash version to use */ |
504 | __u8 s_jnl_backup_type; /* Default type of journal backup */ | 504 | __u8 s_jnl_backup_type; /* Default type of journal backup */ |
505 | __u16 s_reserved_word_pad; | 505 | __u16 s_reserved_word_pad; |
506 | __u32 s_default_mount_opts; | 506 | __u32 s_default_mount_opts; |
507 | __u32 s_first_meta_bg; /* First metablock group */ | 507 | __u32 s_first_meta_bg; /* First metablock group */ |
508 | __u32 s_mkfs_time; /* When the filesystem was created */ | 508 | __u32 s_mkfs_time; /* When the filesystem was created */ |
509 | __u32 s_jnl_blocks[17]; /* Backup of the journal inode */ | 509 | __u32 s_jnl_blocks[17]; /* Backup of the journal inode */ |
510 | __u32 s_reserved[172]; /* Padding to the end of the block */ | 510 | __u32 s_reserved[172]; /* Padding to the end of the block */ |
511 | }; | 511 | }; |
512 | 512 | ||
@@ -585,7 +585,7 @@ struct ext2_super_block { | |||
585 | #define EXT2_DEFM_XATTR_USER 0x0004 | 585 | #define EXT2_DEFM_XATTR_USER 0x0004 |
586 | #define EXT2_DEFM_ACL 0x0008 | 586 | #define EXT2_DEFM_ACL 0x0008 |
587 | #define EXT2_DEFM_UID16 0x0010 | 587 | #define EXT2_DEFM_UID16 0x0010 |
588 | #define EXT3_DEFM_JMODE 0x0060 | 588 | #define EXT3_DEFM_JMODE 0x0060 |
589 | #define EXT3_DEFM_JMODE_DATA 0x0020 | 589 | #define EXT3_DEFM_JMODE_DATA 0x0020 |
590 | #define EXT3_DEFM_JMODE_ORDERED 0x0040 | 590 | #define EXT3_DEFM_JMODE_ORDERED 0x0040 |
591 | #define EXT3_DEFM_JMODE_WBACK 0x0060 | 591 | #define EXT3_DEFM_JMODE_WBACK 0x0060 |
diff --git a/e2fsprogs/ext2fs/ext2fs.h b/e2fsprogs/ext2fs/ext2fs.h index e2e86579b..7d2a43695 100644 --- a/e2fsprogs/ext2fs/ext2fs.h +++ b/e2fsprogs/ext2fs/ext2fs.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * ext2fs.h --- ext2fs | 2 | * ext2fs.h --- ext2fs |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -46,7 +46,7 @@ extern "C" { | |||
46 | * 1032 bytes long). | 46 | * 1032 bytes long). |
47 | */ | 47 | */ |
48 | #define SUPERBLOCK_OFFSET 1024 | 48 | #define SUPERBLOCK_OFFSET 1024 |
49 | #define SUPERBLOCK_SIZE 1024 | 49 | #define SUPERBLOCK_SIZE 1024 |
50 | 50 | ||
51 | /* | 51 | /* |
52 | * The last ext2fs revision level that this version of the library is | 52 | * The last ext2fs revision level that this version of the library is |
@@ -87,7 +87,7 @@ typedef struct struct_ext2_filsys *ext2_filsys; | |||
87 | 87 | ||
88 | struct ext2fs_struct_generic_bitmap { | 88 | struct ext2fs_struct_generic_bitmap { |
89 | errcode_t magic; | 89 | errcode_t magic; |
90 | ext2_filsys fs; | 90 | ext2_filsys fs; |
91 | __u32 start, end; | 91 | __u32 start, end; |
92 | __u32 real_end; | 92 | __u32 real_end; |
93 | char * description; | 93 | char * description; |
@@ -96,8 +96,8 @@ struct ext2fs_struct_generic_bitmap { | |||
96 | __u32 reserved[7]; | 96 | __u32 reserved[7]; |
97 | }; | 97 | }; |
98 | 98 | ||
99 | #define EXT2FS_MARK_ERROR 0 | 99 | #define EXT2FS_MARK_ERROR 0 |
100 | #define EXT2FS_UNMARK_ERROR 1 | 100 | #define EXT2FS_UNMARK_ERROR 1 |
101 | #define EXT2FS_TEST_ERROR 2 | 101 | #define EXT2FS_TEST_ERROR 2 |
102 | 102 | ||
103 | typedef struct ext2fs_struct_generic_bitmap *ext2fs_generic_bitmap; | 103 | typedef struct ext2fs_struct_generic_bitmap *ext2fs_generic_bitmap; |
@@ -194,7 +194,7 @@ struct struct_ext2_filsys { | |||
194 | io_channel io; | 194 | io_channel io; |
195 | int flags; | 195 | int flags; |
196 | char * device_name; | 196 | char * device_name; |
197 | struct ext2_super_block * super; | 197 | struct ext2_super_block * super; |
198 | unsigned int blocksize; | 198 | unsigned int blocksize; |
199 | int fragsize; | 199 | int fragsize; |
200 | dgrp_t group_desc_count; | 200 | dgrp_t group_desc_count; |
@@ -250,7 +250,7 @@ struct struct_ext2_filsys { | |||
250 | * This is used by ext2fs_expand_dir() to be able to add a new block | 250 | * This is used by ext2fs_expand_dir() to be able to add a new block |
251 | * to an inode. It can also be used for programs that want to be able | 251 | * to an inode. It can also be used for programs that want to be able |
252 | * to deal with files that contain "holes". | 252 | * to deal with files that contain "holes". |
253 | * | 253 | * |
254 | * BLOCK_FLAG_TRAVERSE indicates that the iterator function for the | 254 | * BLOCK_FLAG_TRAVERSE indicates that the iterator function for the |
255 | * indirect, doubly indirect, etc. blocks should be called after all | 255 | * indirect, doubly indirect, etc. blocks should be called after all |
256 | * of the blocks containined in the indirect blocks are processed. | 256 | * of the blocks containined in the indirect blocks are processed. |
@@ -282,7 +282,7 @@ struct struct_ext2_filsys { | |||
282 | /* | 282 | /* |
283 | * Flags for ext2fs_move_blocks | 283 | * Flags for ext2fs_move_blocks |
284 | */ | 284 | */ |
285 | #define EXT2_BMOVE_GET_DBLIST 0x0001 | 285 | #define EXT2_BMOVE_GET_DBLIST 0x0001 |
286 | #define EXT2_BMOVE_DEBUG 0x0002 | 286 | #define EXT2_BMOVE_DEBUG 0x0002 |
287 | #endif | 287 | #endif |
288 | 288 | ||
@@ -457,7 +457,7 @@ extern errcode_t ext2fs_alloc_block(ext2_filsys fs, blk_t goal, | |||
457 | char *block_buf, blk_t *ret); | 457 | char *block_buf, blk_t *ret); |
458 | 458 | ||
459 | /* alloc_sb.c */ | 459 | /* alloc_sb.c */ |
460 | extern int ext2fs_reserve_super_and_bgd(ext2_filsys fs, | 460 | extern int ext2fs_reserve_super_and_bgd(ext2_filsys fs, |
461 | dgrp_t group, | 461 | dgrp_t group, |
462 | ext2fs_block_bitmap bmap); | 462 | ext2fs_block_bitmap bmap); |
463 | 463 | ||
@@ -567,7 +567,7 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs, | |||
567 | 567 | ||
568 | /* bmap.c */ | 568 | /* bmap.c */ |
569 | extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, | 569 | extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, |
570 | struct ext2_inode *inode, | 570 | struct ext2_inode *inode, |
571 | char *block_buf, int bmap_flags, | 571 | char *block_buf, int bmap_flags, |
572 | blk_t block, blk_t *phys_blk); | 572 | blk_t block, blk_t *phys_blk); |
573 | 573 | ||
@@ -587,7 +587,7 @@ extern errcode_t ext2fs_check_desc(ext2_filsys fs); | |||
587 | extern errcode_t ext2fs_close(ext2_filsys fs); | 587 | extern errcode_t ext2fs_close(ext2_filsys fs); |
588 | extern errcode_t ext2fs_flush(ext2_filsys fs); | 588 | extern errcode_t ext2fs_flush(ext2_filsys fs); |
589 | extern int ext2fs_bg_has_super(ext2_filsys fs, int group_block); | 589 | extern int ext2fs_bg_has_super(ext2_filsys fs, int group_block); |
590 | extern int ext2fs_super_and_bgd_loc(ext2_filsys fs, | 590 | extern int ext2fs_super_and_bgd_loc(ext2_filsys fs, |
591 | dgrp_t group, | 591 | dgrp_t group, |
592 | blk_t *ret_super_blk, | 592 | blk_t *ret_super_blk, |
593 | blk_t *ret_old_desc_blk, | 593 | blk_t *ret_old_desc_blk, |
@@ -652,7 +652,7 @@ extern errcode_t ext2fs_dirhash(int version, const char *name, int len, | |||
652 | 652 | ||
653 | 653 | ||
654 | /* dir_iterate.c */ | 654 | /* dir_iterate.c */ |
655 | extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, | 655 | extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, |
656 | ext2_ino_t dir, | 656 | ext2_ino_t dir, |
657 | int flags, | 657 | int flags, |
658 | char *block_buf, | 658 | char *block_buf, |
@@ -662,7 +662,7 @@ extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, | |||
662 | char *buf, | 662 | char *buf, |
663 | void *priv_data), | 663 | void *priv_data), |
664 | void *priv_data); | 664 | void *priv_data); |
665 | extern errcode_t ext2fs_dir_iterate2(ext2_filsys fs, | 665 | extern errcode_t ext2fs_dir_iterate2(ext2_filsys fs, |
666 | ext2_ino_t dir, | 666 | ext2_ino_t dir, |
667 | int flags, | 667 | int flags, |
668 | char *block_buf, | 668 | char *block_buf, |
@@ -751,10 +751,10 @@ extern errcode_t ext2fs_initialize(const char *name, int flags, | |||
751 | 751 | ||
752 | /* icount.c */ | 752 | /* icount.c */ |
753 | extern void ext2fs_free_icount(ext2_icount_t icount); | 753 | extern void ext2fs_free_icount(ext2_icount_t icount); |
754 | extern errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, | 754 | extern errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, |
755 | unsigned int size, | 755 | unsigned int size, |
756 | ext2_icount_t hint, ext2_icount_t *ret); | 756 | ext2_icount_t hint, ext2_icount_t *ret); |
757 | extern errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, | 757 | extern errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, |
758 | unsigned int size, | 758 | unsigned int size, |
759 | ext2_icount_t *ret); | 759 | ext2_icount_t *ret); |
760 | extern errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ext2_ino_t ino, | 760 | extern errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ext2_ino_t ino, |
@@ -770,9 +770,9 @@ errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *); | |||
770 | 770 | ||
771 | /* inode.c */ | 771 | /* inode.c */ |
772 | extern errcode_t ext2fs_flush_icache(ext2_filsys fs); | 772 | extern errcode_t ext2fs_flush_icache(ext2_filsys fs); |
773 | extern errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, | 773 | extern errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, |
774 | ext2_ino_t *ino, | 774 | ext2_ino_t *ino, |
775 | struct ext2_inode *inode, | 775 | struct ext2_inode *inode, |
776 | int bufsize); | 776 | int bufsize); |
777 | extern errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks, | 777 | extern errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks, |
778 | ext2_inode_scan *ret_scan); | 778 | ext2_inode_scan *ret_scan); |
@@ -791,12 +791,12 @@ extern void ext2fs_set_inode_callback | |||
791 | extern int ext2fs_inode_scan_flags(ext2_inode_scan scan, int set_flags, | 791 | extern int ext2fs_inode_scan_flags(ext2_inode_scan scan, int set_flags, |
792 | int clear_flags); | 792 | int clear_flags); |
793 | extern errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino, | 793 | extern errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino, |
794 | struct ext2_inode * inode, | 794 | struct ext2_inode * inode, |
795 | int bufsize); | 795 | int bufsize); |
796 | extern errcode_t ext2fs_read_inode (ext2_filsys fs, ext2_ino_t ino, | 796 | extern errcode_t ext2fs_read_inode (ext2_filsys fs, ext2_ino_t ino, |
797 | struct ext2_inode * inode); | 797 | struct ext2_inode * inode); |
798 | extern errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino, | 798 | extern errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino, |
799 | struct ext2_inode * inode, | 799 | struct ext2_inode * inode, |
800 | int bufsize); | 800 | int bufsize); |
801 | extern errcode_t ext2fs_write_inode(ext2_filsys fs, ext2_ino_t ino, | 801 | extern errcode_t ext2fs_write_inode(ext2_filsys fs, ext2_ino_t ino, |
802 | struct ext2_inode * inode); | 802 | struct ext2_inode * inode); |
@@ -807,12 +807,12 @@ extern errcode_t ext2fs_check_directory(ext2_filsys fs, ext2_ino_t ino); | |||
807 | 807 | ||
808 | /* inode_io.c */ | 808 | /* inode_io.c */ |
809 | extern io_manager inode_io_manager; | 809 | extern io_manager inode_io_manager; |
810 | extern errcode_t ext2fs_inode_io_intern(ext2_filsys fs, ext2_ino_t ino, | 810 | extern errcode_t ext2fs_inode_io_intern(ext2_filsys fs, ext2_ino_t ino, |
811 | char **name); | 811 | char **name); |
812 | extern errcode_t ext2fs_inode_io_intern2(ext2_filsys fs, ext2_ino_t ino, | 812 | extern errcode_t ext2fs_inode_io_intern2(ext2_filsys fs, ext2_ino_t ino, |
813 | struct ext2_inode *inode, | 813 | struct ext2_inode *inode, |
814 | char **name); | 814 | char **name); |
815 | 815 | ||
816 | /* ismounted.c */ | 816 | /* ismounted.c */ |
817 | extern errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags); | 817 | extern errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags); |
818 | extern errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags, | 818 | extern errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags, |
@@ -852,11 +852,11 @@ extern errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, | |||
852 | extern errcode_t ext2fs_open(const char *name, int flags, int superblock, | 852 | extern errcode_t ext2fs_open(const char *name, int flags, int superblock, |
853 | unsigned int block_size, io_manager manager, | 853 | unsigned int block_size, io_manager manager, |
854 | ext2_filsys *ret_fs); | 854 | ext2_filsys *ret_fs); |
855 | extern errcode_t ext2fs_open2(const char *name, const char *io_options, | 855 | extern errcode_t ext2fs_open2(const char *name, const char *io_options, |
856 | int flags, int superblock, | 856 | int flags, int superblock, |
857 | unsigned int block_size, io_manager manager, | 857 | unsigned int block_size, io_manager manager, |
858 | ext2_filsys *ret_fs); | 858 | ext2_filsys *ret_fs); |
859 | extern blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, | 859 | extern blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, |
860 | dgrp_t i); | 860 | dgrp_t i); |
861 | errcode_t ext2fs_get_data_io(ext2_filsys fs, io_channel *old_io); | 861 | errcode_t ext2fs_get_data_io(ext2_filsys fs, io_channel *old_io); |
862 | errcode_t ext2fs_set_data_io(ext2_filsys fs, io_channel new_io); | 862 | errcode_t ext2fs_set_data_io(ext2_filsys fs, io_channel new_io); |
@@ -877,14 +877,14 @@ extern errcode_t ext2fs_read_bb_inode(ext2_filsys fs, | |||
877 | ext2_badblocks_list *bb_list); | 877 | ext2_badblocks_list *bb_list); |
878 | 878 | ||
879 | /* read_bb_file.c */ | 879 | /* read_bb_file.c */ |
880 | extern errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f, | 880 | extern errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f, |
881 | ext2_badblocks_list *bb_list, | 881 | ext2_badblocks_list *bb_list, |
882 | void *priv_data, | 882 | void *priv_data, |
883 | void (*invalid)(ext2_filsys fs, | 883 | void (*invalid)(ext2_filsys fs, |
884 | blk_t blk, | 884 | blk_t blk, |
885 | char *badstr, | 885 | char *badstr, |
886 | void *priv_data)); | 886 | void *priv_data)); |
887 | extern errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f, | 887 | extern errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f, |
888 | ext2_badblocks_list *bb_list, | 888 | ext2_badblocks_list *bb_list, |
889 | void (*invalid)(ext2_filsys fs, | 889 | void (*invalid)(ext2_filsys fs, |
890 | blk_t blk)); | 890 | blk_t blk)); |
@@ -904,7 +904,7 @@ extern errcode_t ext2fs_copy_bitmap(ext2fs_generic_bitmap src, | |||
904 | ext2fs_generic_bitmap *dest); | 904 | ext2fs_generic_bitmap *dest); |
905 | 905 | ||
906 | /* swapfs.c */ | 906 | /* swapfs.c */ |
907 | extern void ext2fs_swap_ext_attr(char *to, char *from, int bufsize, | 907 | extern void ext2fs_swap_ext_attr(char *to, char *from, int bufsize, |
908 | int has_header); | 908 | int has_header); |
909 | extern void ext2fs_swap_super(struct ext2_super_block * super); | 909 | extern void ext2fs_swap_super(struct ext2_super_block * super); |
910 | extern void ext2fs_swap_group_desc(struct ext2_group_desc *gdp); | 910 | extern void ext2fs_swap_group_desc(struct ext2_group_desc *gdp); |
diff --git a/e2fsprogs/ext2fs/ext2fsP.h b/e2fsprogs/ext2fs/ext2fsP.h index eea32d632..90b081232 100644 --- a/e2fsprogs/ext2fs/ext2fsP.h +++ b/e2fsprogs/ext2fs/ext2fsP.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * ext2fsP.h --- private header file for ext2 library | 2 | * ext2fsP.h --- private header file for ext2 library |
3 | * | 3 | * |
4 | * Copyright (C) 1997 Theodore Ts'o. | 4 | * Copyright (C) 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -78,7 +78,7 @@ struct ext2_inode_cache_ent { | |||
78 | 78 | ||
79 | /* Function prototypes */ | 79 | /* Function prototypes */ |
80 | 80 | ||
81 | extern int ext2fs_process_dir_block(ext2_filsys fs, | 81 | extern int ext2fs_process_dir_block(ext2_filsys fs, |
82 | blk_t *blocknr, | 82 | blk_t *blocknr, |
83 | e2_blkcnt_t blockcnt, | 83 | e2_blkcnt_t blockcnt, |
84 | blk_t ref_block, | 84 | blk_t ref_block, |
diff --git a/e2fsprogs/ext2fs/ext2fs_inline.c b/e2fsprogs/ext2fs/ext2fs_inline.c index f14e7b22f..2fa9a9ed2 100644 --- a/e2fsprogs/ext2fs/ext2fs_inline.c +++ b/e2fsprogs/ext2fs/ext2fs_inline.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * ext2fs.h --- ext2fs | 2 | * ext2fs.h --- ext2fs |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -36,7 +36,7 @@ errcode_t ext2fs_free_mem(void *ptr) | |||
36 | *pp = 0; | 36 | *pp = 0; |
37 | return 0; | 37 | return 0; |
38 | } | 38 | } |
39 | 39 | ||
40 | /* | 40 | /* |
41 | * Resize memory | 41 | * Resize memory |
42 | */ | 42 | */ |
@@ -154,7 +154,7 @@ blk_t ext2fs_inode_data_blocks(ext2_filsys fs, | |||
154 | struct ext2_inode *inode) | 154 | struct ext2_inode *inode) |
155 | { | 155 | { |
156 | return inode->i_blocks - | 156 | return inode->i_blocks - |
157 | (inode->i_file_acl ? fs->blocksize >> 9 : 0); | 157 | (inode->i_file_acl ? fs->blocksize >> 9 : 0); |
158 | } | 158 | } |
159 | 159 | ||
160 | 160 | ||
@@ -179,7 +179,7 @@ __u32 ext2fs_swab32(__u32 val) | |||
179 | int ext2fs_find_first_bit_set(void * addr, unsigned size) | 179 | int ext2fs_find_first_bit_set(void * addr, unsigned size) |
180 | { | 180 | { |
181 | char *cp = (unsigned char *) addr; | 181 | char *cp = (unsigned char *) addr; |
182 | int res = 0, d0; | 182 | int res = 0, d0; |
183 | 183 | ||
184 | if (!size) | 184 | if (!size) |
185 | return 0; | 185 | return 0; |
@@ -191,7 +191,7 @@ int ext2fs_find_first_bit_set(void * addr, unsigned size) | |||
191 | d0 = ffs(*cp); | 191 | d0 = ffs(*cp); |
192 | if (d0 == 0) | 192 | if (d0 == 0) |
193 | return size; | 193 | return size; |
194 | 194 | ||
195 | return res + d0 - 1; | 195 | return res + d0 - 1; |
196 | } | 196 | } |
197 | 197 | ||
@@ -199,10 +199,10 @@ int ext2fs_find_next_bit_set (void * addr, int size, int offset) | |||
199 | { | 199 | { |
200 | unsigned char * p; | 200 | unsigned char * p; |
201 | int set = 0, bit = offset & 7, res = 0, d0; | 201 | int set = 0, bit = offset & 7, res = 0, d0; |
202 | 202 | ||
203 | res = offset >> 3; | 203 | res = offset >> 3; |
204 | p = ((unsigned char *) addr) + res; | 204 | p = ((unsigned char *) addr) + res; |
205 | 205 | ||
206 | if (bit) { | 206 | if (bit) { |
207 | set = ffs(*p & ~((1 << bit) - 1)); | 207 | set = ffs(*p & ~((1 << bit) - 1)); |
208 | if (set) | 208 | if (set) |
@@ -245,35 +245,35 @@ int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, | |||
245 | int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap, | 245 | int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap, |
246 | blk_t block) | 246 | blk_t block) |
247 | { | 247 | { |
248 | return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, | 248 | return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, |
249 | block); | 249 | block); |
250 | } | 250 | } |
251 | 251 | ||
252 | int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, | 252 | int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, |
253 | blk_t block) | 253 | blk_t block) |
254 | { | 254 | { |
255 | return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, | 255 | return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, |
256 | block); | 256 | block); |
257 | } | 257 | } |
258 | 258 | ||
259 | int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, | 259 | int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, |
260 | ext2_ino_t inode) | 260 | ext2_ino_t inode) |
261 | { | 261 | { |
262 | return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, | 262 | return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, |
263 | inode); | 263 | inode); |
264 | } | 264 | } |
265 | 265 | ||
266 | int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, | 266 | int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap, |
267 | ext2_ino_t inode) | 267 | ext2_ino_t inode) |
268 | { | 268 | { |
269 | return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, | 269 | return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, |
270 | inode); | 270 | inode); |
271 | } | 271 | } |
272 | 272 | ||
273 | int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, | 273 | int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, |
274 | ext2_ino_t inode) | 274 | ext2_ino_t inode) |
275 | { | 275 | { |
276 | return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, | 276 | return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, |
277 | inode); | 277 | inode); |
278 | } | 278 | } |
279 | 279 | ||
@@ -286,7 +286,7 @@ void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap, | |||
286 | bitmap->description); | 286 | bitmap->description); |
287 | return; | 287 | return; |
288 | } | 288 | } |
289 | #endif | 289 | #endif |
290 | ext2fs_set_bit(block - bitmap->start, bitmap->bitmap); | 290 | ext2fs_set_bit(block - bitmap->start, bitmap->bitmap); |
291 | } | 291 | } |
292 | 292 | ||
@@ -415,7 +415,7 @@ void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap bitmap, | |||
415 | blk_t block, int num) | 415 | blk_t block, int num) |
416 | { | 416 | { |
417 | int i; | 417 | int i; |
418 | 418 | ||
419 | if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { | 419 | if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { |
420 | ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block, | 420 | ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block, |
421 | bitmap->description); | 421 | bitmap->description); |
@@ -429,14 +429,14 @@ void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap, | |||
429 | blk_t block, int num) | 429 | blk_t block, int num) |
430 | { | 430 | { |
431 | int i; | 431 | int i; |
432 | 432 | ||
433 | #ifdef EXT2FS_DEBUG_FAST_OPS | 433 | #ifdef EXT2FS_DEBUG_FAST_OPS |
434 | if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { | 434 | if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { |
435 | ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block, | 435 | ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_MARK, block, |
436 | bitmap->description); | 436 | bitmap->description); |
437 | return; | 437 | return; |
438 | } | 438 | } |
439 | #endif | 439 | #endif |
440 | for (i=0; i < num; i++) | 440 | for (i=0; i < num; i++) |
441 | ext2fs_set_bit(block + i - bitmap->start, bitmap->bitmap); | 441 | ext2fs_set_bit(block + i - bitmap->start, bitmap->bitmap); |
442 | } | 442 | } |
@@ -445,7 +445,7 @@ void ext2fs_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap, | |||
445 | blk_t block, int num) | 445 | blk_t block, int num) |
446 | { | 446 | { |
447 | int i; | 447 | int i; |
448 | 448 | ||
449 | if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { | 449 | if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { |
450 | ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block, | 450 | ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block, |
451 | bitmap->description); | 451 | bitmap->description); |
@@ -459,14 +459,14 @@ void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap, | |||
459 | blk_t block, int num) | 459 | blk_t block, int num) |
460 | { | 460 | { |
461 | int i; | 461 | int i; |
462 | 462 | ||
463 | #ifdef EXT2FS_DEBUG_FAST_OPS | 463 | #ifdef EXT2FS_DEBUG_FAST_OPS |
464 | if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { | 464 | if ((block < bitmap->start) || (block+num-1 > bitmap->end)) { |
465 | ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block, | 465 | ext2fs_warn_bitmap(EXT2_ET_BAD_BLOCK_UNMARK, block, |
466 | bitmap->description); | 466 | bitmap->description); |
467 | return; | 467 | return; |
468 | } | 468 | } |
469 | #endif | 469 | #endif |
470 | for (i=0; i < num; i++) | 470 | for (i=0; i < num; i++) |
471 | ext2fs_clear_bit(block + i - bitmap->start, bitmap->bitmap); | 471 | ext2fs_clear_bit(block + i - bitmap->start, bitmap->bitmap); |
472 | } | 472 | } |
diff --git a/e2fsprogs/ext2fs/ext_attr.c b/e2fsprogs/ext2fs/ext_attr.c index 08211c316..10b8bfd9d 100644 --- a/e2fsprogs/ext2fs/ext_attr.c +++ b/e2fsprogs/ext2fs/ext_attr.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * ext_attr.c --- extended attribute blocks | 2 | * ext_attr.c --- extended attribute blocks |
3 | * | 3 | * |
4 | * Copyright (C) 2001 Andreas Gruenbacher, <a.gruenbacher@computer.org> | 4 | * Copyright (C) 2001 Andreas Gruenbacher, <a.gruenbacher@computer.org> |
5 | * | 5 | * |
6 | * Copyright (C) 2002 Theodore Ts'o. | 6 | * Copyright (C) 2002 Theodore Ts'o. |
@@ -27,7 +27,7 @@ errcode_t ext2fs_read_ext_attr(ext2_filsys fs, blk_t block, void *buf) | |||
27 | { | 27 | { |
28 | errcode_t retval; | 28 | errcode_t retval; |
29 | 29 | ||
30 | retval = io_channel_read_blk(fs->io, block, 1, buf); | 30 | retval = io_channel_read_blk(fs->io, block, 1, buf); |
31 | if (retval) | 31 | if (retval) |
32 | return retval; | 32 | return retval; |
33 | #ifdef EXT2FS_ENABLE_SWAPFS | 33 | #ifdef EXT2FS_ENABLE_SWAPFS |
@@ -55,7 +55,7 @@ errcode_t ext2fs_write_ext_attr(ext2_filsys fs, blk_t block, void *inbuf) | |||
55 | } else | 55 | } else |
56 | #endif | 56 | #endif |
57 | write_buf = (char *) inbuf; | 57 | write_buf = (char *) inbuf; |
58 | retval = io_channel_write_blk(fs->io, block, 1, write_buf); | 58 | retval = io_channel_write_blk(fs->io, block, 1, write_buf); |
59 | if (buf) | 59 | if (buf) |
60 | ext2fs_free_mem(&buf); | 60 | ext2fs_free_mem(&buf); |
61 | if (!retval) | 61 | if (!retval) |
diff --git a/e2fsprogs/ext2fs/fileio.c b/e2fsprogs/ext2fs/fileio.c index 3e42cbc32..669e80c65 100644 --- a/e2fsprogs/ext2fs/fileio.c +++ b/e2fsprogs/ext2fs/fileio.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * fileio.c --- Simple file I/O routines | 2 | * fileio.c --- Simple file I/O routines |
3 | * | 3 | * |
4 | * Copyright (C) 1997 Theodore Ts'o. | 4 | * Copyright (C) 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -20,14 +20,14 @@ | |||
20 | 20 | ||
21 | struct ext2_file { | 21 | struct ext2_file { |
22 | errcode_t magic; | 22 | errcode_t magic; |
23 | ext2_filsys fs; | 23 | ext2_filsys fs; |
24 | ext2_ino_t ino; | 24 | ext2_ino_t ino; |
25 | struct ext2_inode inode; | 25 | struct ext2_inode inode; |
26 | int flags; | 26 | int flags; |
27 | __u64 pos; | 27 | __u64 pos; |
28 | blk_t blockno; | 28 | blk_t blockno; |
29 | blk_t physblock; | 29 | blk_t physblock; |
30 | char *buf; | 30 | char *buf; |
31 | }; | 31 | }; |
32 | 32 | ||
33 | #define BMAP_BUFFER (file->buf + fs->blocksize) | 33 | #define BMAP_BUFFER (file->buf + fs->blocksize) |
@@ -36,7 +36,7 @@ errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino, | |||
36 | struct ext2_inode *inode, | 36 | struct ext2_inode *inode, |
37 | int flags, ext2_file_t *ret) | 37 | int flags, ext2_file_t *ret) |
38 | { | 38 | { |
39 | ext2_file_t file; | 39 | ext2_file_t file; |
40 | errcode_t retval; | 40 | errcode_t retval; |
41 | 41 | ||
42 | /* | 42 | /* |
@@ -50,7 +50,7 @@ errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino, | |||
50 | retval = ext2fs_get_mem(sizeof(struct ext2_file), &file); | 50 | retval = ext2fs_get_mem(sizeof(struct ext2_file), &file); |
51 | if (retval) | 51 | if (retval) |
52 | return retval; | 52 | return retval; |
53 | 53 | ||
54 | memset(file, 0, sizeof(struct ext2_file)); | 54 | memset(file, 0, sizeof(struct ext2_file)); |
55 | file->magic = EXT2_ET_MAGIC_EXT2_FILE; | 55 | file->magic = EXT2_ET_MAGIC_EXT2_FILE; |
56 | file->fs = fs; | 56 | file->fs = fs; |
@@ -64,14 +64,14 @@ errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino, | |||
64 | if (retval) | 64 | if (retval) |
65 | goto fail; | 65 | goto fail; |
66 | } | 66 | } |
67 | 67 | ||
68 | retval = ext2fs_get_mem(fs->blocksize * 3, &file->buf); | 68 | retval = ext2fs_get_mem(fs->blocksize * 3, &file->buf); |
69 | if (retval) | 69 | if (retval) |
70 | goto fail; | 70 | goto fail; |
71 | 71 | ||
72 | *ret = file; | 72 | *ret = file; |
73 | return 0; | 73 | return 0; |
74 | 74 | ||
75 | fail: | 75 | fail: |
76 | if (file->buf) | 76 | if (file->buf) |
77 | ext2fs_free_mem(&file->buf); | 77 | ext2fs_free_mem(&file->buf); |
@@ -103,7 +103,7 @@ errcode_t ext2fs_file_flush(ext2_file_t file) | |||
103 | { | 103 | { |
104 | errcode_t retval; | 104 | errcode_t retval; |
105 | ext2_filsys fs; | 105 | ext2_filsys fs; |
106 | 106 | ||
107 | EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE); | 107 | EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE); |
108 | fs = file->fs; | 108 | fs = file->fs; |
109 | 109 | ||
@@ -176,7 +176,7 @@ static errcode_t load_buffer(ext2_file_t file, int dontfill) | |||
176 | if (!dontfill) { | 176 | if (!dontfill) { |
177 | if (file->physblock) { | 177 | if (file->physblock) { |
178 | retval = io_channel_read_blk(fs->io, | 178 | retval = io_channel_read_blk(fs->io, |
179 | file->physblock, | 179 | file->physblock, |
180 | 1, file->buf); | 180 | 1, file->buf); |
181 | if (retval) | 181 | if (retval) |
182 | return retval; | 182 | return retval; |
@@ -187,16 +187,16 @@ static errcode_t load_buffer(ext2_file_t file, int dontfill) | |||
187 | } | 187 | } |
188 | return 0; | 188 | return 0; |
189 | } | 189 | } |
190 | 190 | ||
191 | 191 | ||
192 | errcode_t ext2fs_file_close(ext2_file_t file) | 192 | errcode_t ext2fs_file_close(ext2_file_t file) |
193 | { | 193 | { |
194 | errcode_t retval; | 194 | errcode_t retval; |
195 | 195 | ||
196 | EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE); | 196 | EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE); |
197 | 197 | ||
198 | retval = ext2fs_file_flush(file); | 198 | retval = ext2fs_file_flush(file); |
199 | 199 | ||
200 | if (file->buf) | 200 | if (file->buf) |
201 | ext2fs_free_mem(&file->buf); | 201 | ext2fs_free_mem(&file->buf); |
202 | ext2fs_free_mem(&file); | 202 | ext2fs_free_mem(&file); |
@@ -232,14 +232,14 @@ errcode_t ext2fs_file_read(ext2_file_t file, void *buf, | |||
232 | left = EXT2_I_SIZE(&file->inode) - file->pos ; | 232 | left = EXT2_I_SIZE(&file->inode) - file->pos ; |
233 | if (c > left) | 233 | if (c > left) |
234 | c = left; | 234 | c = left; |
235 | 235 | ||
236 | memcpy(ptr, file->buf+start, c); | 236 | memcpy(ptr, file->buf+start, c); |
237 | file->pos += c; | 237 | file->pos += c; |
238 | ptr += c; | 238 | ptr += c; |
239 | count += c; | 239 | count += c; |
240 | wanted -= c; | 240 | wanted -= c; |
241 | } | 241 | } |
242 | 242 | ||
243 | fail: | 243 | fail: |
244 | if (got) | 244 | if (got) |
245 | *got = count; | 245 | *got = count; |
@@ -265,7 +265,7 @@ errcode_t ext2fs_file_write(ext2_file_t file, const void *buf, | |||
265 | retval = sync_buffer_position(file); | 265 | retval = sync_buffer_position(file); |
266 | if (retval) | 266 | if (retval) |
267 | goto fail; | 267 | goto fail; |
268 | 268 | ||
269 | start = file->pos % fs->blocksize; | 269 | start = file->pos % fs->blocksize; |
270 | c = fs->blocksize - start; | 270 | c = fs->blocksize - start; |
271 | if (c > nbytes) | 271 | if (c > nbytes) |
@@ -286,7 +286,7 @@ errcode_t ext2fs_file_write(ext2_file_t file, const void *buf, | |||
286 | count += c; | 286 | count += c; |
287 | nbytes -= c; | 287 | nbytes -= c; |
288 | } | 288 | } |
289 | 289 | ||
290 | fail: | 290 | fail: |
291 | if (written) | 291 | if (written) |
292 | *written = count; | 292 | *written = count; |
@@ -318,7 +318,7 @@ errcode_t ext2fs_file_lseek(ext2_file_t file, ext2_off_t offset, | |||
318 | { | 318 | { |
319 | __u64 loffset, ret_loffset; | 319 | __u64 loffset, ret_loffset; |
320 | errcode_t retval; | 320 | errcode_t retval; |
321 | 321 | ||
322 | loffset = offset; | 322 | loffset = offset; |
323 | retval = ext2fs_file_llseek(file, loffset, whence, &ret_loffset); | 323 | retval = ext2fs_file_llseek(file, loffset, whence, &ret_loffset); |
324 | if (ret_pos) | 324 | if (ret_pos) |
@@ -354,14 +354,14 @@ ext2_off_t ext2fs_file_get_size(ext2_file_t file) | |||
354 | 354 | ||
355 | /* | 355 | /* |
356 | * This function sets the size of the file, truncating it if necessary | 356 | * This function sets the size of the file, truncating it if necessary |
357 | * | 357 | * |
358 | * XXX still need to call truncate | 358 | * XXX still need to call truncate |
359 | */ | 359 | */ |
360 | errcode_t ext2fs_file_set_size(ext2_file_t file, ext2_off_t size) | 360 | errcode_t ext2fs_file_set_size(ext2_file_t file, ext2_off_t size) |
361 | { | 361 | { |
362 | errcode_t retval; | 362 | errcode_t retval; |
363 | EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE); | 363 | EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE); |
364 | 364 | ||
365 | file->inode.i_size = size; | 365 | file->inode.i_size = size; |
366 | file->inode.i_size_high = 0; | 366 | file->inode.i_size_high = 0; |
367 | if (file->ino) { | 367 | if (file->ino) { |
@@ -370,7 +370,7 @@ errcode_t ext2fs_file_set_size(ext2_file_t file, ext2_off_t size) | |||
370 | return retval; | 370 | return retval; |
371 | } | 371 | } |
372 | 372 | ||
373 | /* | 373 | /* |
374 | * XXX truncate inode if necessary | 374 | * XXX truncate inode if necessary |
375 | */ | 375 | */ |
376 | 376 | ||
diff --git a/e2fsprogs/ext2fs/finddev.c b/e2fsprogs/ext2fs/finddev.c index c459c0833..552aa79c3 100644 --- a/e2fsprogs/ext2fs/finddev.c +++ b/e2fsprogs/ext2fs/finddev.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * finddev.c -- this routine attempts to find a particular device in | 2 | * finddev.c -- this routine attempts to find a particular device in |
3 | * /dev | 3 | * /dev |
4 | * | 4 | * |
5 | * Copyright (C) 2000 Theodore Ts'o. | 5 | * Copyright (C) 2000 Theodore Ts'o. |
6 | * | 6 | * |
7 | * %Begin-Header% | 7 | * %Begin-Header% |
@@ -124,7 +124,7 @@ char *ext2fs_find_block_device(dev_t device) | |||
124 | add_to_dirlist("/devices", &list); | 124 | add_to_dirlist("/devices", &list); |
125 | add_to_dirlist("/devfs", &list); | 125 | add_to_dirlist("/devfs", &list); |
126 | add_to_dirlist("/dev", &list); | 126 | add_to_dirlist("/dev", &list); |
127 | 127 | ||
128 | while (list) { | 128 | while (list) { |
129 | current = list; | 129 | current = list; |
130 | list = list->next; | 130 | list = list->next; |
@@ -150,7 +150,7 @@ char *ext2fs_find_block_device(dev_t device) | |||
150 | return ret_path; | 150 | return ret_path; |
151 | } | 151 | } |
152 | 152 | ||
153 | 153 | ||
154 | #ifdef DEBUG | 154 | #ifdef DEBUG |
155 | int main(int argc, char** argv) | 155 | int main(int argc, char** argv) |
156 | { | 156 | { |
@@ -194,5 +194,5 @@ int main(int argc, char** argv) | |||
194 | } | 194 | } |
195 | return 0; | 195 | return 0; |
196 | } | 196 | } |
197 | 197 | ||
198 | #endif | 198 | #endif |
diff --git a/e2fsprogs/ext2fs/flushb.c b/e2fsprogs/ext2fs/flushb.c index 18827955f..9f04647ec 100644 --- a/e2fsprogs/ext2fs/flushb.c +++ b/e2fsprogs/ext2fs/flushb.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * flushb.c --- Hides system-dependent information for both syncing a | 2 | * flushb.c --- Hides system-dependent information for both syncing a |
3 | * device to disk and to flush any buffers from disk cache. | 3 | * device to disk and to flush any buffers from disk cache. |
4 | * | 4 | * |
5 | * Copyright (C) 2000 Theodore Ts'o. | 5 | * Copyright (C) 2000 Theodore Ts'o. |
6 | * | 6 | * |
7 | * %Begin-Header% | 7 | * %Begin-Header% |
@@ -29,7 +29,7 @@ | |||
29 | #include "ext2fs.h" | 29 | #include "ext2fs.h" |
30 | 30 | ||
31 | /* | 31 | /* |
32 | * For Linux, define BLKFLSBUF and FDFLUSH if necessary, since | 32 | * For Linux, define BLKFLSBUF and FDFLUSH if necessary, since |
33 | * not all portable header file does so for us. This really should be | 33 | * not all portable header file does so for us. This really should be |
34 | * fixed in the glibc header files. (Recent glibcs appear to define | 34 | * fixed in the glibc header files. (Recent glibcs appear to define |
35 | * BLKFLSBUF in sys/mount.h, but FDFLUSH still doesn't seem to be | 35 | * BLKFLSBUF in sys/mount.h, but FDFLUSH still doesn't seem to be |
diff --git a/e2fsprogs/ext2fs/freefs.c b/e2fsprogs/ext2fs/freefs.c index 029ffaae1..3fd51f257 100644 --- a/e2fsprogs/ext2fs/freefs.c +++ b/e2fsprogs/ext2fs/freefs.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * freefs.c --- free an ext2 filesystem | 2 | * freefs.c --- free an ext2 filesystem |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -52,7 +52,7 @@ void ext2fs_free(ext2_filsys fs) | |||
52 | 52 | ||
53 | if (fs->icache) | 53 | if (fs->icache) |
54 | ext2fs_free_inode_cache(fs->icache); | 54 | ext2fs_free_inode_cache(fs->icache); |
55 | 55 | ||
56 | fs->magic = 0; | 56 | fs->magic = 0; |
57 | 57 | ||
58 | ext2fs_free_mem(&fs); | 58 | ext2fs_free_mem(&fs); |
diff --git a/e2fsprogs/ext2fs/gen_bitmap.c b/e2fsprogs/ext2fs/gen_bitmap.c index 700affa19..3f15ce6a7 100644 --- a/e2fsprogs/ext2fs/gen_bitmap.c +++ b/e2fsprogs/ext2fs/gen_bitmap.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * gen_bitmap.c --- Generic bitmap routines that used to be inlined. | 2 | * gen_bitmap.c --- Generic bitmap routines that used to be inlined. |
3 | * | 3 | * |
4 | * Copyright (C) 2001 Theodore Ts'o. | 4 | * Copyright (C) 2001 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
diff --git a/e2fsprogs/ext2fs/get_pathname.c b/e2fsprogs/ext2fs/get_pathname.c index 23f593f67..594090da0 100644 --- a/e2fsprogs/ext2fs/get_pathname.c +++ b/e2fsprogs/ext2fs/get_pathname.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * get_pathname.c --- do directry/inode -> name translation | 2 | * get_pathname.c --- do directry/inode -> name translation |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1995 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1995 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -8,14 +8,14 @@ | |||
8 | * License. | 8 | * License. |
9 | * %End-Header% | 9 | * %End-Header% |
10 | * | 10 | * |
11 | * ext2fs_get_pathname(fs, dir, ino, name) | 11 | * ext2fs_get_pathname(fs, dir, ino, name) |
12 | * | ||
13 | * This function translates takes two inode numbers into a | ||
14 | * string, placing the result in <name>. <dir> is the containing | ||
15 | * directory inode, and <ino> is the inode number itself. If | ||
16 | * <ino> is zero, then ext2fs_get_pathname will return pathname | ||
17 | * of the the directory <dir>. | ||
12 | * | 18 | * |
13 | * This function translates takes two inode numbers into a | ||
14 | * string, placing the result in <name>. <dir> is the containing | ||
15 | * directory inode, and <ino> is the inode number itself. If | ||
16 | * <ino> is zero, then ext2fs_get_pathname will return pathname | ||
17 | * of the the directory <dir>. | ||
18 | * | ||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <stdio.h> | 21 | #include <stdio.h> |
@@ -65,8 +65,8 @@ static int get_pathname_proc(struct ext2_dir_entry *dirent, | |||
65 | return 0; | 65 | return 0; |
66 | } | 66 | } |
67 | 67 | ||
68 | static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir, | 68 | static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir, |
69 | ext2_ino_t ino, int maxdepth, | 69 | ext2_ino_t ino, int maxdepth, |
70 | char *buf, char **name) | 70 | char *buf, char **name) |
71 | { | 71 | { |
72 | struct get_pathname_struct gp; | 72 | struct get_pathname_struct gp; |
@@ -93,7 +93,7 @@ static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir, | |||
93 | gp.parent = 0; | 93 | gp.parent = 0; |
94 | gp.name = 0; | 94 | gp.name = 0; |
95 | gp.errcode = 0; | 95 | gp.errcode = 0; |
96 | 96 | ||
97 | retval = ext2fs_dir_iterate(fs, dir, 0, buf, get_pathname_proc, &gp); | 97 | retval = ext2fs_dir_iterate(fs, dir, 0, buf, get_pathname_proc, &gp); |
98 | if (retval) | 98 | if (retval) |
99 | goto cleanup; | 99 | goto cleanup; |
@@ -110,15 +110,15 @@ static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir, | |||
110 | *name = parent_name; | 110 | *name = parent_name; |
111 | return 0; | 111 | return 0; |
112 | } | 112 | } |
113 | 113 | ||
114 | if (gp.name) | 114 | if (gp.name) |
115 | retval = ext2fs_get_mem(strlen(parent_name)+strlen(gp.name)+2, | 115 | retval = ext2fs_get_mem(strlen(parent_name)+strlen(gp.name)+2, |
116 | &ret); | 116 | &ret); |
117 | else | 117 | else |
118 | retval = ext2fs_get_mem(strlen(parent_name)+5, &ret); | 118 | retval = ext2fs_get_mem(strlen(parent_name)+5, &ret); |
119 | if (retval) | 119 | if (retval) |
120 | goto cleanup; | 120 | goto cleanup; |
121 | 121 | ||
122 | ret[0] = 0; | 122 | ret[0] = 0; |
123 | if (parent_name[1]) | 123 | if (parent_name[1]) |
124 | strcat(ret, parent_name); | 124 | strcat(ret, parent_name); |
@@ -130,7 +130,7 @@ static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir, | |||
130 | *name = ret; | 130 | *name = ret; |
131 | ext2fs_free_mem(&parent_name); | 131 | ext2fs_free_mem(&parent_name); |
132 | retval = 0; | 132 | retval = 0; |
133 | 133 | ||
134 | cleanup: | 134 | cleanup: |
135 | if (gp.name) | 135 | if (gp.name) |
136 | ext2fs_free_mem(&gp.name); | 136 | ext2fs_free_mem(&gp.name); |
@@ -153,5 +153,5 @@ errcode_t ext2fs_get_pathname(ext2_filsys fs, ext2_ino_t dir, ext2_ino_t ino, | |||
153 | retval = ext2fs_get_pathname_int(fs, dir, ino, 32, buf, name); | 153 | retval = ext2fs_get_pathname_int(fs, dir, ino, 32, buf, name); |
154 | ext2fs_free_mem(&buf); | 154 | ext2fs_free_mem(&buf); |
155 | return retval; | 155 | return retval; |
156 | 156 | ||
157 | } | 157 | } |
diff --git a/e2fsprogs/ext2fs/getsectsize.c b/e2fsprogs/ext2fs/getsectsize.c index 77a9e3da7..b561660ba 100644 --- a/e2fsprogs/ext2fs/getsectsize.c +++ b/e2fsprogs/ext2fs/getsectsize.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * getsectsize.c --- get the sector size of a device. | 2 | * getsectsize.c --- get the sector size of a device. |
3 | * | 3 | * |
4 | * Copyright (C) 1995, 1995 Theodore Ts'o. | 4 | * Copyright (C) 1995, 1995 Theodore Ts'o. |
5 | * Copyright (C) 2003 VMware, Inc. | 5 | * Copyright (C) 2003 VMware, Inc. |
6 | * | 6 | * |
diff --git a/e2fsprogs/ext2fs/getsize.c b/e2fsprogs/ext2fs/getsize.c index 036d9260c..bfafdf2ba 100644 --- a/e2fsprogs/ext2fs/getsize.c +++ b/e2fsprogs/ext2fs/getsize.c | |||
@@ -1,11 +1,11 @@ | |||
1 | /* | 1 | /* |
2 | * getsize.c --- get the size of a partition. | 2 | * getsize.c --- get the size of a partition. |
3 | * | 3 | * |
4 | * Copyright (C) 1995, 1995 Theodore Ts'o. | 4 | * Copyright (C) 1995, 1995 Theodore Ts'o. |
5 | * Copyright (C) 2003 VMware, Inc. | 5 | * Copyright (C) 2003 VMware, Inc. |
6 | * | 6 | * |
7 | * Windows version of ext2fs_get_device_size by Chris Li, VMware. | 7 | * Windows version of ext2fs_get_device_size by Chris Li, VMware. |
8 | * | 8 | * |
9 | * %Begin-Header% | 9 | * %Begin-Header% |
10 | * This file may be redistributed under the terms of the GNU Public | 10 | * This file may be redistributed under the terms of the GNU Public |
11 | * License. | 11 | * License. |
@@ -75,10 +75,10 @@ errcode_t ext2fs_get_device_size(const char *file, int blocksize, | |||
75 | DWORD filesize; | 75 | DWORD filesize; |
76 | #endif /* HAVE_GET_FILE_SIZE_EX */ | 76 | #endif /* HAVE_GET_FILE_SIZE_EX */ |
77 | 77 | ||
78 | dev = CreateFile(file, GENERIC_READ, | 78 | dev = CreateFile(file, GENERIC_READ, |
79 | FILE_SHARE_READ | FILE_SHARE_WRITE , | 79 | FILE_SHARE_READ | FILE_SHARE_WRITE , |
80 | NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); | 80 | NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); |
81 | 81 | ||
82 | if (dev == INVALID_HANDLE_VALUE) | 82 | if (dev == INVALID_HANDLE_VALUE) |
83 | return EBADF; | 83 | return EBADF; |
84 | if (DeviceIoControl(dev, IOCTL_DISK_GET_PARTITION_INFO, | 84 | if (DeviceIoControl(dev, IOCTL_DISK_GET_PARTITION_INFO, |
@@ -87,7 +87,7 @@ errcode_t ext2fs_get_device_size(const char *file, int blocksize, | |||
87 | &retbytes, NULL)) { | 87 | &retbytes, NULL)) { |
88 | 88 | ||
89 | *retblocks = pi.PartitionLength.QuadPart / blocksize; | 89 | *retblocks = pi.PartitionLength.QuadPart / blocksize; |
90 | 90 | ||
91 | } else if (DeviceIoControl(dev, IOCTL_DISK_GET_DRIVE_GEOMETRY, | 91 | } else if (DeviceIoControl(dev, IOCTL_DISK_GET_DRIVE_GEOMETRY, |
92 | &gi, sizeof(DISK_GEOMETRY), | 92 | &gi, sizeof(DISK_GEOMETRY), |
93 | &gi, sizeof(DISK_GEOMETRY), | 93 | &gi, sizeof(DISK_GEOMETRY), |
@@ -137,7 +137,7 @@ errcode_t ext2fs_get_device_size(const char *file, int blocksize, | |||
137 | int fd; | 137 | int fd; |
138 | int valid_blkgetsize64 = 1; | 138 | int valid_blkgetsize64 = 1; |
139 | #ifdef __linux__ | 139 | #ifdef __linux__ |
140 | struct utsname ut; | 140 | struct utsname ut; |
141 | #endif | 141 | #endif |
142 | unsigned long long size64; | 142 | unsigned long long size64; |
143 | unsigned long size; | 143 | unsigned long size; |
@@ -272,7 +272,7 @@ int main(int argc, char **argv) | |||
272 | { | 272 | { |
273 | blk_t blocks; | 273 | blk_t blocks; |
274 | int retval; | 274 | int retval; |
275 | 275 | ||
276 | if (argc < 2) { | 276 | if (argc < 2) { |
277 | fprintf(stderr, "Usage: %s device\n", argv[0]); | 277 | fprintf(stderr, "Usage: %s device\n", argv[0]); |
278 | exit(1); | 278 | exit(1); |
diff --git a/e2fsprogs/ext2fs/icount.c b/e2fsprogs/ext2fs/icount.c index 59977928b..01677775f 100644 --- a/e2fsprogs/ext2fs/icount.c +++ b/e2fsprogs/ext2fs/icount.c | |||
@@ -81,19 +81,19 @@ errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, unsigned int size, | |||
81 | if (hint->size > size) | 81 | if (hint->size > size) |
82 | size = (size_t) hint->size; | 82 | size = (size_t) hint->size; |
83 | } | 83 | } |
84 | 84 | ||
85 | retval = ext2fs_get_mem(sizeof(struct ext2_icount), &icount); | 85 | retval = ext2fs_get_mem(sizeof(struct ext2_icount), &icount); |
86 | if (retval) | 86 | if (retval) |
87 | return retval; | 87 | return retval; |
88 | memset(icount, 0, sizeof(struct ext2_icount)); | 88 | memset(icount, 0, sizeof(struct ext2_icount)); |
89 | 89 | ||
90 | retval = ext2fs_allocate_inode_bitmap(fs, 0, | 90 | retval = ext2fs_allocate_inode_bitmap(fs, 0, |
91 | &icount->single); | 91 | &icount->single); |
92 | if (retval) | 92 | if (retval) |
93 | goto errout; | 93 | goto errout; |
94 | 94 | ||
95 | if (flags & EXT2_ICOUNT_OPT_INCREMENT) { | 95 | if (flags & EXT2_ICOUNT_OPT_INCREMENT) { |
96 | retval = ext2fs_allocate_inode_bitmap(fs, 0, | 96 | retval = ext2fs_allocate_inode_bitmap(fs, 0, |
97 | &icount->multiple); | 97 | &icount->multiple); |
98 | if (retval) | 98 | if (retval) |
99 | goto errout; | 99 | goto errout; |
@@ -113,7 +113,7 @@ errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, unsigned int size, | |||
113 | goto errout; | 113 | goto errout; |
114 | icount->size += fs->super->s_inodes_count / 50; | 114 | icount->size += fs->super->s_inodes_count / 50; |
115 | } | 115 | } |
116 | 116 | ||
117 | bytes = (size_t) (icount->size * sizeof(struct ext2_icount_el)); | 117 | bytes = (size_t) (icount->size * sizeof(struct ext2_icount_el)); |
118 | #if 0 | 118 | #if 0 |
119 | printf("Icount allocated %d entries, %d bytes.\n", | 119 | printf("Icount allocated %d entries, %d bytes.\n", |
@@ -148,7 +148,7 @@ errout: | |||
148 | return(retval); | 148 | return(retval); |
149 | } | 149 | } |
150 | 150 | ||
151 | errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, | 151 | errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, |
152 | unsigned int size, | 152 | unsigned int size, |
153 | ext2_icount_t *ret) | 153 | ext2_icount_t *ret) |
154 | { | 154 | { |
@@ -157,12 +157,12 @@ errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, | |||
157 | 157 | ||
158 | /* | 158 | /* |
159 | * insert_icount_el() --- Insert a new entry into the sorted list at a | 159 | * insert_icount_el() --- Insert a new entry into the sorted list at a |
160 | * specified position. | 160 | * specified position. |
161 | */ | 161 | */ |
162 | static struct ext2_icount_el *insert_icount_el(ext2_icount_t icount, | 162 | static struct ext2_icount_el *insert_icount_el(ext2_icount_t icount, |
163 | ext2_ino_t ino, int pos) | 163 | ext2_ino_t ino, int pos) |
164 | { | 164 | { |
165 | struct ext2_icount_el *el; | 165 | struct ext2_icount_el *el; |
166 | errcode_t retval; | 166 | errcode_t retval; |
167 | ext2_ino_t new_size = 0; | 167 | ext2_ino_t new_size = 0; |
168 | int num; | 168 | int num; |
@@ -170,14 +170,14 @@ static struct ext2_icount_el *insert_icount_el(ext2_icount_t icount, | |||
170 | if (icount->count >= icount->size) { | 170 | if (icount->count >= icount->size) { |
171 | if (icount->count) { | 171 | if (icount->count) { |
172 | new_size = icount->list[(unsigned)icount->count-1].ino; | 172 | new_size = icount->list[(unsigned)icount->count-1].ino; |
173 | new_size = (ext2_ino_t) (icount->count * | 173 | new_size = (ext2_ino_t) (icount->count * |
174 | ((float) icount->num_inodes / new_size)); | 174 | ((float) icount->num_inodes / new_size)); |
175 | } | 175 | } |
176 | if (new_size < (icount->size + 100)) | 176 | if (new_size < (icount->size + 100)) |
177 | new_size = icount->size + 100; | 177 | new_size = icount->size + 100; |
178 | #if 0 | 178 | #if 0 |
179 | printf("Reallocating icount %d entries...\n", new_size); | 179 | printf("Reallocating icount %d entries...\n", new_size); |
180 | #endif | 180 | #endif |
181 | retval = ext2fs_resize_mem((size_t) icount->size * | 181 | retval = ext2fs_resize_mem((size_t) icount->size * |
182 | sizeof(struct ext2_icount_el), | 182 | sizeof(struct ext2_icount_el), |
183 | (size_t) new_size * | 183 | (size_t) new_size * |
@@ -203,8 +203,8 @@ static struct ext2_icount_el *insert_icount_el(ext2_icount_t icount, | |||
203 | 203 | ||
204 | /* | 204 | /* |
205 | * get_icount_el() --- given an inode number, try to find icount | 205 | * get_icount_el() --- given an inode number, try to find icount |
206 | * information in the sorted list. If the create flag is set, | 206 | * information in the sorted list. If the create flag is set, |
207 | * and we can't find an entry, create one in the sorted list. | 207 | * and we can't find an entry, create one in the sorted list. |
208 | */ | 208 | */ |
209 | static struct ext2_icount_el *get_icount_el(ext2_icount_t icount, | 209 | static struct ext2_icount_el *get_icount_el(ext2_icount_t icount, |
210 | ext2_ino_t ino, int create) | 210 | ext2_ino_t ino, int create) |
@@ -222,7 +222,7 @@ static struct ext2_icount_el *get_icount_el(ext2_icount_t icount, | |||
222 | } | 222 | } |
223 | if (icount->count == 0) | 223 | if (icount->count == 0) |
224 | return 0; | 224 | return 0; |
225 | 225 | ||
226 | if (icount->cursor >= icount->count) | 226 | if (icount->cursor >= icount->count) |
227 | icount->cursor = 0; | 227 | icount->cursor = 0; |
228 | if (ino == icount->list[icount->cursor].ino) | 228 | if (ino == icount->list[icount->cursor].ino) |
@@ -247,7 +247,7 @@ static struct ext2_icount_el *get_icount_el(ext2_icount_t icount, | |||
247 | range = 0; | 247 | range = 0; |
248 | else if (ino > highval) | 248 | else if (ino > highval) |
249 | range = 1; | 249 | range = 1; |
250 | else | 250 | else |
251 | range = ((float) (ino - lowval)) / | 251 | range = ((float) (ino - lowval)) / |
252 | (highval - lowval); | 252 | (highval - lowval); |
253 | mid = low + ((int) (range * (high-low))); | 253 | mid = low + ((int) (range * (high-low))); |
@@ -276,7 +276,7 @@ errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *out) | |||
276 | errcode_t ret = 0; | 276 | errcode_t ret = 0; |
277 | unsigned int i; | 277 | unsigned int i; |
278 | const char *bad = "bad icount"; | 278 | const char *bad = "bad icount"; |
279 | 279 | ||
280 | EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT); | 280 | EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT); |
281 | 281 | ||
282 | if (icount->count > icount->size) { | 282 | if (icount->count > icount->size) { |
@@ -297,7 +297,7 @@ errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *out) | |||
297 | errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ext2_ino_t ino, __u16 *ret) | 297 | errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ext2_ino_t ino, __u16 *ret) |
298 | { | 298 | { |
299 | struct ext2_icount_el *el; | 299 | struct ext2_icount_el *el; |
300 | 300 | ||
301 | EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT); | 301 | EXT2_CHECK_MAGIC(icount, EXT2_ET_MAGIC_ICOUNT); |
302 | 302 | ||
303 | if (!ino || (ino > icount->num_inodes)) | 303 | if (!ino || (ino > icount->num_inodes)) |
@@ -413,7 +413,7 @@ errcode_t ext2fs_icount_decrement(ext2_icount_t icount, ext2_ino_t ino, | |||
413 | if (icount->multiple && | 413 | if (icount->multiple && |
414 | !ext2fs_test_inode_bitmap(icount->multiple, ino)) | 414 | !ext2fs_test_inode_bitmap(icount->multiple, ino)) |
415 | return EXT2_ET_INVALID_ARGUMENT; | 415 | return EXT2_ET_INVALID_ARGUMENT; |
416 | 416 | ||
417 | el = get_icount_el(icount, ino, 0); | 417 | el = get_icount_el(icount, ino, 0); |
418 | if (!el || el->count == 0) | 418 | if (!el || el->count == 0) |
419 | return EXT2_ET_INVALID_ARGUMENT; | 419 | return EXT2_ET_INVALID_ARGUMENT; |
diff --git a/e2fsprogs/ext2fs/imager.c b/e2fsprogs/ext2fs/imager.c index 3f2826b82..00eb71723 100644 --- a/e2fsprogs/ext2fs/imager.c +++ b/e2fsprogs/ext2fs/imager.c | |||
@@ -1,11 +1,11 @@ | |||
1 | /* | 1 | /* |
2 | * image.c --- writes out the critical parts of the filesystem as a | 2 | * image.c --- writes out the critical parts of the filesystem as a |
3 | * flat file. | 3 | * flat file. |
4 | * | 4 | * |
5 | * Copyright (C) 2000 Theodore Ts'o. | 5 | * Copyright (C) 2000 Theodore Ts'o. |
6 | * | 6 | * |
7 | * Note: this uses the POSIX IO interfaces, unlike most of the other | 7 | * Note: this uses the POSIX IO interfaces, unlike most of the other |
8 | * functions in this library. So sue me. | 8 | * functions in this library. So sue me. |
9 | * | 9 | * |
10 | * %Begin-Header% | 10 | * %Begin-Header% |
11 | * This file may be redistributed under the terms of the GNU Public | 11 | * This file may be redistributed under the terms of the GNU Public |
@@ -67,7 +67,7 @@ errcode_t ext2fs_image_inode_write(ext2_filsys fs, int fd, int flags) | |||
67 | errcode_t retval; | 67 | errcode_t retval; |
68 | 68 | ||
69 | buf = xmalloc(fs->blocksize * BUF_BLOCKS); | 69 | buf = xmalloc(fs->blocksize * BUF_BLOCKS); |
70 | 70 | ||
71 | for (group = 0; group < fs->group_desc_count; group++) { | 71 | for (group = 0; group < fs->group_desc_count; group++) { |
72 | blk = fs->group_desc[(unsigned)group].bg_inode_table; | 72 | blk = fs->group_desc[(unsigned)group].bg_inode_table; |
73 | if (!blk) | 73 | if (!blk) |
@@ -127,7 +127,7 @@ errout: | |||
127 | /* | 127 | /* |
128 | * Read in the inode table and stuff it into place | 128 | * Read in the inode table and stuff it into place |
129 | */ | 129 | */ |
130 | errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd, | 130 | errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd, |
131 | int flags EXT2FS_ATTR((unused))) | 131 | int flags EXT2FS_ATTR((unused))) |
132 | { | 132 | { |
133 | unsigned int group, c, left; | 133 | unsigned int group, c, left; |
@@ -137,7 +137,7 @@ errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd, | |||
137 | errcode_t retval; | 137 | errcode_t retval; |
138 | 138 | ||
139 | buf = xmalloc(fs->blocksize * BUF_BLOCKS); | 139 | buf = xmalloc(fs->blocksize * BUF_BLOCKS); |
140 | 140 | ||
141 | for (group = 0; group < fs->group_desc_count; group++) { | 141 | for (group = 0; group < fs->group_desc_count; group++) { |
142 | blk = fs->group_desc[(unsigned)group].bg_inode_table; | 142 | blk = fs->group_desc[(unsigned)group].bg_inode_table; |
143 | if (!blk) { | 143 | if (!blk) { |
@@ -161,7 +161,7 @@ errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd, | |||
161 | retval = io_channel_write_blk(fs->io, blk, c, buf); | 161 | retval = io_channel_write_blk(fs->io, blk, c, buf); |
162 | if (retval) | 162 | if (retval) |
163 | goto errout; | 163 | goto errout; |
164 | 164 | ||
165 | blk += c; | 165 | blk += c; |
166 | left -= c; | 166 | left -= c; |
167 | } | 167 | } |
@@ -176,7 +176,7 @@ errout: | |||
176 | /* | 176 | /* |
177 | * Write out superblock and group descriptors | 177 | * Write out superblock and group descriptors |
178 | */ | 178 | */ |
179 | errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd, | 179 | errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd, |
180 | int flags EXT2FS_ATTR((unused))) | 180 | int flags EXT2FS_ATTR((unused))) |
181 | { | 181 | { |
182 | char *buf, *cp; | 182 | char *buf, *cp; |
@@ -213,7 +213,7 @@ errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd, | |||
213 | retval = EXT2_ET_SHORT_WRITE; | 213 | retval = EXT2_ET_SHORT_WRITE; |
214 | goto errout; | 214 | goto errout; |
215 | } | 215 | } |
216 | 216 | ||
217 | retval = 0; | 217 | retval = 0; |
218 | 218 | ||
219 | errout: | 219 | errout: |
@@ -224,7 +224,7 @@ errout: | |||
224 | /* | 224 | /* |
225 | * Read the superblock and group descriptors and overwrite them. | 225 | * Read the superblock and group descriptors and overwrite them. |
226 | */ | 226 | */ |
227 | errcode_t ext2fs_image_super_read(ext2_filsys fs, int fd, | 227 | errcode_t ext2fs_image_super_read(ext2_filsys fs, int fd, |
228 | int flags EXT2FS_ATTR((unused))) | 228 | int flags EXT2FS_ATTR((unused))) |
229 | { | 229 | { |
230 | char *buf; | 230 | char *buf; |
@@ -368,7 +368,7 @@ errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags) | |||
368 | goto errout; | 368 | goto errout; |
369 | } | 369 | } |
370 | memcpy(ptr, buf, size); | 370 | memcpy(ptr, buf, size); |
371 | 371 | ||
372 | retval = 0; | 372 | retval = 0; |
373 | errout: | 373 | errout: |
374 | if (buf) | 374 | if (buf) |
diff --git a/e2fsprogs/ext2fs/ind_block.c b/e2fsprogs/ext2fs/ind_block.c index c9fd86aae..3e6cdc138 100644 --- a/e2fsprogs/ext2fs/ind_block.c +++ b/e2fsprogs/ext2fs/ind_block.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * ind_block.c --- indirect block I/O routines | 2 | * ind_block.c --- indirect block I/O routines |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, | 4 | * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, |
5 | * 2001, 2002, 2003, 2004, 2005 by Theodore Ts'o. | 5 | * 2001, 2002, 2003, 2004, 2005 by Theodore Ts'o. |
6 | * | 6 | * |
7 | * %Begin-Header% | 7 | * %Begin-Header% |
8 | * This file may be redistributed under the terms of the GNU Public | 8 | * This file may be redistributed under the terms of the GNU Public |
diff --git a/e2fsprogs/ext2fs/initialize.c b/e2fsprogs/ext2fs/initialize.c index 82cd9f1da..3d326b577 100644 --- a/e2fsprogs/ext2fs/initialize.c +++ b/e2fsprogs/ext2fs/initialize.c | |||
@@ -1,9 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | * initialize.c --- initialize a filesystem handle given superblock | 2 | * initialize.c --- initialize a filesystem handle given superblock |
3 | * parameters. Used by mke2fs when initializing a filesystem. | 3 | * parameters. Used by mke2fs when initializing a filesystem. |
4 | * | 4 | * |
5 | * Copyright (C) 1994, 1995, 1996 Theodore Ts'o. | 5 | * Copyright (C) 1994, 1995, 1996 Theodore Ts'o. |
6 | * | 6 | * |
7 | * %Begin-Header% | 7 | * %Begin-Header% |
8 | * This file may be redistributed under the terms of the GNU Public | 8 | * This file may be redistributed under the terms of the GNU Public |
9 | * License. | 9 | * License. |
@@ -36,7 +36,7 @@ | |||
36 | #if defined(__FreeBSD__) && defined(EXT2_OS_FREEBSD) | 36 | #if defined(__FreeBSD__) && defined(EXT2_OS_FREEBSD) |
37 | #define CREATOR_OS EXT2_OS_FREEBSD | 37 | #define CREATOR_OS EXT2_OS_FREEBSD |
38 | #else | 38 | #else |
39 | #if defined(LITES) && defined(EXT2_OS_LITES) | 39 | #if defined(LITES) && defined(EXT2_OS_LITES) |
40 | #define CREATOR_OS EXT2_OS_LITES | 40 | #define CREATOR_OS EXT2_OS_LITES |
41 | #else | 41 | #else |
42 | #define CREATOR_OS EXT2_OS_LINUX /* by default */ | 42 | #define CREATOR_OS EXT2_OS_LINUX /* by default */ |
@@ -44,13 +44,13 @@ | |||
44 | #endif /* defined(__FreeBSD__) && defined(EXT2_OS_FREEBSD) */ | 44 | #endif /* defined(__FreeBSD__) && defined(EXT2_OS_FREEBSD) */ |
45 | #endif /* defined(__GNU__) && defined(EXT2_OS_HURD) */ | 45 | #endif /* defined(__GNU__) && defined(EXT2_OS_HURD) */ |
46 | #endif /* defined(__linux__) && defined(EXT2_OS_LINUX) */ | 46 | #endif /* defined(__linux__) && defined(EXT2_OS_LINUX) */ |
47 | 47 | ||
48 | /* | 48 | /* |
49 | * Note we override the kernel include file's idea of what the default | 49 | * Note we override the kernel include file's idea of what the default |
50 | * check interval (never) should be. It's a good idea to check at | 50 | * check interval (never) should be. It's a good idea to check at |
51 | * least *occasionally*, specially since servers will never rarely get | 51 | * least *occasionally*, specially since servers will never rarely get |
52 | * to reboot, since Linux is so robust these days. :-) | 52 | * to reboot, since Linux is so robust these days. :-) |
53 | * | 53 | * |
54 | * 180 days (six months) seems like a good value. | 54 | * 180 days (six months) seems like a good value. |
55 | */ | 55 | */ |
56 | #ifdef EXT2_DFL_CHECKINTERVAL | 56 | #ifdef EXT2_DFL_CHECKINTERVAL |
@@ -108,11 +108,11 @@ errcode_t ext2fs_initialize(const char *name, int flags, | |||
108 | 108 | ||
109 | if (!param || !param->s_blocks_count) | 109 | if (!param || !param->s_blocks_count) |
110 | return EXT2_ET_INVALID_ARGUMENT; | 110 | return EXT2_ET_INVALID_ARGUMENT; |
111 | 111 | ||
112 | retval = ext2fs_get_mem(sizeof(struct struct_ext2_filsys), &fs); | 112 | retval = ext2fs_get_mem(sizeof(struct struct_ext2_filsys), &fs); |
113 | if (retval) | 113 | if (retval) |
114 | return retval; | 114 | return retval; |
115 | 115 | ||
116 | memset(fs, 0, sizeof(struct struct_ext2_filsys)); | 116 | memset(fs, 0, sizeof(struct struct_ext2_filsys)); |
117 | fs->magic = EXT2_ET_MAGIC_EXT2FS_FILSYS; | 117 | fs->magic = EXT2_ET_MAGIC_EXT2FS_FILSYS; |
118 | fs->flags = flags | EXT2_FLAG_RW; | 118 | fs->flags = flags | EXT2_FLAG_RW; |
@@ -181,7 +181,7 @@ errcode_t ext2fs_initialize(const char *name, int flags, | |||
181 | if (super->s_blocks_per_group > EXT2_MAX_BLOCKS_PER_GROUP(super)) | 181 | if (super->s_blocks_per_group > EXT2_MAX_BLOCKS_PER_GROUP(super)) |
182 | super->s_blocks_per_group = EXT2_MAX_BLOCKS_PER_GROUP(super); | 182 | super->s_blocks_per_group = EXT2_MAX_BLOCKS_PER_GROUP(super); |
183 | super->s_frags_per_group = super->s_blocks_per_group * frags_per_block; | 183 | super->s_frags_per_group = super->s_blocks_per_group * frags_per_block; |
184 | 184 | ||
185 | super->s_blocks_count = param->s_blocks_count; | 185 | super->s_blocks_count = param->s_blocks_count; |
186 | super->s_r_blocks_count = param->s_r_blocks_count; | 186 | super->s_r_blocks_count = param->s_r_blocks_count; |
187 | if (super->s_r_blocks_count >= param->s_blocks_count) { | 187 | if (super->s_r_blocks_count >= param->s_blocks_count) { |
@@ -222,7 +222,7 @@ retry: | |||
222 | */ | 222 | */ |
223 | if (super->s_inodes_count < EXT2_FIRST_INODE(super)+1) | 223 | if (super->s_inodes_count < EXT2_FIRST_INODE(super)+1) |
224 | super->s_inodes_count = EXT2_FIRST_INODE(super)+1; | 224 | super->s_inodes_count = EXT2_FIRST_INODE(super)+1; |
225 | 225 | ||
226 | /* | 226 | /* |
227 | * There should be at least as many inodes as the user | 227 | * There should be at least as many inodes as the user |
228 | * requested. Figure out how many inodes per group that | 228 | * requested. Figure out how many inodes per group that |
@@ -332,12 +332,12 @@ retry: | |||
332 | retval = ext2fs_get_mem(strlen(fs->device_name) + 80, &buf); | 332 | retval = ext2fs_get_mem(strlen(fs->device_name) + 80, &buf); |
333 | if (retval) | 333 | if (retval) |
334 | goto cleanup; | 334 | goto cleanup; |
335 | 335 | ||
336 | sprintf(buf, "block bitmap for %s", fs->device_name); | 336 | sprintf(buf, "block bitmap for %s", fs->device_name); |
337 | retval = ext2fs_allocate_block_bitmap(fs, buf, &fs->block_map); | 337 | retval = ext2fs_allocate_block_bitmap(fs, buf, &fs->block_map); |
338 | if (retval) | 338 | if (retval) |
339 | goto cleanup; | 339 | goto cleanup; |
340 | 340 | ||
341 | sprintf(buf, "inode bitmap for %s", fs->device_name); | 341 | sprintf(buf, "inode bitmap for %s", fs->device_name); |
342 | retval = ext2fs_allocate_inode_bitmap(fs, buf, &fs->inode_map); | 342 | retval = ext2fs_allocate_inode_bitmap(fs, buf, &fs->inode_map); |
343 | if (retval) | 343 | if (retval) |
@@ -369,14 +369,14 @@ retry: | |||
369 | fs->group_desc[i].bg_free_inodes_count = | 369 | fs->group_desc[i].bg_free_inodes_count = |
370 | fs->super->s_inodes_per_group; | 370 | fs->super->s_inodes_per_group; |
371 | fs->group_desc[i].bg_used_dirs_count = 0; | 371 | fs->group_desc[i].bg_used_dirs_count = 0; |
372 | 372 | ||
373 | group_block += super->s_blocks_per_group; | 373 | group_block += super->s_blocks_per_group; |
374 | } | 374 | } |
375 | 375 | ||
376 | ext2fs_mark_super_dirty(fs); | 376 | ext2fs_mark_super_dirty(fs); |
377 | ext2fs_mark_bb_dirty(fs); | 377 | ext2fs_mark_bb_dirty(fs); |
378 | ext2fs_mark_ib_dirty(fs); | 378 | ext2fs_mark_ib_dirty(fs); |
379 | 379 | ||
380 | io_channel_set_blksize(fs->io, fs->blocksize); | 380 | io_channel_set_blksize(fs->io, fs->blocksize); |
381 | 381 | ||
382 | *ret_fs = fs; | 382 | *ret_fs = fs; |
diff --git a/e2fsprogs/ext2fs/inline.c b/e2fsprogs/ext2fs/inline.c index 5833b1d9d..9c3a6c0d3 100644 --- a/e2fsprogs/ext2fs/inline.c +++ b/e2fsprogs/ext2fs/inline.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * inline.c --- Includes the inlined functions defined in the header | 2 | * inline.c --- Includes the inlined functions defined in the header |
3 | * files as standalone functions, in case the application program | 3 | * files as standalone functions, in case the application program |
4 | * is compiled with inlining turned off. | 4 | * is compiled with inlining turned off. |
5 | * | 5 | * |
6 | * Copyright (C) 1993, 1994 Theodore Ts'o. | 6 | * Copyright (C) 1993, 1994 Theodore Ts'o. |
7 | * | 7 | * |
8 | * %Begin-Header% | 8 | * %Begin-Header% |
diff --git a/e2fsprogs/ext2fs/inode.c b/e2fsprogs/ext2fs/inode.c index 30580bf6d..e50bece40 100644 --- a/e2fsprogs/ext2fs/inode.c +++ b/e2fsprogs/ext2fs/inode.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * inode.c --- utility routines to read and write inodes | 2 | * inode.c --- utility routines to read and write inodes |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1995, 1996, 1997 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1995, 1996, 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -59,7 +59,7 @@ struct ext2_struct_inode_scan { | |||
59 | errcode_t ext2fs_flush_icache(ext2_filsys fs) | 59 | errcode_t ext2fs_flush_icache(ext2_filsys fs) |
60 | { | 60 | { |
61 | int i; | 61 | int i; |
62 | 62 | ||
63 | if (!fs->icache) | 63 | if (!fs->icache) |
64 | return 0; | 64 | return 0; |
65 | 65 | ||
@@ -73,7 +73,7 @@ errcode_t ext2fs_flush_icache(ext2_filsys fs) | |||
73 | static errcode_t create_icache(ext2_filsys fs) | 73 | static errcode_t create_icache(ext2_filsys fs) |
74 | { | 74 | { |
75 | errcode_t retval; | 75 | errcode_t retval; |
76 | 76 | ||
77 | if (fs->icache) | 77 | if (fs->icache) |
78 | return 0; | 78 | return 0; |
79 | retval = ext2fs_get_mem(sizeof(struct ext2_inode_cache), &fs->icache); | 79 | retval = ext2fs_get_mem(sizeof(struct ext2_inode_cache), &fs->icache); |
@@ -146,7 +146,7 @@ errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks, | |||
146 | group_desc[scan->current_group].bg_inode_table; | 146 | group_desc[scan->current_group].bg_inode_table; |
147 | scan->inodes_left = EXT2_INODES_PER_GROUP(scan->fs->super); | 147 | scan->inodes_left = EXT2_INODES_PER_GROUP(scan->fs->super); |
148 | scan->blocks_left = scan->fs->inode_blocks_per_group; | 148 | scan->blocks_left = scan->fs->inode_blocks_per_group; |
149 | retval = ext2fs_get_mem((size_t) (scan->inode_buffer_blocks * | 149 | retval = ext2fs_get_mem((size_t) (scan->inode_buffer_blocks * |
150 | fs->blocksize), | 150 | fs->blocksize), |
151 | &scan->inode_buffer); | 151 | &scan->inode_buffer); |
152 | scan->done_group = 0; | 152 | scan->done_group = 0; |
@@ -172,7 +172,7 @@ void ext2fs_close_inode_scan(ext2_inode_scan scan) | |||
172 | { | 172 | { |
173 | if (!scan || (scan->magic != EXT2_ET_MAGIC_INODE_SCAN)) | 173 | if (!scan || (scan->magic != EXT2_ET_MAGIC_INODE_SCAN)) |
174 | return; | 174 | return; |
175 | 175 | ||
176 | ext2fs_free_mem(&scan->inode_buffer); | 176 | ext2fs_free_mem(&scan->inode_buffer); |
177 | scan->inode_buffer = NULL; | 177 | scan->inode_buffer = NULL; |
178 | ext2fs_free_mem(&scan->temp_buffer); | 178 | ext2fs_free_mem(&scan->temp_buffer); |
@@ -190,7 +190,7 @@ void ext2fs_set_inode_callback(ext2_inode_scan scan, | |||
190 | { | 190 | { |
191 | if (!scan || (scan->magic != EXT2_ET_MAGIC_INODE_SCAN)) | 191 | if (!scan || (scan->magic != EXT2_ET_MAGIC_INODE_SCAN)) |
192 | return; | 192 | return; |
193 | 193 | ||
194 | scan->done_group = done_group; | 194 | scan->done_group = done_group; |
195 | scan->done_group_data = done_group_data; | 195 | scan->done_group_data = done_group_data; |
196 | } | 196 | } |
@@ -217,7 +217,7 @@ static errcode_t get_next_blockgroup(ext2_inode_scan scan) | |||
217 | { | 217 | { |
218 | scan->current_group++; | 218 | scan->current_group++; |
219 | scan->groups_left--; | 219 | scan->groups_left--; |
220 | 220 | ||
221 | scan->current_block = scan->fs-> | 221 | scan->current_block = scan->fs-> |
222 | group_desc[scan->current_group].bg_inode_table; | 222 | group_desc[scan->current_group].bg_inode_table; |
223 | 223 | ||
@@ -335,7 +335,7 @@ static errcode_t get_next_blocks(ext2_inode_scan scan) | |||
335 | if (retval) | 335 | if (retval) |
336 | return retval; | 336 | return retval; |
337 | } | 337 | } |
338 | 338 | ||
339 | if ((scan->scan_flags & EXT2_SF_BAD_INODE_BLK) || | 339 | if ((scan->scan_flags & EXT2_SF_BAD_INODE_BLK) || |
340 | (scan->current_block == 0)) { | 340 | (scan->current_block == 0)) { |
341 | memset(scan->inode_buffer, 0, | 341 | memset(scan->inode_buffer, 0, |
@@ -367,7 +367,7 @@ static errcode_t get_next_blocks(ext2_inode_scan scan) | |||
367 | static inline int is_empty_scan(ext2_inode_scan scan) | 367 | static inline int is_empty_scan(ext2_inode_scan scan) |
368 | { | 368 | { |
369 | int i; | 369 | int i; |
370 | 370 | ||
371 | if (scan->bytes_left == 0) | 371 | if (scan->bytes_left == 0) |
372 | return 0; | 372 | return 0; |
373 | 373 | ||
@@ -383,7 +383,7 @@ errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino, | |||
383 | { | 383 | { |
384 | errcode_t retval; | 384 | errcode_t retval; |
385 | int extra_bytes = 0; | 385 | int extra_bytes = 0; |
386 | 386 | ||
387 | EXT2_CHECK_MAGIC(scan, EXT2_ET_MAGIC_INODE_SCAN); | 387 | EXT2_CHECK_MAGIC(scan, EXT2_ET_MAGIC_INODE_SCAN); |
388 | 388 | ||
389 | /* | 389 | /* |
@@ -416,7 +416,7 @@ errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino, | |||
416 | } else | 416 | } else |
417 | return EXT2_ET_MISSING_INODE_TABLE; | 417 | return EXT2_ET_MISSING_INODE_TABLE; |
418 | } | 418 | } |
419 | 419 | ||
420 | 420 | ||
421 | /* | 421 | /* |
422 | * Have we run out of space in the inode buffer? If so, we | 422 | * Have we run out of space in the inode buffer? If so, we |
@@ -449,9 +449,9 @@ errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino, | |||
449 | #ifdef EXT2FS_ENABLE_SWAPFS | 449 | #ifdef EXT2FS_ENABLE_SWAPFS |
450 | if ((scan->fs->flags & EXT2_FLAG_SWAP_BYTES) || | 450 | if ((scan->fs->flags & EXT2_FLAG_SWAP_BYTES) || |
451 | (scan->fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) | 451 | (scan->fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) |
452 | ext2fs_swap_inode_full(scan->fs, | 452 | ext2fs_swap_inode_full(scan->fs, |
453 | (struct ext2_inode_large *) inode, | 453 | (struct ext2_inode_large *) inode, |
454 | (struct ext2_inode_large *) scan->temp_buffer, | 454 | (struct ext2_inode_large *) scan->temp_buffer, |
455 | 0, bufsize); | 455 | 0, bufsize); |
456 | else | 456 | else |
457 | #endif | 457 | #endif |
@@ -463,7 +463,7 @@ errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino, | |||
463 | #ifdef EXT2FS_ENABLE_SWAPFS | 463 | #ifdef EXT2FS_ENABLE_SWAPFS |
464 | if ((scan->fs->flags & EXT2_FLAG_SWAP_BYTES) || | 464 | if ((scan->fs->flags & EXT2_FLAG_SWAP_BYTES) || |
465 | (scan->fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) | 465 | (scan->fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) |
466 | ext2fs_swap_inode_full(scan->fs, | 466 | ext2fs_swap_inode_full(scan->fs, |
467 | (struct ext2_inode_large *) inode, | 467 | (struct ext2_inode_large *) inode, |
468 | (struct ext2_inode_large *) scan->ptr, | 468 | (struct ext2_inode_large *) scan->ptr, |
469 | 0, bufsize); | 469 | 0, bufsize); |
@@ -495,10 +495,10 @@ errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ext2_ino_t *ino, | |||
495 | errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino, | 495 | errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino, |
496 | struct ext2_inode * inode, int bufsize) | 496 | struct ext2_inode * inode, int bufsize) |
497 | { | 497 | { |
498 | unsigned long group, block, block_nr, offset; | 498 | unsigned long group, block, block_nr, offset; |
499 | char *ptr; | 499 | char *ptr; |
500 | errcode_t retval; | 500 | errcode_t retval; |
501 | int clen, i, inodes_per_block, length; | 501 | int clen, i, inodes_per_block, length; |
502 | io_channel io; | 502 | io_channel io; |
503 | 503 | ||
504 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); | 504 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); |
@@ -541,7 +541,7 @@ errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino, | |||
541 | block = offset >> EXT2_BLOCK_SIZE_BITS(fs->super); | 541 | block = offset >> EXT2_BLOCK_SIZE_BITS(fs->super); |
542 | if (!fs->group_desc[(unsigned)group].bg_inode_table) | 542 | if (!fs->group_desc[(unsigned)group].bg_inode_table) |
543 | return EXT2_ET_MISSING_INODE_TABLE; | 543 | return EXT2_ET_MISSING_INODE_TABLE; |
544 | block_nr = fs->group_desc[(unsigned)group].bg_inode_table + | 544 | block_nr = fs->group_desc[(unsigned)group].bg_inode_table + |
545 | block; | 545 | block; |
546 | io = fs->io; | 546 | io = fs->io; |
547 | } | 547 | } |
@@ -577,8 +577,8 @@ errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino, | |||
577 | #ifdef EXT2FS_ENABLE_SWAPFS | 577 | #ifdef EXT2FS_ENABLE_SWAPFS |
578 | if ((fs->flags & EXT2_FLAG_SWAP_BYTES) || | 578 | if ((fs->flags & EXT2_FLAG_SWAP_BYTES) || |
579 | (fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) | 579 | (fs->flags & EXT2_FLAG_SWAP_BYTES_READ)) |
580 | ext2fs_swap_inode_full(fs, (struct ext2_inode_large *) inode, | 580 | ext2fs_swap_inode_full(fs, (struct ext2_inode_large *) inode, |
581 | (struct ext2_inode_large *) inode, | 581 | (struct ext2_inode_large *) inode, |
582 | 0, length); | 582 | 0, length); |
583 | #endif | 583 | #endif |
584 | 584 | ||
@@ -587,7 +587,7 @@ errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino, | |||
587 | fs->icache->cache_size; | 587 | fs->icache->cache_size; |
588 | fs->icache->cache[fs->icache->cache_last].ino = ino; | 588 | fs->icache->cache[fs->icache->cache_last].ino = ino; |
589 | fs->icache->cache[fs->icache->cache_last].inode = *inode; | 589 | fs->icache->cache[fs->icache->cache_last].inode = *inode; |
590 | 590 | ||
591 | return 0; | 591 | return 0; |
592 | } | 592 | } |
593 | 593 | ||
@@ -629,7 +629,7 @@ errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino, | |||
629 | if (retval) | 629 | if (retval) |
630 | return retval; | 630 | return retval; |
631 | } | 631 | } |
632 | 632 | ||
633 | if (!(fs->flags & EXT2_FLAG_RW)) | 633 | if (!(fs->flags & EXT2_FLAG_RW)) |
634 | return EXT2_ET_RO_FILSYS; | 634 | return EXT2_ET_RO_FILSYS; |
635 | 635 | ||
@@ -649,13 +649,13 @@ errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino, | |||
649 | #ifdef EXT2FS_ENABLE_SWAPFS | 649 | #ifdef EXT2FS_ENABLE_SWAPFS |
650 | if ((fs->flags & EXT2_FLAG_SWAP_BYTES) || | 650 | if ((fs->flags & EXT2_FLAG_SWAP_BYTES) || |
651 | (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE)) | 651 | (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE)) |
652 | ext2fs_swap_inode_full(fs, w_inode, | 652 | ext2fs_swap_inode_full(fs, w_inode, |
653 | (struct ext2_inode_large *) inode, | 653 | (struct ext2_inode_large *) inode, |
654 | 1, bufsize); | 654 | 1, bufsize); |
655 | else | 655 | else |
656 | #endif | 656 | #endif |
657 | memcpy(w_inode, inode, bufsize); | 657 | memcpy(w_inode, inode, bufsize); |
658 | 658 | ||
659 | group = (ino - 1) / EXT2_INODES_PER_GROUP(fs->super); | 659 | group = (ino - 1) / EXT2_INODES_PER_GROUP(fs->super); |
660 | offset = ((ino - 1) % EXT2_INODES_PER_GROUP(fs->super)) * | 660 | offset = ((ino - 1) % EXT2_INODES_PER_GROUP(fs->super)) * |
661 | EXT2_INODE_SIZE(fs->super); | 661 | EXT2_INODE_SIZE(fs->super); |
@@ -685,11 +685,11 @@ errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino, | |||
685 | fs->icache->buffer_blk = block_nr; | 685 | fs->icache->buffer_blk = block_nr; |
686 | } | 686 | } |
687 | 687 | ||
688 | 688 | ||
689 | memcpy((char *) fs->icache->buffer + (unsigned) offset, | 689 | memcpy((char *) fs->icache->buffer + (unsigned) offset, |
690 | ptr, clen); | 690 | ptr, clen); |
691 | 691 | ||
692 | retval = io_channel_write_blk(fs->io, block_nr, 1, | 692 | retval = io_channel_write_blk(fs->io, block_nr, 1, |
693 | fs->icache->buffer); | 693 | fs->icache->buffer); |
694 | if (retval) | 694 | if (retval) |
695 | goto errout; | 695 | goto errout; |
@@ -699,7 +699,7 @@ errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino, | |||
699 | length -= clen; | 699 | length -= clen; |
700 | block_nr++; | 700 | block_nr++; |
701 | } | 701 | } |
702 | 702 | ||
703 | fs->flags |= EXT2_FLAG_CHANGED; | 703 | fs->flags |= EXT2_FLAG_CHANGED; |
704 | errout: | 704 | errout: |
705 | if (w_inode && w_inode != &temp_inode) | 705 | if (w_inode && w_inode != &temp_inode) |
@@ -714,7 +714,7 @@ errcode_t ext2fs_write_inode(ext2_filsys fs, ext2_ino_t ino, | |||
714 | sizeof(struct ext2_inode)); | 714 | sizeof(struct ext2_inode)); |
715 | } | 715 | } |
716 | 716 | ||
717 | /* | 717 | /* |
718 | * This function should be called when writing a new inode. It makes | 718 | * This function should be called when writing a new inode. It makes |
719 | * sure that extra part of large inodes is initialized properly. | 719 | * sure that extra part of large inodes is initialized properly. |
720 | */ | 720 | */ |
@@ -722,7 +722,7 @@ errcode_t ext2fs_write_new_inode(ext2_filsys fs, ext2_ino_t ino, | |||
722 | struct ext2_inode *inode) | 722 | struct ext2_inode *inode) |
723 | { | 723 | { |
724 | struct ext2_inode *buf; | 724 | struct ext2_inode *buf; |
725 | int size = EXT2_INODE_SIZE(fs->super); | 725 | int size = EXT2_INODE_SIZE(fs->super); |
726 | struct ext2_inode_large *large_inode; | 726 | struct ext2_inode_large *large_inode; |
727 | 727 | ||
728 | if (size == sizeof(struct ext2_inode)) | 728 | if (size == sizeof(struct ext2_inode)) |
@@ -735,19 +735,19 @@ errcode_t ext2fs_write_new_inode(ext2_filsys fs, ext2_ino_t ino, | |||
735 | *buf = *inode; | 735 | *buf = *inode; |
736 | 736 | ||
737 | large_inode = (struct ext2_inode_large *) buf; | 737 | large_inode = (struct ext2_inode_large *) buf; |
738 | large_inode->i_extra_isize = sizeof(struct ext2_inode_large) - | 738 | large_inode->i_extra_isize = sizeof(struct ext2_inode_large) - |
739 | EXT2_GOOD_OLD_INODE_SIZE; | 739 | EXT2_GOOD_OLD_INODE_SIZE; |
740 | 740 | ||
741 | return ext2fs_write_inode_full(fs, ino, buf, size); | 741 | return ext2fs_write_inode_full(fs, ino, buf, size); |
742 | } | 742 | } |
743 | 743 | ||
744 | 744 | ||
745 | errcode_t ext2fs_get_blocks(ext2_filsys fs, ext2_ino_t ino, blk_t *blocks) | 745 | errcode_t ext2fs_get_blocks(ext2_filsys fs, ext2_ino_t ino, blk_t *blocks) |
746 | { | 746 | { |
747 | struct ext2_inode inode; | 747 | struct ext2_inode inode; |
748 | int i; | 748 | int i; |
749 | errcode_t retval; | 749 | errcode_t retval; |
750 | 750 | ||
751 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); | 751 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); |
752 | 752 | ||
753 | if (ino > fs->super->s_inodes_count) | 753 | if (ino > fs->super->s_inodes_count) |
@@ -769,7 +769,7 @@ errcode_t ext2fs_check_directory(ext2_filsys fs, ext2_ino_t ino) | |||
769 | { | 769 | { |
770 | struct ext2_inode inode; | 770 | struct ext2_inode inode; |
771 | errcode_t retval; | 771 | errcode_t retval; |
772 | 772 | ||
773 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); | 773 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); |
774 | 774 | ||
775 | if (ino > fs->super->s_inodes_count) | 775 | if (ino > fs->super->s_inodes_count) |
diff --git a/e2fsprogs/ext2fs/inode_io.c b/e2fsprogs/ext2fs/inode_io.c index b5c08b90a..deaa95562 100644 --- a/e2fsprogs/ext2fs/inode_io.c +++ b/e2fsprogs/ext2fs/inode_io.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * inode_io.c --- This is allows an inode in an ext2 filesystem image | 2 | * inode_io.c --- This is allows an inode in an ext2 filesystem image |
3 | * to be accessed via the I/O manager interface. | 3 | * to be accessed via the I/O manager interface. |
4 | * | 4 | * |
5 | * Copyright (C) 2002 Theodore Ts'o. | 5 | * Copyright (C) 2002 Theodore Ts'o. |
6 | * | 6 | * |
@@ -35,7 +35,7 @@ struct inode_private_data { | |||
35 | char name[32]; | 35 | char name[32]; |
36 | ext2_file_t file; | 36 | ext2_file_t file; |
37 | ext2_filsys fs; | 37 | ext2_filsys fs; |
38 | ext2_ino_t ino; | 38 | ext2_ino_t ino; |
39 | struct ext2_inode inode; | 39 | struct ext2_inode inode; |
40 | int flags; | 40 | int flags; |
41 | struct inode_private_data *next; | 41 | struct inode_private_data *next; |
@@ -75,7 +75,7 @@ errcode_t ext2fs_inode_io_intern2(ext2_filsys fs, ext2_ino_t ino, | |||
75 | struct ext2_inode *inode, | 75 | struct ext2_inode *inode, |
76 | char **name) | 76 | char **name) |
77 | { | 77 | { |
78 | struct inode_private_data *data; | 78 | struct inode_private_data *data; |
79 | errcode_t retval; | 79 | errcode_t retval; |
80 | 80 | ||
81 | if ((retval = ext2fs_get_mem(sizeof(struct inode_private_data), | 81 | if ((retval = ext2fs_get_mem(sizeof(struct inode_private_data), |
@@ -150,7 +150,7 @@ static errcode_t inode_open(const char *name, int flags, io_channel *channel) | |||
150 | &data->file); | 150 | &data->file); |
151 | if (retval) | 151 | if (retval) |
152 | goto cleanup; | 152 | goto cleanup; |
153 | 153 | ||
154 | *channel = io; | 154 | *channel = io; |
155 | return 0; | 155 | return 0; |
156 | 156 | ||
@@ -176,7 +176,7 @@ static errcode_t inode_close(io_channel channel) | |||
176 | return 0; | 176 | return 0; |
177 | 177 | ||
178 | retval = ext2fs_file_close(data->file); | 178 | retval = ext2fs_file_close(data->file); |
179 | 179 | ||
180 | ext2fs_free_mem(&channel->private_data); | 180 | ext2fs_free_mem(&channel->private_data); |
181 | if (channel->name) | 181 | if (channel->name) |
182 | ext2fs_free_mem(&channel->name); | 182 | ext2fs_free_mem(&channel->name); |
@@ -255,12 +255,12 @@ static errcode_t inode_write_byte(io_channel channel, unsigned long offset, | |||
255 | } | 255 | } |
256 | 256 | ||
257 | /* | 257 | /* |
258 | * Flush data buffers to disk. | 258 | * Flush data buffers to disk. |
259 | */ | 259 | */ |
260 | static errcode_t inode_flush(io_channel channel) | 260 | static errcode_t inode_flush(io_channel channel) |
261 | { | 261 | { |
262 | struct inode_private_data *data; | 262 | struct inode_private_data *data; |
263 | 263 | ||
264 | EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); | 264 | EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); |
265 | data = (struct inode_private_data *) channel->private_data; | 265 | data = (struct inode_private_data *) channel->private_data; |
266 | EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_INODE_IO_CHANNEL); | 266 | EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_INODE_IO_CHANNEL); |
diff --git a/e2fsprogs/ext2fs/io_manager.c b/e2fsprogs/ext2fs/io_manager.c index e50d7e414..3d0987bc1 100644 --- a/e2fsprogs/ext2fs/io_manager.c +++ b/e2fsprogs/ext2fs/io_manager.c | |||
@@ -61,8 +61,8 @@ errcode_t io_channel_write_byte(io_channel channel, unsigned long offset, | |||
61 | { | 61 | { |
62 | EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); | 62 | EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); |
63 | 63 | ||
64 | if (channel->manager->write_byte) | 64 | if (channel->manager->write_byte) |
65 | return channel->manager->write_byte(channel, offset, | 65 | return channel->manager->write_byte(channel, offset, |
66 | count, data); | 66 | count, data); |
67 | 67 | ||
68 | return EXT2_ET_UNIMPLEMENTED; | 68 | return EXT2_ET_UNIMPLEMENTED; |
diff --git a/e2fsprogs/ext2fs/irel.h b/e2fsprogs/ext2fs/irel.h index 9b943ced1..45e031beb 100644 --- a/e2fsprogs/ext2fs/irel.h +++ b/e2fsprogs/ext2fs/irel.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * irel.h | 2 | * irel.h |
3 | * | 3 | * |
4 | * Copyright (C) 1996, 1997 Theodore Ts'o. | 4 | * Copyright (C) 1996, 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
diff --git a/e2fsprogs/ext2fs/irel_ma.c b/e2fsprogs/ext2fs/irel_ma.c index eedbe55c8..d9e73f73c 100644 --- a/e2fsprogs/ext2fs/irel_ma.c +++ b/e2fsprogs/ext2fs/irel_ma.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * irel_ma.c | 2 | * irel_ma.c |
3 | * | 3 | * |
4 | * Copyright (C) 1996, 1997 Theodore Ts'o. | 4 | * Copyright (C) 1996, 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -64,7 +64,7 @@ errcode_t ext2fs_irel_memarray_create(char *name, ext2_ino_t max_inode, | |||
64 | { | 64 | { |
65 | ext2_irel irel = 0; | 65 | ext2_irel irel = 0; |
66 | errcode_t retval; | 66 | errcode_t retval; |
67 | struct irel_ma *ma = 0; | 67 | struct irel_ma *ma = 0; |
68 | size_t size; | 68 | size_t size; |
69 | 69 | ||
70 | *new_irel = 0; | 70 | *new_irel = 0; |
@@ -77,18 +77,18 @@ errcode_t ext2fs_irel_memarray_create(char *name, ext2_ino_t max_inode, | |||
77 | if (retval) | 77 | if (retval) |
78 | goto errout; | 78 | goto errout; |
79 | memset(irel, 0, sizeof(struct ext2_inode_relocation_table)); | 79 | memset(irel, 0, sizeof(struct ext2_inode_relocation_table)); |
80 | 80 | ||
81 | retval = ext2fs_get_mem(strlen(name)+1, &irel->name); | 81 | retval = ext2fs_get_mem(strlen(name)+1, &irel->name); |
82 | if (retval) | 82 | if (retval) |
83 | goto errout; | 83 | goto errout; |
84 | strcpy(irel->name, name); | 84 | strcpy(irel->name, name); |
85 | 85 | ||
86 | retval = ext2fs_get_mem(sizeof(struct irel_ma), &ma); | 86 | retval = ext2fs_get_mem(sizeof(struct irel_ma), &ma); |
87 | if (retval) | 87 | if (retval) |
88 | goto errout; | 88 | goto errout; |
89 | memset(ma, 0, sizeof(struct irel_ma)); | 89 | memset(ma, 0, sizeof(struct irel_ma)); |
90 | irel->priv_data = ma; | 90 | irel->priv_data = ma; |
91 | 91 | ||
92 | size = (size_t) (sizeof(ext2_ino_t) * (max_inode+1)); | 92 | size = (size_t) (sizeof(ext2_ino_t) * (max_inode+1)); |
93 | retval = ext2fs_get_mem(size, &ma->orig_map); | 93 | retval = ext2fs_get_mem(size, &ma->orig_map); |
94 | if (retval) | 94 | if (retval) |
@@ -124,7 +124,7 @@ errcode_t ext2fs_irel_memarray_create(char *name, ext2_ino_t max_inode, | |||
124 | irel->move = ima_move; | 124 | irel->move = ima_move; |
125 | irel->delete = ima_delete; | 125 | irel->delete = ima_delete; |
126 | irel->free = ima_free; | 126 | irel->free = ima_free; |
127 | 127 | ||
128 | *new_irel = irel; | 128 | *new_irel = irel; |
129 | return 0; | 129 | return 0; |
130 | 130 | ||
@@ -137,7 +137,7 @@ static errcode_t ima_put(ext2_irel irel, ext2_ino_t old, | |||
137 | struct ext2_inode_relocate_entry *ent) | 137 | struct ext2_inode_relocate_entry *ent) |
138 | { | 138 | { |
139 | struct inode_reference_entry *ref_ent; | 139 | struct inode_reference_entry *ref_ent; |
140 | struct irel_ma *ma; | 140 | struct irel_ma *ma; |
141 | errcode_t retval; | 141 | errcode_t retval; |
142 | size_t size, old_size; | 142 | size_t size, old_size; |
143 | 143 | ||
@@ -153,7 +153,7 @@ static errcode_t ima_put(ext2_irel irel, ext2_ino_t old, | |||
153 | ent->orig = old; | 153 | ent->orig = old; |
154 | else | 154 | else |
155 | ent->orig = ma->entries[(unsigned) old].orig; | 155 | ent->orig = ma->entries[(unsigned) old].orig; |
156 | 156 | ||
157 | /* | 157 | /* |
158 | * If max_refs has changed, reallocate the refs array | 158 | * If max_refs has changed, reallocate the refs array |
159 | */ | 159 | */ |
@@ -176,7 +176,7 @@ static errcode_t ima_put(ext2_irel irel, ext2_ino_t old, | |||
176 | static errcode_t ima_get(ext2_irel irel, ext2_ino_t old, | 176 | static errcode_t ima_get(ext2_irel irel, ext2_ino_t old, |
177 | struct ext2_inode_relocate_entry *ent) | 177 | struct ext2_inode_relocate_entry *ent) |
178 | { | 178 | { |
179 | struct irel_ma *ma; | 179 | struct irel_ma *ma; |
180 | 180 | ||
181 | ma = irel->priv_data; | 181 | ma = irel->priv_data; |
182 | if (old > ma->max_inode) | 182 | if (old > ma->max_inode) |
@@ -190,7 +190,7 @@ static errcode_t ima_get(ext2_irel irel, ext2_ino_t old, | |||
190 | static errcode_t ima_get_by_orig(ext2_irel irel, ext2_ino_t orig, ext2_ino_t *old, | 190 | static errcode_t ima_get_by_orig(ext2_irel irel, ext2_ino_t orig, ext2_ino_t *old, |
191 | struct ext2_inode_relocate_entry *ent) | 191 | struct ext2_inode_relocate_entry *ent) |
192 | { | 192 | { |
193 | struct irel_ma *ma; | 193 | struct irel_ma *ma; |
194 | ext2_ino_t ino; | 194 | ext2_ino_t ino; |
195 | 195 | ||
196 | ma = irel->priv_data; | 196 | ma = irel->priv_data; |
@@ -213,7 +213,7 @@ static errcode_t ima_start_iter(ext2_irel irel) | |||
213 | static errcode_t ima_next(ext2_irel irel, ext2_ino_t *old, | 213 | static errcode_t ima_next(ext2_irel irel, ext2_ino_t *old, |
214 | struct ext2_inode_relocate_entry *ent) | 214 | struct ext2_inode_relocate_entry *ent) |
215 | { | 215 | { |
216 | struct irel_ma *ma; | 216 | struct irel_ma *ma; |
217 | 217 | ||
218 | ma = irel->priv_data; | 218 | ma = irel->priv_data; |
219 | while (++irel->current < ma->max_inode) { | 219 | while (++irel->current < ma->max_inode) { |
@@ -230,7 +230,7 @@ static errcode_t ima_next(ext2_irel irel, ext2_ino_t *old, | |||
230 | static errcode_t ima_add_ref(ext2_irel irel, ext2_ino_t ino, | 230 | static errcode_t ima_add_ref(ext2_irel irel, ext2_ino_t ino, |
231 | struct ext2_inode_reference *ref) | 231 | struct ext2_inode_reference *ref) |
232 | { | 232 | { |
233 | struct irel_ma *ma; | 233 | struct irel_ma *ma; |
234 | size_t size; | 234 | size_t size; |
235 | struct inode_reference_entry *ref_ent; | 235 | struct inode_reference_entry *ref_ent; |
236 | struct ext2_inode_relocate_entry *ent; | 236 | struct ext2_inode_relocate_entry *ent; |
@@ -242,12 +242,12 @@ static errcode_t ima_add_ref(ext2_irel irel, ext2_ino_t ino, | |||
242 | 242 | ||
243 | ref_ent = ma->ref_entries + (unsigned) ino; | 243 | ref_ent = ma->ref_entries + (unsigned) ino; |
244 | ent = ma->entries + (unsigned) ino; | 244 | ent = ma->entries + (unsigned) ino; |
245 | 245 | ||
246 | /* | 246 | /* |
247 | * If the inode reference array doesn't exist, create it. | 247 | * If the inode reference array doesn't exist, create it. |
248 | */ | 248 | */ |
249 | if (ref_ent->refs == 0) { | 249 | if (ref_ent->refs == 0) { |
250 | size = (size_t) ((sizeof(struct ext2_inode_reference) * | 250 | size = (size_t) ((sizeof(struct ext2_inode_reference) * |
251 | ent->max_refs)); | 251 | ent->max_refs)); |
252 | retval = ext2fs_get_mem(size, &ref_ent->refs); | 252 | retval = ext2fs_get_mem(size, &ref_ent->refs); |
253 | if (retval) | 253 | if (retval) |
@@ -265,7 +265,7 @@ static errcode_t ima_add_ref(ext2_irel irel, ext2_ino_t ino, | |||
265 | 265 | ||
266 | static errcode_t ima_start_iter_ref(ext2_irel irel, ext2_ino_t ino) | 266 | static errcode_t ima_start_iter_ref(ext2_irel irel, ext2_ino_t ino) |
267 | { | 267 | { |
268 | struct irel_ma *ma; | 268 | struct irel_ma *ma; |
269 | 269 | ||
270 | ma = irel->priv_data; | 270 | ma = irel->priv_data; |
271 | if (ino > ma->max_inode) | 271 | if (ino > ma->max_inode) |
@@ -280,11 +280,11 @@ static errcode_t ima_start_iter_ref(ext2_irel irel, ext2_ino_t ino) | |||
280 | static errcode_t ima_next_ref(ext2_irel irel, | 280 | static errcode_t ima_next_ref(ext2_irel irel, |
281 | struct ext2_inode_reference *ref) | 281 | struct ext2_inode_reference *ref) |
282 | { | 282 | { |
283 | struct irel_ma *ma; | 283 | struct irel_ma *ma; |
284 | struct inode_reference_entry *ref_ent; | 284 | struct inode_reference_entry *ref_ent; |
285 | 285 | ||
286 | ma = irel->priv_data; | 286 | ma = irel->priv_data; |
287 | 287 | ||
288 | ref_ent = ma->ref_entries + ma->ref_current; | 288 | ref_ent = ma->ref_entries + ma->ref_current; |
289 | 289 | ||
290 | if ((ref_ent->refs == NULL) || | 290 | if ((ref_ent->refs == NULL) || |
@@ -300,19 +300,19 @@ static errcode_t ima_next_ref(ext2_irel irel, | |||
300 | 300 | ||
301 | static errcode_t ima_move(ext2_irel irel, ext2_ino_t old, ext2_ino_t new) | 301 | static errcode_t ima_move(ext2_irel irel, ext2_ino_t old, ext2_ino_t new) |
302 | { | 302 | { |
303 | struct irel_ma *ma; | 303 | struct irel_ma *ma; |
304 | 304 | ||
305 | ma = irel->priv_data; | 305 | ma = irel->priv_data; |
306 | if ((old > ma->max_inode) || (new > ma->max_inode)) | 306 | if ((old > ma->max_inode) || (new > ma->max_inode)) |
307 | return EXT2_ET_INVALID_ARGUMENT; | 307 | return EXT2_ET_INVALID_ARGUMENT; |
308 | if (ma->entries[(unsigned) old].new == 0) | 308 | if (ma->entries[(unsigned) old].new == 0) |
309 | return ENOENT; | 309 | return ENOENT; |
310 | 310 | ||
311 | ma->entries[(unsigned) new] = ma->entries[(unsigned) old]; | 311 | ma->entries[(unsigned) new] = ma->entries[(unsigned) old]; |
312 | if (ma->ref_entries[(unsigned) new].refs) | 312 | if (ma->ref_entries[(unsigned) new].refs) |
313 | ext2fs_free_mem(&ma->ref_entries[(unsigned) new].refs); | 313 | ext2fs_free_mem(&ma->ref_entries[(unsigned) new].refs); |
314 | ma->ref_entries[(unsigned) new] = ma->ref_entries[(unsigned) old]; | 314 | ma->ref_entries[(unsigned) new] = ma->ref_entries[(unsigned) old]; |
315 | 315 | ||
316 | ma->entries[(unsigned) old].new = 0; | 316 | ma->entries[(unsigned) old].new = 0; |
317 | ma->ref_entries[(unsigned) old].num = 0; | 317 | ma->ref_entries[(unsigned) old].num = 0; |
318 | ma->ref_entries[(unsigned) old].refs = 0; | 318 | ma->ref_entries[(unsigned) old].refs = 0; |
@@ -323,19 +323,19 @@ static errcode_t ima_move(ext2_irel irel, ext2_ino_t old, ext2_ino_t new) | |||
323 | 323 | ||
324 | static errcode_t ima_delete(ext2_irel irel, ext2_ino_t old) | 324 | static errcode_t ima_delete(ext2_irel irel, ext2_ino_t old) |
325 | { | 325 | { |
326 | struct irel_ma *ma; | 326 | struct irel_ma *ma; |
327 | 327 | ||
328 | ma = irel->priv_data; | 328 | ma = irel->priv_data; |
329 | if (old > ma->max_inode) | 329 | if (old > ma->max_inode) |
330 | return EXT2_ET_INVALID_ARGUMENT; | 330 | return EXT2_ET_INVALID_ARGUMENT; |
331 | if (ma->entries[(unsigned) old].new == 0) | 331 | if (ma->entries[(unsigned) old].new == 0) |
332 | return ENOENT; | 332 | return ENOENT; |
333 | 333 | ||
334 | ma->entries[old].new = 0; | 334 | ma->entries[old].new = 0; |
335 | if (ma->ref_entries[(unsigned) old].refs) | 335 | if (ma->ref_entries[(unsigned) old].refs) |
336 | ext2fs_free_mem(&ma->ref_entries[(unsigned) old].refs); | 336 | ext2fs_free_mem(&ma->ref_entries[(unsigned) old].refs); |
337 | ma->orig_map[ma->entries[(unsigned) old].orig] = 0; | 337 | ma->orig_map[ma->entries[(unsigned) old].orig] = 0; |
338 | 338 | ||
339 | ma->ref_entries[(unsigned) old].num = 0; | 339 | ma->ref_entries[(unsigned) old].num = 0; |
340 | ma->ref_entries[(unsigned) old].refs = 0; | 340 | ma->ref_entries[(unsigned) old].refs = 0; |
341 | return 0; | 341 | return 0; |
@@ -343,7 +343,7 @@ static errcode_t ima_delete(ext2_irel irel, ext2_ino_t old) | |||
343 | 343 | ||
344 | static errcode_t ima_free(ext2_irel irel) | 344 | static errcode_t ima_free(ext2_irel irel) |
345 | { | 345 | { |
346 | struct irel_ma *ma; | 346 | struct irel_ma *ma; |
347 | ext2_ino_t ino; | 347 | ext2_ino_t ino; |
348 | 348 | ||
349 | if (!irel) | 349 | if (!irel) |
diff --git a/e2fsprogs/ext2fs/ismounted.c b/e2fsprogs/ext2fs/ismounted.c index 3f2241d23..2395ccaed 100644 --- a/e2fsprogs/ext2fs/ismounted.c +++ b/e2fsprogs/ext2fs/ismounted.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * ismounted.c --- Check to see if the filesystem was mounted | 2 | * ismounted.c --- Check to see if the filesystem was mounted |
3 | * | 3 | * |
4 | * Copyright (C) 1995,1996,1997,1998,1999,2000 Theodore Ts'o. | 4 | * Copyright (C) 1995,1996,1997,1998,1999,2000 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -38,17 +38,17 @@ | |||
38 | /* | 38 | /* |
39 | * Helper function which checks a file in /etc/mtab format to see if a | 39 | * Helper function which checks a file in /etc/mtab format to see if a |
40 | * filesystem is mounted. Returns an error if the file doesn't exist | 40 | * filesystem is mounted. Returns an error if the file doesn't exist |
41 | * or can't be opened. | 41 | * or can't be opened. |
42 | */ | 42 | */ |
43 | static errcode_t check_mntent_file(const char *mtab_file, const char *file, | 43 | static errcode_t check_mntent_file(const char *mtab_file, const char *file, |
44 | int *mount_flags, char *mtpt, int mtlen) | 44 | int *mount_flags, char *mtpt, int mtlen) |
45 | { | 45 | { |
46 | struct mntent *mnt; | 46 | struct mntent *mnt; |
47 | struct stat st_buf; | 47 | struct stat st_buf; |
48 | errcode_t retval = 0; | 48 | errcode_t retval = 0; |
49 | dev_t file_dev=0, file_rdev=0; | 49 | dev_t file_dev=0, file_rdev=0; |
50 | ino_t file_ino=0; | 50 | ino_t file_ino=0; |
51 | FILE *f; | 51 | FILE *f; |
52 | int fd; | 52 | int fd; |
53 | 53 | ||
54 | *mount_flags = 0; | 54 | *mount_flags = 0; |
@@ -103,7 +103,7 @@ static errcode_t check_mntent_file(const char *mtab_file, const char *file, | |||
103 | } | 103 | } |
104 | #ifndef __GNU__ /* The GNU hurd is deficient; what else is new? */ | 104 | #ifndef __GNU__ /* The GNU hurd is deficient; what else is new? */ |
105 | /* Validate the entry in case /etc/mtab is out of date */ | 105 | /* Validate the entry in case /etc/mtab is out of date */ |
106 | /* | 106 | /* |
107 | * We need to be paranoid, because some broken distributions | 107 | * We need to be paranoid, because some broken distributions |
108 | * (read: Slackware) don't initialize /etc/mtab before checking | 108 | * (read: Slackware) don't initialize /etc/mtab before checking |
109 | * all of the non-root filesystems on the disk. | 109 | * all of the non-root filesystems on the disk. |
@@ -128,7 +128,7 @@ static errcode_t check_mntent_file(const char *mtab_file, const char *file, | |||
128 | } | 128 | } |
129 | #endif /* __GNU__ */ | 129 | #endif /* __GNU__ */ |
130 | *mount_flags = EXT2_MF_MOUNTED; | 130 | *mount_flags = EXT2_MF_MOUNTED; |
131 | 131 | ||
132 | #ifdef MNTOPT_RO | 132 | #ifdef MNTOPT_RO |
133 | /* Check to see if the ro option is set */ | 133 | /* Check to see if the ro option is set */ |
134 | if (hasmntopt(mnt, MNTOPT_RO)) | 134 | if (hasmntopt(mnt, MNTOPT_RO)) |
@@ -145,7 +145,7 @@ static errcode_t check_mntent_file(const char *mtab_file, const char *file, | |||
145 | */ | 145 | */ |
146 | if (!strcmp(mnt->mnt_dir, "/")) { | 146 | if (!strcmp(mnt->mnt_dir, "/")) { |
147 | is_root: | 147 | is_root: |
148 | #define TEST_FILE "/.ismount-test-file" | 148 | #define TEST_FILE "/.ismount-test-file" |
149 | *mount_flags |= EXT2_MF_ISROOT; | 149 | *mount_flags |= EXT2_MF_ISROOT; |
150 | fd = open(TEST_FILE, O_RDWR|O_CREAT); | 150 | fd = open(TEST_FILE, O_RDWR|O_CREAT); |
151 | if (fd < 0) { | 151 | if (fd < 0) { |
@@ -184,7 +184,7 @@ static errcode_t check_mntent(const char *file, int *mount_flags, | |||
184 | #endif /* MOUNTED */ | 184 | #endif /* MOUNTED */ |
185 | retval = check_mntent_file(MOUNTED, file, mount_flags, mtpt, mtlen); | 185 | retval = check_mntent_file(MOUNTED, file, mount_flags, mtpt, mtlen); |
186 | return retval; | 186 | return retval; |
187 | #else | 187 | #else |
188 | *mount_flags = 0; | 188 | *mount_flags = 0; |
189 | return 0; | 189 | return 0; |
190 | #endif /* defined(MOUNTED) || defined(_PATH_MOUNTED) */ | 190 | #endif /* defined(MOUNTED) || defined(_PATH_MOUNTED) */ |
@@ -197,31 +197,31 @@ static errcode_t check_getmntinfo(const char *file, int *mount_flags, | |||
197 | char *mtpt, int mtlen) | 197 | char *mtpt, int mtlen) |
198 | { | 198 | { |
199 | struct statfs *mp; | 199 | struct statfs *mp; |
200 | int len, n; | 200 | int len, n; |
201 | const char *s1; | 201 | const char *s1; |
202 | char *s2; | 202 | char *s2; |
203 | 203 | ||
204 | n = getmntinfo(&mp, MNT_NOWAIT); | 204 | n = getmntinfo(&mp, MNT_NOWAIT); |
205 | if (n == 0) | 205 | if (n == 0) |
206 | return errno; | 206 | return errno; |
207 | 207 | ||
208 | len = sizeof(_PATH_DEV) - 1; | 208 | len = sizeof(_PATH_DEV) - 1; |
209 | s1 = file; | 209 | s1 = file; |
210 | if (strncmp(_PATH_DEV, s1, len) == 0) | 210 | if (strncmp(_PATH_DEV, s1, len) == 0) |
211 | s1 += len; | 211 | s1 += len; |
212 | 212 | ||
213 | *mount_flags = 0; | 213 | *mount_flags = 0; |
214 | while (--n >= 0) { | 214 | while (--n >= 0) { |
215 | s2 = mp->f_mntfromname; | 215 | s2 = mp->f_mntfromname; |
216 | if (strncmp(_PATH_DEV, s2, len) == 0) { | 216 | if (strncmp(_PATH_DEV, s2, len) == 0) { |
217 | s2 += len - 1; | 217 | s2 += len - 1; |
218 | *s2 = 'r'; | 218 | *s2 = 'r'; |
219 | } | 219 | } |
220 | if (strcmp(s1, s2) == 0 || strcmp(s1, &s2[1]) == 0) { | 220 | if (strcmp(s1, s2) == 0 || strcmp(s1, &s2[1]) == 0) { |
221 | *mount_flags = EXT2_MF_MOUNTED; | 221 | *mount_flags = EXT2_MF_MOUNTED; |
222 | break; | 222 | break; |
223 | } | 223 | } |
224 | ++mp; | 224 | ++mp; |
225 | } | 225 | } |
226 | if (mtpt) | 226 | if (mtpt) |
227 | strncpy(mtpt, mp->f_mntonname, mtlen); | 227 | strncpy(mtpt, mp->f_mntonname, mtlen); |
@@ -270,7 +270,7 @@ static int is_swap_device(const char *file) | |||
270 | ret++; | 270 | ret++; |
271 | break; | 271 | break; |
272 | } | 272 | } |
273 | #endif /* __GNU__ */ | 273 | #endif /* __GNU__ */ |
274 | } | 274 | } |
275 | fclose(f); | 275 | fclose(f); |
276 | return ret; | 276 | return ret; |
@@ -296,7 +296,7 @@ errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags, | |||
296 | } | 296 | } |
297 | #ifdef HAVE_MNTENT_H | 297 | #ifdef HAVE_MNTENT_H |
298 | return check_mntent(device, mount_flags, mtpt, mtlen); | 298 | return check_mntent(device, mount_flags, mtpt, mtlen); |
299 | #else | 299 | #else |
300 | #ifdef HAVE_GETMNTINFO | 300 | #ifdef HAVE_GETMNTINFO |
301 | return check_getmntinfo(device, mount_flags, mtpt, mtlen); | 301 | return check_getmntinfo(device, mount_flags, mtpt, mtlen); |
302 | #else | 302 | #else |
@@ -312,7 +312,7 @@ errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags, | |||
312 | /* | 312 | /* |
313 | * ext2fs_check_if_mounted() sets the mount_flags EXT2_MF_MOUNTED, | 313 | * ext2fs_check_if_mounted() sets the mount_flags EXT2_MF_MOUNTED, |
314 | * EXT2_MF_READONLY, and EXT2_MF_ROOT | 314 | * EXT2_MF_READONLY, and EXT2_MF_ROOT |
315 | * | 315 | * |
316 | */ | 316 | */ |
317 | errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags) | 317 | errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags) |
318 | { | 318 | { |
@@ -324,7 +324,7 @@ int main(int argc, char **argv) | |||
324 | { | 324 | { |
325 | int retval, mount_flags; | 325 | int retval, mount_flags; |
326 | char mntpt[80]; | 326 | char mntpt[80]; |
327 | 327 | ||
328 | if (argc < 2) { | 328 | if (argc < 2) { |
329 | fprintf(stderr, "Usage: %s device\n", argv[0]); | 329 | fprintf(stderr, "Usage: %s device\n", argv[0]); |
330 | exit(1); | 330 | exit(1); |
@@ -347,12 +347,12 @@ int main(int argc, char **argv) | |||
347 | 347 | ||
348 | if (mount_flags & EXT2_MF_READONLY) | 348 | if (mount_flags & EXT2_MF_READONLY) |
349 | printf("\t%s is read-only.\n", argv[1]); | 349 | printf("\t%s is read-only.\n", argv[1]); |
350 | 350 | ||
351 | if (mount_flags & EXT2_MF_ISROOT) | 351 | if (mount_flags & EXT2_MF_ISROOT) |
352 | printf("\t%s is the root filesystem.\n", argv[1]); | 352 | printf("\t%s is the root filesystem.\n", argv[1]); |
353 | if (mntpt[0]) | 353 | if (mntpt[0]) |
354 | printf("\t%s is mounted on %s.\n", argv[1], mntpt); | 354 | printf("\t%s is mounted on %s.\n", argv[1], mntpt); |
355 | 355 | ||
356 | exit(0); | 356 | exit(0); |
357 | } | 357 | } |
358 | #endif /* DEBUG */ | 358 | #endif /* DEBUG */ |
diff --git a/e2fsprogs/ext2fs/jfs_dat.h b/e2fsprogs/ext2fs/jfs_dat.h index d6ad9c489..8ec5d3841 100644 --- a/e2fsprogs/ext2fs/jfs_dat.h +++ b/e2fsprogs/ext2fs/jfs_dat.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * jfs_dat.h --- stripped down header file which only contains the JFS | 2 | * jfs_dat.h --- stripped down header file which only contains the JFS |
3 | * on-disk data structures | 3 | * on-disk data structures |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #define JFS_MAGIC_NUMBER 0xc03b3998U /* The first 4 bytes of /dev/random! */ | 6 | #define JFS_MAGIC_NUMBER 0xc03b3998U /* The first 4 bytes of /dev/random! */ |
@@ -9,7 +9,7 @@ | |||
9 | * On-disk structures | 9 | * On-disk structures |
10 | */ | 10 | */ |
11 | 11 | ||
12 | /* | 12 | /* |
13 | * Descriptor block types: | 13 | * Descriptor block types: |
14 | */ | 14 | */ |
15 | 15 | ||
@@ -28,8 +28,8 @@ typedef struct journal_header_s | |||
28 | } journal_header_t; | 28 | } journal_header_t; |
29 | 29 | ||
30 | 30 | ||
31 | /* | 31 | /* |
32 | * The block tag: used to describe a single buffer in the journal | 32 | * The block tag: used to describe a single buffer in the journal |
33 | */ | 33 | */ |
34 | typedef struct journal_block_tag_s | 34 | typedef struct journal_block_tag_s |
35 | { | 35 | { |
@@ -55,10 +55,10 @@ typedef struct journal_superblock_s | |||
55 | __u32 s_blocksize; /* journal device blocksize */ | 55 | __u32 s_blocksize; /* journal device blocksize */ |
56 | __u32 s_maxlen; /* total blocks in journal file */ | 56 | __u32 s_maxlen; /* total blocks in journal file */ |
57 | __u32 s_first; /* first block of log information */ | 57 | __u32 s_first; /* first block of log information */ |
58 | 58 | ||
59 | /* Dynamic information describing the current state of the log */ | 59 | /* Dynamic information describing the current state of the log */ |
60 | __u32 s_sequence; /* first commit ID expected in log */ | 60 | __u32 s_sequence; /* first commit ID expected in log */ |
61 | __u32 s_start; /* blocknr of start of log */ | 61 | __u32 s_start; /* blocknr of start of log */ |
62 | 62 | ||
63 | } journal_superblock_t; | 63 | } journal_superblock_t; |
64 | 64 | ||
diff --git a/e2fsprogs/ext2fs/kernel-jbd.h b/e2fsprogs/ext2fs/kernel-jbd.h index d0efdb3f7..8a5de5e3e 100644 --- a/e2fsprogs/ext2fs/kernel-jbd.h +++ b/e2fsprogs/ext2fs/kernel-jbd.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * linux/include/linux/jbd.h | 2 | * linux/include/linux/jbd.h |
3 | * | 3 | * |
4 | * Written by Stephen C. Tweedie <sct@redhat.com> | 4 | * Written by Stephen C. Tweedie <sct@redhat.com> |
5 | * | 5 | * |
6 | * Copyright 1998-2000 Red Hat, Inc --- All Rights Reserved | 6 | * Copyright 1998-2000 Red Hat, Inc --- All Rights Reserved |
@@ -51,7 +51,7 @@ extern int journal_enable_debug; | |||
51 | if ((n) <= journal_enable_debug) { \ | 51 | if ((n) <= journal_enable_debug) { \ |
52 | printk (KERN_DEBUG "(%s, %d): %s: ", \ | 52 | printk (KERN_DEBUG "(%s, %d): %s: ", \ |
53 | __FILE__, __LINE__, __FUNCTION__); \ | 53 | __FILE__, __LINE__, __FUNCTION__); \ |
54 | printk (f, ## a); \ | 54 | printk (f, ## a); \ |
55 | } \ | 55 | } \ |
56 | } while (0) | 56 | } while (0) |
57 | #else | 57 | #else |
@@ -59,7 +59,7 @@ extern int journal_enable_debug; | |||
59 | #define jbd_debug(f, a...) /**/ | 59 | #define jbd_debug(f, a...) /**/ |
60 | #else | 60 | #else |
61 | #define jbd_debug(f, ...) /**/ | 61 | #define jbd_debug(f, ...) /**/ |
62 | #endif | 62 | #endif |
63 | #endif | 63 | #endif |
64 | #else | 64 | #else |
65 | #define jbd_debug(x) /* AIX doesn't do STDC */ | 65 | #define jbd_debug(x) /* AIX doesn't do STDC */ |
@@ -88,7 +88,7 @@ typedef struct journal_s journal_t; /* Journal control structure */ | |||
88 | * On-disk structures | 88 | * On-disk structures |
89 | */ | 89 | */ |
90 | 90 | ||
91 | /* | 91 | /* |
92 | * Descriptor block types: | 92 | * Descriptor block types: |
93 | */ | 93 | */ |
94 | 94 | ||
@@ -109,8 +109,8 @@ typedef struct journal_header_s | |||
109 | } journal_header_t; | 109 | } journal_header_t; |
110 | 110 | ||
111 | 111 | ||
112 | /* | 112 | /* |
113 | * The block tag: used to describe a single buffer in the journal | 113 | * The block tag: used to describe a single buffer in the journal |
114 | */ | 114 | */ |
115 | typedef struct journal_block_tag_s | 115 | typedef struct journal_block_tag_s |
116 | { | 116 | { |
@@ -118,9 +118,9 @@ typedef struct journal_block_tag_s | |||
118 | __u32 t_flags; /* See below */ | 118 | __u32 t_flags; /* See below */ |
119 | } journal_block_tag_t; | 119 | } journal_block_tag_t; |
120 | 120 | ||
121 | /* | 121 | /* |
122 | * The revoke descriptor: used on disk to describe a series of blocks to | 122 | * The revoke descriptor: used on disk to describe a series of blocks to |
123 | * be revoked from the log | 123 | * be revoked from the log |
124 | */ | 124 | */ |
125 | typedef struct journal_revoke_header_s | 125 | typedef struct journal_revoke_header_s |
126 | { | 126 | { |
@@ -149,7 +149,7 @@ typedef struct journal_superblock_s | |||
149 | __u32 s_blocksize; /* journal device blocksize */ | 149 | __u32 s_blocksize; /* journal device blocksize */ |
150 | __u32 s_maxlen; /* total blocks in journal file */ | 150 | __u32 s_maxlen; /* total blocks in journal file */ |
151 | __u32 s_first; /* first block of log information */ | 151 | __u32 s_first; /* first block of log information */ |
152 | 152 | ||
153 | /* 0x0018 */ | 153 | /* 0x0018 */ |
154 | /* Dynamic information describing the current state of the log */ | 154 | /* Dynamic information describing the current state of the log */ |
155 | __u32 s_sequence; /* first commit ID expected in log */ | 155 | __u32 s_sequence; /* first commit ID expected in log */ |
@@ -161,17 +161,17 @@ typedef struct journal_superblock_s | |||
161 | 161 | ||
162 | /* 0x0024 */ | 162 | /* 0x0024 */ |
163 | /* Remaining fields are only valid in a version-2 superblock */ | 163 | /* Remaining fields are only valid in a version-2 superblock */ |
164 | __u32 s_feature_compat; /* compatible feature set */ | 164 | __u32 s_feature_compat; /* compatible feature set */ |
165 | __u32 s_feature_incompat; /* incompatible feature set */ | 165 | __u32 s_feature_incompat; /* incompatible feature set */ |
166 | __u32 s_feature_ro_compat; /* readonly-compatible feature set */ | 166 | __u32 s_feature_ro_compat; /* readonly-compatible feature set */ |
167 | /* 0x0030 */ | 167 | /* 0x0030 */ |
168 | __u8 s_uuid[16]; /* 128-bit uuid for journal */ | 168 | __u8 s_uuid[16]; /* 128-bit uuid for journal */ |
169 | 169 | ||
170 | /* 0x0040 */ | 170 | /* 0x0040 */ |
171 | __u32 s_nr_users; /* Nr of filesystems sharing log */ | 171 | __u32 s_nr_users; /* Nr of filesystems sharing log */ |
172 | 172 | ||
173 | __u32 s_dynsuper; /* Blocknr of dynamic superblock copy*/ | 173 | __u32 s_dynsuper; /* Blocknr of dynamic superblock copy*/ |
174 | 174 | ||
175 | /* 0x0048 */ | 175 | /* 0x0048 */ |
176 | __u32 s_max_transaction; /* Limit of journal blocks per trans.*/ | 176 | __u32 s_max_transaction; /* Limit of journal blocks per trans.*/ |
177 | __u32 s_max_trans_data; /* Limit of data blocks per trans. */ | 177 | __u32 s_max_trans_data; /* Limit of data blocks per trans. */ |
@@ -276,7 +276,7 @@ struct jbd_revoke_table_s; | |||
276 | * the transaction, so that at all times we know how many buffers the | 276 | * the transaction, so that at all times we know how many buffers the |
277 | * outstanding updates on a transaction might possibly touch. */ | 277 | * outstanding updates on a transaction might possibly touch. */ |
278 | 278 | ||
279 | struct handle_s | 279 | struct handle_s |
280 | { | 280 | { |
281 | /* Which compound transaction is this update a part of? */ | 281 | /* Which compound transaction is this update a part of? */ |
282 | transaction_t * h_transaction; | 282 | transaction_t * h_transaction; |
@@ -314,14 +314,14 @@ struct handle_s | |||
314 | * flushed to home for finished transactions. | 314 | * flushed to home for finished transactions. |
315 | */ | 315 | */ |
316 | 316 | ||
317 | struct transaction_s | 317 | struct transaction_s |
318 | { | 318 | { |
319 | /* Pointer to the journal for this transaction. */ | 319 | /* Pointer to the journal for this transaction. */ |
320 | journal_t * t_journal; | 320 | journal_t * t_journal; |
321 | 321 | ||
322 | /* Sequence number for this transaction */ | 322 | /* Sequence number for this transaction */ |
323 | tid_t t_tid; | 323 | tid_t t_tid; |
324 | 324 | ||
325 | /* Transaction's current state */ | 325 | /* Transaction's current state */ |
326 | enum { | 326 | enum { |
327 | T_RUNNING, | 327 | T_RUNNING, |
@@ -329,74 +329,74 @@ struct transaction_s | |||
329 | T_RUNDOWN, | 329 | T_RUNDOWN, |
330 | T_FLUSH, | 330 | T_FLUSH, |
331 | T_COMMIT, | 331 | T_COMMIT, |
332 | T_FINISHED | 332 | T_FINISHED |
333 | } t_state; | 333 | } t_state; |
334 | 334 | ||
335 | /* Where in the log does this transaction's commit start? */ | 335 | /* Where in the log does this transaction's commit start? */ |
336 | unsigned long t_log_start; | 336 | unsigned long t_log_start; |
337 | 337 | ||
338 | /* Doubly-linked circular list of all inodes owned by this | 338 | /* Doubly-linked circular list of all inodes owned by this |
339 | transaction */ /* AKPM: unused */ | 339 | transaction */ /* AKPM: unused */ |
340 | struct inode * t_ilist; | 340 | struct inode * t_ilist; |
341 | 341 | ||
342 | /* Number of buffers on the t_buffers list */ | 342 | /* Number of buffers on the t_buffers list */ |
343 | int t_nr_buffers; | 343 | int t_nr_buffers; |
344 | 344 | ||
345 | /* Doubly-linked circular list of all buffers reserved but not | 345 | /* Doubly-linked circular list of all buffers reserved but not |
346 | yet modified by this transaction */ | 346 | yet modified by this transaction */ |
347 | struct journal_head * t_reserved_list; | 347 | struct journal_head * t_reserved_list; |
348 | 348 | ||
349 | /* Doubly-linked circular list of all metadata buffers owned by this | 349 | /* Doubly-linked circular list of all metadata buffers owned by this |
350 | transaction */ | 350 | transaction */ |
351 | struct journal_head * t_buffers; | 351 | struct journal_head * t_buffers; |
352 | 352 | ||
353 | /* | 353 | /* |
354 | * Doubly-linked circular list of all data buffers still to be | 354 | * Doubly-linked circular list of all data buffers still to be |
355 | * flushed before this transaction can be committed. | 355 | * flushed before this transaction can be committed. |
356 | * Protected by journal_datalist_lock. | 356 | * Protected by journal_datalist_lock. |
357 | */ | 357 | */ |
358 | struct journal_head * t_sync_datalist; | 358 | struct journal_head * t_sync_datalist; |
359 | 359 | ||
360 | /* | 360 | /* |
361 | * Doubly-linked circular list of all writepage data buffers | 361 | * Doubly-linked circular list of all writepage data buffers |
362 | * still to be written before this transaction can be committed. | 362 | * still to be written before this transaction can be committed. |
363 | * Protected by journal_datalist_lock. | 363 | * Protected by journal_datalist_lock. |
364 | */ | 364 | */ |
365 | struct journal_head * t_async_datalist; | 365 | struct journal_head * t_async_datalist; |
366 | 366 | ||
367 | /* Doubly-linked circular list of all forget buffers (superceded | 367 | /* Doubly-linked circular list of all forget buffers (superceded |
368 | buffers which we can un-checkpoint once this transaction | 368 | buffers which we can un-checkpoint once this transaction |
369 | commits) */ | 369 | commits) */ |
370 | struct journal_head * t_forget; | 370 | struct journal_head * t_forget; |
371 | 371 | ||
372 | /* | 372 | /* |
373 | * Doubly-linked circular list of all buffers still to be | 373 | * Doubly-linked circular list of all buffers still to be |
374 | * flushed before this transaction can be checkpointed. | 374 | * flushed before this transaction can be checkpointed. |
375 | */ | 375 | */ |
376 | /* Protected by journal_datalist_lock */ | 376 | /* Protected by journal_datalist_lock */ |
377 | struct journal_head * t_checkpoint_list; | 377 | struct journal_head * t_checkpoint_list; |
378 | 378 | ||
379 | /* Doubly-linked circular list of temporary buffers currently | 379 | /* Doubly-linked circular list of temporary buffers currently |
380 | undergoing IO in the log */ | 380 | undergoing IO in the log */ |
381 | struct journal_head * t_iobuf_list; | 381 | struct journal_head * t_iobuf_list; |
382 | 382 | ||
383 | /* Doubly-linked circular list of metadata buffers being | 383 | /* Doubly-linked circular list of metadata buffers being |
384 | shadowed by log IO. The IO buffers on the iobuf list and the | 384 | shadowed by log IO. The IO buffers on the iobuf list and the |
385 | shadow buffers on this list match each other one for one at | 385 | shadow buffers on this list match each other one for one at |
386 | all times. */ | 386 | all times. */ |
387 | struct journal_head * t_shadow_list; | 387 | struct journal_head * t_shadow_list; |
388 | 388 | ||
389 | /* Doubly-linked circular list of control buffers being written | 389 | /* Doubly-linked circular list of control buffers being written |
390 | to the log. */ | 390 | to the log. */ |
391 | struct journal_head * t_log_list; | 391 | struct journal_head * t_log_list; |
392 | 392 | ||
393 | /* Number of outstanding updates running on this transaction */ | 393 | /* Number of outstanding updates running on this transaction */ |
394 | int t_updates; | 394 | int t_updates; |
395 | 395 | ||
396 | /* Number of buffers reserved for use by all handles in this | 396 | /* Number of buffers reserved for use by all handles in this |
397 | * transaction handle but not yet modified. */ | 397 | * transaction handle but not yet modified. */ |
398 | int t_outstanding_credits; | 398 | int t_outstanding_credits; |
399 | 399 | ||
400 | /* | 400 | /* |
401 | * Forward and backward links for the circular list of all | 401 | * Forward and backward links for the circular list of all |
402 | * transactions awaiting checkpoint. | 402 | * transactions awaiting checkpoint. |
@@ -415,7 +415,7 @@ struct transaction_s | |||
415 | 415 | ||
416 | /* The journal_t maintains all of the journaling state information for a | 416 | /* The journal_t maintains all of the journaling state information for a |
417 | * single filesystem. It is linked to from the fs superblock structure. | 417 | * single filesystem. It is linked to from the fs superblock structure. |
418 | * | 418 | * |
419 | * We use the journal_t to keep track of all outstanding transaction | 419 | * We use the journal_t to keep track of all outstanding transaction |
420 | * activity on the filesystem, and to manage the state of the log | 420 | * activity on the filesystem, and to manage the state of the log |
421 | * writing process. */ | 421 | * writing process. */ |
@@ -428,7 +428,7 @@ struct journal_s | |||
428 | /* Is there an outstanding uncleared error on the journal (from | 428 | /* Is there an outstanding uncleared error on the journal (from |
429 | * a prior abort)? */ | 429 | * a prior abort)? */ |
430 | int j_errno; | 430 | int j_errno; |
431 | 431 | ||
432 | /* The superblock buffer */ | 432 | /* The superblock buffer */ |
433 | struct buffer_head * j_sb_buffer; | 433 | struct buffer_head * j_sb_buffer; |
434 | journal_superblock_t * j_superblock; | 434 | journal_superblock_t * j_superblock; |
@@ -438,49 +438,49 @@ struct journal_s | |||
438 | 438 | ||
439 | /* Number of processes waiting to create a barrier lock */ | 439 | /* Number of processes waiting to create a barrier lock */ |
440 | int j_barrier_count; | 440 | int j_barrier_count; |
441 | 441 | ||
442 | /* The barrier lock itself */ | 442 | /* The barrier lock itself */ |
443 | struct semaphore j_barrier; | 443 | struct semaphore j_barrier; |
444 | 444 | ||
445 | /* Transactions: The current running transaction... */ | 445 | /* Transactions: The current running transaction... */ |
446 | transaction_t * j_running_transaction; | 446 | transaction_t * j_running_transaction; |
447 | 447 | ||
448 | /* ... the transaction we are pushing to disk ... */ | 448 | /* ... the transaction we are pushing to disk ... */ |
449 | transaction_t * j_committing_transaction; | 449 | transaction_t * j_committing_transaction; |
450 | 450 | ||
451 | /* ... and a linked circular list of all transactions waiting | 451 | /* ... and a linked circular list of all transactions waiting |
452 | * for checkpointing. */ | 452 | * for checkpointing. */ |
453 | /* Protected by journal_datalist_lock */ | 453 | /* Protected by journal_datalist_lock */ |
454 | transaction_t * j_checkpoint_transactions; | 454 | transaction_t * j_checkpoint_transactions; |
455 | 455 | ||
456 | /* Wait queue for waiting for a locked transaction to start | 456 | /* Wait queue for waiting for a locked transaction to start |
457 | committing, or for a barrier lock to be released */ | 457 | committing, or for a barrier lock to be released */ |
458 | wait_queue_head_t j_wait_transaction_locked; | 458 | wait_queue_head_t j_wait_transaction_locked; |
459 | 459 | ||
460 | /* Wait queue for waiting for checkpointing to complete */ | 460 | /* Wait queue for waiting for checkpointing to complete */ |
461 | wait_queue_head_t j_wait_logspace; | 461 | wait_queue_head_t j_wait_logspace; |
462 | 462 | ||
463 | /* Wait queue for waiting for commit to complete */ | 463 | /* Wait queue for waiting for commit to complete */ |
464 | wait_queue_head_t j_wait_done_commit; | 464 | wait_queue_head_t j_wait_done_commit; |
465 | 465 | ||
466 | /* Wait queue to trigger checkpointing */ | 466 | /* Wait queue to trigger checkpointing */ |
467 | wait_queue_head_t j_wait_checkpoint; | 467 | wait_queue_head_t j_wait_checkpoint; |
468 | 468 | ||
469 | /* Wait queue to trigger commit */ | 469 | /* Wait queue to trigger commit */ |
470 | wait_queue_head_t j_wait_commit; | 470 | wait_queue_head_t j_wait_commit; |
471 | 471 | ||
472 | /* Wait queue to wait for updates to complete */ | 472 | /* Wait queue to wait for updates to complete */ |
473 | wait_queue_head_t j_wait_updates; | 473 | wait_queue_head_t j_wait_updates; |
474 | 474 | ||
475 | /* Semaphore for locking against concurrent checkpoints */ | 475 | /* Semaphore for locking against concurrent checkpoints */ |
476 | struct semaphore j_checkpoint_sem; | 476 | struct semaphore j_checkpoint_sem; |
477 | 477 | ||
478 | /* The main journal lock, used by lock_journal() */ | 478 | /* The main journal lock, used by lock_journal() */ |
479 | struct semaphore j_sem; | 479 | struct semaphore j_sem; |
480 | 480 | ||
481 | /* Journal head: identifies the first unused block in the journal. */ | 481 | /* Journal head: identifies the first unused block in the journal. */ |
482 | unsigned long j_head; | 482 | unsigned long j_head; |
483 | 483 | ||
484 | /* Journal tail: identifies the oldest still-used block in the | 484 | /* Journal tail: identifies the oldest still-used block in the |
485 | * journal. */ | 485 | * journal. */ |
486 | unsigned long j_tail; | 486 | unsigned long j_tail; |
@@ -546,12 +546,12 @@ struct journal_s | |||
546 | struct list_head j_all_journals; | 546 | struct list_head j_all_journals; |
547 | 547 | ||
548 | /* The revoke table: maintains the list of revoked blocks in the | 548 | /* The revoke table: maintains the list of revoked blocks in the |
549 | current transaction. */ | 549 | current transaction. */ |
550 | struct jbd_revoke_table_s *j_revoke; | 550 | struct jbd_revoke_table_s *j_revoke; |
551 | }; | 551 | }; |
552 | 552 | ||
553 | /* | 553 | /* |
554 | * Journal flag definitions | 554 | * Journal flag definitions |
555 | */ | 555 | */ |
556 | #define JFS_UNMOUNT 0x001 /* Journal thread is being destroyed */ | 556 | #define JFS_UNMOUNT 0x001 /* Journal thread is being destroyed */ |
557 | #define JFS_ABORT 0x002 /* Journaling has been aborted for errors. */ | 557 | #define JFS_ABORT 0x002 /* Journaling has been aborted for errors. */ |
@@ -559,7 +559,7 @@ struct journal_s | |||
559 | #define JFS_FLUSHED 0x008 /* The journal superblock has been flushed */ | 559 | #define JFS_FLUSHED 0x008 /* The journal superblock has been flushed */ |
560 | #define JFS_LOADED 0x010 /* The journal superblock has been loaded */ | 560 | #define JFS_LOADED 0x010 /* The journal superblock has been loaded */ |
561 | 561 | ||
562 | /* | 562 | /* |
563 | * Function declarations for the journaling transaction and buffer | 563 | * Function declarations for the journaling transaction and buffer |
564 | * management | 564 | * management |
565 | */ | 565 | */ |
@@ -589,7 +589,7 @@ extern void journal_insert_checkpoint(struct journal_head *, transaction_t *); | |||
589 | extern void __journal_insert_checkpoint(struct journal_head *,transaction_t *); | 589 | extern void __journal_insert_checkpoint(struct journal_head *,transaction_t *); |
590 | 590 | ||
591 | /* Buffer IO */ | 591 | /* Buffer IO */ |
592 | extern int | 592 | extern int |
593 | journal_write_metadata_buffer(transaction_t *transaction, | 593 | journal_write_metadata_buffer(transaction_t *transaction, |
594 | struct journal_head *jh_in, | 594 | struct journal_head *jh_in, |
595 | struct journal_head **jh_out, | 595 | struct journal_head **jh_out, |
@@ -603,7 +603,7 @@ extern void __wait_on_journal (journal_t *); | |||
603 | * | 603 | * |
604 | * We need to lock the journal during transaction state changes so that | 604 | * We need to lock the journal during transaction state changes so that |
605 | * nobody ever tries to take a handle on the running transaction while | 605 | * nobody ever tries to take a handle on the running transaction while |
606 | * we are in the middle of moving it to the commit phase. | 606 | * we are in the middle of moving it to the commit phase. |
607 | * | 607 | * |
608 | * Note that the locking is completely interrupt unsafe. We never touch | 608 | * Note that the locking is completely interrupt unsafe. We never touch |
609 | * journal structures from interrupts. | 609 | * journal structures from interrupts. |
@@ -637,7 +637,7 @@ static inline handle_t *journal_current_handle(void) | |||
637 | /* The journaling code user interface: | 637 | /* The journaling code user interface: |
638 | * | 638 | * |
639 | * Create and destroy handles | 639 | * Create and destroy handles |
640 | * Register buffer modifications against the current transaction. | 640 | * Register buffer modifications against the current transaction. |
641 | */ | 641 | */ |
642 | 642 | ||
643 | extern handle_t *journal_start(journal_t *, int nblocks); | 643 | extern handle_t *journal_start(journal_t *, int nblocks); |
@@ -665,11 +665,11 @@ extern journal_t * journal_init_dev(kdev_t dev, kdev_t fs_dev, | |||
665 | int start, int len, int bsize); | 665 | int start, int len, int bsize); |
666 | extern journal_t * journal_init_inode (struct inode *); | 666 | extern journal_t * journal_init_inode (struct inode *); |
667 | extern int journal_update_format (journal_t *); | 667 | extern int journal_update_format (journal_t *); |
668 | extern int journal_check_used_features | 668 | extern int journal_check_used_features |
669 | (journal_t *, unsigned long, unsigned long, unsigned long); | 669 | (journal_t *, unsigned long, unsigned long, unsigned long); |
670 | extern int journal_check_available_features | 670 | extern int journal_check_available_features |
671 | (journal_t *, unsigned long, unsigned long, unsigned long); | 671 | (journal_t *, unsigned long, unsigned long, unsigned long); |
672 | extern int journal_set_features | 672 | extern int journal_set_features |
673 | (journal_t *, unsigned long, unsigned long, unsigned long); | 673 | (journal_t *, unsigned long, unsigned long, unsigned long); |
674 | extern int journal_create (journal_t *); | 674 | extern int journal_create (journal_t *); |
675 | extern int journal_load (journal_t *journal); | 675 | extern int journal_load (journal_t *journal); |
@@ -747,7 +747,7 @@ do { \ | |||
747 | * bit, when set, indicates that we have had a fatal error somewhere, | 747 | * bit, when set, indicates that we have had a fatal error somewhere, |
748 | * either inside the journaling layer or indicated to us by the client | 748 | * either inside the journaling layer or indicated to us by the client |
749 | * (eg. ext3), and that we and should not commit any further | 749 | * (eg. ext3), and that we and should not commit any further |
750 | * transactions. | 750 | * transactions. |
751 | */ | 751 | */ |
752 | 752 | ||
753 | static inline int is_journal_aborted(journal_t *journal) | 753 | static inline int is_journal_aborted(journal_t *journal) |
@@ -770,7 +770,7 @@ static inline void journal_abort_handle(handle_t *handle) | |||
770 | /* Not all architectures define BUG() */ | 770 | /* Not all architectures define BUG() */ |
771 | #ifndef BUG | 771 | #ifndef BUG |
772 | #define BUG() do { \ | 772 | #define BUG() do { \ |
773 | printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ | 773 | printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ |
774 | * ((char *) 0) = 0; \ | 774 | * ((char *) 0) = 0; \ |
775 | } while (0) | 775 | } while (0) |
776 | #endif /* BUG */ | 776 | #endif /* BUG */ |
@@ -826,7 +826,7 @@ extern int journal_blocks_per_page(struct inode *inode); | |||
826 | #define BJ_LogCtl 7 /* Buffer contains log descriptors */ | 826 | #define BJ_LogCtl 7 /* Buffer contains log descriptors */ |
827 | #define BJ_Reserved 8 /* Buffer is reserved for access by journal */ | 827 | #define BJ_Reserved 8 /* Buffer is reserved for access by journal */ |
828 | #define BJ_Types 9 | 828 | #define BJ_Types 9 |
829 | 829 | ||
830 | extern int jbd_blocks_per_page(struct inode *inode); | 830 | extern int jbd_blocks_per_page(struct inode *inode); |
831 | 831 | ||
832 | #ifdef __KERNEL__ | 832 | #ifdef __KERNEL__ |
diff --git a/e2fsprogs/ext2fs/kernel-list.h b/e2fsprogs/ext2fs/kernel-list.h index 24e6ab4a1..fa62ff138 100644 --- a/e2fsprogs/ext2fs/kernel-list.h +++ b/e2fsprogs/ext2fs/kernel-list.h | |||
@@ -29,7 +29,7 @@ struct list_head { | |||
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | /* | 31 | /* |
32 | * Insert a new entry between two known consecutive entries. | 32 | * Insert a new entry between two known consecutive entries. |
33 | * | 33 | * |
34 | * This is only for internal list manipulation where we know | 34 | * This is only for internal list manipulation where we know |
35 | * the prev/next entries already! | 35 | * the prev/next entries already! |
@@ -107,6 +107,6 @@ static __inline__ void list_splice(struct list_head *list, struct list_head *hea | |||
107 | ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) | 107 | ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) |
108 | 108 | ||
109 | #define list_for_each(pos, head) \ | 109 | #define list_for_each(pos, head) \ |
110 | for (pos = (head)->next; pos != (head); pos = pos->next) | 110 | for (pos = (head)->next; pos != (head); pos = pos->next) |
111 | 111 | ||
112 | #endif | 112 | #endif |
diff --git a/e2fsprogs/ext2fs/link.c b/e2fsprogs/ext2fs/link.c index 5e0f4f3c0..281ad065f 100644 --- a/e2fsprogs/ext2fs/link.c +++ b/e2fsprogs/ext2fs/link.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * link.c --- create links in a ext2fs directory | 2 | * link.c --- create links in a ext2fs directory |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -25,7 +25,7 @@ struct link_struct { | |||
25 | int flags; | 25 | int flags; |
26 | int done; | 26 | int done; |
27 | struct ext2_super_block *sb; | 27 | struct ext2_super_block *sb; |
28 | }; | 28 | }; |
29 | 29 | ||
30 | static int link_proc(struct ext2_dir_entry *dirent, | 30 | static int link_proc(struct ext2_dir_entry *dirent, |
31 | int offset, | 31 | int offset, |
@@ -94,7 +94,7 @@ static int link_proc(struct ext2_dir_entry *dirent, | |||
94 | #ifdef __TURBOC__ | 94 | #ifdef __TURBOC__ |
95 | #pragma argsused | 95 | #pragma argsused |
96 | #endif | 96 | #endif |
97 | errcode_t ext2fs_link(ext2_filsys fs, ext2_ino_t dir, const char *name, | 97 | errcode_t ext2fs_link(ext2_filsys fs, ext2_ino_t dir, const char *name, |
98 | ext2_ino_t ino, int flags) | 98 | ext2_ino_t ino, int flags) |
99 | { | 99 | { |
100 | errcode_t retval; | 100 | errcode_t retval; |
diff --git a/e2fsprogs/ext2fs/lookup.c b/e2fsprogs/ext2fs/lookup.c index 1745f33ab..9cb97f1b5 100644 --- a/e2fsprogs/ext2fs/lookup.c +++ b/e2fsprogs/ext2fs/lookup.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * lookup.c --- ext2fs directory lookup operations | 2 | * lookup.c --- ext2fs directory lookup operations |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1994, 1995 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1994, 1995 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -23,7 +23,7 @@ struct lookup_struct { | |||
23 | int len; | 23 | int len; |
24 | ext2_ino_t *inode; | 24 | ext2_ino_t *inode; |
25 | int found; | 25 | int found; |
26 | }; | 26 | }; |
27 | 27 | ||
28 | #ifdef __TURBOC__ | 28 | #ifdef __TURBOC__ |
29 | #pragma argsused | 29 | #pragma argsused |
diff --git a/e2fsprogs/ext2fs/mkdir.c b/e2fsprogs/ext2fs/mkdir.c index 81e7aea58..bf46e5050 100644 --- a/e2fsprogs/ext2fs/mkdir.c +++ b/e2fsprogs/ext2fs/mkdir.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * mkdir.c --- make a directory in the filesystem | 2 | * mkdir.c --- make a directory in the filesystem |
3 | * | 3 | * |
4 | * Copyright (C) 1994, 1995 Theodore Ts'o. | 4 | * Copyright (C) 1994, 1995 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -94,7 +94,7 @@ errcode_t ext2fs_mkdir(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t inum, | |||
94 | retval = ext2fs_write_dir_block(fs, blk, block); | 94 | retval = ext2fs_write_dir_block(fs, blk, block); |
95 | if (retval) | 95 | if (retval) |
96 | goto cleanup; | 96 | goto cleanup; |
97 | retval = ext2fs_write_new_inode(fs, ino, &inode); | 97 | retval = ext2fs_write_new_inode(fs, ino, &inode); |
98 | if (retval) | 98 | if (retval) |
99 | goto cleanup; | 99 | goto cleanup; |
100 | 100 | ||
@@ -125,7 +125,7 @@ errcode_t ext2fs_mkdir(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t inum, | |||
125 | if (retval) | 125 | if (retval) |
126 | goto cleanup; | 126 | goto cleanup; |
127 | } | 127 | } |
128 | 128 | ||
129 | /* | 129 | /* |
130 | * Update accounting.... | 130 | * Update accounting.... |
131 | */ | 131 | */ |
diff --git a/e2fsprogs/ext2fs/mkjournal.c b/e2fsprogs/ext2fs/mkjournal.c index b748918b6..0a9ae7a4d 100644 --- a/e2fsprogs/ext2fs/mkjournal.c +++ b/e2fsprogs/ext2fs/mkjournal.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * mkjournal.c --- make a journal for a filesystem | 2 | * mkjournal.c --- make a journal for a filesystem |
3 | * | 3 | * |
4 | * Copyright (C) 2000 Theodore Ts'o. | 4 | * Copyright (C) 2000 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
7 | * This file may be redistributed under the terms of the GNU Public | 7 | * This file may be redistributed under the terms of the GNU Public |
8 | * License. | 8 | * License. |
@@ -155,7 +155,7 @@ static int mkjournal_proc(ext2_filsys fs, | |||
155 | blk_t new_blk; | 155 | blk_t new_blk; |
156 | static blk_t last_blk = 0; | 156 | static blk_t last_blk = 0; |
157 | errcode_t retval; | 157 | errcode_t retval; |
158 | 158 | ||
159 | if (*blocknr) { | 159 | if (*blocknr) { |
160 | last_blk = *blocknr; | 160 | last_blk = *blocknr; |
161 | return 0; | 161 | return 0; |
@@ -186,7 +186,7 @@ static int mkjournal_proc(ext2_filsys fs, | |||
186 | return (BLOCK_CHANGED | BLOCK_ABORT); | 186 | return (BLOCK_CHANGED | BLOCK_ABORT); |
187 | else | 187 | else |
188 | return BLOCK_CHANGED; | 188 | return BLOCK_CHANGED; |
189 | 189 | ||
190 | } | 190 | } |
191 | 191 | ||
192 | /* | 192 | /* |
@@ -202,7 +202,7 @@ static errcode_t write_journal_inode(ext2_filsys fs, ext2_ino_t journal_ino, | |||
202 | 202 | ||
203 | if ((retval = ext2fs_create_journal_superblock(fs, size, flags, &buf))) | 203 | if ((retval = ext2fs_create_journal_superblock(fs, size, flags, &buf))) |
204 | return retval; | 204 | return retval; |
205 | 205 | ||
206 | if ((retval = ext2fs_read_bitmaps(fs))) | 206 | if ((retval = ext2fs_read_bitmaps(fs))) |
207 | return retval; | 207 | return retval; |
208 | 208 | ||
@@ -227,7 +227,7 @@ static errcode_t write_journal_inode(ext2_filsys fs, ext2_ino_t journal_ino, | |||
227 | if ((retval = ext2fs_read_inode(fs, journal_ino, &inode))) | 227 | if ((retval = ext2fs_read_inode(fs, journal_ino, &inode))) |
228 | goto errout; | 228 | goto errout; |
229 | 229 | ||
230 | inode.i_size += fs->blocksize * size; | 230 | inode.i_size += fs->blocksize * size; |
231 | inode.i_blocks += (fs->blocksize / 512) * es.newblocks; | 231 | inode.i_blocks += (fs->blocksize / 512) * es.newblocks; |
232 | inode.i_mtime = inode.i_ctime = time(0); | 232 | inode.i_mtime = inode.i_ctime = time(0); |
233 | inode.i_links_count = 1; | 233 | inode.i_links_count = 1; |
@@ -262,7 +262,7 @@ errcode_t ext2fs_add_journal_device(ext2_filsys fs, ext2_filsys journal_dev) | |||
262 | /* Make sure the device exists and is a block device */ | 262 | /* Make sure the device exists and is a block device */ |
263 | if (stat(journal_dev->device_name, &st) < 0) | 263 | if (stat(journal_dev->device_name, &st) < 0) |
264 | return errno; | 264 | return errno; |
265 | 265 | ||
266 | if (!S_ISBLK(st.st_mode)) | 266 | if (!S_ISBLK(st.st_mode)) |
267 | return EXT2_ET_JOURNAL_NOT_BLOCK; /* Must be a block device */ | 267 | return EXT2_ET_JOURNAL_NOT_BLOCK; /* Must be a block device */ |
268 | 268 | ||
@@ -297,7 +297,7 @@ errcode_t ext2fs_add_journal_device(ext2_filsys fs, ext2_filsys journal_dev) | |||
297 | /* Writeback the journal superblock */ | 297 | /* Writeback the journal superblock */ |
298 | if ((retval = io_channel_write_blk(journal_dev->io, start, -1024, buf))) | 298 | if ((retval = io_channel_write_blk(journal_dev->io, start, -1024, buf))) |
299 | return retval; | 299 | return retval; |
300 | 300 | ||
301 | fs->super->s_journal_inum = 0; | 301 | fs->super->s_journal_inum = 0; |
302 | fs->super->s_journal_dev = st.st_rdev; | 302 | fs->super->s_journal_dev = st.st_rdev; |
303 | memcpy(fs->super->s_journal_uuid, jsb->s_uuid, | 303 | memcpy(fs->super->s_journal_uuid, jsb->s_uuid, |
@@ -328,7 +328,7 @@ errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, int flags) | |||
328 | strcat(jfile, "/.journal"); | 328 | strcat(jfile, "/.journal"); |
329 | 329 | ||
330 | /* | 330 | /* |
331 | * If .../.journal already exists, make sure any | 331 | * If .../.journal already exists, make sure any |
332 | * immutable or append-only flags are cleared. | 332 | * immutable or append-only flags are cleared. |
333 | */ | 333 | */ |
334 | #if defined(HAVE_CHFLAGS) && defined(UF_NODUMP) | 334 | #if defined(HAVE_CHFLAGS) && defined(UF_NODUMP) |
@@ -350,7 +350,7 @@ errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, int flags) | |||
350 | 350 | ||
351 | if ((retval = write_journal_file(fs, jfile, size, flags))) | 351 | if ((retval = write_journal_file(fs, jfile, size, flags))) |
352 | goto errout; | 352 | goto errout; |
353 | 353 | ||
354 | /* Get inode number of the journal file */ | 354 | /* Get inode number of the journal file */ |
355 | if (fstat(fd, &st) < 0) | 355 | if (fstat(fd, &st) < 0) |
356 | goto errout; | 356 | goto errout; |
@@ -365,7 +365,7 @@ errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, int flags) | |||
365 | #endif | 365 | #endif |
366 | if (retval) | 366 | if (retval) |
367 | goto errout; | 367 | goto errout; |
368 | 368 | ||
369 | close(fd); | 369 | close(fd); |
370 | journal_ino = st.st_ino; | 370 | journal_ino = st.st_ino; |
371 | } else { | 371 | } else { |
@@ -374,7 +374,7 @@ errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, int flags) | |||
374 | size, flags))) | 374 | size, flags))) |
375 | return retval; | 375 | return retval; |
376 | } | 376 | } |
377 | 377 | ||
378 | fs->super->s_journal_inum = journal_ino; | 378 | fs->super->s_journal_inum = journal_ino; |
379 | fs->super->s_journal_dev = 0; | 379 | fs->super->s_journal_dev = 0; |
380 | memset(fs->super->s_journal_uuid, 0, | 380 | memset(fs->super->s_journal_uuid, 0, |
@@ -393,14 +393,14 @@ main(int argc, char **argv) | |||
393 | { | 393 | { |
394 | errcode_t retval; | 394 | errcode_t retval; |
395 | char *device_name; | 395 | char *device_name; |
396 | ext2_filsys fs; | 396 | ext2_filsys fs; |
397 | 397 | ||
398 | if (argc < 2) { | 398 | if (argc < 2) { |
399 | fprintf(stderr, "Usage: %s filesystem\n", argv[0]); | 399 | fprintf(stderr, "Usage: %s filesystem\n", argv[0]); |
400 | exit(1); | 400 | exit(1); |
401 | } | 401 | } |
402 | device_name = argv[1]; | 402 | device_name = argv[1]; |
403 | 403 | ||
404 | retval = ext2fs_open (device_name, EXT2_FLAG_RW, 0, 0, | 404 | retval = ext2fs_open (device_name, EXT2_FLAG_RW, 0, 0, |
405 | unix_io_manager, &fs); | 405 | unix_io_manager, &fs); |
406 | if (retval) { | 406 | if (retval) { |
@@ -420,6 +420,6 @@ main(int argc, char **argv) | |||
420 | } | 420 | } |
421 | ext2fs_close(fs); | 421 | ext2fs_close(fs); |
422 | exit(0); | 422 | exit(0); |
423 | 423 | ||
424 | } | 424 | } |
425 | #endif | 425 | #endif |
diff --git a/e2fsprogs/ext2fs/namei.c b/e2fsprogs/ext2fs/namei.c index 13d13adfe..6ce4bb363 100644 --- a/e2fsprogs/ext2fs/namei.c +++ b/e2fsprogs/ext2fs/namei.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * namei.c --- ext2fs directory lookup operations | 2 | * namei.c --- ext2fs directory lookup operations |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1994, 1995 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1994, 1995 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -36,7 +36,7 @@ static errcode_t follow_link(ext2_filsys fs, ext2_ino_t root, ext2_ino_t dir, | |||
36 | #ifdef NAMEI_DEBUG | 36 | #ifdef NAMEI_DEBUG |
37 | printf("follow_link: root=%lu, dir=%lu, inode=%lu, lc=%d\n", | 37 | printf("follow_link: root=%lu, dir=%lu, inode=%lu, lc=%d\n", |
38 | root, dir, inode, link_count); | 38 | root, dir, inode, link_count); |
39 | 39 | ||
40 | #endif | 40 | #endif |
41 | retval = ext2fs_read_inode (fs, inode, &ei); | 41 | retval = ext2fs_read_inode (fs, inode, &ei); |
42 | if (retval) return retval; | 42 | if (retval) return retval; |
@@ -85,12 +85,12 @@ static errcode_t dir_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t dir, | |||
85 | errcode_t retval; | 85 | errcode_t retval; |
86 | 86 | ||
87 | if ((c = *pathname) == '/') { | 87 | if ((c = *pathname) == '/') { |
88 | dir = root; | 88 | dir = root; |
89 | pathname++; | 89 | pathname++; |
90 | pathlen--; | 90 | pathlen--; |
91 | } | 91 | } |
92 | while (1) { | 92 | while (1) { |
93 | thisname = pathname; | 93 | thisname = pathname; |
94 | for (len=0; --pathlen >= 0;len++) { | 94 | for (len=0; --pathlen >= 0;len++) { |
95 | c = *(pathname++); | 95 | c = *(pathname++); |
96 | if (c == '/') | 96 | if (c == '/') |
@@ -100,10 +100,10 @@ static errcode_t dir_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t dir, | |||
100 | break; | 100 | break; |
101 | retval = ext2fs_lookup (fs, dir, thisname, len, buf, &inode); | 101 | retval = ext2fs_lookup (fs, dir, thisname, len, buf, &inode); |
102 | if (retval) return retval; | 102 | if (retval) return retval; |
103 | retval = follow_link (fs, root, dir, inode, | 103 | retval = follow_link (fs, root, dir, inode, |
104 | link_count, buf, &dir); | 104 | link_count, buf, &dir); |
105 | if (retval) return retval; | 105 | if (retval) return retval; |
106 | } | 106 | } |
107 | *name = thisname; | 107 | *name = thisname; |
108 | *namelen = len; | 108 | *namelen = len; |
109 | *res_inode = dir; | 109 | *res_inode = dir; |
@@ -152,13 +152,13 @@ errcode_t ext2fs_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd, | |||
152 | { | 152 | { |
153 | char *buf; | 153 | char *buf; |
154 | errcode_t retval; | 154 | errcode_t retval; |
155 | 155 | ||
156 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); | 156 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); |
157 | 157 | ||
158 | retval = ext2fs_get_mem(fs->blocksize, &buf); | 158 | retval = ext2fs_get_mem(fs->blocksize, &buf); |
159 | if (retval) | 159 | if (retval) |
160 | return retval; | 160 | return retval; |
161 | 161 | ||
162 | retval = open_namei(fs, root, cwd, name, strlen(name), 0, 0, | 162 | retval = open_namei(fs, root, cwd, name, strlen(name), 0, 0, |
163 | buf, inode); | 163 | buf, inode); |
164 | 164 | ||
@@ -171,13 +171,13 @@ errcode_t ext2fs_namei_follow(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd, | |||
171 | { | 171 | { |
172 | char *buf; | 172 | char *buf; |
173 | errcode_t retval; | 173 | errcode_t retval; |
174 | 174 | ||
175 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); | 175 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); |
176 | 176 | ||
177 | retval = ext2fs_get_mem(fs->blocksize, &buf); | 177 | retval = ext2fs_get_mem(fs->blocksize, &buf); |
178 | if (retval) | 178 | if (retval) |
179 | return retval; | 179 | return retval; |
180 | 180 | ||
181 | retval = open_namei(fs, root, cwd, name, strlen(name), 1, 0, | 181 | retval = open_namei(fs, root, cwd, name, strlen(name), 1, 0, |
182 | buf, inode); | 182 | buf, inode); |
183 | 183 | ||
@@ -190,7 +190,7 @@ errcode_t ext2fs_follow_link(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd, | |||
190 | { | 190 | { |
191 | char *buf; | 191 | char *buf; |
192 | errcode_t retval; | 192 | errcode_t retval; |
193 | 193 | ||
194 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); | 194 | EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); |
195 | 195 | ||
196 | retval = ext2fs_get_mem(fs->blocksize, &buf); | 196 | retval = ext2fs_get_mem(fs->blocksize, &buf); |
diff --git a/e2fsprogs/ext2fs/newdir.c b/e2fsprogs/ext2fs/newdir.c index 3904d9112..27c718ea5 100644 --- a/e2fsprogs/ext2fs/newdir.c +++ b/e2fsprogs/ext2fs/newdir.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * newdir.c --- create a new directory block | 2 | * newdir.c --- create a new directory block |
3 | * | 3 | * |
4 | * Copyright (C) 1994, 1995 Theodore Ts'o. | 4 | * Copyright (C) 1994, 1995 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -28,7 +28,7 @@ | |||
28 | errcode_t ext2fs_new_dir_block(ext2_filsys fs, ext2_ino_t dir_ino, | 28 | errcode_t ext2fs_new_dir_block(ext2_filsys fs, ext2_ino_t dir_ino, |
29 | ext2_ino_t parent_ino, char **block) | 29 | ext2_ino_t parent_ino, char **block) |
30 | { | 30 | { |
31 | struct ext2_dir_entry *dir = NULL; | 31 | struct ext2_dir_entry *dir = NULL; |
32 | errcode_t retval; | 32 | errcode_t retval; |
33 | char *buf; | 33 | char *buf; |
34 | int rec_len; | 34 | int rec_len; |
@@ -65,7 +65,7 @@ errcode_t ext2fs_new_dir_block(ext2_filsys fs, ext2_ino_t dir_ino, | |||
65 | dir->name_len = 2 | filetype; | 65 | dir->name_len = 2 | filetype; |
66 | dir->name[0] = '.'; | 66 | dir->name[0] = '.'; |
67 | dir->name[1] = '.'; | 67 | dir->name[1] = '.'; |
68 | 68 | ||
69 | } | 69 | } |
70 | *block = buf; | 70 | *block = buf; |
71 | return 0; | 71 | return 0; |
diff --git a/e2fsprogs/ext2fs/openfs.c b/e2fsprogs/ext2fs/openfs.c index e8f16495d..aa603337d 100644 --- a/e2fsprogs/ext2fs/openfs.c +++ b/e2fsprogs/ext2fs/openfs.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * openfs.c --- open an ext2 filesystem | 2 | * openfs.c --- open an ext2 filesystem |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
7 | * This file may be redistributed under the terms of the GNU Public | 7 | * This file may be redistributed under the terms of the GNU Public |
8 | * License. | 8 | * License. |
@@ -42,7 +42,7 @@ blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, dgrp_t i) | |||
42 | bg = (fs->blocksize / sizeof (struct ext2_group_desc)) * i; | 42 | bg = (fs->blocksize / sizeof (struct ext2_group_desc)) * i; |
43 | if (ext2fs_bg_has_super(fs, bg)) | 43 | if (ext2fs_bg_has_super(fs, bg)) |
44 | has_super = 1; | 44 | has_super = 1; |
45 | ret_blk = (fs->super->s_first_data_block + has_super + | 45 | ret_blk = (fs->super->s_first_data_block + has_super + |
46 | (bg * fs->super->s_blocks_per_group)); | 46 | (bg * fs->super->s_blocks_per_group)); |
47 | /* | 47 | /* |
48 | * If group_block is not the normal value, we're trying to use | 48 | * If group_block is not the normal value, we're trying to use |
@@ -60,27 +60,27 @@ blk_t ext2fs_descriptor_block_loc(ext2_filsys fs, blk_t group_block, dgrp_t i) | |||
60 | } | 60 | } |
61 | 61 | ||
62 | errcode_t ext2fs_open(const char *name, int flags, int superblock, | 62 | errcode_t ext2fs_open(const char *name, int flags, int superblock, |
63 | unsigned int block_size, io_manager manager, | 63 | unsigned int block_size, io_manager manager, |
64 | ext2_filsys *ret_fs) | 64 | ext2_filsys *ret_fs) |
65 | { | 65 | { |
66 | return ext2fs_open2(name, 0, flags, superblock, block_size, | 66 | return ext2fs_open2(name, 0, flags, superblock, block_size, |
67 | manager, ret_fs); | 67 | manager, ret_fs); |
68 | } | 68 | } |
69 | 69 | ||
70 | /* | 70 | /* |
71 | * Note: if superblock is non-zero, block-size must also be non-zero. | 71 | * Note: if superblock is non-zero, block-size must also be non-zero. |
72 | * Superblock and block_size can be zero to use the default size. | 72 | * Superblock and block_size can be zero to use the default size. |
73 | * | 73 | * |
74 | * Valid flags for ext2fs_open() | 74 | * Valid flags for ext2fs_open() |
75 | * | 75 | * |
76 | * EXT2_FLAG_RW - Open the filesystem for read/write. | 76 | * EXT2_FLAG_RW - Open the filesystem for read/write. |
77 | * EXT2_FLAG_FORCE - Open the filesystem even if some of the | 77 | * EXT2_FLAG_FORCE - Open the filesystem even if some of the |
78 | * features aren't supported. | 78 | * features aren't supported. |
79 | * EXT2_FLAG_JOURNAL_DEV_OK - Open an ext3 journal device | 79 | * EXT2_FLAG_JOURNAL_DEV_OK - Open an ext3 journal device |
80 | */ | 80 | */ |
81 | errcode_t ext2fs_open2(const char *name, const char *io_options, | 81 | errcode_t ext2fs_open2(const char *name, const char *io_options, |
82 | int flags, int superblock, | 82 | int flags, int superblock, |
83 | unsigned int block_size, io_manager manager, | 83 | unsigned int block_size, io_manager manager, |
84 | ext2_filsys *ret_fs) | 84 | ext2_filsys *ret_fs) |
85 | { | 85 | { |
86 | ext2_filsys fs; | 86 | ext2_filsys fs; |
@@ -93,13 +93,13 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, | |||
93 | int j; | 93 | int j; |
94 | struct ext2_group_desc *gdp; | 94 | struct ext2_group_desc *gdp; |
95 | #endif | 95 | #endif |
96 | 96 | ||
97 | EXT2_CHECK_MAGIC(manager, EXT2_ET_MAGIC_IO_MANAGER); | 97 | EXT2_CHECK_MAGIC(manager, EXT2_ET_MAGIC_IO_MANAGER); |
98 | 98 | ||
99 | retval = ext2fs_get_mem(sizeof(struct struct_ext2_filsys), &fs); | 99 | retval = ext2fs_get_mem(sizeof(struct struct_ext2_filsys), &fs); |
100 | if (retval) | 100 | if (retval) |
101 | return retval; | 101 | return retval; |
102 | 102 | ||
103 | memset(fs, 0, sizeof(struct struct_ext2_filsys)); | 103 | memset(fs, 0, sizeof(struct struct_ext2_filsys)); |
104 | fs->magic = EXT2_ET_MAGIC_EXT2FS_FILSYS; | 104 | fs->magic = EXT2_ET_MAGIC_EXT2FS_FILSYS; |
105 | fs->flags = flags; | 105 | fs->flags = flags; |
@@ -113,13 +113,13 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, | |||
113 | *cp++ = 0; | 113 | *cp++ = 0; |
114 | io_options = cp; | 114 | io_options = cp; |
115 | } | 115 | } |
116 | 116 | ||
117 | retval = manager->open(fs->device_name, | 117 | retval = manager->open(fs->device_name, |
118 | (flags & EXT2_FLAG_RW) ? IO_FLAG_RW : 0, | 118 | (flags & EXT2_FLAG_RW) ? IO_FLAG_RW : 0, |
119 | &fs->io); | 119 | &fs->io); |
120 | if (retval) | 120 | if (retval) |
121 | goto cleanup; | 121 | goto cleanup; |
122 | if (io_options && | 122 | if (io_options && |
123 | (retval = io_channel_set_options(fs->io, io_options))) | 123 | (retval = io_channel_set_options(fs->io, io_options))) |
124 | goto cleanup; | 124 | goto cleanup; |
125 | fs->image_io = fs->io; | 125 | fs->image_io = fs->io; |
@@ -183,7 +183,7 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, | |||
183 | ext2fs_swap_super(fs->super); | 183 | ext2fs_swap_super(fs->super); |
184 | } | 184 | } |
185 | #endif | 185 | #endif |
186 | 186 | ||
187 | if (fs->super->s_magic != EXT2_SUPER_MAGIC) { | 187 | if (fs->super->s_magic != EXT2_SUPER_MAGIC) { |
188 | retval = EXT2_ET_BAD_MAGIC; | 188 | retval = EXT2_ET_BAD_MAGIC; |
189 | goto cleanup; | 189 | goto cleanup; |
@@ -215,7 +215,7 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, | |||
215 | goto cleanup; | 215 | goto cleanup; |
216 | } | 216 | } |
217 | } | 217 | } |
218 | 218 | ||
219 | fs->blocksize = EXT2_BLOCK_SIZE(fs->super); | 219 | fs->blocksize = EXT2_BLOCK_SIZE(fs->super); |
220 | if (fs->blocksize == 0) { | 220 | if (fs->blocksize == 0) { |
221 | retval = EXT2_ET_CORRUPT_SUPERBLOCK; | 221 | retval = EXT2_ET_CORRUPT_SUPERBLOCK; |
@@ -247,7 +247,7 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, | |||
247 | *ret_fs = fs; | 247 | *ret_fs = fs; |
248 | return 0; | 248 | return 0; |
249 | } | 249 | } |
250 | 250 | ||
251 | /* | 251 | /* |
252 | * Read group descriptors | 252 | * Read group descriptors |
253 | */ | 253 | */ |
@@ -296,7 +296,7 @@ cleanup: | |||
296 | 296 | ||
297 | /* | 297 | /* |
298 | * Set/get the filesystem data I/O channel. | 298 | * Set/get the filesystem data I/O channel. |
299 | * | 299 | * |
300 | * These functions are only valid if EXT2_FLAG_IMAGE_FILE is true. | 300 | * These functions are only valid if EXT2_FLAG_IMAGE_FILE is true. |
301 | */ | 301 | */ |
302 | errcode_t ext2fs_get_data_io(ext2_filsys fs, io_channel *old_io) | 302 | errcode_t ext2fs_get_data_io(ext2_filsys fs, io_channel *old_io) |
@@ -322,7 +322,7 @@ errcode_t ext2fs_rewrite_to_io(ext2_filsys fs, io_channel new_io) | |||
322 | if ((fs->flags & EXT2_FLAG_IMAGE_FILE) == 0) | 322 | if ((fs->flags & EXT2_FLAG_IMAGE_FILE) == 0) |
323 | return EXT2_ET_NOT_IMAGE_FILE; | 323 | return EXT2_ET_NOT_IMAGE_FILE; |
324 | fs->io = fs->image_io = new_io; | 324 | fs->io = fs->image_io = new_io; |
325 | fs->flags |= EXT2_FLAG_DIRTY | EXT2_FLAG_RW | | 325 | fs->flags |= EXT2_FLAG_DIRTY | EXT2_FLAG_RW | |
326 | EXT2_FLAG_BB_DIRTY | EXT2_FLAG_IB_DIRTY; | 326 | EXT2_FLAG_BB_DIRTY | EXT2_FLAG_IB_DIRTY; |
327 | fs->flags &= ~EXT2_FLAG_IMAGE_FILE; | 327 | fs->flags &= ~EXT2_FLAG_IMAGE_FILE; |
328 | return 0; | 328 | return 0; |
diff --git a/e2fsprogs/ext2fs/read_bb.c b/e2fsprogs/ext2fs/read_bb.c index c717adcd2..226c5375a 100644 --- a/e2fsprogs/ext2fs/read_bb.c +++ b/e2fsprogs/ext2fs/read_bb.c | |||
@@ -38,16 +38,16 @@ struct read_bb_record { | |||
38 | #pragma argsused | 38 | #pragma argsused |
39 | #endif | 39 | #endif |
40 | static int mark_bad_block(ext2_filsys fs, blk_t *block_nr, | 40 | static int mark_bad_block(ext2_filsys fs, blk_t *block_nr, |
41 | e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)), | 41 | e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)), |
42 | blk_t ref_block EXT2FS_ATTR((unused)), | 42 | blk_t ref_block EXT2FS_ATTR((unused)), |
43 | int ref_offset EXT2FS_ATTR((unused)), | 43 | int ref_offset EXT2FS_ATTR((unused)), |
44 | void *priv_data) | 44 | void *priv_data) |
45 | { | 45 | { |
46 | struct read_bb_record *rb = (struct read_bb_record *) priv_data; | 46 | struct read_bb_record *rb = (struct read_bb_record *) priv_data; |
47 | 47 | ||
48 | if (blockcnt < 0) | 48 | if (blockcnt < 0) |
49 | return 0; | 49 | return 0; |
50 | 50 | ||
51 | if ((*block_nr < fs->super->s_first_data_block) || | 51 | if ((*block_nr < fs->super->s_first_data_block) || |
52 | (*block_nr >= fs->super->s_blocks_count)) | 52 | (*block_nr >= fs->super->s_blocks_count)) |
53 | return 0; /* Ignore illegal blocks */ | 53 | return 0; /* Ignore illegal blocks */ |
diff --git a/e2fsprogs/ext2fs/read_bb_file.c b/e2fsprogs/ext2fs/read_bb_file.c index 40c34ee3c..f7851f143 100644 --- a/e2fsprogs/ext2fs/read_bb_file.c +++ b/e2fsprogs/ext2fs/read_bb_file.c | |||
@@ -29,7 +29,7 @@ | |||
29 | /* | 29 | /* |
30 | * Reads a list of bad blocks from a FILE * | 30 | * Reads a list of bad blocks from a FILE * |
31 | */ | 31 | */ |
32 | errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f, | 32 | errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f, |
33 | ext2_badblocks_list *bb_list, | 33 | ext2_badblocks_list *bb_list, |
34 | void *priv_data, | 34 | void *priv_data, |
35 | void (*invalid)(ext2_filsys fs, | 35 | void (*invalid)(ext2_filsys fs, |
@@ -72,7 +72,7 @@ errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f, | |||
72 | } | 72 | } |
73 | 73 | ||
74 | static void call_compat_invalid(ext2_filsys fs, blk_t blk, | 74 | static void call_compat_invalid(ext2_filsys fs, blk_t blk, |
75 | char *badstr EXT2FS_ATTR((unused)), | 75 | char *badstr EXT2FS_ATTR((unused)), |
76 | void *priv_data) | 76 | void *priv_data) |
77 | { | 77 | { |
78 | void (*invalid)(ext2_filsys, blk_t); | 78 | void (*invalid)(ext2_filsys, blk_t); |
@@ -86,7 +86,7 @@ static void call_compat_invalid(ext2_filsys fs, blk_t blk, | |||
86 | /* | 86 | /* |
87 | * Reads a list of bad blocks from a FILE * | 87 | * Reads a list of bad blocks from a FILE * |
88 | */ | 88 | */ |
89 | errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f, | 89 | errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f, |
90 | ext2_badblocks_list *bb_list, | 90 | ext2_badblocks_list *bb_list, |
91 | void (*invalid)(ext2_filsys fs, blk_t blk)) | 91 | void (*invalid)(ext2_filsys fs, blk_t blk)) |
92 | { | 92 | { |
diff --git a/e2fsprogs/ext2fs/rs_bitmap.c b/e2fsprogs/ext2fs/rs_bitmap.c index 46653f0ec..c2e51e021 100644 --- a/e2fsprogs/ext2fs/rs_bitmap.c +++ b/e2fsprogs/ext2fs/rs_bitmap.c | |||
@@ -53,7 +53,7 @@ errcode_t ext2fs_resize_generic_bitmap(__u32 new_end, __u32 new_real_end, | |||
53 | bmap->end = new_end; | 53 | bmap->end = new_end; |
54 | return 0; | 54 | return 0; |
55 | } | 55 | } |
56 | 56 | ||
57 | size = ((bmap->real_end - bmap->start) / 8) + 1; | 57 | size = ((bmap->real_end - bmap->start) / 8) + 1; |
58 | new_size = ((new_real_end - bmap->start) / 8) + 1; | 58 | new_size = ((new_real_end - bmap->start) / 8) + 1; |
59 | 59 | ||
@@ -74,7 +74,7 @@ errcode_t ext2fs_resize_inode_bitmap(__u32 new_end, __u32 new_real_end, | |||
74 | ext2fs_inode_bitmap bmap) | 74 | ext2fs_inode_bitmap bmap) |
75 | { | 75 | { |
76 | errcode_t retval; | 76 | errcode_t retval; |
77 | 77 | ||
78 | if (!bmap) | 78 | if (!bmap) |
79 | return EXT2_ET_INVALID_ARGUMENT; | 79 | return EXT2_ET_INVALID_ARGUMENT; |
80 | 80 | ||
@@ -91,7 +91,7 @@ errcode_t ext2fs_resize_block_bitmap(__u32 new_end, __u32 new_real_end, | |||
91 | ext2fs_block_bitmap bmap) | 91 | ext2fs_block_bitmap bmap) |
92 | { | 92 | { |
93 | errcode_t retval; | 93 | errcode_t retval; |
94 | 94 | ||
95 | if (!bmap) | 95 | if (!bmap) |
96 | return EXT2_ET_INVALID_ARGUMENT; | 96 | return EXT2_ET_INVALID_ARGUMENT; |
97 | 97 | ||
diff --git a/e2fsprogs/ext2fs/rw_bitmaps.c b/e2fsprogs/ext2fs/rw_bitmaps.c index b67a92599..ae7b6e0cf 100644 --- a/e2fsprogs/ext2fs/rw_bitmaps.c +++ b/e2fsprogs/ext2fs/rw_bitmaps.c | |||
@@ -45,7 +45,7 @@ static void ext2fs_swap_bitmap(ext2_filsys fs, char *bitmap, int nbytes) | |||
45 | { | 45 | { |
46 | __u32 *p = (__u32 *) bitmap; | 46 | __u32 *p = (__u32 *) bitmap; |
47 | int n; | 47 | int n; |
48 | 48 | ||
49 | for (n = nbytes / sizeof(__u32); n > 0; --n, ++p) | 49 | for (n = nbytes / sizeof(__u32); n > 0; --n, ++p) |
50 | *p = ext2fs_swab32(*p); | 50 | *p = ext2fs_swab32(*p); |
51 | } | 51 | } |
@@ -53,7 +53,7 @@ static void ext2fs_swap_bitmap(ext2_filsys fs, char *bitmap, int nbytes) | |||
53 | 53 | ||
54 | errcode_t ext2fs_write_inode_bitmap(ext2_filsys fs) | 54 | errcode_t ext2fs_write_inode_bitmap(ext2_filsys fs) |
55 | { | 55 | { |
56 | dgrp_t i; | 56 | dgrp_t i; |
57 | size_t nbytes; | 57 | size_t nbytes; |
58 | errcode_t retval; | 58 | errcode_t retval; |
59 | char * inode_bitmap = fs->inode_map->bitmap; | 59 | char * inode_bitmap = fs->inode_map->bitmap; |
@@ -67,7 +67,7 @@ errcode_t ext2fs_write_inode_bitmap(ext2_filsys fs) | |||
67 | if (!inode_bitmap) | 67 | if (!inode_bitmap) |
68 | return 0; | 68 | return 0; |
69 | nbytes = (size_t) ((EXT2_INODES_PER_GROUP(fs->super)+7) / 8); | 69 | nbytes = (size_t) ((EXT2_INODES_PER_GROUP(fs->super)+7) / 8); |
70 | 70 | ||
71 | retval = ext2fs_get_mem(fs->blocksize, &bitmap_block); | 71 | retval = ext2fs_get_mem(fs->blocksize, &bitmap_block); |
72 | if (retval) | 72 | if (retval) |
73 | return retval; | 73 | return retval; |
@@ -95,7 +95,7 @@ errcode_t ext2fs_write_inode_bitmap(ext2_filsys fs) | |||
95 | 95 | ||
96 | errcode_t ext2fs_write_block_bitmap (ext2_filsys fs) | 96 | errcode_t ext2fs_write_block_bitmap (ext2_filsys fs) |
97 | { | 97 | { |
98 | dgrp_t i; | 98 | dgrp_t i; |
99 | unsigned int j; | 99 | unsigned int j; |
100 | int nbytes; | 100 | int nbytes; |
101 | unsigned int nbits; | 101 | unsigned int nbits; |
@@ -195,7 +195,7 @@ static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block) | |||
195 | if (block_bitmap) { | 195 | if (block_bitmap) { |
196 | blk = (fs->image_header->offset_blockmap / | 196 | blk = (fs->image_header->offset_blockmap / |
197 | fs->blocksize); | 197 | fs->blocksize); |
198 | retval = io_channel_read_blk(fs->image_io, blk, | 198 | retval = io_channel_read_blk(fs->image_io, blk, |
199 | -(block_nbytes * fs->group_desc_count), | 199 | -(block_nbytes * fs->group_desc_count), |
200 | block_bitmap); | 200 | block_bitmap); |
201 | if (retval) | 201 | if (retval) |
@@ -243,7 +243,7 @@ static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block) | |||
243 | } | 243 | } |
244 | } | 244 | } |
245 | return 0; | 245 | return 0; |
246 | 246 | ||
247 | cleanup: | 247 | cleanup: |
248 | if (do_block) { | 248 | if (do_block) { |
249 | ext2fs_free_mem(&fs->block_map); | 249 | ext2fs_free_mem(&fs->block_map); |
@@ -296,5 +296,5 @@ errcode_t ext2fs_write_bitmaps(ext2_filsys fs) | |||
296 | return retval; | 296 | return retval; |
297 | } | 297 | } |
298 | return 0; | 298 | return 0; |
299 | } | 299 | } |
300 | 300 | ||
diff --git a/e2fsprogs/ext2fs/swapfs.c b/e2fsprogs/ext2fs/swapfs.c index 8a0899515..af8b6eb87 100644 --- a/e2fsprogs/ext2fs/swapfs.c +++ b/e2fsprogs/ext2fs/swapfs.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * swapfs.c --- swap ext2 filesystem data structures | 2 | * swapfs.c --- swap ext2 filesystem data structures |
3 | * | 3 | * |
4 | * Copyright (C) 1995, 1996, 2002 Theodore Ts'o. | 4 | * Copyright (C) 1995, 1996, 2002 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -23,7 +23,7 @@ | |||
23 | #ifdef EXT2FS_ENABLE_SWAPFS | 23 | #ifdef EXT2FS_ENABLE_SWAPFS |
24 | void ext2fs_swap_super(struct ext2_super_block * sb) | 24 | void ext2fs_swap_super(struct ext2_super_block * sb) |
25 | { | 25 | { |
26 | int i; | 26 | int i; |
27 | sb->s_inodes_count = ext2fs_swab32(sb->s_inodes_count); | 27 | sb->s_inodes_count = ext2fs_swab32(sb->s_inodes_count); |
28 | sb->s_blocks_count = ext2fs_swab32(sb->s_blocks_count); | 28 | sb->s_blocks_count = ext2fs_swab32(sb->s_blocks_count); |
29 | sb->s_r_blocks_count = ext2fs_swab32(sb->s_r_blocks_count); | 29 | sb->s_r_blocks_count = ext2fs_swab32(sb->s_r_blocks_count); |
@@ -108,11 +108,11 @@ void ext2fs_swap_ext_attr(char *to, char *from, int bufsize, int has_header) | |||
108 | } | 108 | } |
109 | 109 | ||
110 | while ((char *)from_entry < from_end && *(__u32 *)from_entry) { | 110 | while ((char *)from_entry < from_end && *(__u32 *)from_entry) { |
111 | to_entry->e_value_offs = | 111 | to_entry->e_value_offs = |
112 | ext2fs_swab16(from_entry->e_value_offs); | 112 | ext2fs_swab16(from_entry->e_value_offs); |
113 | to_entry->e_value_block = | 113 | to_entry->e_value_block = |
114 | ext2fs_swab32(from_entry->e_value_block); | 114 | ext2fs_swab32(from_entry->e_value_block); |
115 | to_entry->e_value_size = | 115 | to_entry->e_value_size = |
116 | ext2fs_swab32(from_entry->e_value_size); | 116 | ext2fs_swab32(from_entry->e_value_size); |
117 | from_entry = EXT2_EXT_ATTR_NEXT(from_entry); | 117 | from_entry = EXT2_EXT_ATTR_NEXT(from_entry); |
118 | to_entry = EXT2_EXT_ATTR_NEXT(to_entry); | 118 | to_entry = EXT2_EXT_ATTR_NEXT(to_entry); |
diff --git a/e2fsprogs/ext2fs/test_io.c b/e2fsprogs/ext2fs/test_io.c index 6a3b248e9..d4b36532f 100644 --- a/e2fsprogs/ext2fs/test_io.c +++ b/e2fsprogs/ext2fs/test_io.c | |||
@@ -32,7 +32,7 @@ | |||
32 | 32 | ||
33 | #define EXT2_CHECK_MAGIC(struct, code) \ | 33 | #define EXT2_CHECK_MAGIC(struct, code) \ |
34 | if ((struct)->magic != (code)) return (code) | 34 | if ((struct)->magic != (code)) return (code) |
35 | 35 | ||
36 | struct test_private_data { | 36 | struct test_private_data { |
37 | int magic; | 37 | int magic; |
38 | io_channel real; | 38 | io_channel real; |
@@ -56,7 +56,7 @@ static errcode_t test_write_blk(io_channel channel, unsigned long block, | |||
56 | static errcode_t test_flush(io_channel channel); | 56 | static errcode_t test_flush(io_channel channel); |
57 | static errcode_t test_write_byte(io_channel channel, unsigned long offset, | 57 | static errcode_t test_write_byte(io_channel channel, unsigned long offset, |
58 | int count, const void *buf); | 58 | int count, const void *buf); |
59 | static errcode_t test_set_option(io_channel channel, const char *option, | 59 | static errcode_t test_set_option(io_channel channel, const char *option, |
60 | const char *arg); | 60 | const char *arg); |
61 | 61 | ||
62 | static struct struct_io_manager struct_test_manager = { | 62 | static struct struct_io_manager struct_test_manager = { |
@@ -172,10 +172,10 @@ static errcode_t test_open(const char *name, int flags, io_channel *channel) | |||
172 | goto cleanup; | 172 | goto cleanup; |
173 | } else | 173 | } else |
174 | data->real = 0; | 174 | data->real = 0; |
175 | data->read_blk = test_io_cb_read_blk; | 175 | data->read_blk = test_io_cb_read_blk; |
176 | data->write_blk = test_io_cb_write_blk; | 176 | data->write_blk = test_io_cb_write_blk; |
177 | data->set_blksize = test_io_cb_set_blksize; | 177 | data->set_blksize = test_io_cb_set_blksize; |
178 | data->write_byte = test_io_cb_write_byte; | 178 | data->write_byte = test_io_cb_write_byte; |
179 | 179 | ||
180 | data->outfile = NULL; | 180 | data->outfile = NULL; |
181 | if ((value = getenv("TEST_IO_LOGFILE")) != NULL) | 181 | if ((value = getenv("TEST_IO_LOGFILE")) != NULL) |
@@ -186,7 +186,7 @@ static errcode_t test_open(const char *name, int flags, io_channel *channel) | |||
186 | data->flags = 0; | 186 | data->flags = 0; |
187 | if ((value = getenv("TEST_IO_FLAGS")) != NULL) | 187 | if ((value = getenv("TEST_IO_FLAGS")) != NULL) |
188 | data->flags = strtoul(value, NULL, 0); | 188 | data->flags = strtoul(value, NULL, 0); |
189 | 189 | ||
190 | data->block = 0; | 190 | data->block = 0; |
191 | if ((value = getenv("TEST_IO_BLOCK")) != NULL) | 191 | if ((value = getenv("TEST_IO_BLOCK")) != NULL) |
192 | data->block = strtoul(value, NULL, 0); | 192 | data->block = strtoul(value, NULL, 0); |
@@ -198,7 +198,7 @@ static errcode_t test_open(const char *name, int flags, io_channel *channel) | |||
198 | data->write_abort_count = 0; | 198 | data->write_abort_count = 0; |
199 | if ((value = getenv("TEST_IO_WRITE_ABORT")) != NULL) | 199 | if ((value = getenv("TEST_IO_WRITE_ABORT")) != NULL) |
200 | data->write_abort_count = strtoul(value, NULL, 0); | 200 | data->write_abort_count = strtoul(value, NULL, 0); |
201 | 201 | ||
202 | *channel = io; | 202 | *channel = io; |
203 | return 0; | 203 | return 0; |
204 | 204 | ||
@@ -221,13 +221,13 @@ static errcode_t test_close(io_channel channel) | |||
221 | 221 | ||
222 | if (--channel->refcount > 0) | 222 | if (--channel->refcount > 0) |
223 | return 0; | 223 | return 0; |
224 | 224 | ||
225 | if (data->real) | 225 | if (data->real) |
226 | retval = io_channel_close(data->real); | 226 | retval = io_channel_close(data->real); |
227 | 227 | ||
228 | if (data->outfile && data->outfile != stderr) | 228 | if (data->outfile && data->outfile != stderr) |
229 | fclose(data->outfile); | 229 | fclose(data->outfile); |
230 | 230 | ||
231 | ext2fs_free_mem(&channel->private_data); | 231 | ext2fs_free_mem(&channel->private_data); |
232 | if (channel->name) | 232 | if (channel->name) |
233 | ext2fs_free_mem(&channel->name); | 233 | ext2fs_free_mem(&channel->name); |
@@ -280,7 +280,7 @@ static errcode_t test_read_blk(io_channel channel, unsigned long block, | |||
280 | test_dump_block(channel, data, block, buf); | 280 | test_dump_block(channel, data, block, buf); |
281 | if (--data->read_abort_count == 0) | 281 | if (--data->read_abort_count == 0) |
282 | test_abort(channel, block); | 282 | test_abort(channel, block); |
283 | } | 283 | } |
284 | return retval; | 284 | return retval; |
285 | } | 285 | } |
286 | 286 | ||
@@ -339,22 +339,22 @@ static errcode_t test_flush(io_channel channel) | |||
339 | { | 339 | { |
340 | struct test_private_data *data; | 340 | struct test_private_data *data; |
341 | errcode_t retval = 0; | 341 | errcode_t retval = 0; |
342 | 342 | ||
343 | EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); | 343 | EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); |
344 | data = (struct test_private_data *) channel->private_data; | 344 | data = (struct test_private_data *) channel->private_data; |
345 | EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_TEST_IO_CHANNEL); | 345 | EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_TEST_IO_CHANNEL); |
346 | 346 | ||
347 | if (data->real) | 347 | if (data->real) |
348 | retval = io_channel_flush(data->real); | 348 | retval = io_channel_flush(data->real); |
349 | 349 | ||
350 | if (data->flags & TEST_FLAG_FLUSH) | 350 | if (data->flags & TEST_FLAG_FLUSH) |
351 | fprintf(data->outfile, "Test_io: flush() returned %s\n", | 351 | fprintf(data->outfile, "Test_io: flush() returned %s\n", |
352 | retval ? error_message(retval) : "OK"); | 352 | retval ? error_message(retval) : "OK"); |
353 | 353 | ||
354 | return retval; | 354 | return retval; |
355 | } | 355 | } |
356 | 356 | ||
357 | static errcode_t test_set_option(io_channel channel, const char *option, | 357 | static errcode_t test_set_option(io_channel channel, const char *option, |
358 | const char *arg) | 358 | const char *arg) |
359 | { | 359 | { |
360 | struct test_private_data *data; | 360 | struct test_private_data *data; |
@@ -366,10 +366,10 @@ static errcode_t test_set_option(io_channel channel, const char *option, | |||
366 | 366 | ||
367 | 367 | ||
368 | if (data->flags & TEST_FLAG_SET_OPTION) | 368 | if (data->flags & TEST_FLAG_SET_OPTION) |
369 | fprintf(data->outfile, "Test_io: set_option(%s, %s) ", | 369 | fprintf(data->outfile, "Test_io: set_option(%s, %s) ", |
370 | option, arg); | 370 | option, arg); |
371 | if (data->real && data->real->manager->set_option) { | 371 | if (data->real && data->real->manager->set_option) { |
372 | retval = (data->real->manager->set_option)(data->real, | 372 | retval = (data->real->manager->set_option)(data->real, |
373 | option, arg); | 373 | option, arg); |
374 | if (data->flags & TEST_FLAG_SET_OPTION) | 374 | if (data->flags & TEST_FLAG_SET_OPTION) |
375 | fprintf(data->outfile, "returned %s\n", | 375 | fprintf(data->outfile, "returned %s\n", |
diff --git a/e2fsprogs/ext2fs/unix_io.c b/e2fsprogs/ext2fs/unix_io.c index 5bc7a6abe..36b222577 100644 --- a/e2fsprogs/ext2fs/unix_io.c +++ b/e2fsprogs/ext2fs/unix_io.c | |||
@@ -1,13 +1,13 @@ | |||
1 | /* | 1 | /* |
2 | * unix_io.c --- This is the Unix (well, really POSIX) implementation | 2 | * unix_io.c --- This is the Unix (well, really POSIX) implementation |
3 | * of the I/O manager. | 3 | * of the I/O manager. |
4 | * | 4 | * |
5 | * Implements a one-block write-through cache. | 5 | * Implements a one-block write-through cache. |
6 | * | 6 | * |
7 | * Includes support for Windows NT support under Cygwin. | 7 | * Includes support for Windows NT support under Cygwin. |
8 | * | 8 | * |
9 | * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, | 9 | * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, |
10 | * 2002 by Theodore Ts'o. | 10 | * 2002 by Theodore Ts'o. |
11 | * | 11 | * |
12 | * %Begin-Header% | 12 | * %Begin-Header% |
13 | * This file may be redistributed under the terms of the GNU Public | 13 | * This file may be redistributed under the terms of the GNU Public |
@@ -79,7 +79,7 @@ static errcode_t unix_write_blk(io_channel channel, unsigned long block, | |||
79 | static errcode_t unix_flush(io_channel channel); | 79 | static errcode_t unix_flush(io_channel channel); |
80 | static errcode_t unix_write_byte(io_channel channel, unsigned long offset, | 80 | static errcode_t unix_write_byte(io_channel channel, unsigned long offset, |
81 | int size, const void *data); | 81 | int size, const void *data); |
82 | static errcode_t unix_set_option(io_channel channel, const char *option, | 82 | static errcode_t unix_set_option(io_channel channel, const char *option, |
83 | const char *arg); | 83 | const char *arg); |
84 | 84 | ||
85 | static void reuse_cache(io_channel channel, struct unix_private_data *data, | 85 | static void reuse_cache(io_channel channel, struct unix_private_data *data, |
@@ -140,7 +140,7 @@ static errcode_t raw_read_blk(io_channel channel, | |||
140 | goto error_out; | 140 | goto error_out; |
141 | } | 141 | } |
142 | return 0; | 142 | return 0; |
143 | 143 | ||
144 | error_out: | 144 | error_out: |
145 | memset((char *) buf+actual, 0, size-actual); | 145 | memset((char *) buf+actual, 0, size-actual); |
146 | if (channel->read_error) | 146 | if (channel->read_error) |
@@ -168,7 +168,7 @@ static errcode_t raw_read_blk(io_channel channel, | |||
168 | location = ((ext2_loff_t) block * channel->block_size) + data->offset; | 168 | location = ((ext2_loff_t) block * channel->block_size) + data->offset; |
169 | #ifdef DEBUG | 169 | #ifdef DEBUG |
170 | printf("count=%d, size=%d, block=%d, blk_size=%d, location=%lx\n", | 170 | printf("count=%d, size=%d, block=%d, blk_size=%d, location=%lx\n", |
171 | count, size, block, channel->block_size, location); | 171 | count, size, block, channel->block_size, location); |
172 | #endif | 172 | #endif |
173 | if (ext2fs_llseek(data->dev, location, SEEK_SET) != location) { | 173 | if (ext2fs_llseek(data->dev, location, SEEK_SET) != location) { |
174 | retval = errno ? errno : EXT2_ET_LLSEEK_FAILED; | 174 | retval = errno ? errno : EXT2_ET_LLSEEK_FAILED; |
@@ -227,14 +227,14 @@ static errcode_t raw_write_blk(io_channel channel, | |||
227 | retval = errno ? errno : EXT2_ET_LLSEEK_FAILED; | 227 | retval = errno ? errno : EXT2_ET_LLSEEK_FAILED; |
228 | goto error_out; | 228 | goto error_out; |
229 | } | 229 | } |
230 | 230 | ||
231 | actual = write(data->dev, buf, size); | 231 | actual = write(data->dev, buf, size); |
232 | if (actual != size) { | 232 | if (actual != size) { |
233 | retval = EXT2_ET_SHORT_WRITE; | 233 | retval = EXT2_ET_SHORT_WRITE; |
234 | goto error_out; | 234 | goto error_out; |
235 | } | 235 | } |
236 | return 0; | 236 | return 0; |
237 | 237 | ||
238 | error_out: | 238 | error_out: |
239 | if (channel->write_error) | 239 | if (channel->write_error) |
240 | retval = (channel->write_error)(channel, block, count, buf, | 240 | retval = (channel->write_error)(channel, block, count, buf, |
@@ -254,7 +254,7 @@ static errcode_t alloc_cache(io_channel channel, | |||
254 | errcode_t retval; | 254 | errcode_t retval; |
255 | struct unix_cache *cache; | 255 | struct unix_cache *cache; |
256 | int i; | 256 | int i; |
257 | 257 | ||
258 | data->access_time = 0; | 258 | data->access_time = 0; |
259 | for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) { | 259 | for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) { |
260 | cache->block = 0; | 260 | cache->block = 0; |
@@ -273,7 +273,7 @@ static void free_cache(struct unix_private_data *data) | |||
273 | { | 273 | { |
274 | struct unix_cache *cache; | 274 | struct unix_cache *cache; |
275 | int i; | 275 | int i; |
276 | 276 | ||
277 | data->access_time = 0; | 277 | data->access_time = 0; |
278 | for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) { | 278 | for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) { |
279 | cache->block = 0; | 279 | cache->block = 0; |
@@ -298,7 +298,7 @@ static struct unix_cache *find_cached_block(struct unix_private_data *data, | |||
298 | { | 298 | { |
299 | struct unix_cache *cache, *unused_cache, *oldest_cache; | 299 | struct unix_cache *cache, *unused_cache, *oldest_cache; |
300 | int i; | 300 | int i; |
301 | 301 | ||
302 | unused_cache = oldest_cache = 0; | 302 | unused_cache = oldest_cache = 0; |
303 | for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) { | 303 | for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) { |
304 | if (!cache->in_use) { | 304 | if (!cache->in_use) { |
@@ -345,18 +345,18 @@ static errcode_t flush_cached_blocks(io_channel channel, | |||
345 | struct unix_cache *cache; | 345 | struct unix_cache *cache; |
346 | errcode_t retval, retval2; | 346 | errcode_t retval, retval2; |
347 | int i; | 347 | int i; |
348 | 348 | ||
349 | retval2 = 0; | 349 | retval2 = 0; |
350 | for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) { | 350 | for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) { |
351 | if (!cache->in_use) | 351 | if (!cache->in_use) |
352 | continue; | 352 | continue; |
353 | 353 | ||
354 | if (invalidate) | 354 | if (invalidate) |
355 | cache->in_use = 0; | 355 | cache->in_use = 0; |
356 | 356 | ||
357 | if (!cache->dirty) | 357 | if (!cache->dirty) |
358 | continue; | 358 | continue; |
359 | 359 | ||
360 | retval = raw_write_blk(channel, data, | 360 | retval = raw_write_blk(channel, data, |
361 | cache->block, 1, cache->buf); | 361 | cache->block, 1, cache->buf); |
362 | if (retval) | 362 | if (retval) |
@@ -376,7 +376,7 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel) | |||
376 | int open_flags; | 376 | int open_flags; |
377 | struct stat st; | 377 | struct stat st; |
378 | #ifdef __linux__ | 378 | #ifdef __linux__ |
379 | struct utsname ut; | 379 | struct utsname ut; |
380 | #endif | 380 | #endif |
381 | 381 | ||
382 | if (name == 0) | 382 | if (name == 0) |
@@ -431,7 +431,7 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel) | |||
431 | * block devices are wrongly getting hit by the filesize | 431 | * block devices are wrongly getting hit by the filesize |
432 | * limit. This workaround isn't perfect, since it won't work | 432 | * limit. This workaround isn't perfect, since it won't work |
433 | * if glibc wasn't built against 2.2 header files. (Sigh.) | 433 | * if glibc wasn't built against 2.2 header files. (Sigh.) |
434 | * | 434 | * |
435 | */ | 435 | */ |
436 | if ((flags & IO_FLAG_RW) && | 436 | if ((flags & IO_FLAG_RW) && |
437 | (uname(&ut) == 0) && | 437 | (uname(&ut) == 0) && |
@@ -442,7 +442,7 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel) | |||
442 | (fstat(data->dev, &st) == 0) && | 442 | (fstat(data->dev, &st) == 0) && |
443 | (S_ISBLK(st.st_mode))) { | 443 | (S_ISBLK(st.st_mode))) { |
444 | struct rlimit rlim; | 444 | struct rlimit rlim; |
445 | 445 | ||
446 | rlim.rlim_cur = rlim.rlim_max = (unsigned long) RLIM_INFINITY; | 446 | rlim.rlim_cur = rlim.rlim_max = (unsigned long) RLIM_INFINITY; |
447 | setrlimit(RLIMIT_FSIZE, &rlim); | 447 | setrlimit(RLIMIT_FSIZE, &rlim); |
448 | getrlimit(RLIMIT_FSIZE, &rlim); | 448 | getrlimit(RLIMIT_FSIZE, &rlim); |
@@ -507,7 +507,7 @@ static errcode_t unix_set_blksize(io_channel channel, int blksize) | |||
507 | if ((retval = flush_cached_blocks(channel, data, 0))) | 507 | if ((retval = flush_cached_blocks(channel, data, 0))) |
508 | return retval; | 508 | return retval; |
509 | #endif | 509 | #endif |
510 | 510 | ||
511 | channel->block_size = blksize; | 511 | channel->block_size = blksize; |
512 | free_cache(data); | 512 | free_cache(data); |
513 | if ((retval = alloc_cache(channel, data))) | 513 | if ((retval = alloc_cache(channel, data))) |
@@ -568,7 +568,7 @@ static errcode_t unix_read_blk(io_channel channel, unsigned long block, | |||
568 | #endif | 568 | #endif |
569 | if ((retval = raw_read_blk(channel, data, block, i, cp))) | 569 | if ((retval = raw_read_blk(channel, data, block, i, cp))) |
570 | return retval; | 570 | return retval; |
571 | 571 | ||
572 | /* Save the results in the cache */ | 572 | /* Save the results in the cache */ |
573 | for (j=0; j < i; j++) { | 573 | for (j=0; j < i; j++) { |
574 | count--; | 574 | count--; |
@@ -597,7 +597,7 @@ static errcode_t unix_write_blk(io_channel channel, unsigned long block, | |||
597 | 597 | ||
598 | #ifdef NO_IO_CACHE | 598 | #ifdef NO_IO_CACHE |
599 | return raw_write_blk(channel, data, block, count, buf); | 599 | return raw_write_blk(channel, data, block, count, buf); |
600 | #else | 600 | #else |
601 | /* | 601 | /* |
602 | * If we're doing an odd-sized write or a very large write, | 602 | * If we're doing an odd-sized write or a very large write, |
603 | * flush out the cache completely and then do a direct write. | 603 | * flush out the cache completely and then do a direct write. |
@@ -616,7 +616,7 @@ static errcode_t unix_write_blk(io_channel channel, unsigned long block, | |||
616 | writethrough = channel->flags & CHANNEL_FLAGS_WRITETHROUGH; | 616 | writethrough = channel->flags & CHANNEL_FLAGS_WRITETHROUGH; |
617 | if (writethrough) | 617 | if (writethrough) |
618 | retval = raw_write_blk(channel, data, block, count, buf); | 618 | retval = raw_write_blk(channel, data, block, count, buf); |
619 | 619 | ||
620 | cp = buf; | 620 | cp = buf; |
621 | while (count > 0) { | 621 | while (count > 0) { |
622 | cache = find_cached_block(data, block, &reuse); | 622 | cache = find_cached_block(data, block, &reuse); |
@@ -655,7 +655,7 @@ static errcode_t unix_write_byte(io_channel channel, unsigned long offset, | |||
655 | 655 | ||
656 | if (lseek(data->dev, offset + data->offset, SEEK_SET) < 0) | 656 | if (lseek(data->dev, offset + data->offset, SEEK_SET) < 0) |
657 | return errno; | 657 | return errno; |
658 | 658 | ||
659 | actual = write(data->dev, buf, size); | 659 | actual = write(data->dev, buf, size); |
660 | if (actual != size) | 660 | if (actual != size) |
661 | return EXT2_ET_SHORT_WRITE; | 661 | return EXT2_ET_SHORT_WRITE; |
@@ -664,13 +664,13 @@ static errcode_t unix_write_byte(io_channel channel, unsigned long offset, | |||
664 | } | 664 | } |
665 | 665 | ||
666 | /* | 666 | /* |
667 | * Flush data buffers to disk. | 667 | * Flush data buffers to disk. |
668 | */ | 668 | */ |
669 | static errcode_t unix_flush(io_channel channel) | 669 | static errcode_t unix_flush(io_channel channel) |
670 | { | 670 | { |
671 | struct unix_private_data *data; | 671 | struct unix_private_data *data; |
672 | errcode_t retval = 0; | 672 | errcode_t retval = 0; |
673 | 673 | ||
674 | EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); | 674 | EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL); |
675 | data = (struct unix_private_data *) channel->private_data; | 675 | data = (struct unix_private_data *) channel->private_data; |
676 | EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL); | 676 | EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_UNIX_IO_CHANNEL); |
@@ -682,7 +682,7 @@ static errcode_t unix_flush(io_channel channel) | |||
682 | return retval; | 682 | return retval; |
683 | } | 683 | } |
684 | 684 | ||
685 | static errcode_t unix_set_option(io_channel channel, const char *option, | 685 | static errcode_t unix_set_option(io_channel channel, const char *option, |
686 | const char *arg) | 686 | const char *arg) |
687 | { | 687 | { |
688 | struct unix_private_data *data; | 688 | struct unix_private_data *data; |
diff --git a/e2fsprogs/ext2fs/unlink.c b/e2fsprogs/ext2fs/unlink.c index e7b2182d2..a6ab53ae8 100644 --- a/e2fsprogs/ext2fs/unlink.c +++ b/e2fsprogs/ext2fs/unlink.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * unlink.c --- delete links in a ext2fs directory | 2 | * unlink.c --- delete links in a ext2fs directory |
3 | * | 3 | * |
4 | * Copyright (C) 1993, 1994, 1997 Theodore Ts'o. | 4 | * Copyright (C) 1993, 1994, 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -25,7 +25,7 @@ struct link_struct { | |||
25 | int flags; | 25 | int flags; |
26 | struct ext2_dir_entry *prev; | 26 | struct ext2_dir_entry *prev; |
27 | int done; | 27 | int done; |
28 | }; | 28 | }; |
29 | 29 | ||
30 | #ifdef __TURBOC__ | 30 | #ifdef __TURBOC__ |
31 | #pragma argsused | 31 | #pragma argsused |
@@ -56,7 +56,7 @@ static int unlink_proc(struct ext2_dir_entry *dirent, | |||
56 | return 0; | 56 | return 0; |
57 | } | 57 | } |
58 | 58 | ||
59 | if (prev) | 59 | if (prev) |
60 | prev->rec_len += dirent->rec_len; | 60 | prev->rec_len += dirent->rec_len; |
61 | else | 61 | else |
62 | dirent->inode = 0; | 62 | dirent->inode = 0; |
@@ -89,7 +89,7 @@ errcode_t ext2fs_unlink(ext2_filsys fs, ext2_ino_t dir, | |||
89 | ls.done = 0; | 89 | ls.done = 0; |
90 | ls.prev = 0; | 90 | ls.prev = 0; |
91 | 91 | ||
92 | retval = ext2fs_dir_iterate(fs, dir, DIRENT_FLAG_INCLUDE_EMPTY, | 92 | retval = ext2fs_dir_iterate(fs, dir, DIRENT_FLAG_INCLUDE_EMPTY, |
93 | 0, unlink_proc, &ls); | 93 | 0, unlink_proc, &ls); |
94 | if (retval) | 94 | if (retval) |
95 | return retval; | 95 | return retval; |
diff --git a/e2fsprogs/ext2fs/valid_blk.c b/e2fsprogs/ext2fs/valid_blk.c index 29ff27a7c..d0367e71c 100644 --- a/e2fsprogs/ext2fs/valid_blk.c +++ b/e2fsprogs/ext2fs/valid_blk.c | |||
@@ -2,12 +2,12 @@ | |||
2 | * valid_blk.c --- does the inode have valid blocks? | 2 | * valid_blk.c --- does the inode have valid blocks? |
3 | * | 3 | * |
4 | * Copyright 1997 by Theodore Ts'o | 4 | * Copyright 1997 by Theodore Ts'o |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
7 | * This file may be redistributed under the terms of the GNU Public | 7 | * This file may be redistributed under the terms of the GNU Public |
8 | * License. | 8 | * License. |
9 | * %End-Header% | 9 | * %End-Header% |
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <stdio.h> | 13 | #include <stdio.h> |
@@ -33,7 +33,7 @@ int ext2fs_inode_has_valid_blocks(struct ext2_inode *inode) | |||
33 | if (!LINUX_S_ISDIR(inode->i_mode) && !LINUX_S_ISREG(inode->i_mode) && | 33 | if (!LINUX_S_ISDIR(inode->i_mode) && !LINUX_S_ISREG(inode->i_mode) && |
34 | !LINUX_S_ISLNK(inode->i_mode)) | 34 | !LINUX_S_ISLNK(inode->i_mode)) |
35 | return 0; | 35 | return 0; |
36 | 36 | ||
37 | /* | 37 | /* |
38 | * If the symbolic link is a "fast symlink", then the symlink | 38 | * If the symbolic link is a "fast symlink", then the symlink |
39 | * target is stored in the block entries. | 39 | * target is stored in the block entries. |
diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c index 848d559bc..af76c4d21 100644 --- a/e2fsprogs/fsck.c +++ b/e2fsprogs/fsck.c | |||
@@ -104,10 +104,10 @@ struct fsck_instance { | |||
104 | * assure that we only fsck one partition on a particular drive at any | 104 | * assure that we only fsck one partition on a particular drive at any |
105 | * one time. Otherwise, the disk heads will be seeking all over the | 105 | * one time. Otherwise, the disk heads will be seeking all over the |
106 | * place. If the base device can not be determined, return NULL. | 106 | * place. If the base device can not be determined, return NULL. |
107 | * | 107 | * |
108 | * The base_device() function returns an allocated string which must | 108 | * The base_device() function returns an allocated string which must |
109 | * be freed. | 109 | * be freed. |
110 | * | 110 | * |
111 | */ | 111 | */ |
112 | 112 | ||
113 | 113 | ||
diff --git a/e2fsprogs/lsattr.c b/e2fsprogs/lsattr.c index e25f36d82..b5ec8ab98 100644 --- a/e2fsprogs/lsattr.c +++ b/e2fsprogs/lsattr.c | |||
@@ -97,8 +97,8 @@ static void lsattr_args(const char *name) | |||
97 | } | 97 | } |
98 | } | 98 | } |
99 | 99 | ||
100 | static int lsattr_dir_proc(const char *dir_name, struct dirent *de, | 100 | static int lsattr_dir_proc(const char *dir_name, struct dirent *de, |
101 | void *private EXT2FS_ATTR((unused))) | 101 | void *private EXT2FS_ATTR((unused))) |
102 | { | 102 | { |
103 | STRUCT_STAT st; | 103 | STRUCT_STAT st; |
104 | char *path; | 104 | char *path; |
diff --git a/e2fsprogs/mke2fs.c b/e2fsprogs/mke2fs.c index 9c4f1c4d0..10563e2d9 100644 --- a/e2fsprogs/mke2fs.c +++ b/e2fsprogs/mke2fs.c | |||
@@ -107,9 +107,9 @@ static const struct mke2fs_defaults settings[] = { | |||
107 | { default_str, 3, 1024, 8192 }, | 107 | { default_str, 3, 1024, 8192 }, |
108 | { "journal", 0, 4096, 8192 }, | 108 | { "journal", 0, 4096, 8192 }, |
109 | { "news", 0, 4096, 4096 }, | 109 | { "news", 0, 4096, 4096 }, |
110 | { "largefile", 0, 4096, 1024 * 1024 }, | 110 | { "largefile", 0, 4096, 1024 * 1024 }, |
111 | { "largefile4", 0, 4096, 4096 * 1024 }, | 111 | { "largefile4", 0, 4096, 4096 * 1024 }, |
112 | { 0, 0, 0, 0}, | 112 | { 0, 0, 0, 0}, |
113 | }; | 113 | }; |
114 | 114 | ||
115 | static void set_fs_defaults(const char *fs_type, | 115 | static void set_fs_defaults(const char *fs_type, |
@@ -448,7 +448,7 @@ static void write_inode_tables(ext2_filsys fs) | |||
448 | num = fs->inode_blocks_per_group; | 448 | num = fs->inode_blocks_per_group; |
449 | 449 | ||
450 | retval = zero_blocks(fs, blk, num, 0, &blk, &num); | 450 | retval = zero_blocks(fs, blk, num, 0, &blk, &num); |
451 | mke2fs_error_msg_and_die(retval, | 451 | mke2fs_error_msg_and_die(retval, |
452 | "write %d blocks in inode table starting at %d.", | 452 | "write %d blocks in inode table starting at %d.", |
453 | num, blk); | 453 | num, blk); |
454 | if (sync_kludge) { | 454 | if (sync_kludge) { |
@@ -572,7 +572,7 @@ static void zap_sector(ext2_filsys fs, int sect, int nsect) | |||
572 | 572 | ||
573 | static void create_journal_dev(ext2_filsys fs) | 573 | static void create_journal_dev(ext2_filsys fs) |
574 | { | 574 | { |
575 | struct progress_struct progress; | 575 | struct progress_struct progress; |
576 | errcode_t retval; | 576 | errcode_t retval; |
577 | char *buf; | 577 | char *buf; |
578 | char *fmt = "%s journal superblock"; | 578 | char *fmt = "%s journal superblock"; |
@@ -624,7 +624,7 @@ static void show_stats(ext2_filsys fs) | |||
624 | os, | 624 | os, |
625 | fs->blocksize, s->s_log_block_size, | 625 | fs->blocksize, s->s_log_block_size, |
626 | fs->fragsize, s->s_log_frag_size, | 626 | fs->fragsize, s->s_log_frag_size, |
627 | s->s_inodes_count, s->s_blocks_count, | 627 | s->s_inodes_count, s->s_blocks_count, |
628 | s->s_r_blocks_count, 100.0 * s->s_r_blocks_count / s->s_blocks_count, | 628 | s->s_r_blocks_count, 100.0 * s->s_r_blocks_count / s->s_blocks_count, |
629 | s->s_first_data_block); | 629 | s->s_first_data_block); |
630 | free(os); | 630 | free(os); |
@@ -679,7 +679,7 @@ static int set_os(struct ext2_super_block *sb, char *os) | |||
679 | if((sb->s_creator_os = e2p_string2os(os)) >= 0) { | 679 | if((sb->s_creator_os = e2p_string2os(os)) >= 0) { |
680 | return 1; | 680 | return 1; |
681 | } else if (!strcasecmp("GNU", os)) { | 681 | } else if (!strcasecmp("GNU", os)) { |
682 | sb->s_creator_os = EXT2_OS_HURD; | 682 | sb->s_creator_os = EXT2_OS_HURD; |
683 | return 1; | 683 | return 1; |
684 | } | 684 | } |
685 | return 0; | 685 | return 0; |
@@ -842,7 +842,7 @@ static int PRS(int argc, char *argv[]) | |||
842 | #endif | 842 | #endif |
843 | 843 | ||
844 | /* If called as mkfs.ext3, create a journal inode */ | 844 | /* If called as mkfs.ext3, create a journal inode */ |
845 | if (last_char_is(bb_applet_name, '3')) | 845 | if (last_char_is(bb_applet_name, '3')) |
846 | journal_size = -1; | 846 | journal_size = -1; |
847 | 847 | ||
848 | while ((c = getopt (argc, argv, | 848 | while ((c = getopt (argc, argv, |
@@ -886,8 +886,8 @@ BLOCKSIZE_ERROR: | |||
886 | } | 886 | } |
887 | break; | 887 | break; |
888 | case 'i': | 888 | case 'i': |
889 | if (safe_strtoi(optarg, &inode_ratio) | 889 | if (safe_strtoi(optarg, &inode_ratio) |
890 | || inode_ratio < EXT2_MIN_BLOCK_SIZE | 890 | || inode_ratio < EXT2_MIN_BLOCK_SIZE |
891 | || inode_ratio > EXT2_MAX_BLOCK_SIZE * 1024) { | 891 | || inode_ratio > EXT2_MAX_BLOCK_SIZE * 1024) { |
892 | bb_error_msg_and_die("bad inode ratio %s (min %d/max %d)", | 892 | bb_error_msg_and_die("bad inode ratio %s (min %d/max %d)", |
893 | optarg, EXT2_MIN_BLOCK_SIZE, | 893 | optarg, EXT2_MIN_BLOCK_SIZE, |
diff --git a/e2fsprogs/tune2fs.c b/e2fsprogs/tune2fs.c index f23688bc3..f228c56aa 100644 --- a/e2fsprogs/tune2fs.c +++ b/e2fsprogs/tune2fs.c | |||
@@ -163,7 +163,7 @@ no_valid_journal: | |||
163 | 163 | ||
164 | /* Helper function for remove_journal_inode */ | 164 | /* Helper function for remove_journal_inode */ |
165 | static int release_blocks_proc(ext2_filsys fs, blk_t *blocknr, | 165 | static int release_blocks_proc(ext2_filsys fs, blk_t *blocknr, |
166 | int blockcnt EXT2FS_ATTR((unused)), | 166 | int blockcnt EXT2FS_ATTR((unused)), |
167 | void *private EXT2FS_ATTR((unused))) | 167 | void *private EXT2FS_ATTR((unused))) |
168 | { | 168 | { |
169 | blk_t block; | 169 | blk_t block; |
@@ -187,9 +187,9 @@ static void remove_journal_inode(ext2_filsys fs) | |||
187 | ino_t ino = fs->super->s_journal_inum; | 187 | ino_t ino = fs->super->s_journal_inum; |
188 | char *msg = "to read"; | 188 | char *msg = "to read"; |
189 | char *s = "journal inode"; | 189 | char *s = "journal inode"; |
190 | 190 | ||
191 | retval = ext2fs_read_inode(fs, ino, &inode); | 191 | retval = ext2fs_read_inode(fs, ino, &inode); |
192 | if (retval) | 192 | if (retval) |
193 | goto REMOVE_JOURNAL_INODE_ERROR; | 193 | goto REMOVE_JOURNAL_INODE_ERROR; |
194 | if (ino == EXT2_JOURNAL_INO) { | 194 | if (ino == EXT2_JOURNAL_INO) { |
195 | retval = ext2fs_read_bitmaps(fs); | 195 | retval = ext2fs_read_bitmaps(fs); |
@@ -343,13 +343,13 @@ static void add_journal(ext2_filsys fs) | |||
343 | return; | 343 | return; |
344 | } | 344 | } |
345 | 345 | ||
346 | /* | 346 | /* |
347 | * Busybox stuff | 347 | * Busybox stuff |
348 | */ | 348 | */ |
349 | static char * x_blkid_get_devname(const char *token) | 349 | static char * x_blkid_get_devname(const char *token) |
350 | { | 350 | { |
351 | char * dev_name; | 351 | char * dev_name; |
352 | 352 | ||
353 | if (!(dev_name = blkid_get_devname(NULL, token, NULL))) | 353 | if (!(dev_name = blkid_get_devname(NULL, token, NULL))) |
354 | bb_error_msg_and_die("Unable to resolve '%s'", token); | 354 | bb_error_msg_and_die("Unable to resolve '%s'", token); |
355 | return dev_name; | 355 | return dev_name; |
@@ -368,11 +368,11 @@ static void parse_e2label_options(int argc, char ** argv) | |||
368 | open_flag = EXT2_FLAG_RW | EXT2_FLAG_JOURNAL_DEV_OK; | 368 | open_flag = EXT2_FLAG_RW | EXT2_FLAG_JOURNAL_DEV_OK; |
369 | L_flag = 1; | 369 | L_flag = 1; |
370 | new_label = argv[2]; | 370 | new_label = argv[2]; |
371 | } else | 371 | } else |
372 | print_label++; | 372 | print_label++; |
373 | } | 373 | } |
374 | #else | 374 | #else |
375 | #define parse_e2label_options(x,y) | 375 | #define parse_e2label_options(x,y) |
376 | #endif | 376 | #endif |
377 | 377 | ||
378 | static time_t parse_time(char *str) | 378 | static time_t parse_time(char *str) |
@@ -516,7 +516,7 @@ MOUNTS_COUNT_ERROR: | |||
516 | mntopts_cmd = optarg; | 516 | mntopts_cmd = optarg; |
517 | open_flag = EXT2_FLAG_RW; | 517 | open_flag = EXT2_FLAG_RW; |
518 | break; | 518 | break; |
519 | 519 | ||
520 | case 'O': | 520 | case 'O': |
521 | if (features_cmd) { | 521 | if (features_cmd) { |
522 | bb_error_msg_and_die("-O may only be specified once"); | 522 | bb_error_msg_and_die("-O may only be specified once"); |
@@ -594,7 +594,7 @@ int tune2fs_main(int argc, char **argv) | |||
594 | 594 | ||
595 | if (ENABLE_FEATURE_CLEAN_UP) | 595 | if (ENABLE_FEATURE_CLEAN_UP) |
596 | atexit(clean_up); | 596 | atexit(clean_up); |
597 | 597 | ||
598 | if (ENABLE_FINDFS && (bb_applet_name[0] == 'f')) /* findfs */ | 598 | if (ENABLE_FINDFS && (bb_applet_name[0] == 'f')) /* findfs */ |
599 | do_findfs(argc, argv); /* no return */ | 599 | do_findfs(argc, argv); /* no return */ |
600 | else if (ENABLE_E2LABEL && (bb_applet_name[0] == 'e')) /* e2label */ | 600 | else if (ENABLE_E2LABEL && (bb_applet_name[0] == 'e')) /* e2label */ |
@@ -603,7 +603,7 @@ int tune2fs_main(int argc, char **argv) | |||
603 | parse_tune2fs_options(argc, argv); /* tune2fs */ | 603 | parse_tune2fs_options(argc, argv); /* tune2fs */ |
604 | 604 | ||
605 | io_ptr = unix_io_manager; | 605 | io_ptr = unix_io_manager; |
606 | retval = ext2fs_open2(device_name, io_options, open_flag, | 606 | retval = ext2fs_open2(device_name, io_options, open_flag, |
607 | 0, 0, io_ptr, &fs); | 607 | 0, 0, io_ptr, &fs); |
608 | if (retval) | 608 | if (retval) |
609 | bb_error_msg_and_die("No valid superblock on %s", device_name); | 609 | bb_error_msg_and_die("No valid superblock on %s", device_name); |
diff --git a/e2fsprogs/util.c b/e2fsprogs/util.c index 7e9c09234..3902f7ef3 100644 --- a/e2fsprogs/util.c +++ b/e2fsprogs/util.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * util.c --- helper functions used by tune2fs and mke2fs | 2 | * util.c --- helper functions used by tune2fs and mke2fs |
3 | * | 3 | * |
4 | * Copyright 1995, 1996, 1997, 1998, 1999, 2000 by Theodore Ts'o. | 4 | * Copyright 1995, 1996, 1997, 1998, 1999, 2000 by Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -99,8 +99,8 @@ void check_mount(const char *device, int force, const char *type) | |||
99 | bb_error_msg_and_die("will not make a %s here!", type); | 99 | bb_error_msg_and_die("will not make a %s here!", type); |
100 | } | 100 | } |
101 | 101 | ||
102 | void parse_journal_opts(char **journal_device, int *journal_flags, | 102 | void parse_journal_opts(char **journal_device, int *journal_flags, |
103 | int *journal_size, const char *opts) | 103 | int *journal_size, const char *opts) |
104 | { | 104 | { |
105 | char *buf, *token, *next, *p, *arg; | 105 | char *buf, *token, *next, *p, *arg; |
106 | int journal_usage = 0; | 106 | int journal_usage = 0; |
@@ -118,7 +118,7 @@ void parse_journal_opts(char **journal_device, int *journal_flags, | |||
118 | if (p) { | 118 | if (p) { |
119 | *p = 0; | 119 | *p = 0; |
120 | next = p+1; | 120 | next = p+1; |
121 | } | 121 | } |
122 | arg = strchr(token, '='); | 122 | arg = strchr(token, '='); |
123 | if (arg) { | 123 | if (arg) { |
124 | *arg = 0; | 124 | *arg = 0; |
@@ -155,13 +155,13 @@ void parse_journal_opts(char **journal_device, int *journal_flags, | |||
155 | "\tdevice=<journal device>\n\n" | 155 | "\tdevice=<journal device>\n\n" |
156 | "The journal size must be between " | 156 | "The journal size must be between " |
157 | "1024 and 102400 filesystem blocks.\n\n"); | 157 | "1024 and 102400 filesystem blocks.\n\n"); |
158 | } | 158 | } |
159 | 159 | ||
160 | /* | 160 | /* |
161 | * Determine the number of journal blocks to use, either via | 161 | * Determine the number of journal blocks to use, either via |
162 | * user-specified # of megabytes, or via some intelligently selected | 162 | * user-specified # of megabytes, or via some intelligently selected |
163 | * defaults. | 163 | * defaults. |
164 | * | 164 | * |
165 | * Find a reasonable journal file size (in blocks) given the number of blocks | 165 | * Find a reasonable journal file size (in blocks) given the number of blocks |
166 | * in the filesystem. For very small filesystems, it is not reasonable to | 166 | * in the filesystem. For very small filesystems, it is not reasonable to |
167 | * have a journal that fills more than half of the filesystem. | 167 | * have a journal that fills more than half of the filesystem. |
@@ -214,8 +214,8 @@ void make_journal_device(char *journal_device, ext2_filsys fs, int quiet, int fo | |||
214 | io_manager io_ptr; | 214 | io_manager io_ptr; |
215 | 215 | ||
216 | check_plausibility(journal_device, force); | 216 | check_plausibility(journal_device, force); |
217 | check_mount(journal_device, force, "journal"); | 217 | check_mount(journal_device, force, "journal"); |
218 | io_ptr = unix_io_manager; | 218 | io_ptr = unix_io_manager; |
219 | retval = ext2fs_open(journal_device, EXT2_FLAG_RW| | 219 | retval = ext2fs_open(journal_device, EXT2_FLAG_RW| |
220 | EXT2_FLAG_JOURNAL_DEV_OK, 0, | 220 | EXT2_FLAG_JOURNAL_DEV_OK, 0, |
221 | fs->blocksize, io_ptr, &jfs); | 221 | fs->blocksize, io_ptr, &jfs); |
@@ -236,7 +236,7 @@ void make_journal_blocks(ext2_filsys fs, int journal_size, int journal_flags, in | |||
236 | { | 236 | { |
237 | unsigned long journal_blocks; | 237 | unsigned long journal_blocks; |
238 | errcode_t retval; | 238 | errcode_t retval; |
239 | 239 | ||
240 | journal_blocks = figure_journal_size(journal_size, fs); | 240 | journal_blocks = figure_journal_size(journal_size, fs); |
241 | if (!journal_blocks) { | 241 | if (!journal_blocks) { |
242 | fs->super->s_feature_compat &= | 242 | fs->super->s_feature_compat &= |
@@ -259,9 +259,9 @@ char *e2fs_set_sbin_path(void) | |||
259 | char *oldpath = getenv("PATH"); | 259 | char *oldpath = getenv("PATH"); |
260 | /* Update our PATH to include /sbin */ | 260 | /* Update our PATH to include /sbin */ |
261 | #define PATH_SET "/sbin" | 261 | #define PATH_SET "/sbin" |
262 | if (oldpath) | 262 | if (oldpath) |
263 | oldpath = bb_xasprintf("%s:%s", PATH_SET, oldpath); | 263 | oldpath = bb_xasprintf("%s:%s", PATH_SET, oldpath); |
264 | else | 264 | else |
265 | oldpath = PATH_SET; | 265 | oldpath = PATH_SET; |
266 | putenv (oldpath); | 266 | putenv (oldpath); |
267 | return oldpath; | 267 | return oldpath; |
diff --git a/e2fsprogs/util.h b/e2fsprogs/util.h index 24d5e6545..5041046c7 100644 --- a/e2fsprogs/util.h +++ b/e2fsprogs/util.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * util.h --- header file defining prototypes for helper functions | 2 | * util.h --- header file defining prototypes for helper functions |
3 | * used by tune2fs and mke2fs | 3 | * used by tune2fs and mke2fs |
4 | * | 4 | * |
5 | * Copyright 2000 by Theodore Ts'o. | 5 | * Copyright 2000 by Theodore Ts'o. |
6 | * | 6 | * |
7 | * %Begin-Header% | 7 | * %Begin-Header% |
diff --git a/e2fsprogs/uuid/compare.c b/e2fsprogs/uuid/compare.c index 83afeafbf..94c32b1d3 100644 --- a/e2fsprogs/uuid/compare.c +++ b/e2fsprogs/uuid/compare.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * compare.c --- compare whether or not two UUID's are the same | 2 | * compare.c --- compare whether or not two UUID's are the same |
3 | * | 3 | * |
4 | * Returns 0 if the two UUID's are different, and 1 if they are the same. | 4 | * Returns 0 if the two UUID's are different, and 1 if they are the same. |
5 | * | 5 | * |
6 | * Copyright (C) 1996, 1997 Theodore Ts'o. | 6 | * Copyright (C) 1996, 1997 Theodore Ts'o. |
7 | * | 7 | * |
8 | * %Begin-Header% | 8 | * %Begin-Header% |
@@ -18,7 +18,7 @@ | |||
18 | * 3. The name of the author may not be used to endorse or promote | 18 | * 3. The name of the author may not be used to endorse or promote |
19 | * products derived from this software without specific prior | 19 | * products derived from this software without specific prior |
20 | * written permission. | 20 | * written permission. |
21 | * | 21 | * |
22 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | 22 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED |
23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF | 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF |
diff --git a/e2fsprogs/uuid/gen_uuid.c b/e2fsprogs/uuid/gen_uuid.c index 52328cfc4..fca3ebe91 100644 --- a/e2fsprogs/uuid/gen_uuid.c +++ b/e2fsprogs/uuid/gen_uuid.c | |||
@@ -16,7 +16,7 @@ | |||
16 | * 3. The name of the author may not be used to endorse or promote | 16 | * 3. The name of the author may not be used to endorse or promote |
17 | * products derived from this software without specific prior | 17 | * products derived from this software without specific prior |
18 | * written permission. | 18 | * written permission. |
19 | * | 19 | * |
20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | 20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED |
21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF | 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF |
@@ -63,8 +63,8 @@ | |||
63 | #include "uuidP.h" | 63 | #include "uuidP.h" |
64 | 64 | ||
65 | #ifdef HAVE_SRANDOM | 65 | #ifdef HAVE_SRANDOM |
66 | #define srand(x) srandom(x) | 66 | #define srand(x) srandom(x) |
67 | #define rand() random() | 67 | #define rand() random() |
68 | #endif | 68 | #endif |
69 | 69 | ||
70 | static int get_random_fd(void) | 70 | static int get_random_fd(void) |
@@ -111,7 +111,7 @@ static void get_random_bytes(void *buf, int nbytes) | |||
111 | lose_counter = 0; | 111 | lose_counter = 0; |
112 | } | 112 | } |
113 | } | 113 | } |
114 | 114 | ||
115 | /* | 115 | /* |
116 | * We do this all the time, but this is the only source of | 116 | * We do this all the time, but this is the only source of |
117 | * randomness if /dev/random/urandom is out to lunch. | 117 | * randomness if /dev/random/urandom is out to lunch. |
@@ -127,12 +127,12 @@ static void get_random_bytes(void *buf, int nbytes) | |||
127 | static int get_node_id(unsigned char *node_id) | 127 | static int get_node_id(unsigned char *node_id) |
128 | { | 128 | { |
129 | #ifdef HAVE_NET_IF_H | 129 | #ifdef HAVE_NET_IF_H |
130 | int sd; | 130 | int sd; |
131 | struct ifreq ifr, *ifrp; | 131 | struct ifreq ifr, *ifrp; |
132 | struct ifconf ifc; | 132 | struct ifconf ifc; |
133 | char buf[1024]; | 133 | char buf[1024]; |
134 | int n, i; | 134 | int n, i; |
135 | unsigned char *a; | 135 | unsigned char *a; |
136 | #ifdef HAVE_NET_IF_DL_H | 136 | #ifdef HAVE_NET_IF_DL_H |
137 | struct sockaddr_dl *sdlp; | 137 | struct sockaddr_dl *sdlp; |
138 | #endif | 138 | #endif |
@@ -140,7 +140,7 @@ static int get_node_id(unsigned char *node_id) | |||
140 | /* | 140 | /* |
141 | * BSD 4.4 defines the size of an ifreq to be | 141 | * BSD 4.4 defines the size of an ifreq to be |
142 | * max(sizeof(ifreq), sizeof(ifreq.ifr_name)+ifreq.ifr_addr.sa_len | 142 | * max(sizeof(ifreq), sizeof(ifreq.ifr_name)+ifreq.ifr_addr.sa_len |
143 | * However, under earlier systems, sa_len isn't present, so the size is | 143 | * However, under earlier systems, sa_len isn't present, so the size is |
144 | * just sizeof(struct ifreq) | 144 | * just sizeof(struct ifreq) |
145 | */ | 145 | */ |
146 | #ifdef HAVE_SA_LEN | 146 | #ifdef HAVE_SA_LEN |
@@ -214,9 +214,9 @@ static int get_clock(uint32_t *clock_high, uint32_t *clock_low, uint16_t *ret_cl | |||
214 | static int adjustment = 0; | 214 | static int adjustment = 0; |
215 | static struct timeval last = {0, 0}; | 215 | static struct timeval last = {0, 0}; |
216 | static uint16_t clock_seq; | 216 | static uint16_t clock_seq; |
217 | struct timeval tv; | 217 | struct timeval tv; |
218 | unsigned long long clock_reg; | 218 | unsigned long long clock_reg; |
219 | 219 | ||
220 | try_again: | 220 | try_again: |
221 | gettimeofday(&tv, 0); | 221 | gettimeofday(&tv, 0); |
222 | if ((last.tv_sec == 0) && (last.tv_usec == 0)) { | 222 | if ((last.tv_sec == 0) && (last.tv_usec == 0)) { |
@@ -240,7 +240,7 @@ try_again: | |||
240 | adjustment = 0; | 240 | adjustment = 0; |
241 | last = tv; | 241 | last = tv; |
242 | } | 242 | } |
243 | 243 | ||
244 | clock_reg = tv.tv_usec*10 + adjustment; | 244 | clock_reg = tv.tv_usec*10 + adjustment; |
245 | clock_reg += ((unsigned long long) tv.tv_sec)*10000000; | 245 | clock_reg += ((unsigned long long) tv.tv_sec)*10000000; |
246 | clock_reg += (((unsigned long long) 0x01B21DD2) << 32) + 0x13814000; | 246 | clock_reg += (((unsigned long long) 0x01B21DD2) << 32) + 0x13814000; |
diff --git a/e2fsprogs/uuid/pack.c b/e2fsprogs/uuid/pack.c index 1013886e5..9d733f000 100644 --- a/e2fsprogs/uuid/pack.c +++ b/e2fsprogs/uuid/pack.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Internal routine for packing UUID's | 2 | * Internal routine for packing UUID's |
3 | * | 3 | * |
4 | * Copyright (C) 1996, 1997 Theodore Ts'o. | 4 | * Copyright (C) 1996, 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -16,7 +16,7 @@ | |||
16 | * 3. The name of the author may not be used to endorse or promote | 16 | * 3. The name of the author may not be used to endorse or promote |
17 | * products derived from this software without specific prior | 17 | * products derived from this software without specific prior |
18 | * written permission. | 18 | * written permission. |
19 | * | 19 | * |
20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | 20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED |
21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF | 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF |
diff --git a/e2fsprogs/uuid/parse.c b/e2fsprogs/uuid/parse.c index 07b894d11..21b29498e 100644 --- a/e2fsprogs/uuid/parse.c +++ b/e2fsprogs/uuid/parse.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * parse.c --- UUID parsing | 2 | * parse.c --- UUID parsing |
3 | * | 3 | * |
4 | * Copyright (C) 1996, 1997 Theodore Ts'o. | 4 | * Copyright (C) 1996, 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -16,7 +16,7 @@ | |||
16 | * 3. The name of the author may not be used to endorse or promote | 16 | * 3. The name of the author may not be used to endorse or promote |
17 | * products derived from this software without specific prior | 17 | * products derived from this software without specific prior |
18 | * written permission. | 18 | * written permission. |
19 | * | 19 | * |
20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | 20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED |
21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF | 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF |
@@ -42,7 +42,7 @@ | |||
42 | int uuid_parse(const char *in, uuid_t uu) | 42 | int uuid_parse(const char *in, uuid_t uu) |
43 | { | 43 | { |
44 | struct uuid uuid; | 44 | struct uuid uuid; |
45 | int i; | 45 | int i; |
46 | const char *cp; | 46 | const char *cp; |
47 | char buf[3]; | 47 | char buf[3]; |
48 | 48 | ||
@@ -73,7 +73,7 @@ int uuid_parse(const char *in, uuid_t uu) | |||
73 | buf[1] = *cp++; | 73 | buf[1] = *cp++; |
74 | uuid.node[i] = strtoul(buf, NULL, 16); | 74 | uuid.node[i] = strtoul(buf, NULL, 16); |
75 | } | 75 | } |
76 | 76 | ||
77 | uuid_pack(&uuid, uu); | 77 | uuid_pack(&uuid, uu); |
78 | return 0; | 78 | return 0; |
79 | } | 79 | } |
diff --git a/e2fsprogs/uuid/unpack.c b/e2fsprogs/uuid/unpack.c index d63589521..8f9c520c1 100644 --- a/e2fsprogs/uuid/unpack.c +++ b/e2fsprogs/uuid/unpack.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Internal routine for unpacking UUID | 2 | * Internal routine for unpacking UUID |
3 | * | 3 | * |
4 | * Copyright (C) 1996, 1997 Theodore Ts'o. | 4 | * Copyright (C) 1996, 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -16,7 +16,7 @@ | |||
16 | * 3. The name of the author may not be used to endorse or promote | 16 | * 3. The name of the author may not be used to endorse or promote |
17 | * products derived from this software without specific prior | 17 | * products derived from this software without specific prior |
18 | * written permission. | 18 | * written permission. |
19 | * | 19 | * |
20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | 20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED |
21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF | 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF |
diff --git a/e2fsprogs/uuid/unparse.c b/e2fsprogs/uuid/unparse.c index c0e08ef49..a95bbb042 100644 --- a/e2fsprogs/uuid/unparse.c +++ b/e2fsprogs/uuid/unparse.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * unparse.c -- convert a UUID to string | 2 | * unparse.c -- convert a UUID to string |
3 | * | 3 | * |
4 | * Copyright (C) 1996, 1997 Theodore Ts'o. | 4 | * Copyright (C) 1996, 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -16,7 +16,7 @@ | |||
16 | * 3. The name of the author may not be used to endorse or promote | 16 | * 3. The name of the author may not be used to endorse or promote |
17 | * products derived from this software without specific prior | 17 | * products derived from this software without specific prior |
18 | * written permission. | 18 | * written permission. |
19 | * | 19 | * |
20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | 20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED |
21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF | 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF |
@@ -36,10 +36,10 @@ | |||
36 | 36 | ||
37 | #include "uuidP.h" | 37 | #include "uuidP.h" |
38 | 38 | ||
39 | static const char *fmt_lower = | 39 | static const char *fmt_lower = |
40 | "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x"; | 40 | "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x"; |
41 | 41 | ||
42 | static const char *fmt_upper = | 42 | static const char *fmt_upper = |
43 | "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X"; | 43 | "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X"; |
44 | 44 | ||
45 | #ifdef UUID_UNPARSE_DEFAULT_UPPER | 45 | #ifdef UUID_UNPARSE_DEFAULT_UPPER |
diff --git a/e2fsprogs/uuid/uuid.h b/e2fsprogs/uuid/uuid.h index a05f1c690..cd97a5e78 100644 --- a/e2fsprogs/uuid/uuid.h +++ b/e2fsprogs/uuid/uuid.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Public include file for the UUID library | 2 | * Public include file for the UUID library |
3 | * | 3 | * |
4 | * Copyright (C) 1996, 1997, 1998 Theodore Ts'o. | 4 | * Copyright (C) 1996, 1997, 1998 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -16,7 +16,7 @@ | |||
16 | * 3. The name of the author may not be used to endorse or promote | 16 | * 3. The name of the author may not be used to endorse or promote |
17 | * products derived from this software without specific prior | 17 | * products derived from this software without specific prior |
18 | * written permission. | 18 | * written permission. |
19 | * | 19 | * |
20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | 20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED |
21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF | 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF |
@@ -42,8 +42,8 @@ | |||
42 | typedef unsigned char uuid_t[16]; | 42 | typedef unsigned char uuid_t[16]; |
43 | 43 | ||
44 | /* UUID Variant definitions */ | 44 | /* UUID Variant definitions */ |
45 | #define UUID_VARIANT_NCS 0 | 45 | #define UUID_VARIANT_NCS 0 |
46 | #define UUID_VARIANT_DCE 1 | 46 | #define UUID_VARIANT_DCE 1 |
47 | #define UUID_VARIANT_MICROSOFT 2 | 47 | #define UUID_VARIANT_MICROSOFT 2 |
48 | #define UUID_VARIANT_OTHER 3 | 48 | #define UUID_VARIANT_OTHER 3 |
49 | 49 | ||
diff --git a/e2fsprogs/uuid/uuidP.h b/e2fsprogs/uuid/uuidP.h index d2e1a450a..9d30ce2f8 100644 --- a/e2fsprogs/uuid/uuidP.h +++ b/e2fsprogs/uuid/uuidP.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * uuid.h -- private header file for uuids | 2 | * uuid.h -- private header file for uuids |
3 | * | 3 | * |
4 | * Copyright (C) 1996, 1997 Theodore Ts'o. | 4 | * Copyright (C) 1996, 1997 Theodore Ts'o. |
5 | * | 5 | * |
6 | * %Begin-Header% | 6 | * %Begin-Header% |
@@ -16,7 +16,7 @@ | |||
16 | * 3. The name of the author may not be used to endorse or promote | 16 | * 3. The name of the author may not be used to endorse or promote |
17 | * products derived from this software without specific prior | 17 | * products derived from this software without specific prior |
18 | * written permission. | 18 | * written permission. |
19 | * | 19 | * |
20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | 20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED |
21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF | 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF |
diff --git a/e2fsprogs/uuid/uuid_time.c b/e2fsprogs/uuid/uuid_time.c index d5f992b39..9ff3607d8 100644 --- a/e2fsprogs/uuid/uuid_time.c +++ b/e2fsprogs/uuid/uuid_time.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * uuid_time.c --- Interpret the time field from a uuid. This program | 2 | * uuid_time.c --- Interpret the time field from a uuid. This program |
3 | * violates the UUID abstraction barrier by reaching into the guts | 3 | * violates the UUID abstraction barrier by reaching into the guts |
4 | * of a UUID and interpreting it. | 4 | * of a UUID and interpreting it. |
5 | * | 5 | * |
6 | * Copyright (C) 1998, 1999 Theodore Ts'o. | 6 | * Copyright (C) 1998, 1999 Theodore Ts'o. |
7 | * | 7 | * |
8 | * %Begin-Header% | 8 | * %Begin-Header% |
@@ -18,7 +18,7 @@ | |||
18 | * 3. The name of the author may not be used to endorse or promote | 18 | * 3. The name of the author may not be used to endorse or promote |
19 | * products derived from this software without specific prior | 19 | * products derived from this software without specific prior |
20 | * written permission. | 20 | * written permission. |
21 | * | 21 | * |
22 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | 22 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED |
23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF | 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF |
@@ -51,7 +51,7 @@ time_t uuid_time(const uuid_t uu, struct timeval *ret_tv) | |||
51 | unsigned long long clock_reg; | 51 | unsigned long long clock_reg; |
52 | 52 | ||
53 | uuid_unpack(uu, &uuid); | 53 | uuid_unpack(uu, &uuid); |
54 | 54 | ||
55 | high = uuid.time_mid | ((uuid.time_hi_and_version & 0xFFF) << 16); | 55 | high = uuid.time_mid | ((uuid.time_hi_and_version & 0xFFF) << 16); |
56 | clock_reg = uuid.time_low | ((unsigned long long) high << 32); | 56 | clock_reg = uuid.time_low | ((unsigned long long) high << 32); |
57 | 57 | ||
@@ -69,7 +69,7 @@ int uuid_type(const uuid_t uu) | |||
69 | { | 69 | { |
70 | struct uuid uuid; | 70 | struct uuid uuid; |
71 | 71 | ||
72 | uuid_unpack(uu, &uuid); | 72 | uuid_unpack(uu, &uuid); |
73 | return ((uuid.time_hi_and_version >> 12) & 0xF); | 73 | return ((uuid.time_hi_and_version >> 12) & 0xF); |
74 | } | 74 | } |
75 | 75 | ||
@@ -78,7 +78,7 @@ int uuid_variant(const uuid_t uu) | |||
78 | struct uuid uuid; | 78 | struct uuid uuid; |
79 | int var; | 79 | int var; |
80 | 80 | ||
81 | uuid_unpack(uu, &uuid); | 81 | uuid_unpack(uu, &uuid); |
82 | var = uuid.clock_seq; | 82 | var = uuid.clock_seq; |
83 | 83 | ||
84 | if ((var & 0x8000) == 0) | 84 | if ((var & 0x8000) == 0) |
@@ -105,7 +105,7 @@ static const char *variant_string(int variant) | |||
105 | } | 105 | } |
106 | } | 106 | } |
107 | 107 | ||
108 | 108 | ||
109 | int | 109 | int |
110 | main(int argc, char **argv) | 110 | main(int argc, char **argv) |
111 | { | 111 | { |
@@ -155,7 +155,7 @@ main(int argc, char **argv) | |||
155 | } | 155 | } |
156 | printf("UUID time is: (%ld, %ld): %s\n", tv.tv_sec, tv.tv_usec, | 156 | printf("UUID time is: (%ld, %ld): %s\n", tv.tv_sec, tv.tv_usec, |
157 | ctime(&time_reg)); | 157 | ctime(&time_reg)); |
158 | 158 | ||
159 | return 0; | 159 | return 0; |
160 | } | 160 | } |
161 | #endif | 161 | #endif |
diff --git a/editors/sed.c b/editors/sed.c index 2f6fc174c..dcc2ca06b 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -1191,7 +1191,7 @@ extern int sed_main(int argc, char **argv) | |||
1191 | if(in_place) { | 1191 | if(in_place) { |
1192 | struct stat statbuf; | 1192 | struct stat statbuf; |
1193 | int nonstdoutfd; | 1193 | int nonstdoutfd; |
1194 | 1194 | ||
1195 | outname=bb_xstrndup(argv[i],strlen(argv[i])+6); | 1195 | outname=bb_xstrndup(argv[i],strlen(argv[i])+6); |
1196 | strcat(outname,"XXXXXX"); | 1196 | strcat(outname,"XXXXXX"); |
1197 | if(-1==(nonstdoutfd=mkstemp(outname))) | 1197 | if(-1==(nonstdoutfd=mkstemp(outname))) |
diff --git a/editors/vi.c b/editors/vi.c index 6689e290b..fddd0a9ea 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -1673,13 +1673,13 @@ static Byte find_range(Byte ** start, Byte ** stop, Byte c) | |||
1673 | q = dot; | 1673 | q = dot; |
1674 | } else if (strchr("wW", c)) { | 1674 | } else if (strchr("wW", c)) { |
1675 | do_cmd(c); // execute movement cmd | 1675 | do_cmd(c); // execute movement cmd |
1676 | // if we are at the next word's first char | 1676 | // if we are at the next word's first char |
1677 | // step back one char | 1677 | // step back one char |
1678 | // but check the possibilities when it is true | 1678 | // but check the possibilities when it is true |
1679 | if (dot > text && ((isspace(dot[-1]) && !isspace(dot[0])) | 1679 | if (dot > text && ((isspace(dot[-1]) && !isspace(dot[0])) |
1680 | || (ispunct(dot[-1]) && !ispunct(dot[0])) | 1680 | || (ispunct(dot[-1]) && !ispunct(dot[0])) |
1681 | || (isalnum(dot[-1]) && !isalnum(dot[0])))) | 1681 | || (isalnum(dot[-1]) && !isalnum(dot[0])))) |
1682 | dot--; // move back off of next word | 1682 | dot--; // move back off of next word |
1683 | if (dot > text && *dot == '\n') | 1683 | if (dot > text && *dot == '\n') |
1684 | dot--; // stay off NL | 1684 | dot--; // stay off NL |
1685 | q = dot; | 1685 | q = dot; |
@@ -2405,7 +2405,7 @@ static Byte *get_input_line(Byte * prompt) // get input line- use "status line" | |||
2405 | if (c == '\n' || c == '\r' || c == 27) | 2405 | if (c == '\n' || c == '\r' || c == 27) |
2406 | break; // is this end of input | 2406 | break; // is this end of input |
2407 | if (c == erase_char || c == 8 || c == 127) { | 2407 | if (c == erase_char || c == 8 || c == 127) { |
2408 | // user wants to erase prev char | 2408 | // user wants to erase prev char |
2409 | i--; // backup to prev char | 2409 | i--; // backup to prev char |
2410 | buf[i] = '\0'; // erase the char | 2410 | buf[i] = '\0'; // erase the char |
2411 | buf[i + 1] = '\0'; // null terminate buffer | 2411 | buf[i + 1] = '\0'; // null terminate buffer |
@@ -3754,11 +3754,11 @@ key_cmd_mode: | |||
3754 | end_cmd_q(); // stop adding to q | 3754 | end_cmd_q(); // stop adding to q |
3755 | break; | 3755 | break; |
3756 | case 't': // t- move to char prior to next x | 3756 | case 't': // t- move to char prior to next x |
3757 | last_forward_char = get_one_char(); | 3757 | last_forward_char = get_one_char(); |
3758 | do_cmd(';'); | 3758 | do_cmd(';'); |
3759 | if (*dot == last_forward_char) | 3759 | if (*dot == last_forward_char) |
3760 | dot_left(); | 3760 | dot_left(); |
3761 | last_forward_char= 0; | 3761 | last_forward_char= 0; |
3762 | break; | 3762 | break; |
3763 | case 'w': // w- forward a word | 3763 | case 'w': // w- forward a word |
3764 | if (cmdcnt-- > 1) { | 3764 | if (cmdcnt-- > 1) { |
@@ -4047,4 +4047,4 @@ static void crash_test() | |||
4047 | } | 4047 | } |
4048 | return; | 4048 | return; |
4049 | } | 4049 | } |
4050 | #endif /* CONFIG_FEATURE_VI_CRASHME */ | 4050 | #endif /* CONFIG_FEATURE_VI_CRASHME */ |
diff --git a/findutils/find.c b/findutils/find.c index 603c20643..0f2f2144c 100644 --- a/findutils/find.c +++ b/findutils/find.c | |||
@@ -164,7 +164,7 @@ static int fileAction(const char *fileName, struct stat *statbuf, void* junk) | |||
164 | goto no_match; | 164 | goto no_match; |
165 | } | 165 | } |
166 | #endif | 166 | #endif |
167 | 167 | ||
168 | puts(fileName); | 168 | puts(fileName); |
169 | no_match: | 169 | no_match: |
170 | return (TRUE); | 170 | return (TRUE); |
@@ -317,7 +317,7 @@ int find_main(int argc, char **argv) | |||
317 | break; | 317 | break; |
318 | cmd_string = bb_xasprintf("%s %s", cmd_string, argv[i]); | 318 | cmd_string = bb_xasprintf("%s %s", cmd_string, argv[i]); |
319 | } | 319 | } |
320 | 320 | ||
321 | if (*cmd_string == 0) | 321 | if (*cmd_string == 0) |
322 | bb_error_msg_and_die(msg_req_arg, "-exec"); | 322 | bb_error_msg_and_die(msg_req_arg, "-exec"); |
323 | cmd_string++; | 323 | cmd_string++; |
diff --git a/include/usage.h b/include/usage.h index 99257329c..bff187a3d 100644 --- a/include/usage.h +++ b/include/usage.h | |||
@@ -873,7 +873,7 @@ | |||
873 | "\t-s Don't print or kill anything.\n" \ | 873 | "\t-s Don't print or kill anything.\n" \ |
874 | "\t-4 When using port/proto only search IPv4 space\n" \ | 874 | "\t-4 When using port/proto only search IPv4 space\n" \ |
875 | "\t-6 When using port/proto only search IPv6 space\n" \ | 875 | "\t-6 When using port/proto only search IPv6 space\n" \ |
876 | "\t-SIGNAL When used with -k, this signal will be used to kill\n" | 876 | "\t-SIGNAL When used with -k, this signal will be used to kill\n" |
877 | #define getopt_trivial_usage \ | 877 | #define getopt_trivial_usage \ |
878 | "[OPTIONS]..." | 878 | "[OPTIONS]..." |
879 | #define getopt_full_usage \ | 879 | #define getopt_full_usage \ |
@@ -1873,8 +1873,8 @@ | |||
1873 | #ifdef CONFIG_FEATURE_MDEV_CONFIG | 1873 | #ifdef CONFIG_FEATURE_MDEV_CONFIG |
1874 | #define mdev_notes_usage \ | 1874 | #define mdev_notes_usage \ |
1875 | "The mdev config file contains lines that look like:\n" \ | 1875 | "The mdev config file contains lines that look like:\n" \ |
1876 | " hd[a-z][0-9]* 0:3 660\n\n" \ | 1876 | " hd[a-z][0-9]* 0:3 660\n\n" \ |
1877 | "That's device name (with regex match), uid:gid, and permissions.\n\n" \ | 1877 | "That's device name (with regex match), uid:gid, and permissions.\n\n" \ |
1878 | "Optionally, that can be followed (on the same line) by an asterisk\n" \ | 1878 | "Optionally, that can be followed (on the same line) by an asterisk\n" \ |
1879 | "and a command line to run after creating the corresponding device(s),\n"\ | 1879 | "and a command line to run after creating the corresponding device(s),\n"\ |
1880 | "ala:\n\n" \ | 1880 | "ala:\n\n" \ |
diff --git a/init/init.c b/init/init.c index dcc8bd9ce..337d31c2d 100644 --- a/init/init.c +++ b/init/init.c | |||
@@ -462,7 +462,7 @@ static pid_t run(const struct init_action *a) | |||
462 | break; | 462 | break; |
463 | } | 463 | } |
464 | /* FIXME handle other errors */ | 464 | /* FIXME handle other errors */ |
465 | } | 465 | } |
466 | 466 | ||
467 | /* See if stealing the controlling tty back is necessary */ | 467 | /* See if stealing the controlling tty back is necessary */ |
468 | pgrp = tcgetpgrp(0); | 468 | pgrp = tcgetpgrp(0); |
diff --git a/libbb/compare_string_array.c b/libbb/compare_string_array.c index fc077b309..e4191e35a 100644 --- a/libbb/compare_string_array.c +++ b/libbb/compare_string_array.c | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <string.h> | 17 | #include <string.h> |
18 | 18 | ||
19 | /* returns the array number of the string */ | 19 | /* returns the array number of the string */ |
20 | extern int | 20 | extern int |
21 | compare_string_array(const char * const string_array[], const char *key) | 21 | compare_string_array(const char * const string_array[], const char *key) |
22 | { | 22 | { |
23 | int i; | 23 | int i; |
diff --git a/libbb/copy_file.c b/libbb/copy_file.c index 991fa8f5b..0763b4586 100644 --- a/libbb/copy_file.c +++ b/libbb/copy_file.c | |||
@@ -119,7 +119,7 @@ int copy_file(const char *source, const char *dest, int flags) | |||
119 | status = -1; | 119 | status = -1; |
120 | } | 120 | } |
121 | } else if (S_ISREG(source_stat.st_mode) || (flags & FILEUTILS_DEREFERENCE)) | 121 | } else if (S_ISREG(source_stat.st_mode) || (flags & FILEUTILS_DEREFERENCE)) |
122 | { | 122 | { |
123 | int src_fd; | 123 | int src_fd; |
124 | int dst_fd; | 124 | int dst_fd; |
125 | #ifdef CONFIG_FEATURE_PRESERVE_HARDLINKS | 125 | #ifdef CONFIG_FEATURE_PRESERVE_HARDLINKS |
diff --git a/libbb/copyfd.c b/libbb/copyfd.c index 0b850884b..fcae8d3f7 100644 --- a/libbb/copyfd.c +++ b/libbb/copyfd.c | |||
@@ -32,7 +32,7 @@ static ssize_t bb_full_fd_action(int src_fd, int dst_fd, size_t size) | |||
32 | while (!size || total < size) | 32 | while (!size || total < size) |
33 | { | 33 | { |
34 | ssize_t wrote, xread; | 34 | ssize_t wrote, xread; |
35 | 35 | ||
36 | xread = safe_read(src_fd, buffer, | 36 | xread = safe_read(src_fd, buffer, |
37 | (!size || size - total > BUFSIZ) ? BUFSIZ : size - total); | 37 | (!size || size - total > BUFSIZ) ? BUFSIZ : size - total); |
38 | 38 | ||
@@ -53,7 +53,7 @@ static ssize_t bb_full_fd_action(int src_fd, int dst_fd, size_t size) | |||
53 | break; | 53 | break; |
54 | } | 54 | } |
55 | } | 55 | } |
56 | 56 | ||
57 | out: | 57 | out: |
58 | RELEASE_CONFIG_BUFFER(buffer); | 58 | RELEASE_CONFIG_BUFFER(buffer); |
59 | 59 | ||
diff --git a/libbb/correct_password.c b/libbb/correct_password.c index 039379ae1..bb9e7d3cc 100644 --- a/libbb/correct_password.c +++ b/libbb/correct_password.c | |||
@@ -61,7 +61,7 @@ int correct_password ( const struct passwd *pw ) | |||
61 | } | 61 | } |
62 | else | 62 | else |
63 | #endif | 63 | #endif |
64 | correct = pw-> pw_passwd; | 64 | correct = pw-> pw_passwd; |
65 | 65 | ||
66 | if ( correct == 0 || correct[0] == '\0' ) | 66 | if ( correct == 0 || correct[0] == '\0' ) |
67 | return 1; | 67 | return 1; |
diff --git a/libbb/dump.c b/libbb/dump.c index 98f004ff6..7d923083a 100644 --- a/libbb/dump.c +++ b/libbb/dump.c | |||
@@ -695,7 +695,7 @@ void bb_dump_add(const char *fmt) | |||
695 | 695 | ||
696 | /* start new linked list of format units */ | 696 | /* start new linked list of format units */ |
697 | /* NOSTRICT */ | 697 | /* NOSTRICT */ |
698 | tfs = (FS *) xcalloc(1,sizeof(FS)); /*DBU:[dave@cray.com] start out NULL */ | 698 | tfs = (FS *) xcalloc(1,sizeof(FS)); /*DBU:[dave@cray.com] start out NULL */ |
699 | if (!bb_dump_fshead) { | 699 | if (!bb_dump_fshead) { |
700 | bb_dump_fshead = tfs; | 700 | bb_dump_fshead = tfs; |
701 | } else { | 701 | } else { |
diff --git a/libbb/hash_fd.c b/libbb/hash_fd.c index 3445a25a0..39825b378 100644 --- a/libbb/hash_fd.c +++ b/libbb/hash_fd.c | |||
@@ -212,7 +212,7 @@ static void sha1_end(unsigned char hval[], struct sha1_ctx_t *ctx) | |||
212 | ctx->wbuf[cnt++] = 0; | 212 | ctx->wbuf[cnt++] = 0; |
213 | 213 | ||
214 | /* assemble the eight byte counter in the buffer in big-endian */ | 214 | /* assemble the eight byte counter in the buffer in big-endian */ |
215 | /* format */ | 215 | /* format */ |
216 | 216 | ||
217 | ctx->wbuf[14] = swap_b32((ctx->count[1] << 3) | (ctx->count[0] >> 29)); | 217 | ctx->wbuf[14] = swap_b32((ctx->count[1] << 3) | (ctx->count[0] >> 29)); |
218 | ctx->wbuf[15] = swap_b32(ctx->count[0] << 3); | 218 | ctx->wbuf[15] = swap_b32(ctx->count[0] << 3); |
@@ -492,12 +492,12 @@ static void md5_hash_block(const void *buffer, size_t len, struct md5_ctx_t *ctx | |||
492 | 492 | ||
493 | # define OP(a, b, c, d, s, T) \ | 493 | # define OP(a, b, c, d, s, T) \ |
494 | do \ | 494 | do \ |
495 | { \ | 495 | { \ |
496 | a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \ | 496 | a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \ |
497 | ++words; \ | 497 | ++words; \ |
498 | CYCLIC (a, s); \ | 498 | CYCLIC (a, s); \ |
499 | a += b; \ | 499 | a += b; \ |
500 | } \ | 500 | } \ |
501 | while (0) | 501 | while (0) |
502 | 502 | ||
503 | /* It is unfortunate that C does not provide an operator for | 503 | /* It is unfortunate that C does not provide an operator for |
diff --git a/libbb/inet_common.c b/libbb/inet_common.c index 321322d1f..3ff819742 100644 --- a/libbb/inet_common.c +++ b/libbb/inet_common.c | |||
@@ -206,8 +206,8 @@ int INET6_resolve(const char *name, struct sockaddr_in6 *sin6) | |||
206 | 206 | ||
207 | #ifndef IN6_IS_ADDR_UNSPECIFIED | 207 | #ifndef IN6_IS_ADDR_UNSPECIFIED |
208 | # define IN6_IS_ADDR_UNSPECIFIED(a) \ | 208 | # define IN6_IS_ADDR_UNSPECIFIED(a) \ |
209 | (((__u32 *) (a))[0] == 0 && ((__u32 *) (a))[1] == 0 && \ | 209 | (((__u32 *) (a))[0] == 0 && ((__u32 *) (a))[1] == 0 && \ |
210 | ((__u32 *) (a))[2] == 0 && ((__u32 *) (a))[3] == 0) | 210 | ((__u32 *) (a))[2] == 0 && ((__u32 *) (a))[3] == 0) |
211 | #endif | 211 | #endif |
212 | 212 | ||
213 | 213 | ||
diff --git a/libbb/loop.c b/libbb/loop.c index 6c3144a77..09b2beaa7 100644 --- a/libbb/loop.c +++ b/libbb/loop.c | |||
@@ -56,7 +56,7 @@ char *query_loop(const char *device) | |||
56 | int fd; | 56 | int fd; |
57 | bb_loop_info loopinfo; | 57 | bb_loop_info loopinfo; |
58 | char *dev=0; | 58 | char *dev=0; |
59 | 59 | ||
60 | if ((fd = open(device, O_RDONLY)) < 0) return 0; | 60 | if ((fd = open(device, O_RDONLY)) < 0) return 0; |
61 | if (!ioctl(fd, BB_LOOP_GET_STATUS, &loopinfo)) | 61 | if (!ioctl(fd, BB_LOOP_GET_STATUS, &loopinfo)) |
62 | dev=bb_xasprintf("%ld %s", (long) loopinfo.lo_offset, | 62 | dev=bb_xasprintf("%ld %s", (long) loopinfo.lo_offset, |
@@ -64,7 +64,7 @@ char *query_loop(const char *device) | |||
64 | close(fd); | 64 | close(fd); |
65 | 65 | ||
66 | return dev; | 66 | return dev; |
67 | } | 67 | } |
68 | 68 | ||
69 | 69 | ||
70 | int del_loop(const char *device) | 70 | int del_loop(const char *device) |
@@ -74,7 +74,7 @@ int del_loop(const char *device) | |||
74 | if ((fd = open(device, O_RDONLY)) < 0) return 1; | 74 | if ((fd = open(device, O_RDONLY)) < 0) return 1; |
75 | rc=ioctl(fd, LOOP_CLR_FD, 0); | 75 | rc=ioctl(fd, LOOP_CLR_FD, 0); |
76 | close(fd); | 76 | close(fd); |
77 | 77 | ||
78 | return rc; | 78 | return rc; |
79 | } | 79 | } |
80 | 80 | ||
diff --git a/libbb/printf.c b/libbb/printf.c index 4451273ef..2cba31792 100644 --- a/libbb/printf.c +++ b/libbb/printf.c | |||
@@ -65,7 +65,7 @@ | |||
65 | /* Using either the original stdio implementation (from dev86) or | 65 | /* Using either the original stdio implementation (from dev86) or |
66 | * my original stdio rewrite. Macros were: | 66 | * my original stdio rewrite. Macros were: |
67 | * #define ferror(fp) (((fp)->mode&__MODE_ERR) != 0) | 67 | * #define ferror(fp) (((fp)->mode&__MODE_ERR) != 0) |
68 | * #define feof(fp) (((fp)->mode&__MODE_EOF) != 0) | 68 | * #define feof(fp) (((fp)->mode&__MODE_EOF) != 0) |
69 | * #define clearerr(fp) ((fp)->mode &= ~(__MODE_EOF|__MODE_ERR),0) | 69 | * #define clearerr(fp) ((fp)->mode &= ~(__MODE_EOF|__MODE_ERR),0) |
70 | */ | 70 | */ |
71 | #define SET_FERROR_UNLOCKED(S) ((S)->mode |= __MODE_ERR) | 71 | #define SET_FERROR_UNLOCKED(S) ((S)->mode |= __MODE_ERR) |
diff --git a/libbb/process_escape_sequence.c b/libbb/process_escape_sequence.c index 28b1e3697..1b7b6d190 100644 --- a/libbb/process_escape_sequence.c +++ b/libbb/process_escape_sequence.c | |||
@@ -70,7 +70,7 @@ char bb_process_escape_sequence(const char **ptr) | |||
70 | if (d >= base) { | 70 | if (d >= base) { |
71 | #ifdef WANT_HEX_ESCAPES | 71 | #ifdef WANT_HEX_ESCAPES |
72 | if ((base == 16) && (!--num_digits)) { | 72 | if ((base == 16) && (!--num_digits)) { |
73 | /* return '\\'; */ | 73 | /* return '\\'; */ |
74 | --q; | 74 | --q; |
75 | } | 75 | } |
76 | #endif | 76 | #endif |
diff --git a/libbb/run_shell.c b/libbb/run_shell.c index 6d084eead..d5dc37b54 100644 --- a/libbb/run_shell.c +++ b/libbb/run_shell.c | |||
@@ -46,7 +46,7 @@ static security_context_t current_sid=NULL; | |||
46 | void | 46 | void |
47 | renew_current_security_context(void) | 47 | renew_current_security_context(void) |
48 | { | 48 | { |
49 | if (current_sid) | 49 | if (current_sid) |
50 | freecon(current_sid); /* Release old context */ | 50 | freecon(current_sid); /* Release old context */ |
51 | 51 | ||
52 | getcon(¤t_sid); /* update */ | 52 | getcon(¤t_sid); /* update */ |
@@ -56,7 +56,7 @@ renew_current_security_context(void) | |||
56 | void | 56 | void |
57 | set_current_security_context(security_context_t sid) | 57 | set_current_security_context(security_context_t sid) |
58 | { | 58 | { |
59 | if (current_sid) | 59 | if (current_sid) |
60 | freecon(current_sid); /* Release old context */ | 60 | freecon(current_sid); /* Release old context */ |
61 | 61 | ||
62 | current_sid=sid; | 62 | current_sid=sid; |
@@ -84,7 +84,7 @@ void run_shell ( const char *shell, int loginshell, const char *command, const c | |||
84 | 84 | ||
85 | args [0] = bb_get_last_path_component ( bb_xstrdup ( shell )); | 85 | args [0] = bb_get_last_path_component ( bb_xstrdup ( shell )); |
86 | 86 | ||
87 | if ( loginshell ) | 87 | if ( loginshell ) |
88 | args [0] = bb_xasprintf ("-%s", args [0]); | 88 | args [0] = bb_xasprintf ("-%s", args [0]); |
89 | 89 | ||
90 | if ( command ) { | 90 | if ( command ) { |
diff --git a/libbb/setup_environment.c b/libbb/setup_environment.c index aeb285a53..dfab786d9 100644 --- a/libbb/setup_environment.c +++ b/libbb/setup_environment.c | |||
@@ -58,7 +58,7 @@ void setup_environment ( const char *shell, int loginshell, int changeenv, const | |||
58 | * to change to that directory. There is no "default" home | 58 | * to change to that directory. There is no "default" home |
59 | * directory. | 59 | * directory. |
60 | * Some systems default to HOME=/ | 60 | * Some systems default to HOME=/ |
61 | */ | 61 | */ |
62 | if ( chdir ( pw-> pw_dir )) { | 62 | if ( chdir ( pw-> pw_dir )) { |
63 | if ( chdir ( "/" )) { | 63 | if ( chdir ( "/" )) { |
64 | syslog ( LOG_WARNING, "unable to cd to %s' for user %s'\n", pw-> pw_dir, pw-> pw_name ); | 64 | syslog ( LOG_WARNING, "unable to cd to %s' for user %s'\n", pw-> pw_dir, pw-> pw_name ); |
@@ -81,7 +81,7 @@ void setup_environment ( const char *shell, int loginshell, int changeenv, const | |||
81 | } | 81 | } |
82 | else if ( changeenv ) { | 82 | else if ( changeenv ) { |
83 | /* Set HOME, SHELL, and if not becoming a super-user, | 83 | /* Set HOME, SHELL, and if not becoming a super-user, |
84 | USER and LOGNAME. */ | 84 | USER and LOGNAME. */ |
85 | xsetenv ( "HOME", pw-> pw_dir ); | 85 | xsetenv ( "HOME", pw-> pw_dir ); |
86 | xsetenv ( "SHELL", shell ); | 86 | xsetenv ( "SHELL", shell ); |
87 | if ( pw-> pw_uid ) { | 87 | if ( pw-> pw_uid ) { |
diff --git a/libbb/xgetlarg.c b/libbb/xgetlarg.c index f24492bee..f332bb37e 100644 --- a/libbb/xgetlarg.c +++ b/libbb/xgetlarg.c | |||
@@ -22,7 +22,7 @@ extern long bb_xgetlarg(const char *arg, int base, long lower, long upper) | |||
22 | assert(arg!=NULL); | 22 | assert(arg!=NULL); |
23 | 23 | ||
24 | /* Don't allow leading whitespace. | 24 | /* Don't allow leading whitespace. |
25 | * Wrap isspace in () to make sure we call the | 25 | * Wrap isspace in () to make sure we call the |
26 | * function rather than the macro. */ | 26 | * function rather than the macro. */ |
27 | if ((isspace)(*arg)) { | 27 | if ((isspace)(*arg)) { |
28 | bb_show_usage(); | 28 | bb_show_usage(); |
diff --git a/libbb/xgetularg.c b/libbb/xgetularg.c index e90085446..8d793f3d1 100644 --- a/libbb/xgetularg.c +++ b/libbb/xgetularg.c | |||
@@ -75,7 +75,7 @@ unsigned long bb_xgetularg_bnd_sfx(const char *arg, int base, | |||
75 | ++e; | 75 | ++e; |
76 | r *= suffixes->mult; | 76 | r *= suffixes->mult; |
77 | break; | 77 | break; |
78 | } | 78 | } |
79 | ++suffixes; | 79 | ++suffixes; |
80 | } | 80 | } |
81 | } | 81 | } |
diff --git a/libbb/xreadlink.c b/libbb/xreadlink.c index 49823fa7f..b3e3eda2b 100644 --- a/libbb/xreadlink.c +++ b/libbb/xreadlink.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #include "libbb.h" | 14 | #include "libbb.h" |
15 | 15 | ||
16 | extern char *xreadlink(const char *path) | 16 | extern char *xreadlink(const char *path) |
17 | { | 17 | { |
18 | static const int GROWBY = 80; /* how large we will grow strings by */ | 18 | static const int GROWBY = 80; /* how large we will grow strings by */ |
19 | 19 | ||
20 | char *buf = NULL; | 20 | char *buf = NULL; |
diff --git a/libpwdgrp/pwd_grp.c b/libpwdgrp/pwd_grp.c index 18782002d..faf53d7e1 100644 --- a/libpwdgrp/pwd_grp.c +++ b/libpwdgrp/pwd_grp.c | |||
@@ -220,7 +220,7 @@ int sgetspent_r(const char *string, struct spwd *result_buf, | |||
220 | 220 | ||
221 | #ifdef L_getpwnam_r | 221 | #ifdef L_getpwnam_r |
222 | #define GETXXKEY_R_FUNC getpwnam_r | 222 | #define GETXXKEY_R_FUNC getpwnam_r |
223 | #define GETXXKEY_R_PARSER __parsepwent | 223 | #define GETXXKEY_R_PARSER __parsepwent |
224 | #define GETXXKEY_R_ENTTYPE struct passwd | 224 | #define GETXXKEY_R_ENTTYPE struct passwd |
225 | #define GETXXKEY_R_TEST(ENT) (!strcmp((ENT)->pw_name, key)) | 225 | #define GETXXKEY_R_TEST(ENT) (!strcmp((ENT)->pw_name, key)) |
226 | #define DO_GETXXKEY_R_KEYTYPE const char *__restrict | 226 | #define DO_GETXXKEY_R_KEYTYPE const char *__restrict |
@@ -230,7 +230,7 @@ int sgetspent_r(const char *string, struct spwd *result_buf, | |||
230 | 230 | ||
231 | #ifdef L_getgrnam_r | 231 | #ifdef L_getgrnam_r |
232 | #define GETXXKEY_R_FUNC getgrnam_r | 232 | #define GETXXKEY_R_FUNC getgrnam_r |
233 | #define GETXXKEY_R_PARSER __parsegrent | 233 | #define GETXXKEY_R_PARSER __parsegrent |
234 | #define GETXXKEY_R_ENTTYPE struct group | 234 | #define GETXXKEY_R_ENTTYPE struct group |
235 | #define GETXXKEY_R_TEST(ENT) (!strcmp((ENT)->gr_name, key)) | 235 | #define GETXXKEY_R_TEST(ENT) (!strcmp((ENT)->gr_name, key)) |
236 | #define DO_GETXXKEY_R_KEYTYPE const char *__restrict | 236 | #define DO_GETXXKEY_R_KEYTYPE const char *__restrict |
@@ -240,7 +240,7 @@ int sgetspent_r(const char *string, struct spwd *result_buf, | |||
240 | 240 | ||
241 | #ifdef L_getspnam_r | 241 | #ifdef L_getspnam_r |
242 | #define GETXXKEY_R_FUNC getspnam_r | 242 | #define GETXXKEY_R_FUNC getspnam_r |
243 | #define GETXXKEY_R_PARSER __parsespent | 243 | #define GETXXKEY_R_PARSER __parsespent |
244 | #define GETXXKEY_R_ENTTYPE struct spwd | 244 | #define GETXXKEY_R_ENTTYPE struct spwd |
245 | #define GETXXKEY_R_TEST(ENT) (!strcmp((ENT)->sp_namp, key)) | 245 | #define GETXXKEY_R_TEST(ENT) (!strcmp((ENT)->sp_namp, key)) |
246 | #define DO_GETXXKEY_R_KEYTYPE const char *__restrict | 246 | #define DO_GETXXKEY_R_KEYTYPE const char *__restrict |
@@ -250,7 +250,7 @@ int sgetspent_r(const char *string, struct spwd *result_buf, | |||
250 | 250 | ||
251 | #ifdef L_getpwuid_r | 251 | #ifdef L_getpwuid_r |
252 | #define GETXXKEY_R_FUNC getpwuid_r | 252 | #define GETXXKEY_R_FUNC getpwuid_r |
253 | #define GETXXKEY_R_PARSER __parsepwent | 253 | #define GETXXKEY_R_PARSER __parsepwent |
254 | #define GETXXKEY_R_ENTTYPE struct passwd | 254 | #define GETXXKEY_R_ENTTYPE struct passwd |
255 | #define GETXXKEY_R_TEST(ENT) ((ENT)->pw_uid == key) | 255 | #define GETXXKEY_R_TEST(ENT) ((ENT)->pw_uid == key) |
256 | #define DO_GETXXKEY_R_KEYTYPE uid_t | 256 | #define DO_GETXXKEY_R_KEYTYPE uid_t |
@@ -260,7 +260,7 @@ int sgetspent_r(const char *string, struct spwd *result_buf, | |||
260 | 260 | ||
261 | #ifdef L_getgrgid_r | 261 | #ifdef L_getgrgid_r |
262 | #define GETXXKEY_R_FUNC getgrgid_r | 262 | #define GETXXKEY_R_FUNC getgrgid_r |
263 | #define GETXXKEY_R_PARSER __parsegrent | 263 | #define GETXXKEY_R_PARSER __parsegrent |
264 | #define GETXXKEY_R_ENTTYPE struct group | 264 | #define GETXXKEY_R_ENTTYPE struct group |
265 | #define GETXXKEY_R_TEST(ENT) ((ENT)->gr_gid == key) | 265 | #define GETXXKEY_R_TEST(ENT) ((ENT)->gr_gid == key) |
266 | #define DO_GETXXKEY_R_KEYTYPE gid_t | 266 | #define DO_GETXXKEY_R_KEYTYPE gid_t |
@@ -442,7 +442,7 @@ void endpwent(void) | |||
442 | } | 442 | } |
443 | 443 | ||
444 | 444 | ||
445 | int getpwent_r(struct passwd *__restrict resultbuf, | 445 | int getpwent_r(struct passwd *__restrict resultbuf, |
446 | char *__restrict buffer, size_t buflen, | 446 | char *__restrict buffer, size_t buflen, |
447 | struct passwd **__restrict result) | 447 | struct passwd **__restrict result) |
448 | { | 448 | { |
@@ -542,7 +542,7 @@ void endspent(void) | |||
542 | UNLOCK; | 542 | UNLOCK; |
543 | } | 543 | } |
544 | 544 | ||
545 | int getspent_r(struct spwd *resultbuf, char *buffer, | 545 | int getspent_r(struct spwd *resultbuf, char *buffer, |
546 | size_t buflen, struct spwd **result) | 546 | size_t buflen, struct spwd **result) |
547 | { | 547 | { |
548 | int rv; | 548 | int rv; |
@@ -755,11 +755,11 @@ int putgrent(const struct group *__restrict p, FILE *__restrict f) | |||
755 | 755 | ||
756 | static const unsigned char _sp_off[] = { | 756 | static const unsigned char _sp_off[] = { |
757 | offsetof(struct spwd, sp_lstchg), /* 2 - not a char ptr */ | 757 | offsetof(struct spwd, sp_lstchg), /* 2 - not a char ptr */ |
758 | offsetof(struct spwd, sp_min), /* 3 - not a char ptr */ | 758 | offsetof(struct spwd, sp_min), /* 3 - not a char ptr */ |
759 | offsetof(struct spwd, sp_max), /* 4 - not a char ptr */ | 759 | offsetof(struct spwd, sp_max), /* 4 - not a char ptr */ |
760 | offsetof(struct spwd, sp_warn), /* 5 - not a char ptr */ | 760 | offsetof(struct spwd, sp_warn), /* 5 - not a char ptr */ |
761 | offsetof(struct spwd, sp_inact), /* 6 - not a char ptr */ | 761 | offsetof(struct spwd, sp_inact), /* 6 - not a char ptr */ |
762 | offsetof(struct spwd, sp_expire), /* 7 - not a char ptr */ | 762 | offsetof(struct spwd, sp_expire), /* 7 - not a char ptr */ |
763 | }; | 763 | }; |
764 | 764 | ||
765 | int putspent(const struct spwd *p, FILE *stream) | 765 | int putspent(const struct spwd *p, FILE *stream) |
@@ -801,18 +801,18 @@ DO_UNLOCK: | |||
801 | 801 | ||
802 | #endif | 802 | #endif |
803 | /**********************************************************************/ | 803 | /**********************************************************************/ |
804 | /* Internal uClibc functions. */ | 804 | /* Internal uClibc functions. */ |
805 | /**********************************************************************/ | 805 | /**********************************************************************/ |
806 | #ifdef L___parsepwent | 806 | #ifdef L___parsepwent |
807 | 807 | ||
808 | static const unsigned char pw_off[] = { | 808 | static const unsigned char pw_off[] = { |
809 | offsetof(struct passwd, pw_name), /* 0 */ | 809 | offsetof(struct passwd, pw_name), /* 0 */ |
810 | offsetof(struct passwd, pw_passwd), /* 1 */ | 810 | offsetof(struct passwd, pw_passwd), /* 1 */ |
811 | offsetof(struct passwd, pw_uid), /* 2 - not a char ptr */ | 811 | offsetof(struct passwd, pw_uid), /* 2 - not a char ptr */ |
812 | offsetof(struct passwd, pw_gid), /* 3 - not a char ptr */ | 812 | offsetof(struct passwd, pw_gid), /* 3 - not a char ptr */ |
813 | offsetof(struct passwd, pw_gecos), /* 4 */ | 813 | offsetof(struct passwd, pw_gecos), /* 4 */ |
814 | offsetof(struct passwd, pw_dir), /* 5 */ | 814 | offsetof(struct passwd, pw_dir), /* 5 */ |
815 | offsetof(struct passwd, pw_shell) /* 6 */ | 815 | offsetof(struct passwd, pw_shell) /* 6 */ |
816 | }; | 816 | }; |
817 | 817 | ||
818 | int __parsepwent(void *data, char *line) | 818 | int __parsepwent(void *data, char *line) |
@@ -825,7 +825,7 @@ int __parsepwent(void *data, char *line) | |||
825 | do { | 825 | do { |
826 | p = ((char *) ((struct passwd *) data)) + pw_off[i]; | 826 | p = ((char *) ((struct passwd *) data)) + pw_off[i]; |
827 | 827 | ||
828 | if ((i & 6) ^ 2) { /* i!=2 and i!=3 */ | 828 | if ((i & 6) ^ 2) { /* i!=2 and i!=3 */ |
829 | *((char **) p) = line; | 829 | *((char **) p) = line; |
830 | if (i==6) { | 830 | if (i==6) { |
831 | return 0; | 831 | return 0; |
@@ -865,7 +865,7 @@ int __parsepwent(void *data, char *line) | |||
865 | #ifdef L___parsegrent | 865 | #ifdef L___parsegrent |
866 | 866 | ||
867 | static const unsigned char gr_off[] = { | 867 | static const unsigned char gr_off[] = { |
868 | offsetof(struct group, gr_name), /* 0 */ | 868 | offsetof(struct group, gr_name), /* 0 */ |
869 | offsetof(struct group, gr_passwd), /* 1 */ | 869 | offsetof(struct group, gr_passwd), /* 1 */ |
870 | offsetof(struct group, gr_gid) /* 2 - not a char ptr */ | 870 | offsetof(struct group, gr_gid) /* 2 - not a char ptr */ |
871 | }; | 871 | }; |
@@ -947,7 +947,7 @@ int __parsegrent(void *data, char *line) | |||
947 | if (!--i) break; | 947 | if (!--i) break; |
948 | while (*++p) {} | 948 | while (*++p) {} |
949 | } while (1); | 949 | } while (1); |
950 | } | 950 | } |
951 | *members = NULL; | 951 | *members = NULL; |
952 | 952 | ||
953 | return 0; | 953 | return 0; |
@@ -966,12 +966,12 @@ static const unsigned char sp_off[] = { | |||
966 | offsetof(struct spwd, sp_namp), /* 0 */ | 966 | offsetof(struct spwd, sp_namp), /* 0 */ |
967 | offsetof(struct spwd, sp_pwdp), /* 1 */ | 967 | offsetof(struct spwd, sp_pwdp), /* 1 */ |
968 | offsetof(struct spwd, sp_lstchg), /* 2 - not a char ptr */ | 968 | offsetof(struct spwd, sp_lstchg), /* 2 - not a char ptr */ |
969 | offsetof(struct spwd, sp_min), /* 3 - not a char ptr */ | 969 | offsetof(struct spwd, sp_min), /* 3 - not a char ptr */ |
970 | offsetof(struct spwd, sp_max), /* 4 - not a char ptr */ | 970 | offsetof(struct spwd, sp_max), /* 4 - not a char ptr */ |
971 | offsetof(struct spwd, sp_warn), /* 5 - not a char ptr */ | 971 | offsetof(struct spwd, sp_warn), /* 5 - not a char ptr */ |
972 | offsetof(struct spwd, sp_inact), /* 6 - not a char ptr */ | 972 | offsetof(struct spwd, sp_inact), /* 6 - not a char ptr */ |
973 | offsetof(struct spwd, sp_expire), /* 7 - not a char ptr */ | 973 | offsetof(struct spwd, sp_expire), /* 7 - not a char ptr */ |
974 | offsetof(struct spwd, sp_flag) /* 8 - not a char ptr */ | 974 | offsetof(struct spwd, sp_flag) /* 8 - not a char ptr */ |
975 | }; | 975 | }; |
976 | 976 | ||
977 | int __parsespent(void *data, char * line) | 977 | int __parsespent(void *data, char * line) |
diff --git a/loginutils/Config.in b/loginutils/Config.in index 89f699850..48bb1fee3 100644 --- a/loginutils/Config.in +++ b/loginutils/Config.in | |||
@@ -85,7 +85,7 @@ config CONFIG_GETTY | |||
85 | 85 | ||
86 | config CONFIG_FEATURE_UTMP | 86 | config CONFIG_FEATURE_UTMP |
87 | bool " Support utmp file" | 87 | bool " Support utmp file" |
88 | depends on CONFIG_GETTY || CONFIG_LOGIN || CONFIG_SU || CONFIG_WHO | 88 | depends on CONFIG_GETTY || CONFIG_LOGIN || CONFIG_SU || CONFIG_WHO |
89 | default n | 89 | default n |
90 | help | 90 | help |
91 | The file /var/run/utmp is used to track who is currently logged in. | 91 | The file /var/run/utmp is used to track who is currently logged in. |
@@ -96,7 +96,7 @@ config CONFIG_FEATURE_WTMP | |||
96 | default n | 96 | default n |
97 | select CONFIG_FEATURE_UTMP | 97 | select CONFIG_FEATURE_UTMP |
98 | help | 98 | help |
99 | The file /var/run/wtmp is used to track when user's have logged into | 99 | The file /var/run/wtmp is used to track when user's have logged into |
100 | and logged out of the system. | 100 | and logged out of the system. |
101 | 101 | ||
102 | config CONFIG_LOGIN | 102 | config CONFIG_LOGIN |
diff --git a/loginutils/addgroup.c b/loginutils/addgroup.c index 804d6961c..7b68f394e 100644 --- a/loginutils/addgroup.c +++ b/loginutils/addgroup.c | |||
@@ -163,7 +163,7 @@ int addgroup_main(int argc, char **argv) | |||
163 | } else { | 163 | } else { |
164 | user = ""; | 164 | user = ""; |
165 | } | 165 | } |
166 | 166 | ||
167 | if_i_am_not_root(); | 167 | if_i_am_not_root(); |
168 | 168 | ||
169 | /* werk */ | 169 | /* werk */ |
diff --git a/loginutils/adduser.c b/loginutils/adduser.c index a25632e44..716f83069 100644 --- a/loginutils/adduser.c +++ b/loginutils/adduser.c | |||
@@ -244,7 +244,7 @@ int adduser_main(int argc, char **argv) | |||
244 | const char *gecos = default_gecos; | 244 | const char *gecos = default_gecos; |
245 | const char *home = NULL; | 245 | const char *home = NULL; |
246 | const char *shell = DEFAULT_SHELL; | 246 | const char *shell = DEFAULT_SHELL; |
247 | const char *usegroup = NULL; | 247 | const char *usegroup = NULL; |
248 | int flags; | 248 | int flags; |
249 | int setpass = 1; | 249 | int setpass = 1; |
250 | int makehome = 1; | 250 | int makehome = 1; |
@@ -293,7 +293,7 @@ int adduser_main(int argc, char **argv) | |||
293 | if (usegroup) { | 293 | if (usegroup) { |
294 | /* Add user to a group that already exists */ | 294 | /* Add user to a group that already exists */ |
295 | pw.pw_gid = bb_xgetgrnam(usegroup); | 295 | pw.pw_gid = bb_xgetgrnam(usegroup); |
296 | /* exits on error */ | 296 | /* exits on error */ |
297 | } | 297 | } |
298 | 298 | ||
299 | /* grand finale */ | 299 | /* grand finale */ |
diff --git a/loginutils/login.c b/loginutils/login.c index 21e807615..b2f3166e2 100644 --- a/loginutils/login.c +++ b/loginutils/login.c | |||
@@ -101,7 +101,7 @@ extern int login_main(int argc, char **argv) | |||
101 | if ( optarg != argv[optind-1] ) | 101 | if ( optarg != argv[optind-1] ) |
102 | bb_show_usage( ); | 102 | bb_show_usage( ); |
103 | 103 | ||
104 | if ( !amroot ) /* Auth bypass only if real UID is zero */ | 104 | if ( !amroot ) /* Auth bypass only if real UID is zero */ |
105 | bb_error_msg_and_die ( "-f permission denied" ); | 105 | bb_error_msg_and_die ( "-f permission denied" ); |
106 | 106 | ||
107 | safe_strncpy(username, optarg, USERNAME_SIZE); | 107 | safe_strncpy(username, optarg, USERNAME_SIZE); |
diff --git a/loginutils/sulogin.c b/loginutils/sulogin.c index f54939eef..434683299 100644 --- a/loginutils/sulogin.c +++ b/loginutils/sulogin.c | |||
@@ -53,9 +53,9 @@ extern int sulogin_main(int argc, char **argv) | |||
53 | char *device = (char *) 0; | 53 | char *device = (char *) 0; |
54 | const char *name = "root"; | 54 | const char *name = "root"; |
55 | int timeout = 0; | 55 | int timeout = 0; |
56 | 56 | ||
57 | #define pass bb_common_bufsiz1 | 57 | #define pass bb_common_bufsiz1 |
58 | 58 | ||
59 | struct passwd pwent; | 59 | struct passwd pwent; |
60 | struct passwd *pwd; | 60 | struct passwd *pwd; |
61 | const char * const *p; | 61 | const char * const *p; |
diff --git a/miscutils/Config.in b/miscutils/Config.in index 4d81dde0d..aed7e5a99 100644 --- a/miscutils/Config.in +++ b/miscutils/Config.in | |||
@@ -218,14 +218,14 @@ config CONFIG_MAKEDEVS | |||
218 | . | 218 | . |
219 | There are two choices for command line behaviour, the interface | 219 | There are two choices for command line behaviour, the interface |
220 | as used by LEAF/Linux Router Project, or a device table file. | 220 | as used by LEAF/Linux Router Project, or a device table file. |
221 | . | 221 | . |
222 | 'leaf' is traditionally what busybox follows, it allows multiple | 222 | 'leaf' is traditionally what busybox follows, it allows multiple |
223 | devices of a particluar type to be created per command. | 223 | devices of a particluar type to be created per command. |
224 | e.g. /dev/hda[0-9] | 224 | e.g. /dev/hda[0-9] |
225 | Device properties are passed as command line arguments. | 225 | Device properties are passed as command line arguments. |
226 | . | 226 | . |
227 | 'table' reads device properties from a file or stdin, allowing | 227 | 'table' reads device properties from a file or stdin, allowing |
228 | a batch of unrelated devices to be makde with one command. | 228 | a batch of unrelated devices to be makde with one command. |
229 | User/group names are allowed as an alternative to uid/gid. | 229 | User/group names are allowed as an alternative to uid/gid. |
230 | 230 | ||
231 | choice | 231 | choice |
diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c index 62d217345..d8a630c04 100644 --- a/miscutils/devfsd.c +++ b/miscutils/devfsd.c | |||
@@ -121,7 +121,7 @@ struct devfsd_notify_struct | |||
121 | #define BUFFER_SIZE 16384 | 121 | #define BUFFER_SIZE 16384 |
122 | #define DEVFSD_VERSION "1.3.25" | 122 | #define DEVFSD_VERSION "1.3.25" |
123 | #define CONFIG_FILE "/etc/devfsd.conf" | 123 | #define CONFIG_FILE "/etc/devfsd.conf" |
124 | #define MODPROBE "/sbin/modprobe" | 124 | #define MODPROBE "/sbin/modprobe" |
125 | #define MODPROBE_SWITCH_1 "-k" | 125 | #define MODPROBE_SWITCH_1 "-k" |
126 | #define MODPROBE_SWITCH_2 "-C" | 126 | #define MODPROBE_SWITCH_2 "-C" |
127 | #define CONFIG_MODULES_DEVFS "/etc/modules.devfs" | 127 | #define CONFIG_MODULES_DEVFS "/etc/modules.devfs" |
@@ -289,7 +289,7 @@ static struct event_type | |||
289 | /* Busybox messages */ | 289 | /* Busybox messages */ |
290 | 290 | ||
291 | static const char * const bb_msg_proto_rev = "protocol revision"; | 291 | static const char * const bb_msg_proto_rev = "protocol revision"; |
292 | static const char * const bb_msg_bad_config = "bad %s config file: %s"; | 292 | static const char * const bb_msg_bad_config = "bad %s config file: %s"; |
293 | static const char * const bb_msg_small_buffer = "buffer too small"; | 293 | static const char * const bb_msg_small_buffer = "buffer too small"; |
294 | static const char * const bb_msg_variable_not_found = "variable: %s not found"; | 294 | static const char * const bb_msg_variable_not_found = "variable: %s not found"; |
295 | 295 | ||
@@ -297,16 +297,16 @@ static const char * const bb_msg_variable_not_found = "variable: %s not found"; | |||
297 | static void msg_logger(int pri, const char * fmt, ... ) | 297 | static void msg_logger(int pri, const char * fmt, ... ) |
298 | { | 298 | { |
299 | va_list ap; | 299 | va_list ap; |
300 | int ret; | 300 | int ret; |
301 | 301 | ||
302 | va_start(ap, fmt); | 302 | va_start(ap, fmt); |
303 | ret = access ("/dev/log", F_OK); | 303 | ret = access ("/dev/log", F_OK); |
304 | if (ret == 0) { | 304 | if (ret == 0) { |
305 | openlog(bb_applet_name, 0, LOG_DAEMON); | 305 | openlog(bb_applet_name, 0, LOG_DAEMON); |
306 | vsyslog( pri , fmt, ap); | 306 | vsyslog( pri , fmt, ap); |
307 | /* Man: A trailing newline is added when needed. */ | 307 | /* Man: A trailing newline is added when needed. */ |
308 | closelog(); | 308 | closelog(); |
309 | } | 309 | } |
310 | /* ENABLE_DEVFSD_VERBOSE is always enabled if msg_logger is used */ | 310 | /* ENABLE_DEVFSD_VERBOSE is always enabled if msg_logger is used */ |
311 | if ((ENABLE_DEVFSD_VERBOSE && ret) || ENABLE_DEBUG) { | 311 | if ((ENABLE_DEVFSD_VERBOSE && ret) || ENABLE_DEBUG) { |
312 | bb_error_msg(fmt, ap); | 312 | bb_error_msg(fmt, ap); |
@@ -319,28 +319,28 @@ static void msg_logger_and_die(int pri, const char* fmt, ...) | |||
319 | va_list ap; | 319 | va_list ap; |
320 | 320 | ||
321 | va_start(ap, fmt); | 321 | va_start(ap, fmt); |
322 | msg_logger(pri, fmt, ap); | 322 | msg_logger(pri, fmt, ap); |
323 | va_end(ap); | 323 | va_end(ap); |
324 | exit(EXIT_FAILURE); | 324 | exit(EXIT_FAILURE); |
325 | } | 325 | } |
326 | 326 | ||
327 | /* Busybox stuff */ | 327 | /* Busybox stuff */ |
328 | #if defined(CONFIG_DEVFSD_VERBOSE) || defined(CONFIG_DEBUG) | 328 | #if defined(CONFIG_DEVFSD_VERBOSE) || defined(CONFIG_DEBUG) |
329 | #define devfsd_error_msg(fmt, args...) bb_error_msg(fmt, ## args) | 329 | #define devfsd_error_msg(fmt, args...) bb_error_msg(fmt, ## args) |
330 | #define devfsd_perror_msg_and_die(fmt, args...) bb_perror_msg_and_die(fmt, ## args) | 330 | #define devfsd_perror_msg_and_die(fmt, args...) bb_perror_msg_and_die(fmt, ## args) |
331 | #define devfsd_error_msg_and_die(fmt, args...) bb_error_msg_and_die(fmt, ## args) | 331 | #define devfsd_error_msg_and_die(fmt, args...) bb_error_msg_and_die(fmt, ## args) |
332 | #if defined(CONFIG_DEBUG) | 332 | #if defined(CONFIG_DEBUG) |
333 | #define debug_msg_logger(x, fmt, args...) msg_logger(x, fmt, ## args) | 333 | #define debug_msg_logger(x, fmt, args...) msg_logger(x, fmt, ## args) |
334 | #else | 334 | #else |
335 | #define debug_msg_logger(x, fmt, args...) | 335 | #define debug_msg_logger(x, fmt, args...) |
336 | #endif | 336 | #endif |
337 | #else | 337 | #else |
338 | #define debug_msg_logger(x, fmt, args...) | 338 | #define debug_msg_logger(x, fmt, args...) |
339 | #define msg_logger(p, fmt, args...) | 339 | #define msg_logger(p, fmt, args...) |
340 | #define msg_logger_and_die(p, fmt, args...) exit(1) | 340 | #define msg_logger_and_die(p, fmt, args...) exit(1) |
341 | #define devfsd_perror_msg_and_die(fmt, args...) exit(1) | 341 | #define devfsd_perror_msg_and_die(fmt, args...) exit(1) |
342 | #define devfsd_error_msg_and_die(fmt, args...) exit(1) | 342 | #define devfsd_error_msg_and_die(fmt, args...) exit(1) |
343 | #define devfsd_error_msg(fmt, args...) | 343 | #define devfsd_error_msg(fmt, args...) |
344 | #endif | 344 | #endif |
345 | 345 | ||
346 | static void do_ioctl_and_die(int fd, int request, unsigned long event_mask_flag) | 346 | static void do_ioctl_and_die(int fd, int request, unsigned long event_mask_flag) |
@@ -451,10 +451,10 @@ int devfsd_main (int argc, char **argv) | |||
451 | { | 451 | { |
452 | if(argv[count][1]=='v' && !argv[count][2]) /* -v */ | 452 | if(argv[count][1]=='v' && !argv[count][2]) /* -v */ |
453 | print_version = TRUE; | 453 | print_version = TRUE; |
454 | else if(ENABLE_DEVFSD_FG_NP && argv[count][1]=='f' | 454 | else if(ENABLE_DEVFSD_FG_NP && argv[count][1]=='f' |
455 | && argv[count][2]=='g' && !argv[count][3]) /* -fg */ | 455 | && argv[count][2]=='g' && !argv[count][3]) /* -fg */ |
456 | do_daemon = FALSE; | 456 | do_daemon = FALSE; |
457 | else if(ENABLE_DEVFSD_FG_NP && argv[count][1]=='n' | 457 | else if(ENABLE_DEVFSD_FG_NP && argv[count][1]=='n' |
458 | && argv[count][2]=='p' && !argv[count][3]) /* -np */ | 458 | && argv[count][2]=='p' && !argv[count][3]) /* -np */ |
459 | no_polling = TRUE; | 459 | no_polling = TRUE; |
460 | else | 460 | else |
@@ -470,7 +470,7 @@ int devfsd_main (int argc, char **argv) | |||
470 | 470 | ||
471 | if (chdir (mount_point) != 0) | 471 | if (chdir (mount_point) != 0) |
472 | devfsd_perror_msg_and_die(mount_point); | 472 | devfsd_perror_msg_and_die(mount_point); |
473 | 473 | ||
474 | fd = bb_xopen (".devfsd", O_RDONLY); | 474 | fd = bb_xopen (".devfsd", O_RDONLY); |
475 | 475 | ||
476 | if (fcntl (fd, F_SETFD, FD_CLOEXEC) != 0) | 476 | if (fcntl (fd, F_SETFD, FD_CLOEXEC) != 0) |
@@ -503,15 +503,15 @@ int devfsd_main (int argc, char **argv) | |||
503 | new_action.sa_handler = signal_handler; | 503 | new_action.sa_handler = signal_handler; |
504 | if (sigaction (SIGHUP, &new_action, NULL) != 0 || sigaction (SIGUSR1, &new_action, NULL) != 0 ) | 504 | if (sigaction (SIGHUP, &new_action, NULL) != 0 || sigaction (SIGUSR1, &new_action, NULL) != 0 ) |
505 | devfsd_error_msg_and_die( "sigaction"); | 505 | devfsd_error_msg_and_die( "sigaction"); |
506 | 506 | ||
507 | bb_printf("%s v%s started for %s\n",bb_applet_name, DEVFSD_VERSION, mount_point); | 507 | bb_printf("%s v%s started for %s\n",bb_applet_name, DEVFSD_VERSION, mount_point); |
508 | 508 | ||
509 | /* Set umask so that mknod(2), open(2) and mkdir(2) have complete control over permissions */ | 509 | /* Set umask so that mknod(2), open(2) and mkdir(2) have complete control over permissions */ |
510 | umask (0); | 510 | umask (0); |
511 | read_config_file (CONFIG_FILE, FALSE, &event_mask); | 511 | read_config_file (CONFIG_FILE, FALSE, &event_mask); |
512 | /* Do the scan before forking, so that boot scripts see the finished product */ | 512 | /* Do the scan before forking, so that boot scripts see the finished product */ |
513 | dir_operation(SERVICE,mount_point,0,NULL); | 513 | dir_operation(SERVICE,mount_point,0,NULL); |
514 | 514 | ||
515 | if (ENABLE_DEVFSD_FG_NP && no_polling) | 515 | if (ENABLE_DEVFSD_FG_NP && no_polling) |
516 | exit (0); | 516 | exit (0); |
517 | if (do_daemon) | 517 | if (do_daemon) |
@@ -553,7 +553,7 @@ static void read_config_file (char *path, int optional, unsigned long *event_mas | |||
553 | char *line=NULL; | 553 | char *line=NULL; |
554 | 554 | ||
555 | debug_msg_logger(LOG_INFO, "%s: %s", __FUNCTION__, path); | 555 | debug_msg_logger(LOG_INFO, "%s: %s", __FUNCTION__, path); |
556 | 556 | ||
557 | if (stat (path, &statbuf) == 0 ) | 557 | if (stat (path, &statbuf) == 0 ) |
558 | { | 558 | { |
559 | /* Don't read 0 length files: ignored */ | 559 | /* Don't read 0 length files: ignored */ |
@@ -564,7 +564,7 @@ static void read_config_file (char *path, int optional, unsigned long *event_mas | |||
564 | /* strip last / from dirname so we don't need to check for it later */ | 564 | /* strip last / from dirname so we don't need to check for it later */ |
565 | while( path && path[1]!='\0' && path[strlen(path)-1] == '/') | 565 | while( path && path[1]!='\0' && path[strlen(path)-1] == '/') |
566 | path[strlen(path) -1] = '\0'; | 566 | path[strlen(path) -1] = '\0'; |
567 | 567 | ||
568 | dir_operation(READ_CONFIG, path, 0, event_mask); | 568 | dir_operation(READ_CONFIG, path, 0, event_mask); |
569 | return; | 569 | return; |
570 | } | 570 | } |
@@ -586,7 +586,7 @@ static void read_config_file (char *path, int optional, unsigned long *event_mas | |||
586 | } else { | 586 | } else { |
587 | read_config_file_err: | 587 | read_config_file_err: |
588 | if(optional == 0 && errno == ENOENT) | 588 | if(optional == 0 && errno == ENOENT) |
589 | msg_logger_and_die(LOG_ERR, "read config file: %s: %m", path); | 589 | msg_logger_and_die(LOG_ERR, "read config file: %s: %m", path); |
590 | } | 590 | } |
591 | return; | 591 | return; |
592 | } /* End Function read_config_file */ | 592 | } /* End Function read_config_file */ |
@@ -691,7 +691,7 @@ static void process_config_line (const char *line, unsigned long *event_mask) | |||
691 | the device name) to the module loading facility. In addition, | 691 | the device name) to the module loading facility. In addition, |
692 | the /etc/modules.devfs configuration file is used.*/ | 692 | the /etc/modules.devfs configuration file is used.*/ |
693 | if (ENABLE_DEVFSD_MODLOAD) | 693 | if (ENABLE_DEVFSD_MODLOAD) |
694 | new->action.what = AC_MODLOAD; | 694 | new->action.what = AC_MODLOAD; |
695 | break; | 695 | break; |
696 | case 6: /* EXECUTE */ | 696 | case 6: /* EXECUTE */ |
697 | new->action.what = AC_EXECUTE; | 697 | new->action.what = AC_EXECUTE; |
@@ -759,7 +759,7 @@ static int do_servicing (int fd, unsigned long event_mask) | |||
759 | unsigned long tmp_event_mask; | 759 | unsigned long tmp_event_mask; |
760 | 760 | ||
761 | debug_msg_logger(LOG_INFO, __FUNCTION__); | 761 | debug_msg_logger(LOG_INFO, __FUNCTION__); |
762 | 762 | ||
763 | /* Tell devfs what events we care about */ | 763 | /* Tell devfs what events we care about */ |
764 | tmp_event_mask = event_mask; | 764 | tmp_event_mask = event_mask; |
765 | do_ioctl_and_die(fd, DEVFSDIOC_SET_EVENT_MASK, tmp_event_mask); | 765 | do_ioctl_and_die(fd, DEVFSDIOC_SET_EVENT_MASK, tmp_event_mask); |
@@ -816,9 +816,9 @@ static void service_name (const struct devfsd_notify_struct *info) | |||
816 | continue; | 816 | continue; |
817 | for (n = 0; (n < MAX_SUBEXPR) && (mbuf[n].rm_so != -1); ++n) | 817 | for (n = 0; (n < MAX_SUBEXPR) && (mbuf[n].rm_so != -1); ++n) |
818 | /* VOID */; | 818 | /* VOID */; |
819 | 819 | ||
820 | debug_msg_logger(LOG_INFO, "%s: action.what %d", __FUNCTION__, entry->action.what); | 820 | debug_msg_logger(LOG_INFO, "%s: action.what %d", __FUNCTION__, entry->action.what); |
821 | 821 | ||
822 | switch (entry->action.what) | 822 | switch (entry->action.what) |
823 | { | 823 | { |
824 | case AC_PERMISSIONS: | 824 | case AC_PERMISSIONS: |
@@ -928,7 +928,7 @@ static void action_execute (const struct devfsd_notify_struct *info, | |||
928 | 928 | ||
929 | static void action_copy (const struct devfsd_notify_struct *info, | 929 | static void action_copy (const struct devfsd_notify_struct *info, |
930 | const struct config_entry_struct *entry, | 930 | const struct config_entry_struct *entry, |
931 | const regmatch_t *regexpr, unsigned int numexpr) | 931 | const regmatch_t *regexpr, unsigned int numexpr) |
932 | /* [SUMMARY] Copy permissions. | 932 | /* [SUMMARY] Copy permissions. |
933 | <info> The devfs change. | 933 | <info> The devfs change. |
934 | <entry> The config file entry. | 934 | <entry> The config file entry. |
@@ -945,9 +945,9 @@ static void action_copy (const struct devfsd_notify_struct *info, | |||
945 | int ret = 0; | 945 | int ret = 0; |
946 | 946 | ||
947 | debug_msg_logger(LOG_INFO, __FUNCTION__); | 947 | debug_msg_logger(LOG_INFO, __FUNCTION__); |
948 | 948 | ||
949 | dest_stat.st_mode = 0; | 949 | dest_stat.st_mode = 0; |
950 | 950 | ||
951 | if ( (info->type == DEVFSD_NOTIFY_CHANGE) && S_ISLNK (info->mode) ) | 951 | if ( (info->type == DEVFSD_NOTIFY_CHANGE) && S_ISLNK (info->mode) ) |
952 | return; | 952 | return; |
953 | gv_info.info = info; | 953 | gv_info.info = info; |
@@ -970,7 +970,7 @@ static void action_copy (const struct devfsd_notify_struct *info, | |||
970 | new_mode |= S_ISVTX; | 970 | new_mode |= S_ISVTX; |
971 | else if ( (info->type == DEVFSD_NOTIFY_CHANGE) && (dest_stat.st_mode & S_ISVTX) ) | 971 | else if ( (info->type == DEVFSD_NOTIFY_CHANGE) && (dest_stat.st_mode & S_ISVTX) ) |
972 | new_mode |= S_ISVTX; | 972 | new_mode |= S_ISVTX; |
973 | ret = copy_inode (destination, &dest_stat, new_mode, source, &source_stat); | 973 | ret = copy_inode (destination, &dest_stat, new_mode, source, &source_stat); |
974 | if (ENABLE_DEBUG && ret && (errno != EEXIST)) | 974 | if (ENABLE_DEBUG && ret && (errno != EEXIST)) |
975 | debug_msg_logger(LOG_ERR, "copy_inode: %s to %s: %m", source, destination); | 975 | debug_msg_logger(LOG_ERR, "copy_inode: %s to %s: %m", source, destination); |
976 | return; | 976 | return; |
@@ -1126,7 +1126,7 @@ static int copy_inode (const char *destpath, const struct stat *dest_stat, | |||
1126 | ( dest_len = readlink (destpath , dest_link , STRING_LENGTH - 1) ) < 0 ) | 1126 | ( dest_len = readlink (destpath , dest_link , STRING_LENGTH - 1) ) < 0 ) |
1127 | return (FALSE); | 1127 | return (FALSE); |
1128 | source_link[source_len] = '\0'; | 1128 | source_link[source_len] = '\0'; |
1129 | dest_link[dest_len] = '\0'; | 1129 | dest_link[dest_len] = '\0'; |
1130 | if ( (source_len != dest_len) || (strcmp (source_link, dest_link) != 0) ) | 1130 | if ( (source_len != dest_len) || (strcmp (source_link, dest_link) != 0) ) |
1131 | { | 1131 | { |
1132 | unlink (destpath); | 1132 | unlink (destpath); |
@@ -1224,12 +1224,12 @@ static int get_uid_gid (int flag, const char *string) | |||
1224 | struct passwd *pw_ent; | 1224 | struct passwd *pw_ent; |
1225 | struct group *grp_ent; | 1225 | struct group *grp_ent; |
1226 | static char *msg; | 1226 | static char *msg; |
1227 | 1227 | ||
1228 | if (ENABLE_DEVFSD_VERBOSE) | 1228 | if (ENABLE_DEVFSD_VERBOSE) |
1229 | msg="user"; | 1229 | msg="user"; |
1230 | 1230 | ||
1231 | debug_msg_logger(LOG_INFO, __FUNCTION__); | 1231 | debug_msg_logger(LOG_INFO, __FUNCTION__); |
1232 | 1232 | ||
1233 | if(ENABLE_DEBUG && flag != UID && flag != GID) | 1233 | if(ENABLE_DEBUG && flag != UID && flag != GID) |
1234 | msg_logger_and_die(LOG_ERR,"%s: flag != UID && flag != GID", __FUNCTION__); | 1234 | msg_logger_and_die(LOG_ERR,"%s: flag != UID && flag != GID", __FUNCTION__); |
1235 | 1235 | ||
@@ -1241,7 +1241,7 @@ static int get_uid_gid (int flag, const char *string) | |||
1241 | 1241 | ||
1242 | if ( flag == GID && ( grp_ent = getgrnam (string) ) != NULL ) | 1242 | if ( flag == GID && ( grp_ent = getgrnam (string) ) != NULL ) |
1243 | return (grp_ent->gr_gid); | 1243 | return (grp_ent->gr_gid); |
1244 | else if(ENABLE_DEVFSD_VERBOSE) | 1244 | else if(ENABLE_DEVFSD_VERBOSE) |
1245 | msg="group"; | 1245 | msg="group"; |
1246 | 1246 | ||
1247 | if(ENABLE_DEVFSD_VERBOSE) | 1247 | if(ENABLE_DEVFSD_VERBOSE) |
@@ -1264,7 +1264,7 @@ static mode_t get_mode (const char *string) | |||
1264 | return strtoul (string, NULL, 8); | 1264 | return strtoul (string, NULL, 8); |
1265 | if (strlen (string) != 9) | 1265 | if (strlen (string) != 9) |
1266 | msg_logger_and_die(LOG_ERR, "bad mode: %s", string); | 1266 | msg_logger_and_die(LOG_ERR, "bad mode: %s", string); |
1267 | 1267 | ||
1268 | mode = 0; | 1268 | mode = 0; |
1269 | i= S_IRUSR; | 1269 | i= S_IRUSR; |
1270 | while(i>0) | 1270 | while(i>0) |
@@ -1280,7 +1280,7 @@ static mode_t get_mode (const char *string) | |||
1280 | static void signal_handler (int sig) | 1280 | static void signal_handler (int sig) |
1281 | { | 1281 | { |
1282 | debug_msg_logger(LOG_INFO, __FUNCTION__); | 1282 | debug_msg_logger(LOG_INFO, __FUNCTION__); |
1283 | 1283 | ||
1284 | caught_signal = TRUE; | 1284 | caught_signal = TRUE; |
1285 | if (sig == SIGHUP) | 1285 | if (sig == SIGHUP) |
1286 | caught_sighup = TRUE; | 1286 | caught_sighup = TRUE; |
@@ -1301,7 +1301,7 @@ static const char *get_variable (const char *variable, void *info) | |||
1301 | 1301 | ||
1302 | if (gethostname (hostname, STRING_LENGTH - 1) != 0) | 1302 | if (gethostname (hostname, STRING_LENGTH - 1) != 0) |
1303 | msg_logger_and_die(LOG_ERR, "gethostname: %m"); | 1303 | msg_logger_and_die(LOG_ERR, "gethostname: %m"); |
1304 | 1304 | ||
1305 | /* Here on error we should do exit(RV_SYS_ERROR), instead we do exit(EXIT_FAILURE) */ | 1305 | /* Here on error we should do exit(RV_SYS_ERROR), instead we do exit(EXIT_FAILURE) */ |
1306 | hostname[STRING_LENGTH - 1] = '\0'; | 1306 | hostname[STRING_LENGTH - 1] = '\0'; |
1307 | 1307 | ||
@@ -1442,9 +1442,9 @@ static int make_dir_tree (const char *path) | |||
1442 | static int expand_expression(char *output, unsigned int outsize, | 1442 | static int expand_expression(char *output, unsigned int outsize, |
1443 | const char *input, | 1443 | const char *input, |
1444 | const char *(*get_variable_func)(const char *variable, void *info), | 1444 | const char *(*get_variable_func)(const char *variable, void *info), |
1445 | void *info, | 1445 | void *info, |
1446 | const char *devname, | 1446 | const char *devname, |
1447 | const regmatch_t *ex, unsigned int numexp) | 1447 | const regmatch_t *ex, unsigned int numexp) |
1448 | /* [SUMMARY] Expand environment variables and regular subexpressions in string. | 1448 | /* [SUMMARY] Expand environment variables and regular subexpressions in string. |
1449 | <output> The output expanded expression is written here. | 1449 | <output> The output expanded expression is written here. |
1450 | <length> The size of the output buffer. | 1450 | <length> The size of the output buffer. |
@@ -1632,7 +1632,7 @@ const char *get_old_name (const char *devname, unsigned int namelen, | |||
1632 | compat_name = buffer; | 1632 | compat_name = buffer; |
1633 | else | 1633 | else |
1634 | return NULL; | 1634 | return NULL; |
1635 | 1635 | ||
1636 | debug_msg_logger(LOG_INFO, "%s: scan_dev_name = %d", __FUNCTION__, i); | 1636 | debug_msg_logger(LOG_INFO, "%s: scan_dev_name = %d", __FUNCTION__, i); |
1637 | 1637 | ||
1638 | /* 1 == scsi/generic, 3 == scsi/cd, 10 == sbp/ */ | 1638 | /* 1 == scsi/generic, 3 == scsi/cd, 10 == sbp/ */ |
@@ -1677,10 +1677,10 @@ const char *get_old_name (const char *devname, unsigned int namelen, | |||
1677 | indexx = atoi (devname + 5); | 1677 | indexx = atoi (devname + 5); |
1678 | sprintf (buffer, fmt[i], (devname[4] == 'm') ? 'p' : 't', pty1[indexx >> 4], pty2[indexx & 0x0f]); | 1678 | sprintf (buffer, fmt[i], (devname[4] == 'm') ? 'p' : 't', pty1[indexx >> 4], pty2[indexx & 0x0f]); |
1679 | } | 1679 | } |
1680 | 1680 | ||
1681 | if(ENABLE_DEBUG && compat_name!=NULL) | 1681 | if(ENABLE_DEBUG && compat_name!=NULL) |
1682 | msg_logger(LOG_INFO, "%s: compat_name %s", __FUNCTION__, compat_name); | 1682 | msg_logger(LOG_INFO, "%s: compat_name %s", __FUNCTION__, compat_name); |
1683 | 1683 | ||
1684 | return (compat_name); | 1684 | return (compat_name); |
1685 | } /* End Function get_old_name */ | 1685 | } /* End Function get_old_name */ |
1686 | 1686 | ||
@@ -1692,7 +1692,7 @@ static char get_old_ide_name (unsigned int major, unsigned int minor) | |||
1692 | */ | 1692 | */ |
1693 | { | 1693 | { |
1694 | char letter='y'; /* 121 */ | 1694 | char letter='y'; /* 121 */ |
1695 | char c='a'; /* 97 */ | 1695 | char c='a'; /* 97 */ |
1696 | int i=IDE0_MAJOR; | 1696 | int i=IDE0_MAJOR; |
1697 | 1697 | ||
1698 | debug_msg_logger(LOG_INFO, __FUNCTION__); | 1698 | debug_msg_logger(LOG_INFO, __FUNCTION__); |
diff --git a/miscutils/eject.c b/miscutils/eject.c index 3f1d6ab44..511d8b204 100644 --- a/miscutils/eject.c +++ b/miscutils/eject.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <sys/ioctl.h> | 28 | #include <sys/ioctl.h> |
29 | #include <unistd.h> | 29 | #include <unistd.h> |
30 | #include <sys/mount.h> | 30 | #include <sys/mount.h> |
31 | #include <mntent.h> | 31 | #include <mntent.h> |
32 | #include "busybox.h" | 32 | #include "busybox.h" |
33 | 33 | ||
34 | /* various defines swiped from linux/cdrom.h */ | 34 | /* various defines swiped from linux/cdrom.h */ |
@@ -41,16 +41,16 @@ extern int eject_main(int argc, char **argv) | |||
41 | unsigned long flags; | 41 | unsigned long flags; |
42 | char *device; | 42 | char *device; |
43 | struct mntent *m; | 43 | struct mntent *m; |
44 | 44 | ||
45 | flags = bb_getopt_ulflags(argc, argv, "t"); | 45 | flags = bb_getopt_ulflags(argc, argv, "t"); |
46 | device=argv[optind] ? : DEFAULT_CDROM; | 46 | device=argv[optind] ? : DEFAULT_CDROM; |
47 | 47 | ||
48 | if((m = find_mount_point(device, bb_path_mtab_file))) { | 48 | if((m = find_mount_point(device, bb_path_mtab_file))) { |
49 | if(umount(m->mnt_dir)) | 49 | if(umount(m->mnt_dir)) |
50 | bb_error_msg_and_die("Can't umount"); | 50 | bb_error_msg_and_die("Can't umount"); |
51 | else if(ENABLE_FEATURE_MTAB_SUPPORT) erase_mtab(m->mnt_fsname); | 51 | else if(ENABLE_FEATURE_MTAB_SUPPORT) erase_mtab(m->mnt_fsname); |
52 | } | 52 | } |
53 | if (ioctl(bb_xopen( device, (O_RDONLY | O_NONBLOCK)), | 53 | if (ioctl(bb_xopen( device, (O_RDONLY | O_NONBLOCK)), |
54 | ( flags ? CDROMCLOSETRAY : CDROMEJECT))) | 54 | ( flags ? CDROMCLOSETRAY : CDROMEJECT))) |
55 | { | 55 | { |
56 | bb_perror_msg_and_die(device); | 56 | bb_perror_msg_and_die(device); |
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c index 04ce073db..4bf0d45ce 100644 --- a/miscutils/hdparm.c +++ b/miscutils/hdparm.c | |||
@@ -74,8 +74,8 @@ | |||
74 | #define RW_LONG 22 /* extra bytes in R/W LONG cmd ( < ATA-4)*/ | 74 | #define RW_LONG 22 /* extra bytes in R/W LONG cmd ( < ATA-4)*/ |
75 | #define START_FW_REV 23 /* ASCII firmware revision */ | 75 | #define START_FW_REV 23 /* ASCII firmware revision */ |
76 | #define LENGTH_FW_REV 4 /* 4 words (8 bytes or characters) */ | 76 | #define LENGTH_FW_REV 4 /* 4 words (8 bytes or characters) */ |
77 | #define START_MODEL 27 /* ASCII model number */ | 77 | #define START_MODEL 27 /* ASCII model number */ |
78 | #define LENGTH_MODEL 20 /* 20 words (40 bytes or characters) */ | 78 | #define LENGTH_MODEL 20 /* 20 words (40 bytes or characters) */ |
79 | #define SECTOR_XFER_MAX 47 /* r/w multiple: max sectors xfered */ | 79 | #define SECTOR_XFER_MAX 47 /* r/w multiple: max sectors xfered */ |
80 | #define DWORD_IO 48 /* can do double-word IO (ATA-1 only) */ | 80 | #define DWORD_IO 48 /* can do double-word IO (ATA-1 only) */ |
81 | #define CAPAB_0 49 /* capabilities */ | 81 | #define CAPAB_0 49 /* capabilities */ |
@@ -121,12 +121,12 @@ | |||
121 | in low byte, 0x40 in high byte. */ | 121 | in low byte, 0x40 in high byte. */ |
122 | #define PSWD_CODE 92 /* master password revision code */ | 122 | #define PSWD_CODE 92 /* master password revision code */ |
123 | #define HWRST_RSLT 93 /* hardware reset result */ | 123 | #define HWRST_RSLT 93 /* hardware reset result */ |
124 | #define ACOUSTIC 94 /* acoustic mgmt values ( >= ATA-6) */ | 124 | #define ACOUSTIC 94 /* acoustic mgmt values ( >= ATA-6) */ |
125 | #define LBA_LSB 100 /* LBA: maximum. Currently only 48 */ | 125 | #define LBA_LSB 100 /* LBA: maximum. Currently only 48 */ |
126 | #define LBA_MID 101 /* bits are used, but addr 103 */ | 126 | #define LBA_MID 101 /* bits are used, but addr 103 */ |
127 | #define LBA_48_MSB 102 /* has been reserved for LBA in */ | 127 | #define LBA_48_MSB 102 /* has been reserved for LBA in */ |
128 | #define LBA_64_MSB 103 /* the future. */ | 128 | #define LBA_64_MSB 103 /* the future. */ |
129 | #define RM_STAT 127 /* removable media status notification feature set support */ | 129 | #define RM_STAT 127 /* removable media status notification feature set support */ |
130 | #define SECU_STATUS 128 /* security status */ | 130 | #define SECU_STATUS 128 /* security status */ |
131 | #define CFA_PWR_MODE 160 /* CFA power mode 1 */ | 131 | #define CFA_PWR_MODE 160 /* CFA power mode 1 */ |
132 | #define START_MEDIA 176 /* media serial number */ | 132 | #define START_MEDIA 176 /* media serial number */ |
@@ -229,7 +229,7 @@ static const char * const ata1_cfg_str[] = { /* word 0 in ATA-1 mode */ | |||
229 | */ | 229 | */ |
230 | #define STBY_NID_VAL 0x37c8 /* (a) and (b) */ | 230 | #define STBY_NID_VAL 0x37c8 /* (a) and (b) */ |
231 | #define STBY_ID_VAL 0x738c /* (a) and not (b) */ | 231 | #define STBY_ID_VAL 0x738c /* (a) and not (b) */ |
232 | #define PWRD_NID_VAL 0x8c73 /* not (a) and (b) */ | 232 | #define PWRD_NID_VAL 0x8c73 /* not (a) and (b) */ |
233 | #define PWRD_ID_VAL 0xc837 /* not (a) and not (b) */ | 233 | #define PWRD_ID_VAL 0xc837 /* not (a) and not (b) */ |
234 | 234 | ||
235 | /* words 47 & 59: sector_xfer_max & sector_xfer_cur */ | 235 | /* words 47 & 59: sector_xfer_max & sector_xfer_cur */ |
@@ -237,7 +237,7 @@ static const char * const ata1_cfg_str[] = { /* word 0 in ATA-1 mode */ | |||
237 | #define MULTIPLE_SETTING_VALID 0x0100 /* 1=multiple sector setting is valid */ | 237 | #define MULTIPLE_SETTING_VALID 0x0100 /* 1=multiple sector setting is valid */ |
238 | 238 | ||
239 | /* word 49: capabilities 0 */ | 239 | /* word 49: capabilities 0 */ |
240 | #define STD_STBY 0x2000 /* 1=standard values supported (ATA); | 240 | #define STD_STBY 0x2000 /* 1=standard values supported (ATA); |
241 | 0=vendor specific values */ | 241 | 0=vendor specific values */ |
242 | #define IORDY_SUP 0x0800 /* 1=support; 0=may be supported */ | 242 | #define IORDY_SUP 0x0800 /* 1=support; 0=may be supported */ |
243 | #define IORDY_OFF 0x0400 /* 1=may be disabled */ | 243 | #define IORDY_OFF 0x0400 /* 1=may be disabled */ |
@@ -255,7 +255,7 @@ static const char * const ata1_cfg_str[] = { /* word 0 in ATA-1 mode */ | |||
255 | #define MODE 0xff00 /* the mode is in the MSBs */ | 255 | #define MODE 0xff00 /* the mode is in the MSBs */ |
256 | 256 | ||
257 | /* word 53: whats_valid */ | 257 | /* word 53: whats_valid */ |
258 | #define OK_W88 0x0004 /* the ultra_dma info is valid */ | 258 | #define OK_W88 0x0004 /* the ultra_dma info is valid */ |
259 | #define OK_W64_70 0x0002 /* see above for word descriptions */ | 259 | #define OK_W64_70 0x0002 /* see above for word descriptions */ |
260 | #define OK_W54_58 0x0001 /* current cyl, head, sector, cap. info valid */ | 260 | #define OK_W54_58 0x0001 /* current cyl, head, sector, cap. info valid */ |
261 | 261 | ||
@@ -314,25 +314,25 @@ static const char * const minor_str[] = { /* word 81 value: */ | |||
314 | #endif | 314 | #endif |
315 | static const char actual_ver[] = { | 315 | static const char actual_ver[] = { |
316 | /* word 81 value: */ | 316 | /* word 81 value: */ |
317 | 0, /* 0x0000 WARNING: */ | 317 | 0, /* 0x0000 WARNING: */ |
318 | 1, /* 0x0001 WARNING: */ | 318 | 1, /* 0x0001 WARNING: */ |
319 | 1, /* 0x0002 WARNING: */ | 319 | 1, /* 0x0002 WARNING: */ |
320 | 1, /* 0x0003 WARNING: */ | 320 | 1, /* 0x0003 WARNING: */ |
321 | 2, /* 0x0004 WARNING: This array */ | 321 | 2, /* 0x0004 WARNING: This array */ |
322 | 2, /* 0x0005 WARNING: corresponds */ | 322 | 2, /* 0x0005 WARNING: corresponds */ |
323 | 3, /* 0x0006 WARNING: *exactly* */ | 323 | 3, /* 0x0006 WARNING: *exactly* */ |
324 | 2, /* 0x0007 WARNING: to the ATA/ */ | 324 | 2, /* 0x0007 WARNING: to the ATA/ */ |
325 | 3, /* 0x0008 WARNING: ATAPI version */ | 325 | 3, /* 0x0008 WARNING: ATAPI version */ |
326 | 2, /* 0x0009 WARNING: listed in */ | 326 | 2, /* 0x0009 WARNING: listed in */ |
327 | 3, /* 0x000a WARNING: the */ | 327 | 3, /* 0x000a WARNING: the */ |
328 | 3, /* 0x000b WARNING: minor_str */ | 328 | 3, /* 0x000b WARNING: minor_str */ |
329 | 3, /* 0x000c WARNING: array */ | 329 | 3, /* 0x000c WARNING: array */ |
330 | 4, /* 0x000d WARNING: above. */ | 330 | 4, /* 0x000d WARNING: above. */ |
331 | 4, /* 0x000e WARNING: */ | 331 | 4, /* 0x000e WARNING: */ |
332 | 4, /* 0x000f WARNING: if you change */ | 332 | 4, /* 0x000f WARNING: if you change */ |
333 | 4, /* 0x0010 WARNING: that one, */ | 333 | 4, /* 0x0010 WARNING: that one, */ |
334 | 4, /* 0x0011 WARNING: change this one */ | 334 | 4, /* 0x0011 WARNING: change this one */ |
335 | 4, /* 0x0012 WARNING: too!!! */ | 335 | 4, /* 0x0012 WARNING: too!!! */ |
336 | 5, /* 0x0013 WARNING: */ | 336 | 5, /* 0x0013 WARNING: */ |
337 | 4, /* 0x0014 WARNING: */ | 337 | 4, /* 0x0014 WARNING: */ |
338 | 5, /* 0x0015 WARNING: */ | 338 | 5, /* 0x0015 WARNING: */ |
@@ -343,7 +343,7 @@ static const char actual_ver[] = { | |||
343 | 0, /* 0x001a WARNING: */ | 343 | 0, /* 0x001a WARNING: */ |
344 | 6, /* 0x001b WARNING: */ | 344 | 6, /* 0x001b WARNING: */ |
345 | 6, /* 0x001c WARNING: */ | 345 | 6, /* 0x001c WARNING: */ |
346 | 0 /* 0x001d-0xfffe */ | 346 | 0 /* 0x001d-0xfffe */ |
347 | }; | 347 | }; |
348 | 348 | ||
349 | /* words 82-84: cmds/feats supported */ | 349 | /* words 82-84: cmds/feats supported */ |
@@ -387,7 +387,7 @@ static const char * const cmd_feat_str[] = { | |||
387 | "Adv. Power Management feature set",/* word 83 bit 3 */ | 387 | "Adv. Power Management feature set",/* word 83 bit 3 */ |
388 | "CFA feature set", /* word 83 bit 2 */ | 388 | "CFA feature set", /* word 83 bit 2 */ |
389 | "READ/WRITE DMA QUEUED", /* word 83 bit 1 */ | 389 | "READ/WRITE DMA QUEUED", /* word 83 bit 1 */ |
390 | "DOWNLOAD MICROCODE cmd", /* word 83 bit 0 */ | 390 | "DOWNLOAD MICROCODE cmd", /* word 83 bit 0 */ |
391 | /* --------------*/ | 391 | /* --------------*/ |
392 | "", /* word 84 bit 15: !valid bit */ | 392 | "", /* word 84 bit 15: !valid bit */ |
393 | "", /* word 84 bit 14: valid bit */ | 393 | "", /* word 84 bit 14: valid bit */ |
@@ -428,7 +428,7 @@ static const char * const cmd_feat_str[] = { | |||
428 | #define CSEL_VAL 0x0004 /* device num determined by CSEL_VAL */ | 428 | #define CSEL_VAL 0x0004 /* device num determined by CSEL_VAL */ |
429 | 429 | ||
430 | /* word 127: removable media status notification feature set support */ | 430 | /* word 127: removable media status notification feature set support */ |
431 | #define RM_STAT_BITS 0x0003 | 431 | #define RM_STAT_BITS 0x0003 |
432 | #define RM_STAT_SUP 0x0001 | 432 | #define RM_STAT_SUP 0x0001 |
433 | 433 | ||
434 | /* word 128: security */ | 434 | /* word 128: security */ |
@@ -774,7 +774,7 @@ static void identify (uint16_t *id_supplied, const char *devname) | |||
774 | like_std = 6; | 774 | like_std = 6; |
775 | } | 775 | } |
776 | else if(((std == 4) || (!std && (like_std < 5))) && | 776 | else if(((std == 4) || (!std && (like_std < 5))) && |
777 | ((((val[INTEGRITY] & SIG) == SIG_VAL) && !chksum) || | 777 | ((((val[INTEGRITY] & SIG) == SIG_VAL) && !chksum) || |
778 | (( val[HWRST_RSLT] & VALID) == VALID_VAL) || | 778 | (( val[HWRST_RSLT] & VALID) == VALID_VAL) || |
779 | ((( val[CMDS_SUPP_1] & VALID) == VALID_VAL) && | 779 | ((( val[CMDS_SUPP_1] & VALID) == VALID_VAL) && |
780 | (( val[CMDS_SUPP_1] & CMDS_W83) > 0x001f)) ) ) | 780 | (( val[CMDS_SUPP_1] & CMDS_W83) > 0x001f)) ) ) |
@@ -805,14 +805,14 @@ static void identify (uint16_t *id_supplied, const char *devname) | |||
805 | if(!std) | 805 | if(!std) |
806 | printf("\n\tLikely used: %u\n",like_std); | 806 | printf("\n\tLikely used: %u\n",like_std); |
807 | else if(like_std > std) | 807 | else if(like_std > std) |
808 | printf("& some of %u\n",like_std); | 808 | printf("& some of %u\n",like_std); |
809 | else | 809 | else |
810 | printf("\n"); | 810 | printf("\n"); |
811 | } | 811 | } |
812 | else | 812 | else |
813 | { | 813 | { |
814 | /* TBD: do CDROM stuff more thoroughly. For now... */ | 814 | /* TBD: do CDROM stuff more thoroughly. For now... */ |
815 | kk = 0; | 815 | kk = 0; |
816 | if(val[CDR_MINOR] == 9) | 816 | if(val[CDR_MINOR] == 9) |
817 | { | 817 | { |
818 | kk = 1; | 818 | kk = 1; |
@@ -886,7 +886,7 @@ static void identify (uint16_t *id_supplied, const char *devname) | |||
886 | ll = (uint32_t)val[LBA_SECTS_MSB] << 16 | val[LBA_SECTS_LSB]; | 886 | ll = (uint32_t)val[LBA_SECTS_MSB] << 16 | val[LBA_SECTS_LSB]; |
887 | mm = 0; bbbig = 0; | 887 | mm = 0; bbbig = 0; |
888 | if ( (ll > 0x00FBFC10) && (!val[LCYLS])) | 888 | if ( (ll > 0x00FBFC10) && (!val[LCYLS])) |
889 | printf("\tCHS addressing not supported\n"); | 889 | printf("\tCHS addressing not supported\n"); |
890 | else | 890 | else |
891 | { | 891 | { |
892 | jj = val[WHATS_VALID] & OK_W54_58; | 892 | jj = val[WHATS_VALID] & OK_W54_58; |
@@ -915,9 +915,9 @@ static void identify (uint16_t *id_supplied, const char *devname) | |||
915 | if( ((val[CMDS_SUPP_1] & VALID) == VALID_VAL) && | 915 | if( ((val[CMDS_SUPP_1] & VALID) == VALID_VAL) && |
916 | (val[CMDS_SUPP_1] & SUPPORT_48_BIT) ) | 916 | (val[CMDS_SUPP_1] & SUPPORT_48_BIT) ) |
917 | { | 917 | { |
918 | bbbig = (__u64)val[LBA_64_MSB] << 48 | | 918 | bbbig = (__u64)val[LBA_64_MSB] << 48 | |
919 | (__u64)val[LBA_48_MSB] << 32 | | 919 | (__u64)val[LBA_48_MSB] << 32 | |
920 | (__u64)val[LBA_MID] << 16 | | 920 | (__u64)val[LBA_MID] << 16 | |
921 | val[LBA_LSB] ; | 921 | val[LBA_LSB] ; |
922 | printf("\tLBA48 user addressable sectors:%11llu\n",bbbig); | 922 | printf("\tLBA48 user addressable sectors:%11llu\n",bbbig); |
923 | } | 923 | } |
@@ -1081,7 +1081,7 @@ static void identify (uint16_t *id_supplied, const char *devname) | |||
1081 | 1081 | ||
1082 | /* Programmed IO stuff */ | 1082 | /* Programmed IO stuff */ |
1083 | printf("\tPIO: "); | 1083 | printf("\tPIO: "); |
1084 | /* If a drive supports mode n (e.g. 3), it also supports all modes less | 1084 | /* If a drive supports mode n (e.g. 3), it also supports all modes less |
1085 | * than n (e.g. 3, 2, 1 and 0). Print all the modes. */ | 1085 | * than n (e.g. 3, 2, 1 and 0). Print all the modes. */ |
1086 | if((val[WHATS_VALID] & OK_W64_70) && (val[ADV_PIO_MODES] & PIO_SUP)) | 1086 | if((val[WHATS_VALID] & OK_W64_70) && (val[ADV_PIO_MODES] & PIO_SUP)) |
1087 | { | 1087 | { |
@@ -1349,8 +1349,8 @@ static void dump_identity (const struct hd_driveid *id) | |||
1349 | capacity = (id->cur_capacity1 << 16) | id->cur_capacity0; | 1349 | capacity = (id->cur_capacity1 << 16) | id->cur_capacity0; |
1350 | #endif | 1350 | #endif |
1351 | printf(" CurCHS=%u/%u/%u, CurSects=%lu, LBA=%s",id->cur_cyls, id->cur_heads, | 1351 | printf(" CurCHS=%u/%u/%u, CurSects=%lu, LBA=%s",id->cur_cyls, id->cur_heads, |
1352 | id->cur_sectors, capacity , | 1352 | id->cur_sectors, capacity , |
1353 | ((id->capability&2)==0)?"no":"yes"); | 1353 | ((id->capability&2)==0)?"no":"yes"); |
1354 | 1354 | ||
1355 | if_printf((id->capability&2),", LBAsects=%u", id->lba_capacity); | 1355 | if_printf((id->capability&2),", LBAsects=%u", id->lba_capacity); |
1356 | 1356 | ||
@@ -1363,7 +1363,7 @@ static void dump_identity (const struct hd_driveid *id) | |||
1363 | if_strcat((id->dma_1word & 0x200), dmodes, "*"); | 1363 | if_strcat((id->dma_1word & 0x200), dmodes, "*"); |
1364 | if_strcat((id->dma_1word & 2), dmodes, "sdma1 "); | 1364 | if_strcat((id->dma_1word & 2), dmodes, "sdma1 "); |
1365 | if_strcat((id->dma_1word & 0x400), dmodes, "*"); | 1365 | if_strcat((id->dma_1word & 0x400), dmodes, "*"); |
1366 | if_strcat((id->dma_1word & 4), dmodes, "sdma2 "); | 1366 | if_strcat((id->dma_1word & 4), dmodes, "sdma2 "); |
1367 | if_strcat((id->dma_1word & 0xf800), dmodes, "*"); | 1367 | if_strcat((id->dma_1word & 0xf800), dmodes, "*"); |
1368 | if_strcat((id->dma_1word & 0xf8), dmodes, "sdma? "); | 1368 | if_strcat((id->dma_1word & 0xf8), dmodes, "sdma? "); |
1369 | if_strcat((id->dma_mword & 0x100), dmodes, "*"); | 1369 | if_strcat((id->dma_mword & 0x100), dmodes, "*"); |
@@ -2346,7 +2346,7 @@ static void process_dev (char *devname) | |||
2346 | no_scsi(); | 2346 | no_scsi(); |
2347 | if (ioctl(fd, HDIO_DRIVE_CMD, &args) | 2347 | if (ioctl(fd, HDIO_DRIVE_CMD, &args) |
2348 | && (args[0] = WIN_CHECKPOWERMODE2) /* try again with 0x98 */ | 2348 | && (args[0] = WIN_CHECKPOWERMODE2) /* try again with 0x98 */ |
2349 | && ioctl(fd, HDIO_DRIVE_CMD, &args)) | 2349 | && ioctl(fd, HDIO_DRIVE_CMD, &args)) |
2350 | { | 2350 | { |
2351 | if (errno != EIO || args[0] != 0 || args[1] != 0) | 2351 | if (errno != EIO || args[0] != 0 || args[1] != 0) |
2352 | state = "unknown"; | 2352 | state = "unknown"; |
@@ -2456,7 +2456,7 @@ identify_abort: | |||
2456 | 2456 | ||
2457 | 2457 | ||
2458 | if (do_ctimings) | 2458 | if (do_ctimings) |
2459 | do_time(0,fd); /*time cache */ | 2459 | do_time(0,fd); /*time cache */ |
2460 | if (do_timings) | 2460 | if (do_timings) |
2461 | do_time(1,fd); /*time device */ | 2461 | do_time(1,fd); /*time device */ |
2462 | if (do_flush) | 2462 | if (do_flush) |
diff --git a/miscutils/mountpoint.c b/miscutils/mountpoint.c index 771df5588..38c654c6d 100644 --- a/miscutils/mountpoint.c +++ b/miscutils/mountpoint.c | |||
@@ -47,7 +47,7 @@ int mountpoint_main(int argc, char **argv) | |||
47 | dev_t st_dev = st.st_dev; | 47 | dev_t st_dev = st.st_dev; |
48 | ino_t st_ino = st.st_ino; | 48 | ino_t st_ino = st.st_ino; |
49 | char *p = bb_xasprintf("%s/..", arg); | 49 | char *p = bb_xasprintf("%s/..", arg); |
50 | 50 | ||
51 | if (stat(p, &st) == 0) { | 51 | if (stat(p, &st) == 0) { |
52 | short ret = (st_dev != st.st_dev) || | 52 | short ret = (st_dev != st.st_dev) || |
53 | (st_dev == st.st_dev && st_ino == st.st_ino); | 53 | (st_dev == st.st_dev && st_ino == st.st_ino); |
diff --git a/miscutils/setsid.c b/miscutils/setsid.c index 7df35be3b..8061896f5 100644 --- a/miscutils/setsid.c +++ b/miscutils/setsid.c | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | int | 21 | int |
22 | setsid_main(int argc, char *argv[]) { | 22 | setsid_main(int argc, char *argv[]) { |
23 | 23 | ||
24 | if (argc < 2) { | 24 | if (argc < 2) { |
25 | bb_show_usage(); | 25 | bb_show_usage(); |
26 | } | 26 | } |
diff --git a/miscutils/strings.c b/miscutils/strings.c index 111aa94ba..df7ff093b 100644 --- a/miscutils/strings.c +++ b/miscutils/strings.c | |||
@@ -47,23 +47,23 @@ int strings_main(int argc, char **argv) | |||
47 | char *string; | 47 | char *string; |
48 | const char *fmt = "%s: "; | 48 | const char *fmt = "%s: "; |
49 | char *n_arg = "4"; | 49 | char *n_arg = "4"; |
50 | 50 | ||
51 | opt = bb_getopt_ulflags (argc, argv, "afon:", &n_arg); | 51 | opt = bb_getopt_ulflags (argc, argv, "afon:", &n_arg); |
52 | /* -a is our default behaviour */ | 52 | /* -a is our default behaviour */ |
53 | 53 | ||
54 | argc -= optind; | 54 | argc -= optind; |
55 | argv += optind; | 55 | argv += optind; |
56 | 56 | ||
57 | n = bb_xgetlarg(n_arg, 10, 1, INT_MAX); | 57 | n = bb_xgetlarg(n_arg, 10, 1, INT_MAX); |
58 | string = xcalloc(n + 1, 1); | 58 | string = xcalloc(n + 1, 1); |
59 | n--; | 59 | n--; |
60 | 60 | ||
61 | if ( argc == 0) { | 61 | if ( argc == 0) { |
62 | fmt = "{%s}: "; | 62 | fmt = "{%s}: "; |
63 | *argv = (char *)bb_msg_standard_input; | 63 | *argv = (char *)bb_msg_standard_input; |
64 | goto PIPE; | 64 | goto PIPE; |
65 | } | 65 | } |
66 | 66 | ||
67 | do { | 67 | do { |
68 | if ((file = bb_wfopen(*argv, "r"))) { | 68 | if ((file = bb_wfopen(*argv, "r"))) { |
69 | PIPE: | 69 | PIPE: |
diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c index 4b00e50c6..944288d29 100644 --- a/miscutils/watchdog.c +++ b/miscutils/watchdog.c | |||
@@ -29,7 +29,7 @@ static void watchdog_shutdown(int unused) | |||
29 | 29 | ||
30 | int watchdog_main(int argc, char **argv) | 30 | int watchdog_main(int argc, char **argv) |
31 | { | 31 | { |
32 | 32 | ||
33 | char *t_arg; | 33 | char *t_arg; |
34 | unsigned long flags; | 34 | unsigned long flags; |
35 | flags = bb_getopt_ulflags(argc, argv, "t:", &t_arg); | 35 | flags = bb_getopt_ulflags(argc, argv, "t:", &t_arg); |
diff --git a/modutils/Config.in b/modutils/Config.in index 8f23be836..b04988c7a 100644 --- a/modutils/Config.in +++ b/modutils/Config.in | |||
@@ -75,9 +75,9 @@ config CONFIG_LSMOD | |||
75 | config CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT | 75 | config CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT |
76 | bool "lsmod pretty output for 2.6.x Linux kernels " | 76 | bool "lsmod pretty output for 2.6.x Linux kernels " |
77 | default n | 77 | default n |
78 | depends on CONFIG_LSMOD | 78 | depends on CONFIG_LSMOD |
79 | help | 79 | help |
80 | This option makes output format of lsmod adjusted to | 80 | This option makes output format of lsmod adjusted to |
81 | the format of module-init-tools for Linux kernel 2.6. | 81 | the format of module-init-tools for Linux kernel 2.6. |
82 | 82 | ||
83 | config CONFIG_MODPROBE | 83 | config CONFIG_MODPROBE |
diff --git a/modutils/insmod.c b/modutils/insmod.c index 79bdebd2c..390a50316 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c | |||
@@ -295,7 +295,7 @@ extern int insmod_ng_main( int argc, char **argv); | |||
295 | #define CONFIG_PLT_ENTRY_SIZE 8 | 295 | #define CONFIG_PLT_ENTRY_SIZE 8 |
296 | #define CONFIG_USE_SINGLE | 296 | #define CONFIG_USE_SINGLE |
297 | #ifndef EM_CYGNUS_V850 /* grumble */ | 297 | #ifndef EM_CYGNUS_V850 /* grumble */ |
298 | #define EM_CYGNUS_V850 0x9080 | 298 | #define EM_CYGNUS_V850 0x9080 |
299 | #endif | 299 | #endif |
300 | #define SYMBOL_PREFIX "_" | 300 | #define SYMBOL_PREFIX "_" |
301 | #endif | 301 | #endif |
@@ -695,7 +695,7 @@ static int obj_gpl_license(struct obj_file *f, const char **license); | |||
695 | #ifdef SYMBOL_PREFIX | 695 | #ifdef SYMBOL_PREFIX |
696 | #define SPFX SYMBOL_PREFIX | 696 | #define SPFX SYMBOL_PREFIX |
697 | #else | 697 | #else |
698 | #define SPFX "" | 698 | #define SPFX "" |
699 | #endif | 699 | #endif |
700 | 700 | ||
701 | 701 | ||
diff --git a/modutils/lsmod.c b/modutils/lsmod.c index 3d9f700fb..018bc5323 100644 --- a/modutils/lsmod.c +++ b/modutils/lsmod.c | |||
@@ -173,7 +173,7 @@ extern int lsmod_main(int argc, char **argv) | |||
173 | 173 | ||
174 | while (fgets(line, sizeof(line), file)) { | 174 | while (fgets(line, sizeof(line), file)) { |
175 | char *tok; | 175 | char *tok; |
176 | 176 | ||
177 | tok = strtok(line, " \t"); | 177 | tok = strtok(line, " \t"); |
178 | printf("%-19s", tok); | 178 | printf("%-19s", tok); |
179 | tok = strtok(NULL, " \t\n"); | 179 | tok = strtok(NULL, " \t\n"); |
diff --git a/modutils/rmmod.c b/modutils/rmmod.c index 7bc929de2..44c606e47 100644 --- a/modutils/rmmod.c +++ b/modutils/rmmod.c | |||
@@ -60,7 +60,7 @@ extern int rmmod_main(int argc, char **argv) | |||
60 | int n, ret = EXIT_SUCCESS; | 60 | int n, ret = EXIT_SUCCESS; |
61 | unsigned int flags = O_NONBLOCK|O_EXCL; | 61 | unsigned int flags = O_NONBLOCK|O_EXCL; |
62 | #ifdef CONFIG_FEATURE_QUERY_MODULE_INTERFACE | 62 | #ifdef CONFIG_FEATURE_QUERY_MODULE_INTERFACE |
63 | /* bb_common_bufsiz1 hold the module names which we ignore | 63 | /* bb_common_bufsiz1 hold the module names which we ignore |
64 | but must get */ | 64 | but must get */ |
65 | size_t bufsize = sizeof(bb_common_bufsiz1); | 65 | size_t bufsize = sizeof(bb_common_bufsiz1); |
66 | #endif | 66 | #endif |
@@ -76,7 +76,7 @@ extern int rmmod_main(int argc, char **argv) | |||
76 | /* until the number of modules does not change */ | 76 | /* until the number of modules does not change */ |
77 | size_t nmod = 0; /* number of modules */ | 77 | size_t nmod = 0; /* number of modules */ |
78 | size_t pnmod = -1; /* previous number of modules */ | 78 | size_t pnmod = -1; /* previous number of modules */ |
79 | 79 | ||
80 | while (nmod != pnmod) { | 80 | while (nmod != pnmod) { |
81 | if (syscall(__NR_delete_module, NULL, flags) != 0) { | 81 | if (syscall(__NR_delete_module, NULL, flags) != 0) { |
82 | if (errno==EFAULT) | 82 | if (errno==EFAULT) |
@@ -101,7 +101,7 @@ extern int rmmod_main(int argc, char **argv) | |||
101 | #ifdef CONFIG_FEATURE_2_6_MODULES | 101 | #ifdef CONFIG_FEATURE_2_6_MODULES |
102 | const char *afterslash; | 102 | const char *afterslash; |
103 | char *module_name; | 103 | char *module_name; |
104 | 104 | ||
105 | afterslash = strrchr(argv[n], '/'); | 105 | afterslash = strrchr(argv[n], '/'); |
106 | if (!afterslash) | 106 | if (!afterslash) |
107 | afterslash = argv[n]; | 107 | afterslash = argv[n]; |
diff --git a/networking/ether-wake.c b/networking/ether-wake.c index 9ea5c0366..7d5f79b6a 100644 --- a/networking/ether-wake.c +++ b/networking/ether-wake.c | |||
@@ -14,53 +14,53 @@ | |||
14 | /* full usage according Donald Becker | 14 | /* full usage according Donald Becker |
15 | * usage: ether-wake [-i <ifname>] [-p aa:bb:cc:dd[:ee:ff]] 00:11:22:33:44:55\n" | 15 | * usage: ether-wake [-i <ifname>] [-p aa:bb:cc:dd[:ee:ff]] 00:11:22:33:44:55\n" |
16 | * | 16 | * |
17 | * This program generates and transmits a Wake-On-LAN (WOL)\n" | 17 | * This program generates and transmits a Wake-On-LAN (WOL)\n" |
18 | * \"Magic Packet\", used for restarting machines that have been\n" | 18 | * \"Magic Packet\", used for restarting machines that have been\n" |
19 | * soft-powered-down (ACPI D3-warm state).\n" | 19 | * soft-powered-down (ACPI D3-warm state).\n" |
20 | * It currently generates the standard AMD Magic Packet format, with\n" | 20 | * It currently generates the standard AMD Magic Packet format, with\n" |
21 | * an optional password appended.\n" | 21 | * an optional password appended.\n" |
22 | * | 22 | * |
23 | * The single required parameter is the Ethernet MAC (station) address\n" | 23 | * The single required parameter is the Ethernet MAC (station) address\n" |
24 | * of the machine to wake or a host ID with known NSS 'ethers' entry.\n" | 24 | * of the machine to wake or a host ID with known NSS 'ethers' entry.\n" |
25 | * The MAC address may be found with the 'arp' program while the target\n" | 25 | * The MAC address may be found with the 'arp' program while the target\n" |
26 | * machine is awake.\n" | 26 | * machine is awake.\n" |
27 | * | 27 | * |
28 | * Options:\n" | 28 | * Options:\n" |
29 | * -b Send wake-up packet to the broadcast address.\n" | 29 | * -b Send wake-up packet to the broadcast address.\n" |
30 | * -D Increase the debug level.\n" | 30 | * -D Increase the debug level.\n" |
31 | * -i ifname Use interface IFNAME instead of the default 'eth0'.\n" | 31 | * -i ifname Use interface IFNAME instead of the default 'eth0'.\n" |
32 | * -p <pw> Append the four or six byte password PW to the packet.\n" | 32 | * -p <pw> Append the four or six byte password PW to the packet.\n" |
33 | * A password is only required for a few adapter types.\n" | 33 | * A password is only required for a few adapter types.\n" |
34 | * The password may be specified in ethernet hex format\n" | 34 | * The password may be specified in ethernet hex format\n" |
35 | * or dotted decimal (Internet address)\n" | 35 | * or dotted decimal (Internet address)\n" |
36 | * -p 00:22:44:66:88:aa\n" | 36 | * -p 00:22:44:66:88:aa\n" |
37 | * -p 192.168.1.1\n"; | 37 | * -p 192.168.1.1\n"; |
38 | * | 38 | * |
39 | * | ||
40 | * This program generates and transmits a Wake-On-LAN (WOL) "Magic Packet", | ||
41 | * used for restarting machines that have been soft-powered-down | ||
42 | * (ACPI D3-warm state). It currently generates the standard AMD Magic Packet | ||
43 | * format, with an optional password appended. | ||
44 | * | ||
45 | * This software may be used and distributed according to the terms | ||
46 | * of the GNU Public License, incorporated herein by reference. | ||
47 | * Contact the author for use under other terms. | ||
48 | * | ||
49 | * This source file was originally part of the network tricks package, and | ||
50 | * is now distributed to support the Scyld Beowulf system. | ||
51 | * Copyright 1999-2003 Donald Becker and Scyld Computing Corporation. | ||
52 | * | ||
53 | * The author may be reached as becker@scyld, or C/O | ||
54 | * Scyld Computing Corporation | ||
55 | * 914 Bay Ridge Road, Suite 220 | ||
56 | * Annapolis MD 21403 | ||
39 | * | 57 | * |
40 | * This program generates and transmits a Wake-On-LAN (WOL) "Magic Packet", | ||
41 | * used for restarting machines that have been soft-powered-down | ||
42 | * (ACPI D3-warm state). It currently generates the standard AMD Magic Packet | ||
43 | * format, with an optional password appended. | ||
44 | * | ||
45 | * This software may be used and distributed according to the terms | ||
46 | * of the GNU Public License, incorporated herein by reference. | ||
47 | * Contact the author for use under other terms. | ||
48 | * | ||
49 | * This source file was originally part of the network tricks package, and | ||
50 | * is now distributed to support the Scyld Beowulf system. | ||
51 | * Copyright 1999-2003 Donald Becker and Scyld Computing Corporation. | ||
52 | * | ||
53 | * The author may be reached as becker@scyld, or C/O | ||
54 | * Scyld Computing Corporation | ||
55 | * 914 Bay Ridge Road, Suite 220 | ||
56 | * Annapolis MD 21403 | ||
57 | * | ||
58 | * Notes: | 58 | * Notes: |
59 | * On some systems dropping root capability allows the process to be | 59 | * On some systems dropping root capability allows the process to be |
60 | * dumped, traced or debugged. | 60 | * dumped, traced or debugged. |
61 | * If someone traces this program, they get control of a raw socket. | 61 | * If someone traces this program, they get control of a raw socket. |
62 | * Linux handles this safely, but beware when porting this program. | 62 | * Linux handles this safely, but beware when porting this program. |
63 | * | 63 | * |
64 | * An alternative to needing 'root' is using a UDP broadcast socket, however | 64 | * An alternative to needing 'root' is using a UDP broadcast socket, however |
65 | * doing so only works with adapters configured for unicast+broadcast Rx | 65 | * doing so only works with adapters configured for unicast+broadcast Rx |
66 | * filter. That configuration consumes more power. | 66 | * filter. That configuration consumes more power. |
diff --git a/networking/fakeidentd.c b/networking/fakeidentd.c index 40d5cf1b7..c7fb42fc4 100644 --- a/networking/fakeidentd.c +++ b/networking/fakeidentd.c | |||
@@ -55,7 +55,7 @@ static const int ident_substr_len = sizeof(ident_substr) - 1; | |||
55 | #define PIDFILE "/var/run/identd.pid" | 55 | #define PIDFILE "/var/run/identd.pid" |
56 | 56 | ||
57 | /* | 57 | /* |
58 | * We have to track the 'first connection socket' so that we | 58 | * We have to track the 'first connection socket' so that we |
59 | * don't go around closing file descriptors for non-clients. | 59 | * don't go around closing file descriptors for non-clients. |
60 | * | 60 | * |
61 | * descriptor setup normally | 61 | * descriptor setup normally |
diff --git a/networking/hostname.c b/networking/hostname.c index a00263d8f..8b9314c98 100644 --- a/networking/hostname.c +++ b/networking/hostname.c | |||
@@ -77,8 +77,8 @@ int hostname_main(int argc, char **argv) | |||
77 | if (argc < 1) | 77 | if (argc < 1) |
78 | bb_show_usage(); | 78 | bb_show_usage(); |
79 | 79 | ||
80 | while ((opt = getopt(argc, argv, "dfisF:")) > 0) { | 80 | while ((opt = getopt(argc, argv, "dfisF:")) > 0) { |
81 | switch (opt) { | 81 | switch (opt) { |
82 | case 'd': | 82 | case 'd': |
83 | case 'f': | 83 | case 'f': |
84 | case 'i': | 84 | case 'i': |
diff --git a/networking/ifupdown.c b/networking/ifupdown.c index 9dce445bd..34a43e6fa 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c | |||
@@ -471,8 +471,8 @@ static int static_up(struct interface_defn_t *ifd, execfn *exec) | |||
471 | return ((result == 3) ? 3 : 0); | 471 | return ((result == 3) ? 3 : 0); |
472 | #else | 472 | #else |
473 | result = execute("ifconfig %iface% %address% netmask %netmask% " | 473 | result = execute("ifconfig %iface% %address% netmask %netmask% " |
474 | "[[broadcast %broadcast%]] [[pointopoint %pointopoint%]] " | 474 | "[[broadcast %broadcast%]] [[pointopoint %pointopoint%]] " |
475 | "[[media %media%]] [[mtu %mtu%]] [[hw %hwaddress%]] up", | 475 | "[[media %media%]] [[mtu %mtu%]] [[hw %hwaddress%]] up", |
476 | ifd, exec); | 476 | ifd, exec); |
477 | result += execute("[[ route add default gw %gateway% %iface% ]]", ifd, exec); | 477 | result += execute("[[ route add default gw %gateway% %iface% ]]", ifd, exec); |
478 | return ((result == 2) ? 2 : 0); | 478 | return ((result == 2) ? 2 : 0); |
diff --git a/networking/inetd.c b/networking/inetd.c index 7a6ffae0c..9f6acdb98 100644 --- a/networking/inetd.c +++ b/networking/inetd.c | |||
@@ -1364,7 +1364,7 @@ inetd_main (int argc, char *argv[]) | |||
1364 | sigaction (SIGINT, &sa, NULL); | 1364 | sigaction (SIGINT, &sa, NULL); |
1365 | sa.sa_handler = SIG_IGN; | 1365 | sa.sa_handler = SIG_IGN; |
1366 | sigaction (SIGPIPE, &sa, &sapipe); | 1366 | sigaction (SIGPIPE, &sa, &sapipe); |
1367 | memset(&wait_mask, 0, sizeof(wait_mask)); | 1367 | memset(&wait_mask, 0, sizeof(wait_mask)); |
1368 | { | 1368 | { |
1369 | /* space for daemons to overwrite environment for ps */ | 1369 | /* space for daemons to overwrite environment for ps */ |
1370 | #define DUMMYSIZE 100 | 1370 | #define DUMMYSIZE 100 |
diff --git a/networking/interface.c b/networking/interface.c index 554dc16d0..ad6c40fc1 100644 --- a/networking/interface.c +++ b/networking/interface.c | |||
@@ -1039,9 +1039,9 @@ static char *get_name(char *name, char *p) | |||
1039 | * args. */ | 1039 | * args. */ |
1040 | 1040 | ||
1041 | /* static const char * const ss_fmt[] = { */ | 1041 | /* static const char * const ss_fmt[] = { */ |
1042 | /* "%Ln%Lu%lu%lu%lu%lu%ln%ln%Ln%Lu%lu%lu%lu%lu%lu", */ | 1042 | /* "%Ln%Lu%lu%lu%lu%lu%ln%ln%Ln%Lu%lu%lu%lu%lu%lu", */ |
1043 | /* "%Lu%Lu%lu%lu%lu%lu%ln%ln%Lu%Lu%lu%lu%lu%lu%lu", */ | 1043 | /* "%Lu%Lu%lu%lu%lu%lu%ln%ln%Lu%Lu%lu%lu%lu%lu%lu", */ |
1044 | /* "%Lu%Lu%lu%lu%lu%lu%lu%lu%Lu%Lu%lu%lu%lu%lu%lu%lu" */ | 1044 | /* "%Lu%Lu%lu%lu%lu%lu%lu%lu%Lu%Lu%lu%lu%lu%lu%lu%lu" */ |
1045 | /* }; */ | 1045 | /* }; */ |
1046 | 1046 | ||
1047 | /* Lie about the size of the int pointed to for %n. */ | 1047 | /* Lie about the size of the int pointed to for %n. */ |
diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c index c6115b356..c5e6e4ea5 100644 --- a/networking/libiproute/ipaddress.c +++ b/networking/libiproute/ipaddress.c | |||
@@ -54,8 +54,8 @@ static void print_link_flags(FILE *fp, unsigned flags, unsigned mdown) | |||
54 | fprintf(fp, "<"); | 54 | fprintf(fp, "<"); |
55 | flags &= ~IFF_RUNNING; | 55 | flags &= ~IFF_RUNNING; |
56 | #define _PF(f) if (flags&IFF_##f) { \ | 56 | #define _PF(f) if (flags&IFF_##f) { \ |
57 | flags &= ~IFF_##f ; \ | 57 | flags &= ~IFF_##f ; \ |
58 | fprintf(fp, #f "%s", flags ? "," : ""); } | 58 | fprintf(fp, #f "%s", flags ? "," : ""); } |
59 | _PF(LOOPBACK); | 59 | _PF(LOOPBACK); |
60 | _PF(BROADCAST); | 60 | _PF(BROADCAST); |
61 | _PF(POINTOPOINT); | 61 | _PF(POINTOPOINT); |
@@ -74,7 +74,7 @@ static void print_link_flags(FILE *fp, unsigned flags, unsigned mdown) | |||
74 | #endif | 74 | #endif |
75 | _PF(UP); | 75 | _PF(UP); |
76 | #undef _PF | 76 | #undef _PF |
77 | if (flags) | 77 | if (flags) |
78 | fprintf(fp, "%x", flags); | 78 | fprintf(fp, "%x", flags); |
79 | if (mdown) | 79 | if (mdown) |
80 | fprintf(fp, ",M-DOWN"); | 80 | fprintf(fp, ",M-DOWN"); |
@@ -636,9 +636,9 @@ static int ipaddr_modify(int cmd, int argc, char **argv) | |||
636 | "anycast", "scope", "dev", "label", "local", 0 }; | 636 | "anycast", "scope", "dev", "label", "local", 0 }; |
637 | struct rtnl_handle rth; | 637 | struct rtnl_handle rth; |
638 | struct { | 638 | struct { |
639 | struct nlmsghdr n; | 639 | struct nlmsghdr n; |
640 | struct ifaddrmsg ifa; | 640 | struct ifaddrmsg ifa; |
641 | char buf[256]; | 641 | char buf[256]; |
642 | } req; | 642 | } req; |
643 | char *d = NULL; | 643 | char *d = NULL; |
644 | char *l = NULL; | 644 | char *l = NULL; |
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c index b4493d67d..91c85820c 100644 --- a/networking/libiproute/iplink.c +++ b/networking/libiproute/iplink.c | |||
@@ -289,7 +289,7 @@ static int do_set(int argc, char **argv) | |||
289 | NEXT_ARG(); | 289 | NEXT_ARG(); |
290 | newaddr = *argv; | 290 | newaddr = *argv; |
291 | } else { | 291 | } else { |
292 | if (strcmp(*argv, "dev") == 0) { | 292 | if (strcmp(*argv, "dev") == 0) { |
293 | NEXT_ARG(); | 293 | NEXT_ARG(); |
294 | } | 294 | } |
295 | if (dev) | 295 | if (dev) |
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c index b622afd47..1c4f75520 100644 --- a/networking/libiproute/iproute.c +++ b/networking/libiproute/iproute.c | |||
@@ -286,9 +286,9 @@ static int iproute_modify(int cmd, unsigned flags, int argc, char **argv) | |||
286 | { | 286 | { |
287 | struct rtnl_handle rth; | 287 | struct rtnl_handle rth; |
288 | struct { | 288 | struct { |
289 | struct nlmsghdr n; | 289 | struct nlmsghdr n; |
290 | struct rtmsg r; | 290 | struct rtmsg r; |
291 | char buf[1024]; | 291 | char buf[1024]; |
292 | } req; | 292 | } req; |
293 | char mxbuf[256]; | 293 | char mxbuf[256]; |
294 | struct rtattr * mxrta = (void*)mxbuf; | 294 | struct rtattr * mxrta = (void*)mxbuf; |
@@ -648,15 +648,15 @@ static int iproute_get(int argc, char **argv) | |||
648 | { | 648 | { |
649 | struct rtnl_handle rth; | 649 | struct rtnl_handle rth; |
650 | struct { | 650 | struct { |
651 | struct nlmsghdr n; | 651 | struct nlmsghdr n; |
652 | struct rtmsg r; | 652 | struct rtmsg r; |
653 | char buf[1024]; | 653 | char buf[1024]; |
654 | } req; | 654 | } req; |
655 | char *idev = NULL; | 655 | char *idev = NULL; |
656 | char *odev = NULL; | 656 | char *odev = NULL; |
657 | int connected = 0; | 657 | int connected = 0; |
658 | int from_ok = 0; | 658 | int from_ok = 0; |
659 | static const char * const options[] = | 659 | static const char * const options[] = |
660 | { "from", "iif", "oif", "dev", "notify", "connected", "to", 0 }; | 660 | { "from", "iif", "oif", "dev", "notify", "connected", "to", 0 }; |
661 | 661 | ||
662 | memset(&req, 0, sizeof(req)); | 662 | memset(&req, 0, sizeof(req)); |
@@ -816,8 +816,8 @@ static int iproute_get(int argc, char **argv) | |||
816 | 816 | ||
817 | int do_iproute(int argc, char **argv) | 817 | int do_iproute(int argc, char **argv) |
818 | { | 818 | { |
819 | static const char * const ip_route_commands[] = | 819 | static const char * const ip_route_commands[] = |
820 | { "add", "append", "change", "chg", "delete", "del", "get", | 820 | { "add", "append", "change", "chg", "delete", "del", "get", |
821 | "list", "show", "prepend", "replace", "test", "flush", 0 }; | 821 | "list", "show", "prepend", "replace", "test", "flush", 0 }; |
822 | int command_num = 7; | 822 | int command_num = 7; |
823 | unsigned int flags = 0; | 823 | unsigned int flags = 0; |
diff --git a/networking/libiproute/linux/pkt_sched.h b/networking/libiproute/linux/pkt_sched.h index 70cbabc26..ec5b3fddd 100644 --- a/networking/libiproute/linux/pkt_sched.h +++ b/networking/libiproute/linux/pkt_sched.h | |||
@@ -256,8 +256,8 @@ struct tc_gred_sopt | |||
256 | 256 | ||
257 | struct tc_htb_opt | 257 | struct tc_htb_opt |
258 | { | 258 | { |
259 | struct tc_ratespec rate; | 259 | struct tc_ratespec rate; |
260 | struct tc_ratespec ceil; | 260 | struct tc_ratespec ceil; |
261 | __u32 buffer; | 261 | __u32 buffer; |
262 | __u32 cbuffer; | 262 | __u32 cbuffer; |
263 | __u32 quantum; /* out only */ | 263 | __u32 quantum; /* out only */ |
@@ -268,9 +268,9 @@ struct tc_htb_opt | |||
268 | }; | 268 | }; |
269 | struct tc_htb_glob | 269 | struct tc_htb_glob |
270 | { | 270 | { |
271 | __u32 rate2quantum; /* bps->quantum divisor */ | 271 | __u32 rate2quantum; /* bps->quantum divisor */ |
272 | __u32 defcls; /* default class number */ | 272 | __u32 defcls; /* default class number */ |
273 | __u32 use_dcache; /* use dequeue cache ? */ | 273 | __u32 use_dcache; /* use dequeue cache ? */ |
274 | __u32 debug; /* debug flags */ | 274 | __u32 debug; /* debug flags */ |
275 | 275 | ||
276 | 276 | ||
@@ -311,8 +311,8 @@ struct tc_cbq_lssopt | |||
311 | unsigned char flags; | 311 | unsigned char flags; |
312 | #define TCF_CBQ_LSS_BOUNDED 1 | 312 | #define TCF_CBQ_LSS_BOUNDED 1 |
313 | #define TCF_CBQ_LSS_ISOLATED 2 | 313 | #define TCF_CBQ_LSS_ISOLATED 2 |
314 | unsigned char ewma_log; | 314 | unsigned char ewma_log; |
315 | unsigned char level; | 315 | unsigned char level; |
316 | #define TCF_CBQ_LSS_FLAGS 1 | 316 | #define TCF_CBQ_LSS_FLAGS 1 |
317 | #define TCF_CBQ_LSS_EWMA 2 | 317 | #define TCF_CBQ_LSS_EWMA 2 |
318 | #define TCF_CBQ_LSS_MAXIDLE 4 | 318 | #define TCF_CBQ_LSS_MAXIDLE 4 |
diff --git a/networking/libiproute/ll_proto.c b/networking/libiproute/ll_proto.c index 104fbca25..873253050 100644 --- a/networking/libiproute/ll_proto.c +++ b/networking/libiproute/ll_proto.c | |||
@@ -92,23 +92,23 @@ __PF(ECONET,econet) | |||
92 | 92 | ||
93 | const char * ll_proto_n2a(unsigned short id, char *buf, int len) | 93 | const char * ll_proto_n2a(unsigned short id, char *buf, int len) |
94 | { | 94 | { |
95 | int i; | 95 | int i; |
96 | 96 | ||
97 | id = ntohs(id); | 97 | id = ntohs(id); |
98 | 98 | ||
99 | for (i=0; i<sizeof(llproto_names)/sizeof(llproto_names[0]); i++) { | 99 | for (i=0; i<sizeof(llproto_names)/sizeof(llproto_names[0]); i++) { |
100 | if (llproto_names[i].id == id) | 100 | if (llproto_names[i].id == id) |
101 | return llproto_names[i].name; | 101 | return llproto_names[i].name; |
102 | } | 102 | } |
103 | snprintf(buf, len, "[%d]", id); | 103 | snprintf(buf, len, "[%d]", id); |
104 | return buf; | 104 | return buf; |
105 | } | 105 | } |
106 | 106 | ||
107 | int ll_proto_a2n(unsigned short *id, char *buf) | 107 | int ll_proto_a2n(unsigned short *id, char *buf) |
108 | { | 108 | { |
109 | int i; | 109 | int i; |
110 | for (i=0; i<sizeof(llproto_names)/sizeof(llproto_names[0]); i++) { | 110 | for (i=0; i<sizeof(llproto_names)/sizeof(llproto_names[0]); i++) { |
111 | if (strcasecmp(llproto_names[i].name, buf) == 0) { | 111 | if (strcasecmp(llproto_names[i].name, buf) == 0) { |
112 | *id = htons(llproto_names[i].id); | 112 | *id = htons(llproto_names[i].id); |
113 | return 0; | 113 | return 0; |
114 | } | 114 | } |
diff --git a/networking/libiproute/ll_types.c b/networking/libiproute/ll_types.c index 6b42426d5..fc5a01530 100644 --- a/networking/libiproute/ll_types.c +++ b/networking/libiproute/ll_types.c | |||
@@ -105,11 +105,11 @@ __PF(VOID,void) | |||
105 | }; | 105 | }; |
106 | #undef __PF | 106 | #undef __PF |
107 | 107 | ||
108 | int i; | 108 | int i; |
109 | for (i=0; i<sizeof(arphrd_names)/sizeof(arphrd_names[0]); i++) { | 109 | for (i=0; i<sizeof(arphrd_names)/sizeof(arphrd_names[0]); i++) { |
110 | if (arphrd_names[i].type == type) | 110 | if (arphrd_names[i].type == type) |
111 | return arphrd_names[i].name; | 111 | return arphrd_names[i].name; |
112 | } | 112 | } |
113 | snprintf(buf, len, "[%d]", type); | 113 | snprintf(buf, len, "[%d]", type); |
114 | return buf; | 114 | return buf; |
115 | } | 115 | } |
diff --git a/networking/libiproute/utils.h b/networking/libiproute/utils.h index 3d223edf6..0a3a06c15 100644 --- a/networking/libiproute/utils.h +++ b/networking/libiproute/utils.h | |||
@@ -46,8 +46,8 @@ typedef struct | |||
46 | 46 | ||
47 | struct dn_naddr | 47 | struct dn_naddr |
48 | { | 48 | { |
49 | unsigned short a_len; | 49 | unsigned short a_len; |
50 | unsigned char a_addr[DN_MAXADDL]; | 50 | unsigned char a_addr[DN_MAXADDL]; |
51 | }; | 51 | }; |
52 | 52 | ||
53 | #define IPX_NODE_LEN 6 | 53 | #define IPX_NODE_LEN 6 |
diff --git a/networking/nc.c b/networking/nc.c index fda1fb8f6..85148c4a7 100644 --- a/networking/nc.c +++ b/networking/nc.c | |||
@@ -48,9 +48,9 @@ static void timeout(int signum) | |||
48 | int nc_main(int argc, char **argv) | 48 | int nc_main(int argc, char **argv) |
49 | { | 49 | { |
50 | int do_listen = 0, lport = 0, delay = 0, wsecs = 0, tmpfd, opt, sfd, x; | 50 | int do_listen = 0, lport = 0, delay = 0, wsecs = 0, tmpfd, opt, sfd, x; |
51 | 51 | ||
52 | #define buf bb_common_bufsiz1 | 52 | #define buf bb_common_bufsiz1 |
53 | 53 | ||
54 | #ifdef CONFIG_NC_GAPING_SECURITY_HOLE | 54 | #ifdef CONFIG_NC_GAPING_SECURITY_HOLE |
55 | char *pr00gie = NULL; | 55 | char *pr00gie = NULL; |
56 | #endif | 56 | #endif |
diff --git a/networking/netstat.c b/networking/netstat.c index bc1ed057b..ea372322f 100644 --- a/networking/netstat.c +++ b/networking/netstat.c | |||
@@ -247,7 +247,7 @@ static void udp_do_one(int lnr, const char *line) | |||
247 | 247 | ||
248 | if (strlen(local_addr) > 8) { | 248 | if (strlen(local_addr) > 8) { |
249 | #ifdef CONFIG_FEATURE_IPV6 | 249 | #ifdef CONFIG_FEATURE_IPV6 |
250 | /* Demangle what the kernel gives us */ | 250 | /* Demangle what the kernel gives us */ |
251 | sscanf(local_addr, "%08X%08X%08X%08X", | 251 | sscanf(local_addr, "%08X%08X%08X%08X", |
252 | &in6.s6_addr32[0], &in6.s6_addr32[1], | 252 | &in6.s6_addr32[0], &in6.s6_addr32[1], |
253 | &in6.s6_addr32[2], &in6.s6_addr32[3]); | 253 | &in6.s6_addr32[2], &in6.s6_addr32[3]); |
diff --git a/networking/ping.c b/networking/ping.c index ed52abf04..14373c8d6 100644 --- a/networking/ping.c +++ b/networking/ping.c | |||
@@ -236,20 +236,20 @@ static void sendping(int junk) | |||
236 | static char *icmp_type_name (int id) | 236 | static char *icmp_type_name (int id) |
237 | { | 237 | { |
238 | switch (id) { | 238 | switch (id) { |
239 | case ICMP_ECHOREPLY: return "Echo Reply"; | 239 | case ICMP_ECHOREPLY: return "Echo Reply"; |
240 | case ICMP_DEST_UNREACH: return "Destination Unreachable"; | 240 | case ICMP_DEST_UNREACH: return "Destination Unreachable"; |
241 | case ICMP_SOURCE_QUENCH: return "Source Quench"; | 241 | case ICMP_SOURCE_QUENCH: return "Source Quench"; |
242 | case ICMP_REDIRECT: return "Redirect (change route)"; | 242 | case ICMP_REDIRECT: return "Redirect (change route)"; |
243 | case ICMP_ECHO: return "Echo Request"; | 243 | case ICMP_ECHO: return "Echo Request"; |
244 | case ICMP_TIME_EXCEEDED: return "Time Exceeded"; | 244 | case ICMP_TIME_EXCEEDED: return "Time Exceeded"; |
245 | case ICMP_PARAMETERPROB: return "Parameter Problem"; | 245 | case ICMP_PARAMETERPROB: return "Parameter Problem"; |
246 | case ICMP_TIMESTAMP: return "Timestamp Request"; | 246 | case ICMP_TIMESTAMP: return "Timestamp Request"; |
247 | case ICMP_TIMESTAMPREPLY: return "Timestamp Reply"; | 247 | case ICMP_TIMESTAMPREPLY: return "Timestamp Reply"; |
248 | case ICMP_INFO_REQUEST: return "Information Request"; | 248 | case ICMP_INFO_REQUEST: return "Information Request"; |
249 | case ICMP_INFO_REPLY: return "Information Reply"; | 249 | case ICMP_INFO_REPLY: return "Information Reply"; |
250 | case ICMP_ADDRESS: return "Address Mask Request"; | 250 | case ICMP_ADDRESS: return "Address Mask Request"; |
251 | case ICMP_ADDRESSREPLY: return "Address Mask Reply"; | 251 | case ICMP_ADDRESSREPLY: return "Address Mask Reply"; |
252 | default: return "unknown ICMP type"; | 252 | default: return "unknown ICMP type"; |
253 | } | 253 | } |
254 | } | 254 | } |
255 | 255 | ||
diff --git a/networking/ping6.c b/networking/ping6.c index 72867f346..1d7271d7b 100644 --- a/networking/ping6.c +++ b/networking/ping6.c | |||
@@ -246,7 +246,7 @@ static char *icmp6_type_name (int id) | |||
246 | case ICMP6_MEMBERSHIP_QUERY: return "Membership Query"; | 246 | case ICMP6_MEMBERSHIP_QUERY: return "Membership Query"; |
247 | case ICMP6_MEMBERSHIP_REPORT: return "Membership Report"; | 247 | case ICMP6_MEMBERSHIP_REPORT: return "Membership Report"; |
248 | case ICMP6_MEMBERSHIP_REDUCTION: return "Membership Reduction"; | 248 | case ICMP6_MEMBERSHIP_REDUCTION: return "Membership Reduction"; |
249 | default: return "unknown ICMP type"; | 249 | default: return "unknown ICMP type"; |
250 | } | 250 | } |
251 | } | 251 | } |
252 | 252 | ||
diff --git a/networking/route.c b/networking/route.c index bb5f9405b..49d219ae0 100644 --- a/networking/route.c +++ b/networking/route.c | |||
@@ -86,7 +86,7 @@ | |||
86 | /* We remap '-' to '#' to avoid problems with getopt. */ | 86 | /* We remap '-' to '#' to avoid problems with getopt. */ |
87 | static const char tbl_hash_net_host[] = | 87 | static const char tbl_hash_net_host[] = |
88 | "\007\001#net\0" | 88 | "\007\001#net\0" |
89 | /* "\010\002#host\0" */ | 89 | /* "\010\002#host\0" */ |
90 | "\007\002#host" /* Since last, we can save a byte. */ | 90 | "\007\002#host" /* Since last, we can save a byte. */ |
91 | ; | 91 | ; |
92 | 92 | ||
@@ -128,7 +128,7 @@ static const char tbl_ipvx[] = | |||
128 | #endif | 128 | #endif |
129 | "\006\041mod\0" | 129 | "\006\041mod\0" |
130 | "\006\042dyn\0" | 130 | "\006\042dyn\0" |
131 | /* "\014\043reinstate\0" */ | 131 | /* "\014\043reinstate\0" */ |
132 | "\013\043reinstate" /* Since last, we can save a byte. */ | 132 | "\013\043reinstate" /* Since last, we can save a byte. */ |
133 | ; | 133 | ; |
134 | 134 | ||
@@ -186,7 +186,7 @@ static void INET_setroute(int action, char **args) | |||
186 | const char *target = *args++; | 186 | const char *target = *args++; |
187 | 187 | ||
188 | /* Prefer hostname lookup is -host flag (xflag==1) was given. */ | 188 | /* Prefer hostname lookup is -host flag (xflag==1) was given. */ |
189 | isnet = INET_resolve(target, (struct sockaddr_in *) &rt.rt_dst, | 189 | isnet = INET_resolve(target, (struct sockaddr_in *) &rt.rt_dst, |
190 | (xflag & HOST_FLAG)); | 190 | (xflag & HOST_FLAG)); |
191 | if (isnet < 0) { | 191 | if (isnet < 0) { |
192 | bb_error_msg_and_die("resolving %s", target); | 192 | bb_error_msg_and_die("resolving %s", target); |
@@ -459,7 +459,7 @@ static const unsigned int flagvals[] = { /* Must agree with flagchars[]. */ | |||
459 | #define IPV4_MASK (RTF_GATEWAY|RTF_HOST|RTF_REINSTATE|RTF_DYNAMIC|RTF_MODIFIED) | 459 | #define IPV4_MASK (RTF_GATEWAY|RTF_HOST|RTF_REINSTATE|RTF_DYNAMIC|RTF_MODIFIED) |
460 | #define IPV6_MASK (RTF_GATEWAY|RTF_HOST|RTF_DEFAULT|RTF_ADDRCONF|RTF_CACHE) | 460 | #define IPV6_MASK (RTF_GATEWAY|RTF_HOST|RTF_DEFAULT|RTF_ADDRCONF|RTF_CACHE) |
461 | 461 | ||
462 | static const char flagchars[] = /* Must agree with flagvals[]. */ | 462 | static const char flagchars[] = /* Must agree with flagvals[]. */ |
463 | "GHRDM" | 463 | "GHRDM" |
464 | #ifdef CONFIG_FEATURE_IPV6 | 464 | #ifdef CONFIG_FEATURE_IPV6 |
465 | "DAC" | 465 | "DAC" |
@@ -645,10 +645,10 @@ static void INET6_displayroutes(int noresolve) | |||
645 | #define ROUTE_OPT_INET6 0x08 /* Not an actual option. See below. */ | 645 | #define ROUTE_OPT_INET6 0x08 /* Not an actual option. See below. */ |
646 | 646 | ||
647 | /* 1st byte is offset to next entry offset. 2nd byte is return value. */ | 647 | /* 1st byte is offset to next entry offset. 2nd byte is return value. */ |
648 | static const char tbl_verb[] = /* 2nd byte matches RTACTION_* code */ | 648 | static const char tbl_verb[] = /* 2nd byte matches RTACTION_* code */ |
649 | "\006\001add\0" | 649 | "\006\001add\0" |
650 | "\006\002del\0" | 650 | "\006\002del\0" |
651 | /* "\011\002delete\0" */ | 651 | /* "\011\002delete\0" */ |
652 | "\010\002delete" /* Since last, we can save a byte. */ | 652 | "\010\002delete" /* Since last, we can save a byte. */ |
653 | ; | 653 | ; |
654 | 654 | ||
diff --git a/networking/telnet.c b/networking/telnet.c index 314363188..d9e66e5d3 100644 --- a/networking/telnet.c +++ b/networking/telnet.c | |||
@@ -647,7 +647,7 @@ extern int telnet_main(int argc, char** argv) | |||
647 | #ifdef CONFIG_FEATURE_TELNET_AUTOLOGIN | 647 | #ifdef CONFIG_FEATURE_TELNET_AUTOLOGIN |
648 | if (1 & bb_getopt_ulflags(argc, argv, "al:", &autologin)) | 648 | if (1 & bb_getopt_ulflags(argc, argv, "al:", &autologin)) |
649 | autologin = getenv("USER"); | 649 | autologin = getenv("USER"); |
650 | 650 | ||
651 | if (optind < argc) { | 651 | if (optind < argc) { |
652 | bb_lookup_host(&s_in, argv[optind++]); | 652 | bb_lookup_host(&s_in, argv[optind++]); |
653 | s_in.sin_port = bb_lookup_port((optind < argc) ? argv[optind++] : | 653 | s_in.sin_port = bb_lookup_port((optind < argc) ? argv[optind++] : |
diff --git a/networking/telnetd.c b/networking/telnetd.c index d5de8903c..73303a20a 100644 --- a/networking/telnetd.c +++ b/networking/telnetd.c | |||
@@ -94,7 +94,7 @@ struct tsession { | |||
94 | +-------+ wridx1++ +------+ rdidx1++ +----------+ | 94 | +-------+ wridx1++ +------+ rdidx1++ +----------+ |
95 | | | <-------------- | buf1 | <-------------- | | | 95 | | | <-------------- | buf1 | <-------------- | | |
96 | | | size1-- +------+ size1++ | | | 96 | | | size1-- +------+ size1++ | | |
97 | | pty | | socket | | 97 | | pty | | socket | |
98 | | | rdidx2++ +------+ wridx2++ | | | 98 | | | rdidx2++ +------+ wridx2++ | | |
99 | | | --------------> | buf2 | --------------> | | | 99 | | | --------------> | buf2 | --------------> | | |
100 | +-------+ size2++ +------+ size2-- +----------+ | 100 | +-------+ size2++ +------+ size2-- +----------+ |
@@ -166,7 +166,7 @@ remove_iacs(struct tsession *ts, int *pnum_totty) { | |||
166 | else if (ptr[1] == SB && ptr[2] == TELOPT_NAWS) { | 166 | else if (ptr[1] == SB && ptr[2] == TELOPT_NAWS) { |
167 | struct winsize ws; | 167 | struct winsize ws; |
168 | if ((ptr+8) >= end) | 168 | if ((ptr+8) >= end) |
169 | break; /* incomplete, can't process */ | 169 | break; /* incomplete, can't process */ |
170 | ws.ws_col = (ptr[3] << 8) | ptr[4]; | 170 | ws.ws_col = (ptr[3] << 8) | ptr[4]; |
171 | ws.ws_row = (ptr[5] << 8) | ptr[6]; | 171 | ws.ws_row = (ptr[5] << 8) | ptr[6]; |
172 | (void) ioctl(ts->ptyfd, TIOCSWINSZ, (char *)&ws); | 172 | (void) ioctl(ts->ptyfd, TIOCSWINSZ, (char *)&ws); |
@@ -383,7 +383,7 @@ int | |||
383 | telnetd_main(int argc, char **argv) | 383 | telnetd_main(int argc, char **argv) |
384 | { | 384 | { |
385 | #ifndef CONFIG_FEATURE_TELNETD_INETD | 385 | #ifndef CONFIG_FEATURE_TELNETD_INETD |
386 | sockaddr_type sa; | 386 | sockaddr_type sa; |
387 | int master_fd; | 387 | int master_fd; |
388 | #endif /* CONFIG_FEATURE_TELNETD_INETD */ | 388 | #endif /* CONFIG_FEATURE_TELNETD_INETD */ |
389 | fd_set rdfdset, wrfdset; | 389 | fd_set rdfdset, wrfdset; |
@@ -446,7 +446,7 @@ telnetd_main(int argc, char **argv) | |||
446 | 446 | ||
447 | /* Grab a TCP socket. */ | 447 | /* Grab a TCP socket. */ |
448 | 448 | ||
449 | master_fd = socket(SOCKET_TYPE, SOCK_STREAM, 0); | 449 | master_fd = socket(SOCKET_TYPE, SOCK_STREAM, 0); |
450 | if (master_fd < 0) { | 450 | if (master_fd < 0) { |
451 | bb_perror_msg_and_die("socket"); | 451 | bb_perror_msg_and_die("socket"); |
452 | } | 452 | } |
diff --git a/networking/tftp.c b/networking/tftp.c index cad0dcc45..402d5d03c 100644 --- a/networking/tftp.c +++ b/networking/tftp.c | |||
@@ -1,34 +1,34 @@ | |||
1 | /* ------------------------------------------------------------------------- */ | 1 | /* ------------------------------------------------------------------------- */ |
2 | /* tftp.c */ | 2 | /* tftp.c */ |
3 | /* */ | 3 | /* */ |
4 | /* A simple tftp client for busybox. */ | 4 | /* A simple tftp client for busybox. */ |
5 | /* Tries to follow RFC1350. */ | 5 | /* Tries to follow RFC1350. */ |
6 | /* Only "octet" mode supported. */ | 6 | /* Only "octet" mode supported. */ |
7 | /* Optional blocksize negotiation (RFC2347 + RFC2348) */ | 7 | /* Optional blocksize negotiation (RFC2347 + RFC2348) */ |
8 | /* */ | 8 | /* */ |
9 | /* Copyright (C) 2001 Magnus Damm <damm@opensource.se> */ | 9 | /* Copyright (C) 2001 Magnus Damm <damm@opensource.se> */ |
10 | /* */ | 10 | /* */ |
11 | /* Parts of the code based on: */ | 11 | /* Parts of the code based on: */ |
12 | /* */ | 12 | /* */ |
13 | /* atftp: Copyright (C) 2000 Jean-Pierre Lefebvre <helix@step.polymtl.ca> */ | 13 | /* atftp: Copyright (C) 2000 Jean-Pierre Lefebvre <helix@step.polymtl.ca> */ |
14 | /* and Remi Lefebvre <remi@debian.org> */ | 14 | /* and Remi Lefebvre <remi@debian.org> */ |
15 | /* */ | 15 | /* */ |
16 | /* utftp: Copyright (C) 1999 Uwe Ohse <uwe@ohse.de> */ | 16 | /* utftp: Copyright (C) 1999 Uwe Ohse <uwe@ohse.de> */ |
17 | /* */ | 17 | /* */ |
18 | /* This program is free software; you can redistribute it and/or modify */ | 18 | /* This program is free software; you can redistribute it and/or modify */ |
19 | /* it under the terms of the GNU General Public License as published by */ | 19 | /* it under the terms of the GNU General Public License as published by */ |
20 | /* the Free Software Foundation; either version 2 of the License, or */ | 20 | /* the Free Software Foundation; either version 2 of the License, or */ |
21 | /* (at your option) any later version. */ | 21 | /* (at your option) any later version. */ |
22 | /* */ | 22 | /* */ |
23 | /* This program is distributed in the hope that it will be useful, */ | 23 | /* This program is distributed in the hope that it will be useful, */ |
24 | /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ | 24 | /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ |
25 | /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ | 25 | /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ |
26 | /* General Public License for more details. */ | 26 | /* General Public License for more details. */ |
27 | /* */ | 27 | /* */ |
28 | /* You should have received a copy of the GNU General Public License */ | 28 | /* You should have received a copy of the GNU General Public License */ |
29 | /* along with this program; if not, write to the Free Software */ | 29 | /* along with this program; if not, write to the Free Software */ |
30 | /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ | 30 | /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ |
31 | /* */ | 31 | /* */ |
32 | /* ------------------------------------------------------------------------- */ | 32 | /* ------------------------------------------------------------------------- */ |
33 | 33 | ||
34 | #include <stdio.h> | 34 | #include <stdio.h> |
@@ -87,13 +87,13 @@ static const char * const tftp_bb_error_msg[] = { | |||
87 | 87 | ||
88 | static int tftp_blocksize_check(int blocksize, int bufsize) | 88 | static int tftp_blocksize_check(int blocksize, int bufsize) |
89 | { | 89 | { |
90 | /* Check if the blocksize is valid: | 90 | /* Check if the blocksize is valid: |
91 | * RFC2348 says between 8 and 65464, | 91 | * RFC2348 says between 8 and 65464, |
92 | * but our implementation makes it impossible | 92 | * but our implementation makes it impossible |
93 | * to use blocksizes smaller than 22 octets. | 93 | * to use blocksizes smaller than 22 octets. |
94 | */ | 94 | */ |
95 | 95 | ||
96 | if ((bufsize && (blocksize > bufsize)) || | 96 | if ((bufsize && (blocksize > bufsize)) || |
97 | (blocksize < 8) || (blocksize > 65464)) { | 97 | (blocksize < 8) || (blocksize > 65464)) { |
98 | bb_error_msg("bad blocksize"); | 98 | bb_error_msg("bad blocksize"); |
99 | return 0; | 99 | return 0; |
@@ -104,7 +104,7 @@ static int tftp_blocksize_check(int blocksize, int bufsize) | |||
104 | 104 | ||
105 | static char *tftp_option_get(char *buf, int len, char *option) | 105 | static char *tftp_option_get(char *buf, int len, char *option) |
106 | { | 106 | { |
107 | int opt_val = 0; | 107 | int opt_val = 0; |
108 | int opt_found = 0; | 108 | int opt_found = 0; |
109 | int k; | 109 | int k; |
110 | 110 | ||
@@ -216,7 +216,7 @@ static inline int tftp(const int cmd, const struct hostent *host, | |||
216 | 216 | ||
217 | if ((cmd_get && (opcode == TFTP_RRQ)) || | 217 | if ((cmd_get && (opcode == TFTP_RRQ)) || |
218 | (cmd_put && (opcode == TFTP_WRQ))) { | 218 | (cmd_put && (opcode == TFTP_WRQ))) { |
219 | int too_long = 0; | 219 | int too_long = 0; |
220 | 220 | ||
221 | /* see if the filename fits into buf */ | 221 | /* see if the filename fits into buf */ |
222 | /* and fill in packet */ | 222 | /* and fill in packet */ |
@@ -418,7 +418,7 @@ static inline int tftp(const int cmd, const struct hostent *host, | |||
418 | 418 | ||
419 | if (res) { | 419 | if (res) { |
420 | int blksize = atoi(res); | 420 | int blksize = atoi(res); |
421 | 421 | ||
422 | if (tftp_blocksize_check(blksize, | 422 | if (tftp_blocksize_check(blksize, |
423 | tftp_bufsize - 4)) { | 423 | tftp_bufsize - 4)) { |
424 | 424 | ||
@@ -452,7 +452,7 @@ static inline int tftp(const int cmd, const struct hostent *host, | |||
452 | if (cmd_get && (opcode == TFTP_DATA)) { | 452 | if (cmd_get && (opcode == TFTP_DATA)) { |
453 | 453 | ||
454 | if (tmp == block_nr) { | 454 | if (tmp == block_nr) { |
455 | 455 | ||
456 | len = bb_full_write(localfd, &buf[4], len - 4); | 456 | len = bb_full_write(localfd, &buf[4], len - 4); |
457 | 457 | ||
458 | if (len < 0) { | 458 | if (len < 0) { |
@@ -496,7 +496,7 @@ static inline int tftp(const int cmd, const struct hostent *host, | |||
496 | #ifdef CONFIG_FEATURE_CLEAN_UP | 496 | #ifdef CONFIG_FEATURE_CLEAN_UP |
497 | close(socketfd); | 497 | close(socketfd); |
498 | 498 | ||
499 | free(buf); | 499 | free(buf); |
500 | #endif | 500 | #endif |
501 | 501 | ||
502 | return finished ? EXIT_SUCCESS : EXIT_FAILURE; | 502 | return finished ? EXIT_SUCCESS : EXIT_FAILURE; |
@@ -549,8 +549,8 @@ int tftp_main(int argc, char **argv) | |||
549 | /* XXX: may be should #error ? */ | 549 | /* XXX: may be should #error ? */ |
550 | #endif | 550 | #endif |
551 | 551 | ||
552 | 552 | ||
553 | cmd = bb_getopt_ulflags(argc, argv, GET PUT "l:r:" BS, | 553 | cmd = bb_getopt_ulflags(argc, argv, GET PUT "l:r:" BS, |
554 | &localfile, &remotefile BS_ARG); | 554 | &localfile, &remotefile BS_ARG); |
555 | #ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE | 555 | #ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE |
556 | if(sblocksize) { | 556 | if(sblocksize) { |
diff --git a/networking/udhcp/arpping.c b/networking/udhcp/arpping.c index 7cc2be42e..4831d4371 100644 --- a/networking/udhcp/arpping.c +++ b/networking/udhcp/arpping.c | |||
@@ -23,7 +23,7 @@ | |||
23 | * ip - our ip | 23 | * ip - our ip |
24 | * mac - our arp address | 24 | * mac - our arp address |
25 | * interface - interface to use | 25 | * interface - interface to use |
26 | * retn: 1 addr free | 26 | * retn: 1 addr free |
27 | * 0 addr used | 27 | * 0 addr used |
28 | * -1 error | 28 | * -1 error |
29 | */ | 29 | */ |
@@ -33,7 +33,7 @@ int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *mac, char *interface) | |||
33 | { | 33 | { |
34 | 34 | ||
35 | int timeout = 2; | 35 | int timeout = 2; |
36 | int optval = 1; | 36 | int optval = 1; |
37 | int s; /* socket */ | 37 | int s; /* socket */ |
38 | int rv = 1; /* return value */ | 38 | int rv = 1; /* return value */ |
39 | struct sockaddr addr; /* for interface name */ | 39 | struct sockaddr addr; /* for interface name */ |
@@ -101,6 +101,6 @@ int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *mac, char *interface) | |||
101 | prevTime = uptime(); | 101 | prevTime = uptime(); |
102 | } | 102 | } |
103 | close(s); | 103 | close(s); |
104 | DEBUG(LOG_INFO, "%salid arp replies for this address", rv ? "No v" : "V"); | 104 | DEBUG(LOG_INFO, "%salid arp replies for this address", rv ? "No v" : "V"); |
105 | return rv; | 105 | return rv; |
106 | } | 106 | } |
diff --git a/networking/udhcp/clientpacket.c b/networking/udhcp/clientpacket.c index 528befde6..e377bd236 100644 --- a/networking/udhcp/clientpacket.c +++ b/networking/udhcp/clientpacket.c | |||
@@ -205,8 +205,8 @@ int get_raw_packet(struct dhcpMessage *payload, int fd) | |||
205 | packet.ip.ihl != sizeof(packet.ip) >> 2 || packet.udp.dest != htons(CLIENT_PORT) || | 205 | packet.ip.ihl != sizeof(packet.ip) >> 2 || packet.udp.dest != htons(CLIENT_PORT) || |
206 | bytes > (int) sizeof(struct udp_dhcp_packet) || | 206 | bytes > (int) sizeof(struct udp_dhcp_packet) || |
207 | ntohs(packet.udp.len) != (uint16_t) (bytes - sizeof(packet.ip))) { | 207 | ntohs(packet.udp.len) != (uint16_t) (bytes - sizeof(packet.ip))) { |
208 | DEBUG(LOG_INFO, "unrelated/bogus packet"); | 208 | DEBUG(LOG_INFO, "unrelated/bogus packet"); |
209 | return -2; | 209 | return -2; |
210 | } | 210 | } |
211 | 211 | ||
212 | /* check IP checksum */ | 212 | /* check IP checksum */ |
diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h index efa8fd419..071a5c428 100644 --- a/networking/udhcp/common.h +++ b/networking/udhcp/common.h | |||
@@ -43,7 +43,7 @@ long uptime(void); | |||
43 | void background(const char *pidfile); | 43 | void background(const char *pidfile); |
44 | void start_log_and_pid(const char *client_server, const char *pidfile); | 44 | void start_log_and_pid(const char *client_server, const char *pidfile); |
45 | void udhcp_logging(int level, const char *fmt, ...); | 45 | void udhcp_logging(int level, const char *fmt, ...); |
46 | 46 | ||
47 | #define LOG(level, str, args...) udhcp_logging(level, str, ## args) | 47 | #define LOG(level, str, args...) udhcp_logging(level, str, ## args) |
48 | 48 | ||
49 | #ifdef UDHCP_DEBUG | 49 | #ifdef UDHCP_DEBUG |
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index c4277e3f1..a4afb0c46 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c | |||
@@ -196,7 +196,7 @@ int main(int argc, char *argv[]) | |||
196 | {"hostname", required_argument, 0, 'h'}, | 196 | {"hostname", required_argument, 0, 'h'}, |
197 | {"fqdn", required_argument, 0, 'F'}, | 197 | {"fqdn", required_argument, 0, 'F'}, |
198 | {"interface", required_argument, 0, 'i'}, | 198 | {"interface", required_argument, 0, 'i'}, |
199 | {"now", no_argument, 0, 'n'}, | 199 | {"now", no_argument, 0, 'n'}, |
200 | {"pidfile", required_argument, 0, 'p'}, | 200 | {"pidfile", required_argument, 0, 'p'}, |
201 | {"quit", no_argument, 0, 'q'}, | 201 | {"quit", no_argument, 0, 'q'}, |
202 | {"request", required_argument, 0, 'r'}, | 202 | {"request", required_argument, 0, 'r'}, |
@@ -314,7 +314,7 @@ int main(int argc, char *argv[]) | |||
314 | client_config.vendorclass[OPT_CODE] = DHCP_VENDOR; | 314 | client_config.vendorclass[OPT_CODE] = DHCP_VENDOR; |
315 | client_config.vendorclass[OPT_LEN] = sizeof("udhcp "VERSION) - 1; | 315 | client_config.vendorclass[OPT_LEN] = sizeof("udhcp "VERSION) - 1; |
316 | client_config.vendorclass[OPT_DATA] = 1; | 316 | client_config.vendorclass[OPT_DATA] = 1; |
317 | memcpy(&client_config.vendorclass[OPT_DATA], | 317 | memcpy(&client_config.vendorclass[OPT_DATA], |
318 | "udhcp "VERSION, sizeof("udhcp "VERSION) - 1); | 318 | "udhcp "VERSION, sizeof("udhcp "VERSION) - 1); |
319 | } | 319 | } |
320 | 320 | ||
@@ -370,7 +370,7 @@ int main(int argc, char *argv[]) | |||
370 | } else if (client_config.abort_if_no_lease) { | 370 | } else if (client_config.abort_if_no_lease) { |
371 | LOG(LOG_INFO, "No lease, failing."); | 371 | LOG(LOG_INFO, "No lease, failing."); |
372 | return 1; | 372 | return 1; |
373 | } | 373 | } |
374 | /* wait to try again */ | 374 | /* wait to try again */ |
375 | packet_num = 0; | 375 | packet_num = 0; |
376 | timeout = now + 60; | 376 | timeout = now + 60; |
diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c index 2812e6e8c..0dfc0b559 100644 --- a/networking/udhcp/dhcpd.c +++ b/networking/udhcp/dhcpd.c | |||
@@ -193,7 +193,7 @@ int main(int argc, char *argv[]) | |||
193 | LOG(LOG_ERR, "send OFFER failed"); | 193 | LOG(LOG_ERR, "send OFFER failed"); |
194 | } | 194 | } |
195 | break; | 195 | break; |
196 | case DHCPREQUEST: | 196 | case DHCPREQUEST: |
197 | DEBUG(LOG_INFO, "received REQUEST"); | 197 | DEBUG(LOG_INFO, "received REQUEST"); |
198 | 198 | ||
199 | requested = get_option(&packet, DHCP_REQUESTED_IP); | 199 | requested = get_option(&packet, DHCP_REQUESTED_IP); |
diff --git a/networking/udhcp/dhcpd.h b/networking/udhcp/dhcpd.h index 65c8348bf..a060002cd 100644 --- a/networking/udhcp/dhcpd.h +++ b/networking/udhcp/dhcpd.h | |||
@@ -108,23 +108,23 @@ struct static_lease { | |||
108 | 108 | ||
109 | struct server_config_t { | 109 | struct server_config_t { |
110 | uint32_t server; /* Our IP, in network order */ | 110 | uint32_t server; /* Our IP, in network order */ |
111 | uint32_t start; /* Start address of leases, network order */ | 111 | uint32_t start; /* Start address of leases, network order */ |
112 | uint32_t end; /* End of leases, network order */ | 112 | uint32_t end; /* End of leases, network order */ |
113 | struct option_set *options; /* List of DHCP options loaded from the config file */ | 113 | struct option_set *options; /* List of DHCP options loaded from the config file */ |
114 | char *interface; /* The name of the interface to use */ | 114 | char *interface; /* The name of the interface to use */ |
115 | int ifindex; /* Index number of the interface to use */ | 115 | int ifindex; /* Index number of the interface to use */ |
116 | uint8_t arp[6]; /* Our arp address */ | 116 | uint8_t arp[6]; /* Our arp address */ |
117 | unsigned long lease; /* lease time in seconds (host order) */ | 117 | unsigned long lease; /* lease time in seconds (host order) */ |
118 | unsigned long max_leases; /* maximum number of leases (including reserved address) */ | 118 | unsigned long max_leases; /* maximum number of leases (including reserved address) */ |
119 | char remaining; /* should the lease file be interpreted as lease time remaining, or | 119 | char remaining; /* should the lease file be interpreted as lease time remaining, or |
120 | * as the time the lease expires */ | 120 | * as the time the lease expires */ |
121 | unsigned long auto_time; /* how long should udhcpd wait before writing a config file. | 121 | unsigned long auto_time; /* how long should udhcpd wait before writing a config file. |
122 | * if this is zero, it will only write one on SIGUSR1 */ | 122 | * if this is zero, it will only write one on SIGUSR1 */ |
123 | unsigned long decline_time; /* how long an address is reserved if a client returns a | 123 | unsigned long decline_time; /* how long an address is reserved if a client returns a |
124 | * decline message */ | 124 | * decline message */ |
125 | unsigned long conflict_time; /* how long an arp conflict offender is leased for */ | 125 | unsigned long conflict_time; /* how long an arp conflict offender is leased for */ |
126 | unsigned long offer_time; /* how long an offered address is reserved */ | 126 | unsigned long offer_time; /* how long an offered address is reserved */ |
127 | unsigned long min_lease; /* minimum lease a client can request*/ | 127 | unsigned long min_lease; /* minimum lease a client can request*/ |
128 | char *lease_file; | 128 | char *lease_file; |
129 | char *pidfile; | 129 | char *pidfile; |
130 | char *notify_file; /* What to run whenever leases are written */ | 130 | char *notify_file; /* What to run whenever leases are written */ |
diff --git a/networking/udhcp/files.c b/networking/udhcp/files.c index 40e68a0a8..01534f2bb 100644 --- a/networking/udhcp/files.c +++ b/networking/udhcp/files.c | |||
@@ -271,7 +271,7 @@ static const struct config_keyword keywords[] = { | |||
271 | {"boot_file", read_str, &(server_config.boot_file), ""}, | 271 | {"boot_file", read_str, &(server_config.boot_file), ""}, |
272 | {"static_lease",read_staticlease, &(server_config.static_leases), ""}, | 272 | {"static_lease",read_staticlease, &(server_config.static_leases), ""}, |
273 | /*ADDME: static lease */ | 273 | /*ADDME: static lease */ |
274 | {"", NULL, NULL, ""} | 274 | {"", NULL, NULL, ""} |
275 | }; | 275 | }; |
276 | 276 | ||
277 | 277 | ||
diff --git a/networking/udhcp/leases.c b/networking/udhcp/leases.c index 4da21a23b..bb08c3adb 100644 --- a/networking/udhcp/leases.c +++ b/networking/udhcp/leases.c | |||
@@ -148,7 +148,7 @@ uint32_t find_address(int check_expired) | |||
148 | (check_expired && lease_expired(lease))) && | 148 | (check_expired && lease_expired(lease))) && |
149 | 149 | ||
150 | /* and it isn't on the network */ | 150 | /* and it isn't on the network */ |
151 | !check_ip(ret)) { | 151 | !check_ip(ret)) { |
152 | return ret; | 152 | return ret; |
153 | break; | 153 | break; |
154 | } | 154 | } |
diff --git a/networking/udhcp/libbb_udhcp.h b/networking/udhcp/libbb_udhcp.h index 0dae40172..30e167f64 100644 --- a/networking/udhcp/libbb_udhcp.h +++ b/networking/udhcp/libbb_udhcp.h | |||
@@ -29,19 +29,19 @@ | |||
29 | 29 | ||
30 | /* make safe the exported namespace */ | 30 | /* make safe the exported namespace */ |
31 | /* from common.h */ | 31 | /* from common.h */ |
32 | #define background udhcp_background | 32 | #define background udhcp_background |
33 | #define start_log_and_pid udhcp_start_log_and_pid | 33 | #define start_log_and_pid udhcp_start_log_and_pid |
34 | /* from script.h */ | 34 | /* from script.h */ |
35 | #define run_script udhcp_run_script | 35 | #define run_script udhcp_run_script |
36 | /* from packet.h */ | 36 | /* from packet.h */ |
37 | #define init_header udhcp_init_header | 37 | #define init_header udhcp_init_header |
38 | #define get_packet udhcp_get_packet | 38 | #define get_packet udhcp_get_packet |
39 | #define checksum udhcp_checksum | 39 | #define checksum udhcp_checksum |
40 | #define raw_packet udhcp_raw_packet | 40 | #define raw_packet udhcp_raw_packet |
41 | #define kernel_packet udhcp_kernel_packet | 41 | #define kernel_packet udhcp_kernel_packet |
42 | /* from pidfile.h */ | 42 | /* from pidfile.h */ |
43 | #define pidfile_acquire udhcp_pidfile_acquire | 43 | #define pidfile_acquire udhcp_pidfile_acquire |
44 | #define pidfile_write_release udhcp_pidfile_write_release | 44 | #define pidfile_write_release udhcp_pidfile_write_release |
45 | /* from options.h */ | 45 | /* from options.h */ |
46 | #define get_option udhcp_get_option | 46 | #define get_option udhcp_get_option |
47 | #define end_option udhcp_end_option | 47 | #define end_option udhcp_end_option |
diff --git a/networking/udhcp/options.c b/networking/udhcp/options.c index 144345134..eebcaaa58 100644 --- a/networking/udhcp/options.c +++ b/networking/udhcp/options.c | |||
@@ -154,11 +154,11 @@ int add_simple_option(uint8_t *optionptr, uint8_t code, uint32_t data) | |||
154 | for (dh=dhcp_options; dh->code; dh++) { | 154 | for (dh=dhcp_options; dh->code; dh++) { |
155 | if (dh->code == code) { | 155 | if (dh->code == code) { |
156 | uint8_t option[6], len; | 156 | uint8_t option[6], len; |
157 | 157 | ||
158 | option[OPT_CODE] = code; | 158 | option[OPT_CODE] = code; |
159 | len = option_lengths[dh->flags & TYPE_MASK]; | 159 | len = option_lengths[dh->flags & TYPE_MASK]; |
160 | option[OPT_LEN] = len; | 160 | option[OPT_LEN] = len; |
161 | if (__BYTE_ORDER == __BIG_ENDIAN) | 161 | if (__BYTE_ORDER == __BIG_ENDIAN) |
162 | data <<= 8 * (4 - len); | 162 | data <<= 8 * (4 - len); |
163 | /* This memcpy is for broken processors which can't | 163 | /* This memcpy is for broken processors which can't |
164 | * handle a simple unaligned 32-bit assignment */ | 164 | * handle a simple unaligned 32-bit assignment */ |
diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c index 1c6bb0ca4..64a910031 100644 --- a/networking/udhcp/packet.c +++ b/networking/udhcp/packet.c | |||
@@ -71,13 +71,13 @@ int get_packet(struct dhcpMessage *packet, int fd) | |||
71 | for (i = 0; broken_vendors[i][0]; i++) { | 71 | for (i = 0; broken_vendors[i][0]; i++) { |
72 | if (vendor[OPT_LEN - 2] == (uint8_t) strlen(broken_vendors[i]) && | 72 | if (vendor[OPT_LEN - 2] == (uint8_t) strlen(broken_vendors[i]) && |
73 | !strncmp(vendor, broken_vendors[i], vendor[OPT_LEN - 2])) { | 73 | !strncmp(vendor, broken_vendors[i], vendor[OPT_LEN - 2])) { |
74 | DEBUG(LOG_INFO, "broken client (%s), forcing broadcast", | 74 | DEBUG(LOG_INFO, "broken client (%s), forcing broadcast", |
75 | broken_vendors[i]); | 75 | broken_vendors[i]); |
76 | packet->flags |= htons(BROADCAST_FLAG); | 76 | packet->flags |= htons(BROADCAST_FLAG); |
77 | } | 77 | } |
78 | } | 78 | } |
79 | } | 79 | } |
80 | 80 | ||
81 | 81 | ||
82 | return bytes; | 82 | return bytes; |
83 | } | 83 | } |
diff --git a/networking/udhcp/script.c b/networking/udhcp/script.c index c04c69f7e..b6b0e0d59 100644 --- a/networking/udhcp/script.c +++ b/networking/udhcp/script.c | |||
@@ -97,7 +97,7 @@ static void fill_options(char *dest, uint8_t *option, struct dhcp_option *type_p | |||
97 | optlen = 4; | 97 | optlen = 4; |
98 | case OPTION_IP: /* Works regardless of host byte order. */ | 98 | case OPTION_IP: /* Works regardless of host byte order. */ |
99 | dest += sprintip(dest, "", option); | 99 | dest += sprintip(dest, "", option); |
100 | break; | 100 | break; |
101 | case OPTION_BOOLEAN: | 101 | case OPTION_BOOLEAN: |
102 | dest += sprintf(dest, *option ? "yes" : "no"); | 102 | dest += sprintf(dest, *option ? "yes" : "no"); |
103 | break; | 103 | break; |
diff --git a/networking/udhcp/serverpacket.c b/networking/udhcp/serverpacket.c index c6a820909..1b89862b2 100644 --- a/networking/udhcp/serverpacket.c +++ b/networking/udhcp/serverpacket.c | |||
@@ -138,11 +138,11 @@ int sendOffer(struct dhcpMessage *oldpacket) | |||
138 | /* and the ip is in the lease range */ | 138 | /* and the ip is in the lease range */ |
139 | ntohl(req_align) >= ntohl(server_config.start) && | 139 | ntohl(req_align) >= ntohl(server_config.start) && |
140 | ntohl(req_align) <= ntohl(server_config.end) && | 140 | ntohl(req_align) <= ntohl(server_config.end) && |
141 | 141 | ||
142 | !static_lease_ip && /* Check that its not a static lease */ | 142 | !static_lease_ip && /* Check that its not a static lease */ |
143 | /* and is not already taken/offered */ | 143 | /* and is not already taken/offered */ |
144 | ((!(lease = find_lease_by_yiaddr(req_align)) || | 144 | ((!(lease = find_lease_by_yiaddr(req_align)) || |
145 | 145 | ||
146 | /* or its taken, but expired */ /* ADDME: or maybe in here */ | 146 | /* or its taken, but expired */ /* ADDME: or maybe in here */ |
147 | lease_expired(lease)))) { | 147 | lease_expired(lease)))) { |
148 | packet.yiaddr = req_align; /* FIXME: oh my, is there a host using this IP? */ | 148 | packet.yiaddr = req_align; /* FIXME: oh my, is there a host using this IP? */ |
diff --git a/networking/vconfig.c b/networking/vconfig.c index bbd29873c..36458f784 100644 --- a/networking/vconfig.c +++ b/networking/vconfig.c | |||
@@ -54,20 +54,20 @@ struct vlan_ioctl_args { | |||
54 | int cmd; /* Should be one of the vlan_ioctl_cmds enum above. */ | 54 | int cmd; /* Should be one of the vlan_ioctl_cmds enum above. */ |
55 | char device1[24]; | 55 | char device1[24]; |
56 | 56 | ||
57 | union { | 57 | union { |
58 | char device2[24]; | 58 | char device2[24]; |
59 | int VID; | 59 | int VID; |
60 | unsigned int skb_priority; | 60 | unsigned int skb_priority; |
61 | unsigned int name_type; | 61 | unsigned int name_type; |
62 | unsigned int bind_type; | 62 | unsigned int bind_type; |
63 | unsigned int flag; /* Matches vlan_dev_info flags */ | 63 | unsigned int flag; /* Matches vlan_dev_info flags */ |
64 | } u; | 64 | } u; |
65 | 65 | ||
66 | short vlan_qos; | 66 | short vlan_qos; |
67 | }; | 67 | }; |
68 | 68 | ||
69 | #define VLAN_GROUP_ARRAY_LEN 4096 | 69 | #define VLAN_GROUP_ARRAY_LEN 4096 |
70 | #define SIOCSIFVLAN 0x8983 /* Set 802.1Q VLAN options */ | 70 | #define SIOCSIFVLAN 0x8983 /* Set 802.1Q VLAN options */ |
71 | 71 | ||
72 | /* On entry, table points to the length of the current string plus | 72 | /* On entry, table points to the length of the current string plus |
73 | * nul terminator plus data length for the subsequent entry. The | 73 | * nul terminator plus data length for the subsequent entry. The |
diff --git a/networking/wget.c b/networking/wget.c index 29f5d45c3..9c7ed9f1d 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -118,22 +118,22 @@ static char *safe_fgets(char *s, int size, FILE *stream) | |||
118 | */ | 118 | */ |
119 | static char *base64enc(unsigned char *p, char *buf, int len) { | 119 | static char *base64enc(unsigned char *p, char *buf, int len) { |
120 | 120 | ||
121 | char al[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" | 121 | char al[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" |
122 | "0123456789+/"; | 122 | "0123456789+/"; |
123 | char *s = buf; | 123 | char *s = buf; |
124 | 124 | ||
125 | while(*p) { | 125 | while(*p) { |
126 | if (s >= buf+len-4) | 126 | if (s >= buf+len-4) |
127 | bb_error_msg_and_die("buffer overflow"); | 127 | bb_error_msg_and_die("buffer overflow"); |
128 | *(s++) = al[(*p >> 2) & 0x3F]; | 128 | *(s++) = al[(*p >> 2) & 0x3F]; |
129 | *(s++) = al[((*p << 4) & 0x30) | ((*(p+1) >> 4) & 0x0F)]; | 129 | *(s++) = al[((*p << 4) & 0x30) | ((*(p+1) >> 4) & 0x0F)]; |
130 | *s = *(s+1) = '='; | 130 | *s = *(s+1) = '='; |
131 | *(s+2) = 0; | 131 | *(s+2) = 0; |
132 | if (! *(++p)) break; | 132 | if (! *(++p)) break; |
133 | *(s++) = al[((*p << 2) & 0x3C) | ((*(p+1) >> 6) & 0x03)]; | 133 | *(s++) = al[((*p << 2) & 0x3C) | ((*(p+1) >> 6) & 0x03)]; |
134 | if (! *(++p)) break; | 134 | if (! *(++p)) break; |
135 | *(s++) = al[*(p++) & 0x3F]; | 135 | *(s++) = al[*(p++) & 0x3F]; |
136 | } | 136 | } |
137 | 137 | ||
138 | return buf; | 138 | return buf; |
139 | } | 139 | } |
@@ -190,8 +190,8 @@ int wget_main(int argc, char **argv) | |||
190 | */ | 190 | */ |
191 | bb_opt_complementally = "-1:\203::"; | 191 | bb_opt_complementally = "-1:\203::"; |
192 | bb_applet_long_options = wget_long_options; | 192 | bb_applet_long_options = wget_long_options; |
193 | opt = bb_getopt_ulflags(argc, argv, "cq\213O:\203:P:Y:", | 193 | opt = bb_getopt_ulflags(argc, argv, "cq\213O:\203:P:Y:", |
194 | &fname_out, &headers_llist, | 194 | &fname_out, &headers_llist, |
195 | &dir_prefix, &proxy_flag); | 195 | &dir_prefix, &proxy_flag); |
196 | if (opt & WGET_OPT_CONTINUE) { | 196 | if (opt & WGET_OPT_CONTINUE) { |
197 | ++do_continue; | 197 | ++do_continue; |
@@ -217,7 +217,7 @@ int wget_main(int argc, char **argv) | |||
217 | headers_llist = headers_llist->link; | 217 | headers_llist = headers_llist->link; |
218 | } | 218 | } |
219 | } | 219 | } |
220 | 220 | ||
221 | parse_url(argv[optind], &target); | 221 | parse_url(argv[optind], &target); |
222 | server.host = target.host; | 222 | server.host = target.host; |
223 | server.port = target.port; | 223 | server.port = target.port; |
@@ -347,8 +347,8 @@ int wget_main(int argc, char **argv) | |||
347 | fprintf(sfp,"Connection: close\r\n\r\n"); | 347 | fprintf(sfp,"Connection: close\r\n\r\n"); |
348 | 348 | ||
349 | /* | 349 | /* |
350 | * Retrieve HTTP response line and check for "200" status code. | 350 | * Retrieve HTTP response line and check for "200" status code. |
351 | */ | 351 | */ |
352 | read_response: | 352 | read_response: |
353 | if (fgets(buf, sizeof(buf), sfp) == NULL) | 353 | if (fgets(buf, sizeof(buf), sfp) == NULL) |
354 | close_delete_and_die("no response from server"); | 354 | close_delete_and_die("no response from server"); |
diff --git a/networking/zcip.c b/networking/zcip.c index 294ffd066..b64e37c58 100644 --- a/networking/zcip.c +++ b/networking/zcip.c | |||
@@ -174,7 +174,7 @@ run(char *script, char *arg, char *intf, struct in_addr *ip) | |||
174 | execl(script, script, arg, NULL); | 174 | execl(script, script, arg, NULL); |
175 | perror("execl"); | 175 | perror("execl"); |
176 | _exit(EXIT_FAILURE); | 176 | _exit(EXIT_FAILURE); |
177 | } | 177 | } |
178 | 178 | ||
179 | if (waitpid(pid, &status, 0) <= 0) { | 179 | if (waitpid(pid, &status, 0) <= 0) { |
180 | why = "waitpid"; | 180 | why = "waitpid"; |
@@ -365,7 +365,7 @@ fail: | |||
365 | fds[0].events = POLLIN; | 365 | fds[0].events = POLLIN; |
366 | fds[0].revents = 0; | 366 | fds[0].revents = 0; |
367 | 367 | ||
368 | // poll, being ready to adjust current timeout | 368 | // poll, being ready to adjust current timeout |
369 | if (timeout > 0) { | 369 | if (timeout > 0) { |
370 | gettimeofday(&tv1, NULL); | 370 | gettimeofday(&tv1, NULL); |
371 | tv1.tv_usec += (timeout % 1000) * 1000; | 371 | tv1.tv_usec += (timeout % 1000) * 1000; |
@@ -477,7 +477,7 @@ fail: | |||
477 | && p.arp.ar_op != htons(ARPOP_REPLY)) | 477 | && p.arp.ar_op != htons(ARPOP_REPLY)) |
478 | continue; | 478 | continue; |
479 | 479 | ||
480 | // some cases are always conflicts | 480 | // some cases are always conflicts |
481 | if ((p.source_ip.s_addr == ip.s_addr) | 481 | if ((p.source_ip.s_addr == ip.s_addr) |
482 | && (memcmp(&addr, &p.source_addr, | 482 | && (memcmp(&addr, &p.source_addr, |
483 | ETH_ALEN) != 0)) { | 483 | ETH_ALEN) != 0)) { |
@@ -533,7 +533,7 @@ collision: | |||
533 | bad: | 533 | bad: |
534 | if (foreground) | 534 | if (foreground) |
535 | perror(why); | 535 | perror(why); |
536 | else | 536 | else |
537 | syslog(LOG_ERR, "%s %s, %s error: %s", | 537 | syslog(LOG_ERR, "%s %s, %s error: %s", |
538 | prog, intf, why, strerror(errno)); | 538 | prog, intf, why, strerror(errno)); |
539 | return EXIT_FAILURE; | 539 | return EXIT_FAILURE; |
diff --git a/procps/Config.in b/procps/Config.in index 8a22a5dcf..52bfd3f43 100644 --- a/procps/Config.in +++ b/procps/Config.in | |||
@@ -17,7 +17,7 @@ config CONFIG_FUSER | |||
17 | bool "fuser" | 17 | bool "fuser" |
18 | default n | 18 | default n |
19 | help | 19 | help |
20 | fuser lists all PIDs (Process IDs) that currently have a given | 20 | fuser lists all PIDs (Process IDs) that currently have a given |
21 | file open. fuser can also list all PIDs that have a given network | 21 | file open. fuser can also list all PIDs that have a given network |
22 | (TCP or UDP) port open. | 22 | (TCP or UDP) port open. |
23 | 23 | ||
diff --git a/procps/fuser.c b/procps/fuser.c index 0258945ea..7ee56fbd9 100644 --- a/procps/fuser.c +++ b/procps/fuser.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * tiny fuser implementation | 2 | * tiny fuser implementation |
3 | * | 3 | * |
4 | * Copyright 2004 Tony J. White | 4 | * Copyright 2004 Tony J. White |
5 | * | 5 | * |
6 | * May be distributed under the conditions of the | 6 | * May be distributed under the conditions of the |
@@ -25,9 +25,9 @@ | |||
25 | 25 | ||
26 | #define FUSER_OPT_MOUNT 1 | 26 | #define FUSER_OPT_MOUNT 1 |
27 | #define FUSER_OPT_KILL 2 | 27 | #define FUSER_OPT_KILL 2 |
28 | #define FUSER_OPT_SILENT 4 | 28 | #define FUSER_OPT_SILENT 4 |
29 | #define FUSER_OPT_IP6 8 | 29 | #define FUSER_OPT_IP6 8 |
30 | #define FUSER_OPT_IP4 16 | 30 | #define FUSER_OPT_IP4 16 |
31 | 31 | ||
32 | typedef struct inode_list { | 32 | typedef struct inode_list { |
33 | ino_t inode; | 33 | ino_t inode; |
@@ -40,7 +40,7 @@ typedef struct pid_list { | |||
40 | struct pid_list *next; | 40 | struct pid_list *next; |
41 | } pid_list; | 41 | } pid_list; |
42 | 42 | ||
43 | static int fuser_option(char *option) | 43 | static int fuser_option(char *option) |
44 | { | 44 | { |
45 | int opt = 0; | 45 | int opt = 0; |
46 | 46 | ||
@@ -55,7 +55,7 @@ static int fuser_option(char *option) | |||
55 | else if(*option == '4') opt |= FUSER_OPT_IP4; | 55 | else if(*option == '4') opt |= FUSER_OPT_IP4; |
56 | else { | 56 | else { |
57 | bb_error_msg_and_die( | 57 | bb_error_msg_and_die( |
58 | "Unsupported option '%c'", *option); | 58 | "Unsupported option '%c'", *option); |
59 | } | 59 | } |
60 | ++option; | 60 | ++option; |
61 | } | 61 | } |
@@ -69,13 +69,13 @@ static int fuser_file_to_dev_inode(const char *filename, | |||
69 | if((stat(filename, &f_stat)) < 0) return 0; | 69 | if((stat(filename, &f_stat)) < 0) return 0; |
70 | *inode = f_stat.st_ino; | 70 | *inode = f_stat.st_ino; |
71 | *dev = f_stat.st_dev; | 71 | *dev = f_stat.st_dev; |
72 | return 1; | 72 | return 1; |
73 | } | 73 | } |
74 | 74 | ||
75 | static int fuser_find_socket_dev(dev_t *dev) { | 75 | static int fuser_find_socket_dev(dev_t *dev) { |
76 | int fd = socket(PF_INET, SOCK_DGRAM,0); | 76 | int fd = socket(PF_INET, SOCK_DGRAM,0); |
77 | struct stat buf; | 77 | struct stat buf; |
78 | 78 | ||
79 | if (fd >= 0 && (fstat(fd, &buf)) == 0) { | 79 | if (fd >= 0 && (fstat(fd, &buf)) == 0) { |
80 | *dev = buf.st_dev; | 80 | *dev = buf.st_dev; |
81 | close(fd); | 81 | close(fd); |
@@ -84,8 +84,8 @@ static int fuser_find_socket_dev(dev_t *dev) { | |||
84 | return 0; | 84 | return 0; |
85 | } | 85 | } |
86 | 86 | ||
87 | static int fuser_parse_net_arg(const char *filename, | 87 | static int fuser_parse_net_arg(const char *filename, |
88 | const char **proto, int *port) | 88 | const char **proto, int *port) |
89 | { | 89 | { |
90 | char path[sizeof(FUSER_PROC_DIR)+12], tproto[5]; | 90 | char path[sizeof(FUSER_PROC_DIR)+12], tproto[5]; |
91 | 91 | ||
@@ -93,51 +93,51 @@ static int fuser_parse_net_arg(const char *filename, | |||
93 | sprintf(path, "%s/net/%s", FUSER_PROC_DIR, tproto); | 93 | sprintf(path, "%s/net/%s", FUSER_PROC_DIR, tproto); |
94 | if((access(path, R_OK)) != 0) return 0; | 94 | if((access(path, R_OK)) != 0) return 0; |
95 | *proto = bb_xstrdup(tproto); | 95 | *proto = bb_xstrdup(tproto); |
96 | return 1; | 96 | return 1; |
97 | } | 97 | } |
98 | 98 | ||
99 | static int fuser_add_pid(pid_list *plist, pid_t pid) | 99 | static int fuser_add_pid(pid_list *plist, pid_t pid) |
100 | { | 100 | { |
101 | pid_list *curr = NULL, *last = NULL; | 101 | pid_list *curr = NULL, *last = NULL; |
102 | 102 | ||
103 | if(plist->pid == 0) plist->pid = pid; | 103 | if(plist->pid == 0) plist->pid = pid; |
104 | curr = plist; | 104 | curr = plist; |
105 | while(curr != NULL) { | 105 | while(curr != NULL) { |
106 | if(curr->pid == pid) return 1; | 106 | if(curr->pid == pid) return 1; |
107 | last = curr; | 107 | last = curr; |
108 | curr = curr->next; | 108 | curr = curr->next; |
109 | } | 109 | } |
110 | curr = xmalloc(sizeof(pid_list)); | 110 | curr = xmalloc(sizeof(pid_list)); |
111 | last->next = curr; | 111 | last->next = curr; |
112 | curr->pid = pid; | 112 | curr->pid = pid; |
113 | curr->next = NULL; | 113 | curr->next = NULL; |
114 | return 1; | 114 | return 1; |
115 | } | 115 | } |
116 | 116 | ||
117 | static int fuser_add_inode(inode_list *ilist, dev_t dev, ino_t inode) | 117 | static int fuser_add_inode(inode_list *ilist, dev_t dev, ino_t inode) |
118 | { | 118 | { |
119 | inode_list *curr = NULL, *last = NULL; | 119 | inode_list *curr = NULL, *last = NULL; |
120 | 120 | ||
121 | if(!ilist->inode && !ilist->dev) { | 121 | if(!ilist->inode && !ilist->dev) { |
122 | ilist->dev = dev; | 122 | ilist->dev = dev; |
123 | ilist->inode = inode; | 123 | ilist->inode = inode; |
124 | } | 124 | } |
125 | curr = ilist; | 125 | curr = ilist; |
126 | while(curr != NULL) { | 126 | while(curr != NULL) { |
127 | if(curr->inode == inode && curr->dev == dev) return 1; | 127 | if(curr->inode == inode && curr->dev == dev) return 1; |
128 | last = curr; | 128 | last = curr; |
129 | curr = curr->next; | 129 | curr = curr->next; |
130 | } | 130 | } |
131 | curr = xmalloc(sizeof(inode_list)); | 131 | curr = xmalloc(sizeof(inode_list)); |
132 | last->next = curr; | 132 | last->next = curr; |
133 | curr->dev = dev; | 133 | curr->dev = dev; |
134 | curr->inode = inode; | 134 | curr->inode = inode; |
135 | curr->next = NULL; | 135 | curr->next = NULL; |
136 | return 1; | 136 | return 1; |
137 | } | 137 | } |
138 | 138 | ||
139 | static int fuser_scan_proc_net(int opts, const char *proto, | 139 | static int fuser_scan_proc_net(int opts, const char *proto, |
140 | int port, inode_list *ilist) | 140 | int port, inode_list *ilist) |
141 | { | 141 | { |
142 | char path[sizeof(FUSER_PROC_DIR)+12], line[FUSER_MAX_LINE+1]; | 142 | char path[sizeof(FUSER_PROC_DIR)+12], line[FUSER_MAX_LINE+1]; |
143 | char addr[128]; | 143 | char addr[128]; |
@@ -156,10 +156,10 @@ static int fuser_scan_proc_net(int opts, const char *proto, | |||
156 | "%*d: %64[0-9A-Fa-f]:%x %*x:%*x %*x %*x:%*x " | 156 | "%*d: %64[0-9A-Fa-f]:%x %*x:%*x %*x %*x:%*x " |
157 | "%*x:%*x %*x %*d %*d %llu", | 157 | "%*x:%*x %*x %*d %*d %llu", |
158 | addr, &tmp_port, &uint64_inode) == 3) { | 158 | addr, &tmp_port, &uint64_inode) == 3) { |
159 | if((strlen(addr) == 8) && | 159 | if((strlen(addr) == 8) && |
160 | (opts & FUSER_OPT_IP6)) continue; | 160 | (opts & FUSER_OPT_IP6)) continue; |
161 | else if((strlen(addr) > 8) && | 161 | else if((strlen(addr) > 8) && |
162 | (opts & FUSER_OPT_IP4)) continue; | 162 | (opts & FUSER_OPT_IP4)) continue; |
163 | if(tmp_port == port) { | 163 | if(tmp_port == port) { |
164 | tmp_inode = uint64_inode; | 164 | tmp_inode = uint64_inode; |
165 | fuser_add_inode(ilist, tmp_dev, tmp_inode); | 165 | fuser_add_inode(ilist, tmp_dev, tmp_inode); |
@@ -171,24 +171,24 @@ static int fuser_scan_proc_net(int opts, const char *proto, | |||
171 | return 1; | 171 | return 1; |
172 | } | 172 | } |
173 | 173 | ||
174 | static int fuser_search_dev_inode(int opts, inode_list *ilist, | 174 | static int fuser_search_dev_inode(int opts, inode_list *ilist, |
175 | dev_t dev, ino_t inode) | 175 | dev_t dev, ino_t inode) |
176 | { | 176 | { |
177 | inode_list *curr; | 177 | inode_list *curr; |
178 | curr = ilist; | 178 | curr = ilist; |
179 | 179 | ||
180 | while(curr) { | 180 | while(curr) { |
181 | if((opts & FUSER_OPT_MOUNT) && curr->dev == dev) | 181 | if((opts & FUSER_OPT_MOUNT) && curr->dev == dev) |
182 | return 1; | 182 | return 1; |
183 | if(curr->inode == inode && curr->dev == dev) | 183 | if(curr->inode == inode && curr->dev == dev) |
184 | return 1; | 184 | return 1; |
185 | curr = curr->next; | 185 | curr = curr->next; |
186 | } | 186 | } |
187 | return 0; | 187 | return 0; |
188 | } | 188 | } |
189 | 189 | ||
190 | static int fuser_scan_pid_maps(int opts, const char *fname, pid_t pid, | 190 | static int fuser_scan_pid_maps(int opts, const char *fname, pid_t pid, |
191 | inode_list *ilist, pid_list *plist) | 191 | inode_list *ilist, pid_list *plist) |
192 | { | 192 | { |
193 | FILE *file; | 193 | FILE *file; |
194 | char line[FUSER_MAX_LINE + 1]; | 194 | char line[FUSER_MAX_LINE + 1]; |
@@ -199,28 +199,28 @@ static int fuser_scan_pid_maps(int opts, const char *fname, pid_t pid, | |||
199 | 199 | ||
200 | if (!(file = fopen(fname, "r"))) return 0; | 200 | if (!(file = fopen(fname, "r"))) return 0; |
201 | while (fgets(line, FUSER_MAX_LINE, file)) { | 201 | while (fgets(line, FUSER_MAX_LINE, file)) { |
202 | if(sscanf(line, "%*s %*s %*s %x:%x %llu", | 202 | if(sscanf(line, "%*s %*s %*s %x:%x %llu", |
203 | &major, &minor, &uint64_inode) != 3) continue; | 203 | &major, &minor, &uint64_inode) != 3) continue; |
204 | inode = uint64_inode; | 204 | inode = uint64_inode; |
205 | if(major == 0 && minor == 0 && inode == 0) continue; | 205 | if(major == 0 && minor == 0 && inode == 0) continue; |
206 | dev = makedev(major, minor); | 206 | dev = makedev(major, minor); |
207 | if(fuser_search_dev_inode(opts, ilist, dev, inode)) { | 207 | if(fuser_search_dev_inode(opts, ilist, dev, inode)) { |
208 | fuser_add_pid(plist, pid); | 208 | fuser_add_pid(plist, pid); |
209 | } | 209 | } |
210 | 210 | ||
211 | } | 211 | } |
212 | fclose(file); | 212 | fclose(file); |
213 | return 1; | 213 | return 1; |
214 | } | 214 | } |
215 | 215 | ||
216 | static int fuser_scan_link(int opts, const char *lname, pid_t pid, | 216 | static int fuser_scan_link(int opts, const char *lname, pid_t pid, |
217 | inode_list *ilist, pid_list *plist) | 217 | inode_list *ilist, pid_list *plist) |
218 | { | 218 | { |
219 | ino_t inode; | 219 | ino_t inode; |
220 | dev_t dev; | 220 | dev_t dev; |
221 | 221 | ||
222 | if(!fuser_file_to_dev_inode(lname, &dev, &inode)) return 0; | 222 | if(!fuser_file_to_dev_inode(lname, &dev, &inode)) return 0; |
223 | if(fuser_search_dev_inode(opts, ilist, dev, inode)) | 223 | if(fuser_search_dev_inode(opts, ilist, dev, inode)) |
224 | fuser_add_pid(plist, pid); | 224 | fuser_add_pid(plist, pid); |
225 | return 1; | 225 | return 1; |
226 | } | 226 | } |
@@ -245,9 +245,9 @@ static int fuser_scan_dir_links(int opts, const char *dname, pid_t pid, | |||
245 | else return 0; | 245 | else return 0; |
246 | return 1; | 246 | return 1; |
247 | 247 | ||
248 | } | 248 | } |
249 | 249 | ||
250 | static int fuser_scan_proc_pids(int opts, inode_list *ilist, pid_list *plist) | 250 | static int fuser_scan_proc_pids(int opts, inode_list *ilist, pid_list *plist) |
251 | { | 251 | { |
252 | DIR *d; | 252 | DIR *d; |
253 | struct dirent *de; | 253 | struct dirent *de; |
@@ -261,7 +261,7 @@ static int fuser_scan_proc_pids(int opts, inode_list *ilist, pid_list *plist) | |||
261 | dname = concat_subpath_file(FUSER_PROC_DIR, de->d_name); | 261 | dname = concat_subpath_file(FUSER_PROC_DIR, de->d_name); |
262 | if(chdir(dname) < 0) { | 262 | if(chdir(dname) < 0) { |
263 | free(dname); | 263 | free(dname); |
264 | continue; | 264 | continue; |
265 | } | 265 | } |
266 | free(dname); | 266 | free(dname); |
267 | fuser_scan_link(opts, "cwd", pid, ilist, plist); | 267 | fuser_scan_link(opts, "cwd", pid, ilist, plist); |
@@ -272,8 +272,8 @@ static int fuser_scan_proc_pids(int opts, inode_list *ilist, pid_list *plist) | |||
272 | fuser_scan_dir_links(opts, "mmap", pid, ilist, plist); | 272 | fuser_scan_dir_links(opts, "mmap", pid, ilist, plist); |
273 | fuser_scan_pid_maps(opts, "maps", pid, ilist, plist); | 273 | fuser_scan_pid_maps(opts, "maps", pid, ilist, plist); |
274 | chdir(".."); | 274 | chdir(".."); |
275 | } | 275 | } |
276 | closedir(d); | 276 | closedir(d); |
277 | return 1; | 277 | return 1; |
278 | } | 278 | } |
279 | 279 | ||
@@ -290,22 +290,22 @@ static int fuser_print_pid_list(pid_list *plist) { | |||
290 | } | 290 | } |
291 | 291 | ||
292 | static int fuser_kill_pid_list(pid_list *plist, int sig) { | 292 | static int fuser_kill_pid_list(pid_list *plist, int sig) { |
293 | pid_list *curr = plist; | 293 | pid_list *curr = plist; |
294 | pid_t mypid = getpid(); | 294 | pid_t mypid = getpid(); |
295 | int success = 1; | 295 | int success = 1; |
296 | 296 | ||
297 | if(plist == NULL) return 0; | 297 | if(plist == NULL) return 0; |
298 | while(curr != NULL) { | 298 | while(curr != NULL) { |
299 | if(curr->pid > 0 && curr->pid != mypid) { | 299 | if(curr->pid > 0 && curr->pid != mypid) { |
300 | if (kill(curr->pid, sig) != 0) { | 300 | if (kill(curr->pid, sig) != 0) { |
301 | bb_perror_msg( | 301 | bb_perror_msg( |
302 | "Could not kill pid '%d'", curr->pid); | 302 | "Could not kill pid '%d'", curr->pid); |
303 | success = 0; | 303 | success = 0; |
304 | } | 304 | } |
305 | } | 305 | } |
306 | curr = curr->next; | 306 | curr = curr->next; |
307 | } | 307 | } |
308 | return success; | 308 | return success; |
309 | } | 309 | } |
310 | 310 | ||
311 | extern int fuser_main(int argc, char **argv) { | 311 | extern int fuser_main(int argc, char **argv) { |
@@ -324,7 +324,7 @@ extern int fuser_main(int argc, char **argv) { | |||
324 | fni = xmalloc(sizeof(int)); | 324 | fni = xmalloc(sizeof(int)); |
325 | for(i=1;i<argc;i++) { | 325 | for(i=1;i<argc;i++) { |
326 | optn = fuser_option(argv[i]); | 326 | optn = fuser_option(argv[i]); |
327 | if(optn) opt |= optn; | 327 | if(optn) opt |= optn; |
328 | else if(argv[i][0] == '-') { | 328 | else if(argv[i][0] == '-') { |
329 | if(!(u_signal_names(argv[i]+1, &killsig, 0))) | 329 | if(!(u_signal_names(argv[i]+1, &killsig, 0))) |
330 | killsig = SIGTERM; | 330 | killsig = SIGTERM; |
@@ -368,4 +368,4 @@ extern int fuser_main(int argc, char **argv) { | |||
368 | free(inodes); | 368 | free(inodes); |
369 | /* return 0 on (success == 1) 1 otherwise */ | 369 | /* return 0 on (success == 1) 1 otherwise */ |
370 | return (success != 1); | 370 | return (success != 1); |
371 | } | 371 | } |
diff --git a/procps/kill.c b/procps/kill.c index 6d7f083b8..2d4e6deb4 100644 --- a/procps/kill.c +++ b/procps/kill.c | |||
@@ -87,7 +87,7 @@ extern int kill_main(int argc, char **argv) | |||
87 | return EXIT_SUCCESS; | 87 | return EXIT_SUCCESS; |
88 | } | 88 | } |
89 | 89 | ||
90 | #ifdef CONFIG_KILLALL | 90 | #ifdef CONFIG_KILLALL |
91 | /* The -q quiet option */ | 91 | /* The -q quiet option */ |
92 | if(argv[1][1]=='q' && argv[1][2]=='\0'){ | 92 | if(argv[1][1]=='q' && argv[1][2]=='\0'){ |
93 | quiet++; | 93 | quiet++; |
diff --git a/procps/top.c b/procps/top.c index 5faeafb59..a2a44da7d 100644 --- a/procps/top.c +++ b/procps/top.c | |||
@@ -133,20 +133,20 @@ static unsigned long Hertz; | |||
133 | #define FILE_TO_BUF(filename, fd) do{ \ | 133 | #define FILE_TO_BUF(filename, fd) do{ \ |
134 | if (fd == -1 && (fd = open(filename, O_RDONLY)) == -1) { \ | 134 | if (fd == -1 && (fd = open(filename, O_RDONLY)) == -1) { \ |
135 | bb_perror_msg_and_die("/proc not be mounted?"); \ | 135 | bb_perror_msg_and_die("/proc not be mounted?"); \ |
136 | } \ | 136 | } \ |
137 | lseek(fd, 0L, SEEK_SET); \ | 137 | lseek(fd, 0L, SEEK_SET); \ |
138 | if ((local_n = read(fd, buf, sizeof buf - 1)) < 0) { \ | 138 | if ((local_n = read(fd, buf, sizeof buf - 1)) < 0) { \ |
139 | bb_perror_msg_and_die("%s", filename); \ | 139 | bb_perror_msg_and_die("%s", filename); \ |
140 | } \ | 140 | } \ |
141 | buf[local_n] = '\0'; \ | 141 | buf[local_n] = '\0'; \ |
142 | }while(0) | 142 | }while(0) |
143 | 143 | ||
144 | #define FILE_TO_BUF2(filename, fd) do{ \ | 144 | #define FILE_TO_BUF2(filename, fd) do{ \ |
145 | lseek(fd, 0L, SEEK_SET); \ | 145 | lseek(fd, 0L, SEEK_SET); \ |
146 | if ((local_n = read(fd, buf, sizeof buf - 1)) < 0) { \ | 146 | if ((local_n = read(fd, buf, sizeof buf - 1)) < 0) { \ |
147 | bb_perror_msg_and_die("%s", filename); \ | 147 | bb_perror_msg_and_die("%s", filename); \ |
148 | } \ | 148 | } \ |
149 | buf[local_n] = '\0'; \ | 149 | buf[local_n] = '\0'; \ |
150 | }while(0) | 150 | }while(0) |
151 | 151 | ||
152 | static void init_Hertz_value(void) { | 152 | static void init_Hertz_value(void) { |
diff --git a/scripts/config/conf.c b/scripts/config/conf.c index d6c921d98..edcf36d69 100644 --- a/scripts/config/conf.c +++ b/scripts/config/conf.c | |||
@@ -528,7 +528,7 @@ int main(int ac, char **av) | |||
528 | exit(0); | 528 | exit(0); |
529 | } | 529 | } |
530 | } | 530 | } |
531 | name = av[i]; | 531 | name = av[i]; |
532 | if (!name) { | 532 | if (!name) { |
533 | printf("%s: configuration file missing\n", av[0]); | 533 | printf("%s: configuration file missing\n", av[0]); |
534 | } | 534 | } |
diff --git a/scripts/config/confdata.c b/scripts/config/confdata.c index 6fb92c9f3..c4087fd73 100644 --- a/scripts/config/confdata.c +++ b/scripts/config/confdata.c | |||
@@ -264,7 +264,7 @@ struct menu *next_menu(struct menu *menu) | |||
264 | break; | 264 | break; |
265 | } | 265 | } |
266 | } while ((menu = menu->parent)); | 266 | } while ((menu = menu->parent)); |
267 | 267 | ||
268 | return menu; | 268 | return menu; |
269 | } | 269 | } |
270 | 270 | ||
diff --git a/scripts/config/expr.c b/scripts/config/expr.c index 30e4f9d69..6f39e7a25 100644 --- a/scripts/config/expr.c +++ b/scripts/config/expr.c | |||
@@ -824,7 +824,7 @@ bool expr_depends_symbol(struct expr *dep, struct symbol *sym) | |||
824 | default: | 824 | default: |
825 | ; | 825 | ; |
826 | } | 826 | } |
827 | return false; | 827 | return false; |
828 | } | 828 | } |
829 | 829 | ||
830 | struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2) | 830 | struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2) |
diff --git a/scripts/config/lex.zconf.c_shipped b/scripts/config/lex.zconf.c_shipped index b877bb6b3..8e5e85e4c 100644 --- a/scripts/config/lex.zconf.c_shipped +++ b/scripts/config/lex.zconf.c_shipped | |||
@@ -2771,7 +2771,7 @@ YY_FATAL_ERROR( "flex scanner jammed" ); | |||
2771 | */ | 2771 | */ |
2772 | static int yy_get_next_buffer (void) | 2772 | static int yy_get_next_buffer (void) |
2773 | { | 2773 | { |
2774 | register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; | 2774 | register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; |
2775 | register char *source = (yytext_ptr); | 2775 | register char *source = (yytext_ptr); |
2776 | register int number_to_move, i; | 2776 | register int number_to_move, i; |
2777 | int ret_val; | 2777 | int ret_val; |
@@ -3091,7 +3091,7 @@ static int yy_get_next_buffer (void) | |||
3091 | 3091 | ||
3092 | static void zconf_load_buffer_state (void) | 3092 | static void zconf_load_buffer_state (void) |
3093 | { | 3093 | { |
3094 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; | 3094 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; |
3095 | (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; | 3095 | (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; |
3096 | zconfin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; | 3096 | zconfin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; |
3097 | (yy_hold_char) = *(yy_c_buf_p); | 3097 | (yy_hold_char) = *(yy_c_buf_p); |
@@ -3180,7 +3180,7 @@ static void zconf_load_buffer_state (void) | |||
3180 | */ | 3180 | */ |
3181 | void zconf_flush_buffer (YY_BUFFER_STATE b ) | 3181 | void zconf_flush_buffer (YY_BUFFER_STATE b ) |
3182 | { | 3182 | { |
3183 | if ( ! b ) | 3183 | if ( ! b ) |
3184 | return; | 3184 | return; |
3185 | 3185 | ||
3186 | b->yy_n_chars = 0; | 3186 | b->yy_n_chars = 0; |
@@ -3209,7 +3209,7 @@ static void zconf_load_buffer_state (void) | |||
3209 | */ | 3209 | */ |
3210 | void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer ) | 3210 | void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer ) |
3211 | { | 3211 | { |
3212 | if (new_buffer == NULL) | 3212 | if (new_buffer == NULL) |
3213 | return; | 3213 | return; |
3214 | 3214 | ||
3215 | zconfensure_buffer_stack(); | 3215 | zconfensure_buffer_stack(); |
@@ -3239,7 +3239,7 @@ void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer ) | |||
3239 | */ | 3239 | */ |
3240 | void zconfpop_buffer_state (void) | 3240 | void zconfpop_buffer_state (void) |
3241 | { | 3241 | { |
3242 | if (!YY_CURRENT_BUFFER) | 3242 | if (!YY_CURRENT_BUFFER) |
3243 | return; | 3243 | return; |
3244 | 3244 | ||
3245 | zconf_delete_buffer(YY_CURRENT_BUFFER ); | 3245 | zconf_delete_buffer(YY_CURRENT_BUFFER ); |
@@ -3387,7 +3387,7 @@ YY_BUFFER_STATE zconf_scan_bytes (yyconst char * bytes, int len ) | |||
3387 | 3387 | ||
3388 | static void yy_fatal_error (yyconst char* msg ) | 3388 | static void yy_fatal_error (yyconst char* msg ) |
3389 | { | 3389 | { |
3390 | (void) fprintf( stderr, "%s\n", msg ); | 3390 | (void) fprintf( stderr, "%s\n", msg ); |
3391 | exit( YY_EXIT_FAILURE ); | 3391 | exit( YY_EXIT_FAILURE ); |
3392 | } | 3392 | } |
3393 | 3393 | ||
@@ -3514,7 +3514,7 @@ int zconflex_destroy (void) | |||
3514 | static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) | 3514 | static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) |
3515 | { | 3515 | { |
3516 | register int i; | 3516 | register int i; |
3517 | for ( i = 0; i < n; ++i ) | 3517 | for ( i = 0; i < n; ++i ) |
3518 | s1[i] = s2[i]; | 3518 | s1[i] = s2[i]; |
3519 | } | 3519 | } |
3520 | #endif | 3520 | #endif |
@@ -3523,7 +3523,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) | |||
3523 | static int yy_flex_strlen (yyconst char * s ) | 3523 | static int yy_flex_strlen (yyconst char * s ) |
3524 | { | 3524 | { |
3525 | register int n; | 3525 | register int n; |
3526 | for ( n = 0; s[n]; ++n ) | 3526 | for ( n = 0; s[n]; ++n ) |
3527 | ; | 3527 | ; |
3528 | 3528 | ||
3529 | return n; | 3529 | return n; |
diff --git a/scripts/config/lxdialog/checklist.c b/scripts/config/lxdialog/checklist.c index 71de4a191..7565b5db1 100644 --- a/scripts/config/lxdialog/checklist.c +++ b/scripts/config/lxdialog/checklist.c | |||
@@ -52,8 +52,8 @@ print_item (WINDOW * win, const char *item, int status, | |||
52 | wattrset (win, selected ? item_selected_attr : item_attr); | 52 | wattrset (win, selected ? item_selected_attr : item_attr); |
53 | waddstr (win, (char *)item+1); | 53 | waddstr (win, (char *)item+1); |
54 | if (selected) { | 54 | if (selected) { |
55 | wmove (win, choice, check_x+1); | 55 | wmove (win, choice, check_x+1); |
56 | wrefresh (win); | 56 | wrefresh (win); |
57 | } | 57 | } |
58 | } | 58 | } |
59 | 59 | ||
@@ -120,7 +120,7 @@ int | |||
120 | dialog_checklist (const char *title, const char *prompt, int height, int width, | 120 | dialog_checklist (const char *title, const char *prompt, int height, int width, |
121 | int list_height, int item_no, struct dialog_list_item ** items, | 121 | int list_height, int item_no, struct dialog_list_item ** items, |
122 | int flag) | 122 | int flag) |
123 | 123 | ||
124 | { | 124 | { |
125 | int i, x, y, box_x, box_y; | 125 | int i, x, y, box_x, box_y; |
126 | int key = 0, button = 0, choice = 0, scroll = 0, max_choice, *status; | 126 | int key = 0, button = 0, choice = 0, scroll = 0, max_choice, *status; |
@@ -140,7 +140,7 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, | |||
140 | for (i = 0; i < item_no; i++) { | 140 | for (i = 0; i < item_no; i++) { |
141 | status[i] = (items[i]->selected == 1); /* ON */ | 141 | status[i] = (items[i]->selected == 1); /* ON */ |
142 | if ((!choice && status[i]) || items[i]->selected == 2) /* SELECTED */ | 142 | if ((!choice && status[i]) || items[i]->selected == 2) /* SELECTED */ |
143 | choice = i + 1; | 143 | choice = i + 1; |
144 | } | 144 | } |
145 | if (choice) | 145 | if (choice) |
146 | choice--; | 146 | choice--; |
@@ -197,7 +197,7 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, | |||
197 | 197 | ||
198 | /* Find length of longest item in order to center checklist */ | 198 | /* Find length of longest item in order to center checklist */ |
199 | check_x = 0; | 199 | check_x = 0; |
200 | for (i = 0; i < item_no; i++) | 200 | for (i = 0; i < item_no; i++) |
201 | check_x = MAX (check_x, + strlen (items[i]->name) + 4); | 201 | check_x = MAX (check_x, + strlen (items[i]->name) + 4); |
202 | 202 | ||
203 | check_x = (list_width - check_x) / 2; | 203 | check_x = (list_width - check_x) / 2; |
@@ -226,12 +226,12 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, | |||
226 | while (key != ESC) { | 226 | while (key != ESC) { |
227 | key = wgetch (dialog); | 227 | key = wgetch (dialog); |
228 | 228 | ||
229 | for (i = 0; i < max_choice; i++) | 229 | for (i = 0; i < max_choice; i++) |
230 | if (toupper(key) == toupper(items[scroll + i]->name[0])) | 230 | if (toupper(key) == toupper(items[scroll + i]->name[0])) |
231 | break; | 231 | break; |
232 | 232 | ||
233 | 233 | ||
234 | if ( i < max_choice || key == KEY_UP || key == KEY_DOWN || | 234 | if ( i < max_choice || key == KEY_UP || key == KEY_DOWN || |
235 | key == '+' || key == '-' ) { | 235 | key == '+' || key == '-' ) { |
236 | if (key == KEY_UP || key == '-') { | 236 | if (key == KEY_UP || key == '-') { |
237 | if (!choice) { | 237 | if (!choice) { |
@@ -251,7 +251,7 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, | |||
251 | status[scroll], 0, TRUE); | 251 | status[scroll], 0, TRUE); |
252 | wnoutrefresh (list); | 252 | wnoutrefresh (list); |
253 | 253 | ||
254 | print_arrows(dialog, choice, item_no, scroll, | 254 | print_arrows(dialog, choice, item_no, scroll, |
255 | box_y, box_x + check_x + 5, list_height); | 255 | box_y, box_x + check_x + 5, list_height); |
256 | 256 | ||
257 | wrefresh (dialog); | 257 | wrefresh (dialog); |
@@ -279,7 +279,7 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, | |||
279 | max_choice - 1, TRUE); | 279 | max_choice - 1, TRUE); |
280 | wnoutrefresh (list); | 280 | wnoutrefresh (list); |
281 | 281 | ||
282 | print_arrows(dialog, choice, item_no, scroll, | 282 | print_arrows(dialog, choice, item_no, scroll, |
283 | box_y, box_x + check_x + 5, list_height); | 283 | box_y, box_x + check_x + 5, list_height); |
284 | 284 | ||
285 | wrefresh (dialog); | 285 | wrefresh (dialog); |
@@ -342,11 +342,11 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, | |||
342 | } | 342 | } |
343 | wnoutrefresh (list); | 343 | wnoutrefresh (list); |
344 | wrefresh (dialog); | 344 | wrefresh (dialog); |
345 | 345 | ||
346 | for (i = 0; i < item_no; i++) { | 346 | for (i = 0; i < item_no; i++) { |
347 | items[i]->selected = status[i]; | 347 | items[i]->selected = status[i]; |
348 | } | 348 | } |
349 | } else { | 349 | } else { |
350 | for (i = 0; i < item_no; i++) | 350 | for (i = 0; i < item_no; i++) |
351 | items[i]->selected = 0; | 351 | items[i]->selected = 0; |
352 | items[scroll + choice]->selected = 1; | 352 | items[scroll + choice]->selected = 1; |
@@ -364,7 +364,7 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, | |||
364 | /* Now, update everything... */ | 364 | /* Now, update everything... */ |
365 | doupdate (); | 365 | doupdate (); |
366 | } | 366 | } |
367 | 367 | ||
368 | 368 | ||
369 | delwin (dialog); | 369 | delwin (dialog); |
370 | free (status); | 370 | free (status); |
diff --git a/scripts/config/lxdialog/dialog.h b/scripts/config/lxdialog/dialog.h index 7bab3ad0e..cb482a5ab 100644 --- a/scripts/config/lxdialog/dialog.h +++ b/scripts/config/lxdialog/dialog.h | |||
@@ -89,7 +89,7 @@ | |||
89 | #define ACS_DARROW 'v' | 89 | #define ACS_DARROW 'v' |
90 | #endif | 90 | #endif |
91 | 91 | ||
92 | /* | 92 | /* |
93 | * Attribute names | 93 | * Attribute names |
94 | */ | 94 | */ |
95 | #define screen_attr attributes[0] | 95 | #define screen_attr attributes[0] |
@@ -165,7 +165,7 @@ int dialog_msgbox (const char *title, const char *prompt, int height, | |||
165 | int width, int pause); | 165 | int width, int pause); |
166 | int dialog_textbox (const char *title, const char *file, int height, int width); | 166 | int dialog_textbox (const char *title, const char *file, int height, int width); |
167 | int dialog_menu (const char *title, const char *prompt, int height, int width, | 167 | int dialog_menu (const char *title, const char *prompt, int height, int width, |
168 | int menu_height, const char *choice, int item_no, | 168 | int menu_height, const char *choice, int item_no, |
169 | struct dialog_list_item ** items); | 169 | struct dialog_list_item ** items); |
170 | int dialog_checklist (const char *title, const char *prompt, int height, | 170 | int dialog_checklist (const char *title, const char *prompt, int height, |
171 | int width, int list_height, int item_no, | 171 | int width, int list_height, int item_no, |
diff --git a/scripts/config/lxdialog/menubox.c b/scripts/config/lxdialog/menubox.c index 873dc587b..d0990c34e 100644 --- a/scripts/config/lxdialog/menubox.c +++ b/scripts/config/lxdialog/menubox.c | |||
@@ -26,7 +26,7 @@ | |||
26 | * | 26 | * |
27 | * *) A bugfix for the Page-Down problem | 27 | * *) A bugfix for the Page-Down problem |
28 | * | 28 | * |
29 | * *) Formerly when I used Page Down and Page Up, the cursor would be set | 29 | * *) Formerly when I used Page Down and Page Up, the cursor would be set |
30 | * to the first position in the menu box. Now lxdialog is a bit | 30 | * to the first position in the menu box. Now lxdialog is a bit |
31 | * smarter and works more like other menu systems (just have a look at | 31 | * smarter and works more like other menu systems (just have a look at |
32 | * it). | 32 | * it). |
@@ -78,8 +78,8 @@ print_item (WINDOW * win, const char *item, int choice, int selected, int hotkey | |||
78 | wmove (win, choice, 0); | 78 | wmove (win, choice, 0); |
79 | #if OLD_NCURSES | 79 | #if OLD_NCURSES |
80 | { | 80 | { |
81 | int i; | 81 | int i; |
82 | for (i = 0; i < menu_width; i++) | 82 | for (i = 0; i < menu_width; i++) |
83 | waddch (win, ' '); | 83 | waddch (win, ' '); |
84 | } | 84 | } |
85 | #else | 85 | #else |
@@ -88,8 +88,8 @@ print_item (WINDOW * win, const char *item, int choice, int selected, int hotkey | |||
88 | wattrset (win, selected ? item_selected_attr : item_attr); | 88 | wattrset (win, selected ? item_selected_attr : item_attr); |
89 | mvwaddstr (win, choice, item_x, menu_item); | 89 | mvwaddstr (win, choice, item_x, menu_item); |
90 | if (hotkey) { | 90 | if (hotkey) { |
91 | wattrset (win, selected ? tag_key_selected_attr : tag_key_attr); | 91 | wattrset (win, selected ? tag_key_selected_attr : tag_key_attr); |
92 | mvwaddch(win, choice, item_x+j, menu_item[j]); | 92 | mvwaddch(win, choice, item_x+j, menu_item[j]); |
93 | } | 93 | } |
94 | if (selected) { | 94 | if (selected) { |
95 | wmove (win, choice, item_x+1); | 95 | wmove (win, choice, item_x+1); |
@@ -225,7 +225,7 @@ dialog_menu (const char *title, const char *prompt, int height, int width, | |||
225 | 225 | ||
226 | /* | 226 | /* |
227 | * Find length of longest item in order to center menu. | 227 | * Find length of longest item in order to center menu. |
228 | * Set 'choice' to default item. | 228 | * Set 'choice' to default item. |
229 | */ | 229 | */ |
230 | item_x = 0; | 230 | item_x = 0; |
231 | for (i = 0; i < item_no; i++) { | 231 | for (i = 0; i < item_no; i++) { |
@@ -261,7 +261,7 @@ dialog_menu (const char *title, const char *prompt, int height, int width, | |||
261 | /* Print the menu */ | 261 | /* Print the menu */ |
262 | for (i=0; i < max_choice; i++) { | 262 | for (i=0; i < max_choice; i++) { |
263 | print_item (menu, items[first_item + i]->name, i, i == choice, | 263 | print_item (menu, items[first_item + i]->name, i, i == choice, |
264 | (items[first_item + i]->tag[0] != ':')); | 264 | (items[first_item + i]->tag[0] != ':')); |
265 | } | 265 | } |
266 | 266 | ||
267 | wnoutrefresh (menu); | 267 | wnoutrefresh (menu); |
@@ -281,107 +281,107 @@ dialog_menu (const char *title, const char *prompt, int height, int width, | |||
281 | if (strchr("ynmh", key)) | 281 | if (strchr("ynmh", key)) |
282 | i = max_choice; | 282 | i = max_choice; |
283 | else { | 283 | else { |
284 | for (i = choice+1; i < max_choice; i++) { | 284 | for (i = choice+1; i < max_choice; i++) { |
285 | j = first_alpha(items[scroll + i]->name, "YyNnMmHh"); | 285 | j = first_alpha(items[scroll + i]->name, "YyNnMmHh"); |
286 | if (key == tolower(items[scroll + i]->name[j])) | 286 | if (key == tolower(items[scroll + i]->name[j])) |
287 | break; | 287 | break; |
288 | } | 288 | } |
289 | if (i == max_choice) | 289 | if (i == max_choice) |
290 | for (i = 0; i < max_choice; i++) { | 290 | for (i = 0; i < max_choice; i++) { |
291 | j = first_alpha(items[scroll + i]->name, "YyNnMmHh"); | 291 | j = first_alpha(items[scroll + i]->name, "YyNnMmHh"); |
292 | if (key == tolower(items[scroll + i]->name[j])) | 292 | if (key == tolower(items[scroll + i]->name[j])) |
293 | break; | 293 | break; |
294 | } | 294 | } |
295 | } | 295 | } |
296 | 296 | ||
297 | if (i < max_choice || | 297 | if (i < max_choice || |
298 | key == KEY_UP || key == KEY_DOWN || | 298 | key == KEY_UP || key == KEY_DOWN || |
299 | key == '-' || key == '+' || | 299 | key == '-' || key == '+' || |
300 | key == KEY_PPAGE || key == KEY_NPAGE) { | 300 | key == KEY_PPAGE || key == KEY_NPAGE) { |
301 | 301 | ||
302 | print_item (menu, items[scroll + choice]->name, choice, FALSE, | 302 | print_item (menu, items[scroll + choice]->name, choice, FALSE, |
303 | (items[scroll + choice]->tag[0] != ':')); | 303 | (items[scroll + choice]->tag[0] != ':')); |
304 | 304 | ||
305 | if (key == KEY_UP || key == '-') { | 305 | if (key == KEY_UP || key == '-') { |
306 | if (choice < 2 && scroll) { | 306 | if (choice < 2 && scroll) { |
307 | /* Scroll menu down */ | 307 | /* Scroll menu down */ |
308 | scrollok (menu, TRUE); | 308 | scrollok (menu, TRUE); |
309 | wscrl (menu, -1); | 309 | wscrl (menu, -1); |
310 | scrollok (menu, FALSE); | 310 | scrollok (menu, FALSE); |
311 | 311 | ||
312 | scroll--; | 312 | scroll--; |
313 | 313 | ||
314 | print_item (menu, items[scroll]->name, 0, FALSE, | 314 | print_item (menu, items[scroll]->name, 0, FALSE, |
315 | (items[scroll]->tag[0] != ':')); | 315 | (items[scroll]->tag[0] != ':')); |
316 | } else | 316 | } else |
317 | choice = MAX(choice - 1, 0); | 317 | choice = MAX(choice - 1, 0); |
318 | 318 | ||
319 | } else if (key == KEY_DOWN || key == '+') { | 319 | } else if (key == KEY_DOWN || key == '+') { |
320 | 320 | ||
321 | print_item (menu, items[scroll + choice]->name, choice, FALSE, | 321 | print_item (menu, items[scroll + choice]->name, choice, FALSE, |
322 | (items[scroll + choice]->tag[0] != ':')); | 322 | (items[scroll + choice]->tag[0] != ':')); |
323 | 323 | ||
324 | if ((choice > max_choice-3) && | 324 | if ((choice > max_choice-3) && |
325 | (scroll + max_choice < item_no) | 325 | (scroll + max_choice < item_no) |
326 | ) { | 326 | ) { |
327 | /* Scroll menu up */ | 327 | /* Scroll menu up */ |
328 | scrollok (menu, TRUE); | 328 | scrollok (menu, TRUE); |
329 | scroll (menu); | 329 | scroll (menu); |
330 | scrollok (menu, FALSE); | 330 | scrollok (menu, FALSE); |
331 | 331 | ||
332 | scroll++; | 332 | scroll++; |
333 | 333 | ||
334 | print_item (menu, items[scroll + max_choice - 1]->name, | 334 | print_item (menu, items[scroll + max_choice - 1]->name, |
335 | max_choice-1, FALSE, | 335 | max_choice-1, FALSE, |
336 | (items[scroll + max_choice - 1]->tag[0] != ':')); | 336 | (items[scroll + max_choice - 1]->tag[0] != ':')); |
337 | } else | 337 | } else |
338 | choice = MIN(choice+1, max_choice-1); | 338 | choice = MIN(choice+1, max_choice-1); |
339 | 339 | ||
340 | } else if (key == KEY_PPAGE) { | 340 | } else if (key == KEY_PPAGE) { |
341 | scrollok (menu, TRUE); | 341 | scrollok (menu, TRUE); |
342 | for (i=0; (i < max_choice); i++) { | 342 | for (i=0; (i < max_choice); i++) { |
343 | if (scroll > 0) { | 343 | if (scroll > 0) { |
344 | wscrl (menu, -1); | 344 | wscrl (menu, -1); |
345 | scroll--; | 345 | scroll--; |
346 | print_item (menu, items[scroll]->name, 0, FALSE, | 346 | print_item (menu, items[scroll]->name, 0, FALSE, |
347 | (items[scroll]->tag[0] != ':')); | 347 | (items[scroll]->tag[0] != ':')); |
348 | } else { | 348 | } else { |
349 | if (choice > 0) | 349 | if (choice > 0) |
350 | choice--; | 350 | choice--; |
351 | } | 351 | } |
352 | } | 352 | } |
353 | scrollok (menu, FALSE); | 353 | scrollok (menu, FALSE); |
354 | 354 | ||
355 | } else if (key == KEY_NPAGE) { | 355 | } else if (key == KEY_NPAGE) { |
356 | for (i=0; (i < max_choice); i++) { | 356 | for (i=0; (i < max_choice); i++) { |
357 | if (scroll+max_choice < item_no) { | 357 | if (scroll+max_choice < item_no) { |
358 | scrollok (menu, TRUE); | 358 | scrollok (menu, TRUE); |
359 | scroll(menu); | 359 | scroll(menu); |
360 | scrollok (menu, FALSE); | 360 | scrollok (menu, FALSE); |
361 | scroll++; | 361 | scroll++; |
362 | print_item (menu, items[scroll + max_choice - 1]->name, | 362 | print_item (menu, items[scroll + max_choice - 1]->name, |
363 | max_choice-1, FALSE, | 363 | max_choice-1, FALSE, |
364 | (items[scroll + max_choice - 1]->tag[0] != ':')); | 364 | (items[scroll + max_choice - 1]->tag[0] != ':')); |
365 | } else { | 365 | } else { |
366 | if (choice+1 < max_choice) | 366 | if (choice+1 < max_choice) |
367 | choice++; | 367 | choice++; |
368 | } | 368 | } |
369 | } | 369 | } |
370 | 370 | ||
371 | } else | 371 | } else |
372 | choice = i; | 372 | choice = i; |
373 | 373 | ||
374 | print_item (menu, items[scroll + choice]->name, choice, TRUE, | 374 | print_item (menu, items[scroll + choice]->name, choice, TRUE, |
375 | (items[scroll + choice]->tag[0] != ':')); | 375 | (items[scroll + choice]->tag[0] != ':')); |
376 | 376 | ||
377 | print_arrows(dialog, item_no, scroll, | 377 | print_arrows(dialog, item_no, scroll, |
378 | box_y, box_x+item_x+1, menu_height); | 378 | box_y, box_x+item_x+1, menu_height); |
379 | 379 | ||
380 | wnoutrefresh (dialog); | 380 | wnoutrefresh (dialog); |
381 | wrefresh (menu); | 381 | wrefresh (menu); |
382 | 382 | ||
383 | continue; /* wait for another key press */ | 383 | continue; /* wait for another key press */ |
384 | } | 384 | } |
385 | 385 | ||
386 | switch (key) { | 386 | switch (key) { |
387 | case KEY_LEFT: | 387 | case KEY_LEFT: |
@@ -405,15 +405,15 @@ dialog_menu (const char *title, const char *prompt, int height, int width, | |||
405 | fclose(f); | 405 | fclose(f); |
406 | } | 406 | } |
407 | delwin (dialog); | 407 | delwin (dialog); |
408 | items[scroll + choice]->selected = 1; | 408 | items[scroll + choice]->selected = 1; |
409 | switch (key) { | 409 | switch (key) { |
410 | case 's': return 3; | 410 | case 's': return 3; |
411 | case 'y': return 3; | 411 | case 'y': return 3; |
412 | case 'n': return 4; | 412 | case 'n': return 4; |
413 | case 'm': return 5; | 413 | case 'm': return 5; |
414 | case ' ': return 6; | 414 | case ' ': return 6; |
415 | case '/': return 7; | 415 | case '/': return 7; |
416 | } | 416 | } |
417 | return 0; | 417 | return 0; |
418 | case 'h': | 418 | case 'h': |
419 | case '?': | 419 | case '?': |
diff --git a/scripts/config/lxdialog/msgbox.c b/scripts/config/lxdialog/msgbox.c index 93692e1fb..de0f32bf0 100644 --- a/scripts/config/lxdialog/msgbox.c +++ b/scripts/config/lxdialog/msgbox.c | |||
@@ -73,7 +73,7 @@ dialog_msgbox (const char *title, const char *prompt, int height, int width, | |||
73 | 73 | ||
74 | wrefresh (dialog); | 74 | wrefresh (dialog); |
75 | while (key != ESC && key != '\n' && key != ' ' && | 75 | while (key != ESC && key != '\n' && key != ' ' && |
76 | key != 'O' && key != 'o' && key != 'X' && key != 'x') | 76 | key != 'O' && key != 'o' && key != 'X' && key != 'x') |
77 | key = wgetch (dialog); | 77 | key = wgetch (dialog); |
78 | } else { | 78 | } else { |
79 | key = '\n'; | 79 | key = '\n'; |
diff --git a/scripts/config/lxdialog/textbox.c b/scripts/config/lxdialog/textbox.c index a5a460b5c..b75e12a3e 100644 --- a/scripts/config/lxdialog/textbox.c +++ b/scripts/config/lxdialog/textbox.c | |||
@@ -472,8 +472,8 @@ print_line (WINDOW * win, int row, int width) | |||
472 | /* Clear 'residue' of previous line */ | 472 | /* Clear 'residue' of previous line */ |
473 | #if OLD_NCURSES | 473 | #if OLD_NCURSES |
474 | { | 474 | { |
475 | int i; | 475 | int i; |
476 | for (i = 0; i < width - x; i++) | 476 | for (i = 0; i < width - x; i++) |
477 | waddch (win, ' '); | 477 | waddch (win, ' '); |
478 | } | 478 | } |
479 | #else | 479 | #else |
diff --git a/scripts/config/lxdialog/util.c b/scripts/config/lxdialog/util.c index 6f83951b9..47afa5e6a 100644 --- a/scripts/config/lxdialog/util.c +++ b/scripts/config/lxdialog/util.c | |||
@@ -29,7 +29,7 @@ const char *backtitle = NULL; | |||
29 | 29 | ||
30 | const char *dialog_result; | 30 | const char *dialog_result; |
31 | 31 | ||
32 | /* | 32 | /* |
33 | * Attribute values, default is for mono display | 33 | * Attribute values, default is for mono display |
34 | */ | 34 | */ |
35 | chtype attributes[] = | 35 | chtype attributes[] = |
@@ -127,13 +127,13 @@ void dialog_clear (void) | |||
127 | attr_clear (stdscr, LINES, COLS, screen_attr); | 127 | attr_clear (stdscr, LINES, COLS, screen_attr); |
128 | /* Display background title if it exists ... - SLH */ | 128 | /* Display background title if it exists ... - SLH */ |
129 | if (backtitle != NULL) { | 129 | if (backtitle != NULL) { |
130 | int i; | 130 | int i; |
131 | 131 | ||
132 | wattrset (stdscr, screen_attr); | 132 | wattrset (stdscr, screen_attr); |
133 | mvwaddstr (stdscr, 0, 1, (char *)backtitle); | 133 | mvwaddstr (stdscr, 0, 1, (char *)backtitle); |
134 | wmove (stdscr, 1, 1); | 134 | wmove (stdscr, 1, 1); |
135 | for (i = 1; i < COLS - 1; i++) | 135 | for (i = 1; i < COLS - 1; i++) |
136 | waddch (stdscr, ACS_HLINE); | 136 | waddch (stdscr, ACS_HLINE); |
137 | } | 137 | } |
138 | wnoutrefresh (stdscr); | 138 | wnoutrefresh (stdscr); |
139 | } | 139 | } |
@@ -204,7 +204,7 @@ print_autowrap (WINDOW * win, const char *prompt, int width, int y, int x) | |||
204 | strcpy (tempstr, prompt); | 204 | strcpy (tempstr, prompt); |
205 | 205 | ||
206 | prompt_len = strlen(tempstr); | 206 | prompt_len = strlen(tempstr); |
207 | 207 | ||
208 | /* | 208 | /* |
209 | * Remove newlines | 209 | * Remove newlines |
210 | */ | 210 | */ |
@@ -350,7 +350,7 @@ first_alpha(const char *string, const char *exempt) | |||
350 | if (strchr("<[(", c)) ++in_paren; | 350 | if (strchr("<[(", c)) ++in_paren; |
351 | if (strchr(">])", c) && in_paren > 0) --in_paren; | 351 | if (strchr(">])", c) && in_paren > 0) --in_paren; |
352 | 352 | ||
353 | if ((! in_paren) && isalpha(c) && | 353 | if ((! in_paren) && isalpha(c) && |
354 | strchr(exempt, c) == 0) | 354 | strchr(exempt, c) == 0) |
355 | return i; | 355 | return i; |
356 | } | 356 | } |
diff --git a/scripts/config/zconf.tab.c_shipped b/scripts/config/zconf.tab.c_shipped index be6bd4c0d..0bf511e30 100644 --- a/scripts/config/zconf.tab.c_shipped +++ b/scripts/config/zconf.tab.c_shipped | |||
@@ -333,7 +333,7 @@ union yyalloc | |||
333 | #define YYUNDEFTOK 2 | 333 | #define YYUNDEFTOK 2 |
334 | #define YYMAXUTOK 296 | 334 | #define YYMAXUTOK 296 |
335 | 335 | ||
336 | #define YYTRANSLATE(YYX) \ | 336 | #define YYTRANSLATE(YYX) \ |
337 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) | 337 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
338 | 338 | ||
339 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ | 339 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ |
@@ -709,7 +709,7 @@ do \ | |||
709 | goto yybackup; \ | 709 | goto yybackup; \ |
710 | } \ | 710 | } \ |
711 | else \ | 711 | else \ |
712 | { \ | 712 | { \ |
713 | yyerror ("syntax error: cannot back up");\ | 713 | yyerror ("syntax error: cannot back up");\ |
714 | YYERROR; \ | 714 | YYERROR; \ |
715 | } \ | 715 | } \ |
@@ -762,7 +762,7 @@ do { \ | |||
762 | if (yydebug) \ | 762 | if (yydebug) \ |
763 | { \ | 763 | { \ |
764 | YYFPRINTF (stderr, "%s ", Title); \ | 764 | YYFPRINTF (stderr, "%s ", Title); \ |
765 | yysymprint (stderr, \ | 765 | yysymprint (stderr, \ |
766 | Token, Value); \ | 766 | Token, Value); \ |
767 | YYFPRINTF (stderr, "\n"); \ | 767 | YYFPRINTF (stderr, "\n"); \ |
768 | } \ | 768 | } \ |
diff --git a/shell/ash.c b/shell/ash.c index ef1fe0af7..69062e02d 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -841,7 +841,7 @@ static int SIT(int c, int syntax) | |||
841 | return S_I_T[indx][syntax]; | 841 | return S_I_T[indx][syntax]; |
842 | } | 842 | } |
843 | 843 | ||
844 | #else /* USE_SIT_FUNCTION */ | 844 | #else /* USE_SIT_FUNCTION */ |
845 | 845 | ||
846 | #define SIT(c, syntax) S_I_T[(int)syntax_index_table[((int)c)+SYNBASE]][syntax] | 846 | #define SIT(c, syntax) S_I_T[(int)syntax_index_table[((int)c)+SYNBASE]][syntax] |
847 | 847 | ||
@@ -1142,7 +1142,7 @@ static const char syntax_index_table[258] = { | |||
1142 | /* 257 127 */ CWORD_CWORD_CWORD_CWORD, | 1142 | /* 257 127 */ CWORD_CWORD_CWORD_CWORD, |
1143 | }; | 1143 | }; |
1144 | 1144 | ||
1145 | #endif /* USE_SIT_FUNCTION */ | 1145 | #endif /* USE_SIT_FUNCTION */ |
1146 | 1146 | ||
1147 | /* alias.c */ | 1147 | /* alias.c */ |
1148 | 1148 | ||
diff --git a/shell/cmdedit.c b/shell/cmdedit.c index edfa01613..db246315c 100644 --- a/shell/cmdedit.c +++ b/shell/cmdedit.c | |||
@@ -67,7 +67,7 @@ | |||
67 | #define CONFIG_FEATURE_NONPRINTABLE_INVERSE_PUT | 67 | #define CONFIG_FEATURE_NONPRINTABLE_INVERSE_PUT |
68 | #define CONFIG_FEATURE_CLEAN_UP | 68 | #define CONFIG_FEATURE_CLEAN_UP |
69 | 69 | ||
70 | #endif /* TEST */ | 70 | #endif /* TEST */ |
71 | 71 | ||
72 | #ifdef CONFIG_FEATURE_COMMAND_TAB_COMPLETION | 72 | #ifdef CONFIG_FEATURE_COMMAND_TAB_COMPLETION |
73 | #include <dirent.h> | 73 | #include <dirent.h> |
@@ -82,7 +82,7 @@ | |||
82 | 82 | ||
83 | #ifdef CONFIG_FEATURE_GETUSERNAME_AND_HOMEDIR | 83 | #ifdef CONFIG_FEATURE_GETUSERNAME_AND_HOMEDIR |
84 | #include "pwd_.h" | 84 | #include "pwd_.h" |
85 | #endif /* advanced FEATURES */ | 85 | #endif /* advanced FEATURES */ |
86 | 86 | ||
87 | 87 | ||
88 | /* Maximum length of the linked list for the command line history */ | 88 | /* Maximum length of the linked list for the command line history */ |
@@ -177,7 +177,7 @@ static void win_changed(int nsig) | |||
177 | previous_SIGWINCH_handler = signal(SIGWINCH, win_changed); | 177 | previous_SIGWINCH_handler = signal(SIGWINCH, win_changed); |
178 | else if (nsig == SIGWINCH) /* signaled called handler */ | 178 | else if (nsig == SIGWINCH) /* signaled called handler */ |
179 | signal(SIGWINCH, win_changed); /* set for next call */ | 179 | signal(SIGWINCH, win_changed); /* set for next call */ |
180 | else /* nsig == 0 */ | 180 | else /* nsig == 0 */ |
181 | /* set previous handler */ | 181 | /* set previous handler */ |
182 | signal(SIGWINCH, previous_SIGWINCH_handler); /* reset */ | 182 | signal(SIGWINCH, previous_SIGWINCH_handler); /* reset */ |
183 | } | 183 | } |
@@ -907,7 +907,7 @@ static int find_match(char *matchBuf, int *len_with_quotes) | |||
907 | } | 907 | } |
908 | 908 | ||
909 | /* collapse (command...(command...)...) or {command...{command...}...} */ | 909 | /* collapse (command...(command...)...) or {command...{command...}...} */ |
910 | c = 0; /* "recursive" level */ | 910 | c = 0; /* "recursive" level */ |
911 | c2 = 0; | 911 | c2 = 0; |
912 | for (i = 0; int_buf[i]; i++) | 912 | for (i = 0; int_buf[i]; i++) |
913 | if (int_buf[i] == '(' || int_buf[i] == '{') { | 913 | if (int_buf[i] == '(' || int_buf[i] == '{') { |
@@ -1358,7 +1358,7 @@ vi_back_motion(char *command) | |||
1358 | } | 1358 | } |
1359 | #endif | 1359 | #endif |
1360 | 1360 | ||
1361 | /* | 1361 | /* |
1362 | * the normal emacs mode and vi's insert mode are the same. | 1362 | * the normal emacs mode and vi's insert mode are the same. |
1363 | * commands entered when in vi command mode ("escape mode") get | 1363 | * commands entered when in vi command mode ("escape mode") get |
1364 | * an extra bit added to distinguish them. this lets them share | 1364 | * an extra bit added to distinguish them. this lets them share |
@@ -1431,7 +1431,7 @@ int cmdedit_read_input(char *prompt, char command[BUFSIZ]) | |||
1431 | newdelflag = 1; | 1431 | newdelflag = 1; |
1432 | ic = c; | 1432 | ic = c; |
1433 | if (vi_cmdmode) | 1433 | if (vi_cmdmode) |
1434 | ic |= VI_cmdbit; | 1434 | ic |= VI_cmdbit; |
1435 | switch (ic) | 1435 | switch (ic) |
1436 | #else | 1436 | #else |
1437 | switch (c) | 1437 | switch (c) |
@@ -1613,7 +1613,7 @@ prepare_to_die: | |||
1613 | vi_cmdmode = 0; | 1613 | vi_cmdmode = 0; |
1614 | /* fall through */ | 1614 | /* fall through */ |
1615 | case VICMD('d'): | 1615 | case VICMD('d'): |
1616 | { | 1616 | { |
1617 | int nc, sc; | 1617 | int nc, sc; |
1618 | sc = cursor; | 1618 | sc = cursor; |
1619 | prevc = ic; | 1619 | prevc = ic; |
@@ -1632,7 +1632,7 @@ prepare_to_die: | |||
1632 | case 'E': | 1632 | case 'E': |
1633 | switch (c) { | 1633 | switch (c) { |
1634 | case 'w': /* "dw", "cw" */ | 1634 | case 'w': /* "dw", "cw" */ |
1635 | vi_word_motion(command, vi_cmdmode); | 1635 | vi_word_motion(command, vi_cmdmode); |
1636 | break; | 1636 | break; |
1637 | case 'W': /* 'dW', 'cW' */ | 1637 | case 'W': /* 'dW', 'cW' */ |
1638 | vi_Word_motion(command, vi_cmdmode); | 1638 | vi_Word_motion(command, vi_cmdmode); |
diff --git a/shell/hush.c b/shell/hush.c index 70533a2b0..ff29974b6 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -1581,7 +1581,7 @@ static int run_list_real(struct pipe *pi) | |||
1581 | if (rmode == RES_IN) continue; | 1581 | if (rmode == RES_IN) continue; |
1582 | if (rmode == RES_DO) { | 1582 | if (rmode == RES_DO) { |
1583 | if (!flag_rep) continue; | 1583 | if (!flag_rep) continue; |
1584 | } | 1584 | } |
1585 | if ((rmode == RES_DONE)) { | 1585 | if ((rmode == RES_DONE)) { |
1586 | if (flag_rep) { | 1586 | if (flag_rep) { |
1587 | flag_restore = 1; | 1587 | flag_restore = 1; |
@@ -1782,17 +1782,17 @@ static int xglob(o_string *dest, int flags, glob_t *pglob) | |||
1782 | { | 1782 | { |
1783 | int gr; | 1783 | int gr; |
1784 | 1784 | ||
1785 | /* short-circuit for null word */ | 1785 | /* short-circuit for null word */ |
1786 | /* we can code this better when the debug_printf's are gone */ | 1786 | /* we can code this better when the debug_printf's are gone */ |
1787 | if (dest->length == 0) { | 1787 | if (dest->length == 0) { |
1788 | if (dest->nonnull) { | 1788 | if (dest->nonnull) { |
1789 | /* bash man page calls this an "explicit" null */ | 1789 | /* bash man page calls this an "explicit" null */ |
1790 | gr = globhack(dest->data, flags, pglob); | 1790 | gr = globhack(dest->data, flags, pglob); |
1791 | debug_printf("globhack returned %d\n",gr); | 1791 | debug_printf("globhack returned %d\n",gr); |
1792 | } else { | 1792 | } else { |
1793 | return 0; | 1793 | return 0; |
1794 | } | 1794 | } |
1795 | } else if (glob_needed(dest->data)) { | 1795 | } else if (glob_needed(dest->data)) { |
1796 | gr = glob(dest->data, flags, NULL, pglob); | 1796 | gr = glob(dest->data, flags, NULL, pglob); |
1797 | debug_printf("glob returned %d\n",gr); | 1797 | debug_printf("glob returned %d\n",gr); |
1798 | if (gr == GLOB_NOMATCH) { | 1798 | if (gr == GLOB_NOMATCH) { |
@@ -2111,7 +2111,7 @@ static int done_word(o_string *dest, struct p_context *ctx) | |||
2111 | if (reserved_word(dest,ctx)) return ctx->w==RES_SNTX; | 2111 | if (reserved_word(dest,ctx)) return ctx->w==RES_SNTX; |
2112 | } | 2112 | } |
2113 | glob_target = &child->glob_result; | 2113 | glob_target = &child->glob_result; |
2114 | if (child->argv) flags |= GLOB_APPEND; | 2114 | if (child->argv) flags |= GLOB_APPEND; |
2115 | } | 2115 | } |
2116 | gr = xglob(dest, flags, glob_target); | 2116 | gr = xglob(dest, flags, glob_target); |
2117 | if (gr != 0) return 1; | 2117 | if (gr != 0) return 1; |
diff --git a/shell/lash.c b/shell/lash.c index a23f5f4d4..56a3a23dd 100644 --- a/shell/lash.c +++ b/shell/lash.c | |||
@@ -1267,7 +1267,7 @@ static int pseudo_exec(struct child_prog *child) | |||
1267 | char** argv_l=child->argv; | 1267 | char** argv_l=child->argv; |
1268 | int argc_l; | 1268 | int argc_l; |
1269 | #ifdef _NEWLIB_VERSION | 1269 | #ifdef _NEWLIB_VERSION |
1270 | /* newlib uses __getopt_initialized for getopt() in | 1270 | /* newlib uses __getopt_initialized for getopt() in |
1271 | * addition to optind, see newlib/libc/sys/linux/getopt.c | 1271 | * addition to optind, see newlib/libc/sys/linux/getopt.c |
1272 | */ | 1272 | */ |
1273 | extern int __getopt_initialized = 0; | 1273 | extern int __getopt_initialized = 0; |
diff --git a/shell/msh.c b/shell/msh.c index 9e9a10b9f..08ca792fa 100644 --- a/shell/msh.c +++ b/shell/msh.c | |||
@@ -335,9 +335,9 @@ static void sig(int i); /* default signal handler */ | |||
335 | #define GROWBY (256) | 335 | #define GROWBY (256) |
336 | /* #define SHRINKBY (64) */ | 336 | /* #define SHRINKBY (64) */ |
337 | #undef SHRINKBY | 337 | #undef SHRINKBY |
338 | #define FREE (32767) | 338 | #define FREE (32767) |
339 | #define BUSY (0) | 339 | #define BUSY (0) |
340 | #define ALIGN (sizeof(int)-1) | 340 | #define ALIGN (sizeof(int)-1) |
341 | 341 | ||
342 | 342 | ||
343 | struct region { | 343 | struct region { |
diff --git a/sysklogd/logread.c b/sysklogd/logread.c index 883e2cf44..8ea8047f7 100644 --- a/sysklogd/logread.c +++ b/sysklogd/logread.c | |||
@@ -102,7 +102,7 @@ extern int logread_main(int argc, char **argv) | |||
102 | error_exit("Can't get access to circular buffer from syslogd"); | 102 | error_exit("Can't get access to circular buffer from syslogd"); |
103 | 103 | ||
104 | if ( (log_semid = semget(KEY_ID, 0, 0)) == -1) | 104 | if ( (log_semid = semget(KEY_ID, 0, 0)) == -1) |
105 | error_exit("Can't get access to semaphone(s) for circular buffer from syslogd"); | 105 | error_exit("Can't get access to semaphone(s) for circular buffer from syslogd"); |
106 | 106 | ||
107 | // Suppose atomic memory move | 107 | // Suppose atomic memory move |
108 | i = follow ? buf->tail : buf->head; | 108 | i = follow ? buf->tail : buf->head; |
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index e6b7ee7ed..c827fd85a 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c | |||
@@ -386,7 +386,7 @@ static void logMessage(int pri, char *msg) | |||
386 | time_t now; | 386 | time_t now; |
387 | char *timestamp; | 387 | char *timestamp; |
388 | static char res[20]; | 388 | static char res[20]; |
389 | #ifdef CONFIG_FEATURE_REMOTE_LOG | 389 | #ifdef CONFIG_FEATURE_REMOTE_LOG |
390 | static char line[MAXLINE + 1]; | 390 | static char line[MAXLINE + 1]; |
391 | #endif | 391 | #endif |
392 | CODE *c_pri, *c_fac; | 392 | CODE *c_pri, *c_fac; |
diff --git a/util-linux/Config.in b/util-linux/Config.in index bf3e13b2a..27410bf10 100644 --- a/util-linux/Config.in +++ b/util-linux/Config.in | |||
@@ -214,7 +214,7 @@ config CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS | |||
214 | depends on CONFIG_HWCLOCK | 214 | depends on CONFIG_HWCLOCK |
215 | help | 215 | help |
216 | Starting with FHS 2.3, the adjtime state file is supposed to exist | 216 | Starting with FHS 2.3, the adjtime state file is supposed to exist |
217 | at /var/lib/hwclock/adjtime instead of /etc/adjtime. If you wish | 217 | at /var/lib/hwclock/adjtime instead of /etc/adjtime. If you wish |
218 | to use the FHS behavior, answer Y here, otherwise answer N for the | 218 | to use the FHS behavior, answer Y here, otherwise answer N for the |
219 | classic /etc/adjtime path. | 219 | classic /etc/adjtime path. |
220 | 220 | ||
@@ -406,7 +406,7 @@ config CONFIG_FEATURE_MOUNT_LOOP | |||
406 | command will detect you are trying to mount a file instead of a block | 406 | command will detect you are trying to mount a file instead of a block |
407 | device, and transparently associate the file with a loopback device. | 407 | device, and transparently associate the file with a loopback device. |
408 | The umount command will also free that loopback device. | 408 | The umount command will also free that loopback device. |
409 | 409 | ||
410 | You can still use the 'losetup' utility (to manually associate files | 410 | You can still use the 'losetup' utility (to manually associate files |
411 | with loop devices) if you need to do something advanced, such as | 411 | with loop devices) if you need to do something advanced, such as |
412 | specify an offset or cryptographic options to the loopback device. | 412 | specify an offset or cryptographic options to the loopback device. |
diff --git a/util-linux/fbset.c b/util-linux/fbset.c index 83bf309a3..b1118311f 100644 --- a/util-linux/fbset.c +++ b/util-linux/fbset.c | |||
@@ -52,7 +52,7 @@ enum { | |||
52 | CMD_VSYNC = 7, | 52 | CMD_VSYNC = 7, |
53 | CMD_LACED = 8, | 53 | CMD_LACED = 8, |
54 | CMD_DOUBLE = 9, | 54 | CMD_DOUBLE = 9, |
55 | /* CMD_XCOMPAT = 10, */ | 55 | /* CMD_XCOMPAT = 10, */ |
56 | CMD_ALL = 11, | 56 | CMD_ALL = 11, |
57 | CMD_INFO = 12, | 57 | CMD_INFO = 12, |
58 | CMD_CHANGE = 13, | 58 | CMD_CHANGE = 13, |
@@ -207,70 +207,70 @@ static int readmode(struct fb_var_screeninfo *base, const char *fn, | |||
207 | while (!feof(f)) { | 207 | while (!feof(f)) { |
208 | fgets(buf, sizeof(buf), f); | 208 | fgets(buf, sizeof(buf), f); |
209 | 209 | ||
210 | if ((p = strstr(buf, "geometry "))) { | 210 | if ((p = strstr(buf, "geometry "))) { |
211 | p += 9; | 211 | p += 9; |
212 | 212 | ||
213 | sscanf(p, "%d %d %d %d %d", | 213 | sscanf(p, "%d %d %d %d %d", |
214 | &(base->xres), &(base->yres), | 214 | &(base->xres), &(base->yres), |
215 | &(base->xres_virtual), &(base->yres_virtual), | 215 | &(base->xres_virtual), &(base->yres_virtual), |
216 | &(base->bits_per_pixel)); | 216 | &(base->bits_per_pixel)); |
217 | } else if ((p = strstr(buf, "timings "))) { | 217 | } else if ((p = strstr(buf, "timings "))) { |
218 | p += 8; | 218 | p += 8; |
219 | 219 | ||
220 | sscanf(p, "%d %d %d %d %d %d %d", | 220 | sscanf(p, "%d %d %d %d %d %d %d", |
221 | &(base->pixclock), | 221 | &(base->pixclock), |
222 | &(base->left_margin), &(base->right_margin), | 222 | &(base->left_margin), &(base->right_margin), |
223 | &(base->upper_margin), &(base->lower_margin), | 223 | &(base->upper_margin), &(base->lower_margin), |
224 | &(base->hsync_len), &(base->vsync_len)); | 224 | &(base->hsync_len), &(base->vsync_len)); |
225 | } else if ((p = strstr(buf, "laced "))) { | 225 | } else if ((p = strstr(buf, "laced "))) { |
226 | p += 6; | 226 | p += 6; |
227 | 227 | ||
228 | if (strstr(buf, "false")) { | 228 | if (strstr(buf, "false")) { |
229 | base->vmode &= ~FB_VMODE_INTERLACED; | 229 | base->vmode &= ~FB_VMODE_INTERLACED; |
230 | } else { | 230 | } else { |
231 | base->vmode |= FB_VMODE_INTERLACED; | 231 | base->vmode |= FB_VMODE_INTERLACED; |
232 | } | 232 | } |
233 | } else if ((p = strstr(buf, "double "))) { | 233 | } else if ((p = strstr(buf, "double "))) { |
234 | p += 7; | 234 | p += 7; |
235 | 235 | ||
236 | if (strstr(buf, "false")) { | 236 | if (strstr(buf, "false")) { |
237 | base->vmode &= ~FB_VMODE_DOUBLE; | 237 | base->vmode &= ~FB_VMODE_DOUBLE; |
238 | } else { | 238 | } else { |
239 | base->vmode |= FB_VMODE_DOUBLE; | 239 | base->vmode |= FB_VMODE_DOUBLE; |
240 | } | 240 | } |
241 | } else if ((p = strstr(buf, "vsync "))) { | 241 | } else if ((p = strstr(buf, "vsync "))) { |
242 | p += 6; | 242 | p += 6; |
243 | 243 | ||
244 | if (strstr(buf, "low")) { | 244 | if (strstr(buf, "low")) { |
245 | base->sync &= ~FB_SYNC_VERT_HIGH_ACT; | 245 | base->sync &= ~FB_SYNC_VERT_HIGH_ACT; |
246 | } else { | 246 | } else { |
247 | base->sync |= FB_SYNC_VERT_HIGH_ACT; | 247 | base->sync |= FB_SYNC_VERT_HIGH_ACT; |
248 | } | 248 | } |
249 | } else if ((p = strstr(buf, "hsync "))) { | 249 | } else if ((p = strstr(buf, "hsync "))) { |
250 | p += 6; | 250 | p += 6; |
251 | 251 | ||
252 | if (strstr(buf, "low")) { | 252 | if (strstr(buf, "low")) { |
253 | base->sync &= ~FB_SYNC_HOR_HIGH_ACT; | 253 | base->sync &= ~FB_SYNC_HOR_HIGH_ACT; |
254 | } else { | 254 | } else { |
255 | base->sync |= FB_SYNC_HOR_HIGH_ACT; | 255 | base->sync |= FB_SYNC_HOR_HIGH_ACT; |
256 | } | 256 | } |
257 | } else if ((p = strstr(buf, "csync "))) { | 257 | } else if ((p = strstr(buf, "csync "))) { |
258 | p += 6; | 258 | p += 6; |
259 | 259 | ||
260 | if (strstr(buf, "low")) { | 260 | if (strstr(buf, "low")) { |
261 | base->sync &= ~FB_SYNC_COMP_HIGH_ACT; | 261 | base->sync &= ~FB_SYNC_COMP_HIGH_ACT; |
262 | } else { | 262 | } else { |
263 | base->sync |= FB_SYNC_COMP_HIGH_ACT; | 263 | base->sync |= FB_SYNC_COMP_HIGH_ACT; |
264 | } | 264 | } |
265 | } else if ((p = strstr(buf, "extsync "))) { | 265 | } else if ((p = strstr(buf, "extsync "))) { |
266 | p += 8; | 266 | p += 8; |
267 | 267 | ||
268 | if (strstr(buf, "false")) { | 268 | if (strstr(buf, "false")) { |
269 | base->sync &= ~FB_SYNC_EXT; | 269 | base->sync &= ~FB_SYNC_EXT; |
270 | } else { | 270 | } else { |
271 | base->sync |= FB_SYNC_EXT; | 271 | base->sync |= FB_SYNC_EXT; |
272 | } | 272 | } |
273 | } | 273 | } |
274 | 274 | ||
275 | if (strstr(buf, "endmode")) | 275 | if (strstr(buf, "endmode")) |
276 | return 1; | 276 | return 1; |
@@ -374,9 +374,9 @@ extern int fbset_main(int argc, char **argv) | |||
374 | varset.hsync_len = strtoul(argv[6], 0, 0); | 374 | varset.hsync_len = strtoul(argv[6], 0, 0); |
375 | varset.vsync_len = strtoul(argv[7], 0, 0); | 375 | varset.vsync_len = strtoul(argv[7], 0, 0); |
376 | break; | 376 | break; |
377 | case CMD_CHANGE: | 377 | case CMD_CHANGE: |
378 | g_options |= OPT_CHANGE; | 378 | g_options |= OPT_CHANGE; |
379 | break; | 379 | break; |
380 | #ifdef CONFIG_FEATURE_FBSET_FANCY | 380 | #ifdef CONFIG_FEATURE_FBSET_FANCY |
381 | case CMD_XRES: | 381 | case CMD_XRES: |
382 | varset.xres = strtoul(argv[1], 0, 0); | 382 | varset.xres = strtoul(argv[1], 0, 0); |
diff --git a/util-linux/fdformat.c b/util-linux/fdformat.c index 768105159..e7dd943bb 100644 --- a/util-linux/fdformat.c +++ b/util-linux/fdformat.c | |||
@@ -134,7 +134,7 @@ int fdformat_main(int argc,char **argv) | |||
134 | if((read_bytes = safe_read(fd,data,n))!= n ) { | 134 | if((read_bytes = safe_read(fd,data,n))!= n ) { |
135 | if(read_bytes < 0) { | 135 | if(read_bytes < 0) { |
136 | bb_perror_msg("Read: "); | 136 | bb_perror_msg("Read: "); |
137 | } | 137 | } |
138 | bb_error_msg_and_die("Problem reading cylinder %d, expected %d, read %d", cyl, n, read_bytes); | 138 | bb_error_msg_and_die("Problem reading cylinder %d, expected %d, read %d", cyl, n, read_bytes); |
139 | } | 139 | } |
140 | /* Check backwards so we don't need a counter */ | 140 | /* Check backwards so we don't need a counter */ |
@@ -147,14 +147,14 @@ int fdformat_main(int argc,char **argv) | |||
147 | /* There is no point in freeing blocks at the end of a program, because | 147 | /* There is no point in freeing blocks at the end of a program, because |
148 | all of the program's space is given back to the system when the process | 148 | all of the program's space is given back to the system when the process |
149 | terminates.*/ | 149 | terminates.*/ |
150 | 150 | ||
151 | if (ENABLE_FEATURE_CLEAN_UP) free(data); | 151 | if (ENABLE_FEATURE_CLEAN_UP) free(data); |
152 | 152 | ||
153 | print_and_flush("done\n", NULL); | 153 | print_and_flush("done\n", NULL); |
154 | } | 154 | } |
155 | 155 | ||
156 | if (ENABLE_FEATURE_CLEAN_UP) close(fd); | 156 | if (ENABLE_FEATURE_CLEAN_UP) close(fd); |
157 | 157 | ||
158 | /* Don't bother closing. Exit does | 158 | /* Don't bother closing. Exit does |
159 | * that, so we can save a few bytes */ | 159 | * that, so we can save a few bytes */ |
160 | return EXIT_SUCCESS; | 160 | return EXIT_SUCCESS; |
diff --git a/util-linux/getopt.c b/util-linux/getopt.c index fc3b9f97e..16dcbbca0 100644 --- a/util-linux/getopt.c +++ b/util-linux/getopt.c | |||
@@ -71,7 +71,7 @@ static int alternative; /* 0 is getopt_long, 1 is getopt_long_only */ | |||
71 | /* Function prototypes */ | 71 | /* Function prototypes */ |
72 | static const char *normalize(const char *arg); | 72 | static const char *normalize(const char *arg); |
73 | static int generate_output(char * argv[],int argc,const char *optstr, | 73 | static int generate_output(char * argv[],int argc,const char *optstr, |
74 | const struct option *longopts); | 74 | const struct option *longopts); |
75 | static void add_long_options(char *options); | 75 | static void add_long_options(char *options); |
76 | static void add_longopt(const char *name,int has_arg); | 76 | static void add_longopt(const char *name,int has_arg); |
77 | static void set_shell(const char *new_shell); | 77 | static void set_shell(const char *new_shell); |
@@ -88,57 +88,57 @@ static void set_shell(const char *new_shell); | |||
88 | */ | 88 | */ |
89 | const char *normalize(const char *arg) | 89 | const char *normalize(const char *arg) |
90 | { | 90 | { |
91 | static char *BUFFER=NULL; | 91 | static char *BUFFER=NULL; |
92 | const char *argptr=arg; | 92 | const char *argptr=arg; |
93 | char *bufptr; | 93 | char *bufptr; |
94 | 94 | ||
95 | free(BUFFER); | 95 | free(BUFFER); |
96 | 96 | ||
97 | if (!quote) { /* Just copy arg */ | 97 | if (!quote) { /* Just copy arg */ |
98 | BUFFER=bb_xstrdup(arg); | 98 | BUFFER=bb_xstrdup(arg); |
99 | return BUFFER; | 99 | return BUFFER; |
100 | } | 100 | } |
101 | 101 | ||
102 | /* Each character in arg may take up to four characters in the result: | 102 | /* Each character in arg may take up to four characters in the result: |
103 | For a quote we need a closing quote, a backslash, a quote and an | 103 | For a quote we need a closing quote, a backslash, a quote and an |
104 | opening quote! We need also the global opening and closing quote, | 104 | opening quote! We need also the global opening and closing quote, |
105 | and one extra character for '\0'. */ | 105 | and one extra character for '\0'. */ |
106 | BUFFER=xmalloc(strlen(arg)*4+3); | 106 | BUFFER=xmalloc(strlen(arg)*4+3); |
107 | 107 | ||
108 | bufptr=BUFFER; | 108 | bufptr=BUFFER; |
109 | *bufptr++='\''; | 109 | *bufptr++='\''; |
110 | 110 | ||
111 | while (*argptr) { | 111 | while (*argptr) { |
112 | if (*argptr == '\'') { | 112 | if (*argptr == '\'') { |
113 | /* Quote: replace it with: '\'' */ | 113 | /* Quote: replace it with: '\'' */ |
114 | *bufptr++='\''; | 114 | *bufptr++='\''; |
115 | *bufptr++='\\'; | 115 | *bufptr++='\\'; |
116 | *bufptr++='\''; | 116 | *bufptr++='\''; |
117 | *bufptr++='\''; | 117 | *bufptr++='\''; |
118 | } else if (shell==TCSH && *argptr=='!') { | 118 | } else if (shell==TCSH && *argptr=='!') { |
119 | /* Exclamation mark: replace it with: \! */ | 119 | /* Exclamation mark: replace it with: \! */ |
120 | *bufptr++='\''; | 120 | *bufptr++='\''; |
121 | *bufptr++='\\'; | 121 | *bufptr++='\\'; |
122 | *bufptr++='!'; | 122 | *bufptr++='!'; |
123 | *bufptr++='\''; | 123 | *bufptr++='\''; |
124 | } else if (shell==TCSH && *argptr=='\n') { | 124 | } else if (shell==TCSH && *argptr=='\n') { |
125 | /* Newline: replace it with: \n */ | 125 | /* Newline: replace it with: \n */ |
126 | *bufptr++='\\'; | 126 | *bufptr++='\\'; |
127 | *bufptr++='n'; | 127 | *bufptr++='n'; |
128 | } else if (shell==TCSH && isspace(*argptr)) { | 128 | } else if (shell==TCSH && isspace(*argptr)) { |
129 | /* Non-newline whitespace: replace it with \<ws> */ | 129 | /* Non-newline whitespace: replace it with \<ws> */ |
130 | *bufptr++='\''; | 130 | *bufptr++='\''; |
131 | *bufptr++='\\'; | 131 | *bufptr++='\\'; |
132 | *bufptr++=*argptr; | 132 | *bufptr++=*argptr; |
133 | *bufptr++='\''; | 133 | *bufptr++='\''; |
134 | } else | 134 | } else |
135 | /* Just copy */ | 135 | /* Just copy */ |
136 | *bufptr++=*argptr; | 136 | *bufptr++=*argptr; |
137 | argptr++; | 137 | argptr++; |
138 | } | 138 | } |
139 | *bufptr++='\''; | 139 | *bufptr++='\''; |
140 | *bufptr++='\0'; | 140 | *bufptr++='\0'; |
141 | return BUFFER; | 141 | return BUFFER; |
142 | } | 142 | } |
143 | 143 | ||
144 | /* | 144 | /* |
@@ -149,47 +149,47 @@ const char *normalize(const char *arg) | |||
149 | * Other settings are found in global variables. | 149 | * Other settings are found in global variables. |
150 | */ | 150 | */ |
151 | int generate_output(char * argv[],int argc,const char *optstr, | 151 | int generate_output(char * argv[],int argc,const char *optstr, |
152 | const struct option *longopts) | 152 | const struct option *longopts) |
153 | { | 153 | { |
154 | int exit_code = 0; /* We assume everything will be OK */ | 154 | int exit_code = 0; /* We assume everything will be OK */ |
155 | int opt; | 155 | int opt; |
156 | int longindex; | 156 | int longindex; |
157 | const char *charptr; | 157 | const char *charptr; |
158 | 158 | ||
159 | if (quiet_errors) /* No error reporting from getopt(3) */ | 159 | if (quiet_errors) /* No error reporting from getopt(3) */ |
160 | opterr=0; | 160 | opterr=0; |
161 | optind=0; /* Reset getopt(3) */ | 161 | optind=0; /* Reset getopt(3) */ |
162 | 162 | ||
163 | while ((opt = (alternative? | 163 | while ((opt = (alternative? |
164 | getopt_long_only(argc,argv,optstr,longopts,&longindex): | 164 | getopt_long_only(argc,argv,optstr,longopts,&longindex): |
165 | getopt_long(argc,argv,optstr,longopts,&longindex))) | 165 | getopt_long(argc,argv,optstr,longopts,&longindex))) |
166 | != EOF) | 166 | != EOF) |
167 | if (opt == '?' || opt == ':' ) | 167 | if (opt == '?' || opt == ':' ) |
168 | exit_code = 1; | 168 | exit_code = 1; |
169 | else if (!quiet_output) { | 169 | else if (!quiet_output) { |
170 | if (opt == LONG_OPT) { | 170 | if (opt == LONG_OPT) { |
171 | printf(" --%s",longopts[longindex].name); | 171 | printf(" --%s",longopts[longindex].name); |
172 | if (longopts[longindex].has_arg) | 172 | if (longopts[longindex].has_arg) |
173 | printf(" %s", | 173 | printf(" %s", |
174 | normalize(optarg?optarg:"")); | 174 | normalize(optarg?optarg:"")); |
175 | } else if (opt == NON_OPT) | 175 | } else if (opt == NON_OPT) |
176 | printf(" %s",normalize(optarg)); | 176 | printf(" %s",normalize(optarg)); |
177 | else { | 177 | else { |
178 | printf(" -%c",opt); | 178 | printf(" -%c",opt); |
179 | charptr = strchr(optstr,opt); | 179 | charptr = strchr(optstr,opt); |
180 | if (charptr != NULL && *++charptr == ':') | 180 | if (charptr != NULL && *++charptr == ':') |
181 | printf(" %s", | 181 | printf(" %s", |
182 | normalize(optarg?optarg:"")); | 182 | normalize(optarg?optarg:"")); |
183 | } | 183 | } |
184 | } | 184 | } |
185 | 185 | ||
186 | if (! quiet_output) { | 186 | if (! quiet_output) { |
187 | printf(" --"); | 187 | printf(" --"); |
188 | while (optind < argc) | 188 | while (optind < argc) |
189 | printf(" %s",normalize(argv[optind++])); | 189 | printf(" %s",normalize(argv[optind++])); |
190 | printf("\n"); | 190 | printf("\n"); |
191 | } | 191 | } |
192 | return exit_code; | 192 | return exit_code; |
193 | } | 193 | } |
194 | 194 | ||
195 | static struct option *long_options; | 195 | static struct option *long_options; |
@@ -201,32 +201,32 @@ static const int LONG_OPTIONS_INCR = 10; | |||
201 | /* Register a long option. The contents of name is copied. */ | 201 | /* Register a long option. The contents of name is copied. */ |
202 | void add_longopt(const char *name,int has_arg) | 202 | void add_longopt(const char *name,int has_arg) |
203 | { | 203 | { |
204 | if (!name) { /* init */ | 204 | if (!name) { /* init */ |
205 | free(long_options); | 205 | free(long_options); |
206 | long_options=NULL; | 206 | long_options=NULL; |
207 | long_options_length=0; | 207 | long_options_length=0; |
208 | long_options_nr=0; | 208 | long_options_nr=0; |
209 | } | 209 | } |
210 | 210 | ||
211 | if (long_options_nr == long_options_length) { | 211 | if (long_options_nr == long_options_length) { |
212 | long_options_length += LONG_OPTIONS_INCR; | 212 | long_options_length += LONG_OPTIONS_INCR; |
213 | long_options=xrealloc(long_options, | 213 | long_options=xrealloc(long_options, |
214 | sizeof(struct option) * | 214 | sizeof(struct option) * |
215 | long_options_length); | 215 | long_options_length); |
216 | } | 216 | } |
217 | 217 | ||
218 | long_options[long_options_nr].name=NULL; | 218 | long_options[long_options_nr].name=NULL; |
219 | long_options[long_options_nr].has_arg=0; | 219 | long_options[long_options_nr].has_arg=0; |
220 | long_options[long_options_nr].flag=NULL; | 220 | long_options[long_options_nr].flag=NULL; |
221 | long_options[long_options_nr].val=0; | 221 | long_options[long_options_nr].val=0; |
222 | 222 | ||
223 | if (long_options_nr) { /* Not for init! */ | 223 | if (long_options_nr) { /* Not for init! */ |
224 | long_options[long_options_nr-1].has_arg=has_arg; | 224 | long_options[long_options_nr-1].has_arg=has_arg; |
225 | long_options[long_options_nr-1].flag=NULL; | 225 | long_options[long_options_nr-1].flag=NULL; |
226 | long_options[long_options_nr-1].val=LONG_OPT; | 226 | long_options[long_options_nr-1].val=LONG_OPT; |
227 | long_options[long_options_nr-1].name=bb_xstrdup(name); | 227 | long_options[long_options_nr-1].name=bb_xstrdup(name); |
228 | } | 228 | } |
229 | long_options_nr++; | 229 | long_options_nr++; |
230 | } | 230 | } |
231 | 231 | ||
232 | 232 | ||
@@ -237,43 +237,43 @@ void add_longopt(const char *name,int has_arg) | |||
237 | */ | 237 | */ |
238 | void add_long_options(char *options) | 238 | void add_long_options(char *options) |
239 | { | 239 | { |
240 | int arg_opt, tlen; | 240 | int arg_opt, tlen; |
241 | char *tokptr=strtok(options,", \t\n"); | 241 | char *tokptr=strtok(options,", \t\n"); |
242 | while (tokptr) { | 242 | while (tokptr) { |
243 | arg_opt=no_argument; | 243 | arg_opt=no_argument; |
244 | tlen=strlen(tokptr); | 244 | tlen=strlen(tokptr); |
245 | if (tlen > 0) { | 245 | if (tlen > 0) { |
246 | if (tokptr[tlen-1] == ':') { | 246 | if (tokptr[tlen-1] == ':') { |
247 | if (tlen > 1 && tokptr[tlen-2] == ':') { | 247 | if (tlen > 1 && tokptr[tlen-2] == ':') { |
248 | tokptr[tlen-2]='\0'; | 248 | tokptr[tlen-2]='\0'; |
249 | tlen -= 2; | 249 | tlen -= 2; |
250 | arg_opt=optional_argument; | 250 | arg_opt=optional_argument; |
251 | } else { | 251 | } else { |
252 | tokptr[tlen-1]='\0'; | 252 | tokptr[tlen-1]='\0'; |
253 | tlen -= 1; | 253 | tlen -= 1; |
254 | arg_opt=required_argument; | 254 | arg_opt=required_argument; |
255 | } | 255 | } |
256 | if (tlen == 0) | 256 | if (tlen == 0) |
257 | bb_error_msg("empty long option after -l or --long argument"); | 257 | bb_error_msg("empty long option after -l or --long argument"); |
258 | } | 258 | } |
259 | add_longopt(tokptr,arg_opt); | 259 | add_longopt(tokptr,arg_opt); |
260 | } | 260 | } |
261 | tokptr=strtok(NULL,", \t\n"); | 261 | tokptr=strtok(NULL,", \t\n"); |
262 | } | 262 | } |
263 | } | 263 | } |
264 | 264 | ||
265 | void set_shell(const char *new_shell) | 265 | void set_shell(const char *new_shell) |
266 | { | 266 | { |
267 | if (!strcmp(new_shell,"bash")) | 267 | if (!strcmp(new_shell,"bash")) |
268 | shell=BASH; | 268 | shell=BASH; |
269 | else if (!strcmp(new_shell,"tcsh")) | 269 | else if (!strcmp(new_shell,"tcsh")) |
270 | shell=TCSH; | 270 | shell=TCSH; |
271 | else if (!strcmp(new_shell,"sh")) | 271 | else if (!strcmp(new_shell,"sh")) |
272 | shell=BASH; | 272 | shell=BASH; |
273 | else if (!strcmp(new_shell,"csh")) | 273 | else if (!strcmp(new_shell,"csh")) |
274 | shell=TCSH; | 274 | shell=TCSH; |
275 | else | 275 | else |
276 | bb_error_msg("unknown shell after -s or --shell argument"); | 276 | bb_error_msg("unknown shell after -s or --shell argument"); |
277 | } | 277 | } |
278 | 278 | ||
279 | 279 | ||
@@ -287,16 +287,16 @@ void set_shell(const char *new_shell) | |||
287 | 287 | ||
288 | static const struct option longopts[]= | 288 | static const struct option longopts[]= |
289 | { | 289 | { |
290 | {"options",required_argument,NULL,'o'}, | 290 | {"options",required_argument,NULL,'o'}, |
291 | {"longoptions",required_argument,NULL,'l'}, | 291 | {"longoptions",required_argument,NULL,'l'}, |
292 | {"quiet",no_argument,NULL,'q'}, | 292 | {"quiet",no_argument,NULL,'q'}, |
293 | {"quiet-output",no_argument,NULL,'Q'}, | 293 | {"quiet-output",no_argument,NULL,'Q'}, |
294 | {"shell",required_argument,NULL,'s'}, | 294 | {"shell",required_argument,NULL,'s'}, |
295 | {"test",no_argument,NULL,'T'}, | 295 | {"test",no_argument,NULL,'T'}, |
296 | {"unquoted",no_argument,NULL,'u'}, | 296 | {"unquoted",no_argument,NULL,'u'}, |
297 | {"alternative",no_argument,NULL,'a'}, | 297 | {"alternative",no_argument,NULL,'a'}, |
298 | {"name",required_argument,NULL,'n'}, | 298 | {"name",required_argument,NULL,'n'}, |
299 | {NULL,0,NULL,0} | 299 | {NULL,0,NULL,0} |
300 | }; | 300 | }; |
301 | 301 | ||
302 | /* Stop scanning as soon as a non-option argument is found! */ | 302 | /* Stop scanning as soon as a non-option argument is found! */ |
@@ -305,77 +305,77 @@ static const char shortopts[]="+ao:l:n:qQs:Tu"; | |||
305 | 305 | ||
306 | int getopt_main(int argc, char *argv[]) | 306 | int getopt_main(int argc, char *argv[]) |
307 | { | 307 | { |
308 | const char *optstr = NULL; | 308 | const char *optstr = NULL; |
309 | char *name = NULL; | 309 | char *name = NULL; |
310 | int opt; | 310 | int opt; |
311 | int compatible=0; | 311 | int compatible=0; |
312 | 312 | ||
313 | init_longopt(); | 313 | init_longopt(); |
314 | 314 | ||
315 | if (getenv("GETOPT_COMPATIBLE")) | 315 | if (getenv("GETOPT_COMPATIBLE")) |
316 | compatible=1; | 316 | compatible=1; |
317 | 317 | ||
318 | if (argc == 1) { | 318 | if (argc == 1) { |
319 | if (compatible) { | 319 | if (compatible) { |
320 | /* For some reason, the original getopt gave no error | 320 | /* For some reason, the original getopt gave no error |
321 | when there were no arguments. */ | 321 | when there were no arguments. */ |
322 | printf(" --\n"); | 322 | printf(" --\n"); |
323 | return 0; | 323 | return 0; |
324 | } else | 324 | } else |
325 | bb_error_msg_and_die("missing optstring argument"); | 325 | bb_error_msg_and_die("missing optstring argument"); |
326 | } | 326 | } |
327 | 327 | ||
328 | if (argv[1][0] != '-' || compatible) { | 328 | if (argv[1][0] != '-' || compatible) { |
329 | char *s; | 329 | char *s; |
330 | 330 | ||
331 | quote=0; | 331 | quote=0; |
332 | s=xmalloc(strlen(argv[1])+1); | 332 | s=xmalloc(strlen(argv[1])+1); |
333 | strcpy(s,argv[1]+strspn(argv[1],"-+")); | 333 | strcpy(s,argv[1]+strspn(argv[1],"-+")); |
334 | argv[1]=argv[0]; | 334 | argv[1]=argv[0]; |
335 | return (generate_output(argv+1,argc-1,s,long_options)); | 335 | return (generate_output(argv+1,argc-1,s,long_options)); |
336 | } | 336 | } |
337 | 337 | ||
338 | while ((opt=getopt_long(argc,argv,shortopts,longopts,NULL)) != EOF) | 338 | while ((opt=getopt_long(argc,argv,shortopts,longopts,NULL)) != EOF) |
339 | switch (opt) { | 339 | switch (opt) { |
340 | case 'a': | 340 | case 'a': |
341 | alternative=1; | 341 | alternative=1; |
342 | break; | 342 | break; |
343 | case 'o': | 343 | case 'o': |
344 | optstr = optarg; | 344 | optstr = optarg; |
345 | break; | 345 | break; |
346 | case 'l': | 346 | case 'l': |
347 | add_long_options(optarg); | 347 | add_long_options(optarg); |
348 | break; | 348 | break; |
349 | case 'n': | 349 | case 'n': |
350 | name = optarg; | 350 | name = optarg; |
351 | break; | 351 | break; |
352 | case 'q': | 352 | case 'q': |
353 | quiet_errors=1; | 353 | quiet_errors=1; |
354 | break; | 354 | break; |
355 | case 'Q': | 355 | case 'Q': |
356 | quiet_output=1; | 356 | quiet_output=1; |
357 | break; | 357 | break; |
358 | case 's': | 358 | case 's': |
359 | set_shell(optarg); | 359 | set_shell(optarg); |
360 | break; | 360 | break; |
361 | case 'T': | 361 | case 'T': |
362 | return 4; | 362 | return 4; |
363 | case 'u': | 363 | case 'u': |
364 | quote=0; | 364 | quote=0; |
365 | break; | 365 | break; |
366 | default: | 366 | default: |
367 | bb_show_usage(); | 367 | bb_show_usage(); |
368 | } | 368 | } |
369 | 369 | ||
370 | if (!optstr) { | 370 | if (!optstr) { |
371 | if (optind >= argc) | 371 | if (optind >= argc) |
372 | bb_error_msg_and_die("missing optstring argument"); | 372 | bb_error_msg_and_die("missing optstring argument"); |
373 | else optstr=argv[optind++]; | 373 | else optstr=argv[optind++]; |
374 | } | 374 | } |
375 | if (name) | 375 | if (name) |
376 | argv[optind-1]=name; | 376 | argv[optind-1]=name; |
377 | else | 377 | else |
378 | argv[optind-1]=argv[0]; | 378 | argv[optind-1]=argv[0]; |
379 | return (generate_output(argv+optind-1,argc-optind+1,optstr,long_options)); | 379 | return (generate_output(argv+optind-1,argc-optind+1,optstr,long_options)); |
380 | } | 380 | } |
381 | 381 | ||
diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c index 5b990df0c..00abe10a6 100644 --- a/util-linux/hwclock.c +++ b/util-linux/hwclock.c | |||
@@ -67,7 +67,7 @@ static time_t read_rtc(int utc) | |||
67 | if (( rtc = open ( "/dev/misc/rtc", O_RDONLY )) < 0 ) | 67 | if (( rtc = open ( "/dev/misc/rtc", O_RDONLY )) < 0 ) |
68 | bb_perror_msg_and_die ( "Could not access RTC" ); | 68 | bb_perror_msg_and_die ( "Could not access RTC" ); |
69 | } | 69 | } |
70 | memset ( &tm, 0, sizeof( struct tm )); | 70 | memset ( &tm, 0, sizeof( struct tm )); |
71 | if ( ioctl ( rtc, RTC_RD_TIME, &tm ) < 0 ) | 71 | if ( ioctl ( rtc, RTC_RD_TIME, &tm ) < 0 ) |
72 | bb_perror_msg_and_die ( "Could not read time from RTC" ); | 72 | bb_perror_msg_and_die ( "Could not read time from RTC" ); |
73 | tm. tm_isdst = -1; // not known | 73 | tm. tm_isdst = -1; // not known |
@@ -187,10 +187,10 @@ static int check_utc(void) | |||
187 | } | 187 | } |
188 | 188 | ||
189 | #define HWCLOCK_OPT_LOCALTIME 0x01 | 189 | #define HWCLOCK_OPT_LOCALTIME 0x01 |
190 | #define HWCLOCK_OPT_UTC 0x02 | 190 | #define HWCLOCK_OPT_UTC 0x02 |
191 | #define HWCLOCK_OPT_SHOW 0x04 | 191 | #define HWCLOCK_OPT_SHOW 0x04 |
192 | #define HWCLOCK_OPT_HCTOSYS 0x08 | 192 | #define HWCLOCK_OPT_HCTOSYS 0x08 |
193 | #define HWCLOCK_OPT_SYSTOHC 0x10 | 193 | #define HWCLOCK_OPT_SYSTOHC 0x10 |
194 | 194 | ||
195 | extern int hwclock_main ( int argc, char **argv ) | 195 | extern int hwclock_main ( int argc, char **argv ) |
196 | { | 196 | { |
diff --git a/util-linux/ipcrm.c b/util-linux/ipcrm.c index 9e18752a3..f4abf6839 100644 --- a/util-linux/ipcrm.c +++ b/util-linux/ipcrm.c | |||
@@ -94,7 +94,7 @@ remove_ids(type_id type, int argc, char **argv) { | |||
94 | case MSG: | 94 | case MSG: |
95 | ret = msgctl (id, IPC_RMID, NULL); | 95 | ret = msgctl (id, IPC_RMID, NULL); |
96 | break; | 96 | break; |
97 | 97 | ||
98 | case SHM: | 98 | case SHM: |
99 | ret = shmctl (id, IPC_RMID, NULL); | 99 | ret = shmctl (id, IPC_RMID, NULL); |
100 | break; | 100 | break; |
@@ -109,7 +109,7 @@ remove_ids(type_id type, int argc, char **argv) { | |||
109 | argc--; | 109 | argc--; |
110 | argv++; | 110 | argv++; |
111 | } | 111 | } |
112 | 112 | ||
113 | return(nb_errors); | 113 | return(nb_errors); |
114 | } | 114 | } |
115 | 115 | ||
@@ -119,7 +119,7 @@ static int deprecated_main(int argc, char **argv) | |||
119 | bb_show_usage(); | 119 | bb_show_usage(); |
120 | bb_fflush_stdout_and_exit(1); | 120 | bb_fflush_stdout_and_exit(1); |
121 | } | 121 | } |
122 | 122 | ||
123 | if (!strcmp(argv[1], "shm")) { | 123 | if (!strcmp(argv[1], "shm")) { |
124 | if (remove_ids(SHM, argc-2, &argv[2])) | 124 | if (remove_ids(SHM, argc-2, &argv[2])) |
125 | bb_fflush_stdout_and_exit(1); | 125 | bb_fflush_stdout_and_exit(1); |
@@ -127,7 +127,7 @@ static int deprecated_main(int argc, char **argv) | |||
127 | else if (!strcmp(argv[1], "msg")) { | 127 | else if (!strcmp(argv[1], "msg")) { |
128 | if (remove_ids(MSG, argc-2, &argv[2])) | 128 | if (remove_ids(MSG, argc-2, &argv[2])) |
129 | bb_fflush_stdout_and_exit(1); | 129 | bb_fflush_stdout_and_exit(1); |
130 | } | 130 | } |
131 | else if (!strcmp(argv[1], "sem")) { | 131 | else if (!strcmp(argv[1], "sem")) { |
132 | if (remove_ids(SEM, argc-2, &argv[2])) | 132 | if (remove_ids(SEM, argc-2, &argv[2])) |
133 | bb_fflush_stdout_and_exit(1); | 133 | bb_fflush_stdout_and_exit(1); |
@@ -228,7 +228,7 @@ int ipcrm_main(int argc, char **argv) | |||
228 | } | 228 | } |
229 | 229 | ||
230 | result = ((c == 'q') ? msgctl(id, IPC_RMID, NULL) : | 230 | result = ((c == 'q') ? msgctl(id, IPC_RMID, NULL) : |
231 | (c == 'm') ? shmctl(id, IPC_RMID, NULL) : | 231 | (c == 'm') ? shmctl(id, IPC_RMID, NULL) : |
232 | semctl(id, 0, IPC_RMID, arg)); | 232 | semctl(id, 0, IPC_RMID, arg)); |
233 | 233 | ||
234 | if (result < 0) { | 234 | if (result < 0) { |
diff --git a/util-linux/ipcs.c b/util-linux/ipcs.c index ea5e412ea..f1463a8e3 100644 --- a/util-linux/ipcs.c +++ b/util-linux/ipcs.c | |||
@@ -29,12 +29,12 @@ | |||
29 | * 19:30:41 1996 by janl@math.uio.no to add code missing in case PID: | 29 | * 19:30:41 1996 by janl@math.uio.no to add code missing in case PID: |
30 | * clauses. | 30 | * clauses. |
31 | * | 31 | * |
32 | * Patches from Mike Jagdis (jaggy@purplet.demon.co.uk) applied | 32 | * Patches from Mike Jagdis (jaggy@purplet.demon.co.uk) applied |
33 | * Wed Feb 8 12:12:21 1995 by faith@cs.unc.edu to print numeric uids | 33 | * Wed Feb 8 12:12:21 1995 by faith@cs.unc.edu to print numeric uids |
34 | * if no passwd file entry. | 34 | * if no passwd file entry. |
35 | * | 35 | * |
36 | * Modified Sat Oct 9 10:55:28 1993 for 0.99.13 | 36 | * Modified Sat Oct 9 10:55:28 1993 for 0.99.13 |
37 | * Original author unknown, may be "krishna balasub@cis.ohio-state.edu" | 37 | * Original author unknown, may be "krishna balasub@cis.ohio-state.edu" |
38 | * | 38 | * |
39 | */ | 39 | */ |
40 | 40 | ||
@@ -136,7 +136,7 @@ static void print_msg (int id); | |||
136 | static void print_sem (int id); | 136 | static void print_sem (int id); |
137 | 137 | ||
138 | int ipcs_main (int argc, char **argv) { | 138 | int ipcs_main (int argc, char **argv) { |
139 | int opt, msg = 0, sem = 0, shm = 0, id=0, print=0; | 139 | int opt, msg = 0, sem = 0, shm = 0, id=0, print=0; |
140 | char format = 0; | 140 | char format = 0; |
141 | char options[] = "atclupsmqi:ih?"; | 141 | char options[] = "atclupsmqi:ih?"; |
142 | 142 | ||
@@ -173,7 +173,7 @@ int ipcs_main (int argc, char **argv) { | |||
173 | case 'u': | 173 | case 'u': |
174 | format = STATUS; | 174 | format = STATUS; |
175 | break; | 175 | break; |
176 | case 'h': | 176 | case 'h': |
177 | case '?': | 177 | case '?': |
178 | bb_show_usage(); | 178 | bb_show_usage(); |
179 | bb_fflush_stdout_and_exit (0); | 179 | bb_fflush_stdout_and_exit (0); |
@@ -181,11 +181,11 @@ int ipcs_main (int argc, char **argv) { | |||
181 | } | 181 | } |
182 | 182 | ||
183 | if (print) { | 183 | if (print) { |
184 | if (shm) { | 184 | if (shm) { |
185 | print_shm (id); | 185 | print_shm (id); |
186 | bb_fflush_stdout_and_exit (0); | 186 | bb_fflush_stdout_and_exit (0); |
187 | } | 187 | } |
188 | if (sem) { | 188 | if (sem) { |
189 | print_sem (id); | 189 | print_sem (id); |
190 | bb_fflush_stdout_and_exit (0); | 190 | bb_fflush_stdout_and_exit (0); |
191 | } | 191 | } |
@@ -201,15 +201,15 @@ int ipcs_main (int argc, char **argv) { | |||
201 | msg = sem = shm = 1; | 201 | msg = sem = shm = 1; |
202 | bb_printf ("\n"); | 202 | bb_printf ("\n"); |
203 | 203 | ||
204 | if (shm) { | 204 | if (shm) { |
205 | do_shm (format); | 205 | do_shm (format); |
206 | bb_printf ("\n"); | 206 | bb_printf ("\n"); |
207 | } | 207 | } |
208 | if (sem) { | 208 | if (sem) { |
209 | do_sem (format); | 209 | do_sem (format); |
210 | bb_printf ("\n"); | 210 | bb_printf ("\n"); |
211 | } | 211 | } |
212 | if (msg) { | 212 | if (msg) { |
213 | do_msg (format); | 213 | do_msg (format); |
214 | bb_printf ("\n"); | 214 | bb_printf ("\n"); |
215 | } | 215 | } |
@@ -258,7 +258,7 @@ void do_shm (char format) | |||
258 | bb_printf ("kernel not configured for shared memory\n"); | 258 | bb_printf ("kernel not configured for shared memory\n"); |
259 | return; | 259 | return; |
260 | } | 260 | } |
261 | 261 | ||
262 | switch (format) { | 262 | switch (format) { |
263 | case LIMITS: | 263 | case LIMITS: |
264 | bb_printf ("------ Shared Memory Limits --------\n"); | 264 | bb_printf ("------ Shared Memory Limits --------\n"); |
@@ -282,7 +282,7 @@ void do_shm (char format) | |||
282 | bb_printf ("pages allocated %ld\n", shm_info.shm_tot); | 282 | bb_printf ("pages allocated %ld\n", shm_info.shm_tot); |
283 | bb_printf ("pages resident %ld\n", shm_info.shm_rss); | 283 | bb_printf ("pages resident %ld\n", shm_info.shm_rss); |
284 | bb_printf ("pages swapped %ld\n", shm_info.shm_swp); | 284 | bb_printf ("pages swapped %ld\n", shm_info.shm_swp); |
285 | bb_printf ("Swap performance: %ld attempts\t %ld successes\n", | 285 | bb_printf ("Swap performance: %ld attempts\t %ld successes\n", |
286 | shm_info.swap_attempts, shm_info.swap_successes); | 286 | shm_info.swap_attempts, shm_info.swap_successes); |
287 | return; | 287 | return; |
288 | 288 | ||
@@ -313,7 +313,7 @@ void do_shm (char format) | |||
313 | 313 | ||
314 | for (id = 0; id <= maxid; id++) { | 314 | for (id = 0; id <= maxid; id++) { |
315 | shmid = shmctl (id, SHM_STAT, &shmseg); | 315 | shmid = shmctl (id, SHM_STAT, &shmseg); |
316 | if (shmid < 0) | 316 | if (shmid < 0) |
317 | continue; | 317 | continue; |
318 | if (format == CREATOR) { | 318 | if (format == CREATOR) { |
319 | print_perms (shmid, ipcp); | 319 | print_perms (shmid, ipcp); |
@@ -321,7 +321,7 @@ void do_shm (char format) | |||
321 | } | 321 | } |
322 | pw = getpwuid(ipcp->uid); | 322 | pw = getpwuid(ipcp->uid); |
323 | switch (format) { | 323 | switch (format) { |
324 | case TIME: | 324 | case TIME: |
325 | if (pw) | 325 | if (pw) |
326 | bb_printf ("%-10d %-10.10s", shmid, pw->pw_name); | 326 | bb_printf ("%-10d %-10.10s", shmid, pw->pw_name); |
327 | else | 327 | else |
@@ -342,14 +342,14 @@ void do_shm (char format) | |||
342 | bb_printf (" %-10d %-10d\n", | 342 | bb_printf (" %-10d %-10d\n", |
343 | shmseg.shm_cpid, shmseg.shm_lpid); | 343 | shmseg.shm_cpid, shmseg.shm_lpid); |
344 | break; | 344 | break; |
345 | 345 | ||
346 | default: | 346 | default: |
347 | bb_printf("0x%08x ",ipcp->KEY ); | 347 | bb_printf("0x%08x ",ipcp->KEY ); |
348 | if (pw) | 348 | if (pw) |
349 | bb_printf ("%-10d %-10.10s", shmid, pw->pw_name); | 349 | bb_printf ("%-10d %-10.10s", shmid, pw->pw_name); |
350 | else | 350 | else |
351 | bb_printf ("%-10d %-10d", shmid, ipcp->uid); | 351 | bb_printf ("%-10d %-10d", shmid, ipcp->uid); |
352 | bb_printf ("%-10o %-10lu %-10ld %-6s %-6s\n", | 352 | bb_printf ("%-10o %-10lu %-10ld %-6s %-6s\n", |
353 | ipcp->mode & 0777, | 353 | ipcp->mode & 0777, |
354 | /* | 354 | /* |
355 | * earlier: int, Austin has size_t | 355 | * earlier: int, Austin has size_t |
@@ -384,7 +384,7 @@ void do_sem (char format) | |||
384 | bb_printf ("kernel not configured for semaphores\n"); | 384 | bb_printf ("kernel not configured for semaphores\n"); |
385 | return; | 385 | return; |
386 | } | 386 | } |
387 | 387 | ||
388 | switch (format) { | 388 | switch (format) { |
389 | case LIMITS: | 389 | case LIMITS: |
390 | bb_printf ("------ Semaphore Limits --------\n"); | 390 | bb_printf ("------ Semaphore Limits --------\n"); |
@@ -421,7 +421,7 @@ void do_sem (char format) | |||
421 | 421 | ||
422 | default: | 422 | default: |
423 | bb_printf ("------ Semaphore Arrays --------\n"); | 423 | bb_printf ("------ Semaphore Arrays --------\n"); |
424 | bb_printf ("%-10s %-10s %-10s %-10s %-10s\n", | 424 | bb_printf ("%-10s %-10s %-10s %-10s %-10s\n", |
425 | "key","semid","owner","perms","nsems"); | 425 | "key","semid","owner","perms","nsems"); |
426 | break; | 426 | break; |
427 | } | 427 | } |
@@ -437,7 +437,7 @@ void do_sem (char format) | |||
437 | } | 437 | } |
438 | pw = getpwuid(ipcp->uid); | 438 | pw = getpwuid(ipcp->uid); |
439 | switch (format) { | 439 | switch (format) { |
440 | case TIME: | 440 | case TIME: |
441 | if (pw) | 441 | if (pw) |
442 | bb_printf ("%-8d %-10.10s", semid, pw->pw_name); | 442 | bb_printf ("%-8d %-10.10s", semid, pw->pw_name); |
443 | else | 443 | else |
@@ -449,7 +449,7 @@ void do_sem (char format) | |||
449 | break; | 449 | break; |
450 | case PID: | 450 | case PID: |
451 | break; | 451 | break; |
452 | 452 | ||
453 | default: | 453 | default: |
454 | bb_printf("0x%08x ", ipcp->KEY); | 454 | bb_printf("0x%08x ", ipcp->KEY); |
455 | if (pw) | 455 | if (pw) |
@@ -484,7 +484,7 @@ void do_msg (char format) | |||
484 | bb_printf ("kernel not configured for message queues\n"); | 484 | bb_printf ("kernel not configured for message queues\n"); |
485 | return; | 485 | return; |
486 | } | 486 | } |
487 | 487 | ||
488 | switch (format) { | 488 | switch (format) { |
489 | case LIMITS: | 489 | case LIMITS: |
490 | if ((msgctl (0, IPC_INFO, (struct msqid_ds *) (void *) &msginfo)) < 0 ) | 490 | if ((msgctl (0, IPC_INFO, (struct msqid_ds *) (void *) &msginfo)) < 0 ) |
@@ -662,7 +662,7 @@ void print_sem (int semid) | |||
662 | bb_printf ("nsems = %ld\n", (long) semds.sem_nsems); | 662 | bb_printf ("nsems = %ld\n", (long) semds.sem_nsems); |
663 | bb_printf ("otime = %-26.24s\n", | 663 | bb_printf ("otime = %-26.24s\n", |
664 | semds.sem_otime ? ctime (&semds.sem_otime) : "Not set"); | 664 | semds.sem_otime ? ctime (&semds.sem_otime) : "Not set"); |
665 | bb_printf ("ctime = %-26.24s\n", ctime (&semds.sem_ctime)); | 665 | bb_printf ("ctime = %-26.24s\n", ctime (&semds.sem_ctime)); |
666 | 666 | ||
667 | bb_printf ("%-10s %-10s %-10s %-10s %-10s\n", | 667 | bb_printf ("%-10s %-10s %-10s %-10s %-10s\n", |
668 | "semnum","value","ncount","zcount","pid"); | 668 | "semnum","value","ncount","zcount","pid"); |
diff --git a/util-linux/losetup.c b/util-linux/losetup.c index f03889663..c2d3339e0 100644 --- a/util-linux/losetup.c +++ b/util-linux/losetup.c | |||
@@ -31,16 +31,16 @@ die_failed: | |||
31 | case -1: | 31 | case -1: |
32 | /* losetup takes two argument:, loop_device and file */ | 32 | /* losetup takes two argument:, loop_device and file */ |
33 | if(optind+2==argc) { | 33 | if(optind+2==argc) { |
34 | if(set_loop(&argv[optind], argv[optind + 1], offset)>=0) | 34 | if(set_loop(&argv[optind], argv[optind + 1], offset)>=0) |
35 | return EXIT_SUCCESS; | 35 | return EXIT_SUCCESS; |
36 | else goto die_failed; | 36 | else goto die_failed; |
37 | } | 37 | } |
38 | if(optind+1==argc) { | 38 | if(optind+1==argc) { |
39 | char *s=query_loop(argv[optind]); | 39 | char *s=query_loop(argv[optind]); |
40 | if (!s) goto die_failed; | 40 | if (!s) goto die_failed; |
41 | printf("%s: %s\n",argv[optind],s); | 41 | printf("%s: %s\n",argv[optind],s); |
42 | if(ENABLE_FEATURE_CLEAN_UP) free(s); | 42 | if(ENABLE_FEATURE_CLEAN_UP) free(s); |
43 | return EXIT_SUCCESS; | 43 | return EXIT_SUCCESS; |
44 | } | 44 | } |
45 | break; | 45 | break; |
46 | } | 46 | } |
diff --git a/util-linux/mdev.c b/util-linux/mdev.c index a18e44835..b8c0090fa 100644 --- a/util-linux/mdev.c +++ b/util-linux/mdev.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* vi:set ts=4: | 1 | /* vi:set ts=4: |
2 | * | 2 | * |
3 | * mdev - Mini udev for busybox | 3 | * mdev - Mini udev for busybox |
4 | * | 4 | * |
5 | * Copyright 2005 Rob Landley <rob@landley.net> | 5 | * Copyright 2005 Rob Landley <rob@landley.net> |
6 | * Copyright 2005 Frank Sorenson <frank@tuxrocks.com> | 6 | * Copyright 2005 Frank Sorenson <frank@tuxrocks.com> |
7 | * | 7 | * |
@@ -38,21 +38,21 @@ static void make_device(char *path) | |||
38 | RESERVE_CONFIG_BUFFER(temp,PATH_MAX); | 38 | RESERVE_CONFIG_BUFFER(temp,PATH_MAX); |
39 | 39 | ||
40 | /* Try to read major/minor string */ | 40 | /* Try to read major/minor string */ |
41 | 41 | ||
42 | snprintf(temp, PATH_MAX, "%s/dev", path); | 42 | snprintf(temp, PATH_MAX, "%s/dev", path); |
43 | fd = open(temp, O_RDONLY); | 43 | fd = open(temp, O_RDONLY); |
44 | len = read(fd, temp, PATH_MAX-1); | 44 | len = read(fd, temp, PATH_MAX-1); |
45 | if (len<1) goto end; | 45 | if (len<1) goto end; |
46 | close(fd); | 46 | close(fd); |
47 | 47 | ||
48 | /* Determine device name, type, major and minor */ | 48 | /* Determine device name, type, major and minor */ |
49 | 49 | ||
50 | device_name = strrchr(path, '/') + 1; | 50 | device_name = strrchr(path, '/') + 1; |
51 | type = strncmp(path+5, "block/" ,6) ? S_IFCHR : S_IFBLK; | 51 | type = strncmp(path+5, "block/" ,6) ? S_IFCHR : S_IFBLK; |
52 | if(sscanf(temp, "%d:%d", &major, &minor) != 2) goto end; | 52 | if(sscanf(temp, "%d:%d", &major, &minor) != 2) goto end; |
53 | 53 | ||
54 | /* If we have a config file, look up permissions for this device */ | 54 | /* If we have a config file, look up permissions for this device */ |
55 | 55 | ||
56 | if (ENABLE_FEATURE_MDEV_CONF) { | 56 | if (ENABLE_FEATURE_MDEV_CONF) { |
57 | char *conf,*pos,*end; | 57 | char *conf,*pos,*end; |
58 | 58 | ||
@@ -67,7 +67,7 @@ static void make_device(char *path) | |||
67 | for (pos=conf;pos-conf<len;) { | 67 | for (pos=conf;pos-conf<len;) { |
68 | int field; | 68 | int field; |
69 | char *end2; | 69 | char *end2; |
70 | 70 | ||
71 | line++; | 71 | line++; |
72 | /* find end of this line */ | 72 | /* find end of this line */ |
73 | for(end=pos;end-conf<len && *end!='\n';end++); | 73 | for(end=pos;end-conf<len && *end!='\n';end++); |
@@ -88,11 +88,11 @@ static void make_device(char *path) | |||
88 | regmatch_t off; | 88 | regmatch_t off; |
89 | int result; | 89 | int result; |
90 | 90 | ||
91 | /* Is this it? */ | 91 | /* Is this it? */ |
92 | xregcomp(&match,regex,REG_EXTENDED); | 92 | xregcomp(&match,regex,REG_EXTENDED); |
93 | result=regexec(&match,device_name,1,&off,0); | 93 | result=regexec(&match,device_name,1,&off,0); |
94 | regfree(&match); | 94 | regfree(&match); |
95 | 95 | ||
96 | /* If not this device, skip rest of line */ | 96 | /* If not this device, skip rest of line */ |
97 | if(result || off.rm_so | 97 | if(result || off.rm_so |
98 | || off.rm_eo!=strlen(device_name)) | 98 | || off.rm_eo!=strlen(device_name)) |
@@ -159,7 +159,7 @@ found_device: | |||
159 | bb_perror_msg_and_die("mknod %s failed", temp); | 159 | bb_perror_msg_and_die("mknod %s failed", temp); |
160 | 160 | ||
161 | if (ENABLE_FEATURE_MDEV_CONF) chown(temp,uid,gid); | 161 | if (ENABLE_FEATURE_MDEV_CONF) chown(temp,uid,gid); |
162 | 162 | ||
163 | end: | 163 | end: |
164 | RELEASE_CONFIG_BUFFER(temp); | 164 | RELEASE_CONFIG_BUFFER(temp); |
165 | } | 165 | } |
@@ -177,7 +177,7 @@ static void find_dev(char *path) | |||
177 | 177 | ||
178 | for (;;) { | 178 | for (;;) { |
179 | struct dirent *entry = readdir(dir); | 179 | struct dirent *entry = readdir(dir); |
180 | 180 | ||
181 | if (!entry) break; | 181 | if (!entry) break; |
182 | 182 | ||
183 | /* Skip "." and ".." (also skips hidden files, which is ok) */ | 183 | /* Skip "." and ".." (also skips hidden files, which is ok) */ |
@@ -189,12 +189,12 @@ static void find_dev(char *path) | |||
189 | find_dev(path); | 189 | find_dev(path); |
190 | path[len] = 0; | 190 | path[len] = 0; |
191 | } | 191 | } |
192 | 192 | ||
193 | /* If there's a dev entry, mknod it */ | 193 | /* If there's a dev entry, mknod it */ |
194 | 194 | ||
195 | if (!strcmp(entry->d_name, "dev")) make_device(path); | 195 | if (!strcmp(entry->d_name, "dev")) make_device(path); |
196 | } | 196 | } |
197 | 197 | ||
198 | closedir(dir); | 198 | closedir(dir); |
199 | } | 199 | } |
200 | 200 | ||
@@ -205,7 +205,7 @@ int mdev_main(int argc, char *argv[]) | |||
205 | RESERVE_CONFIG_BUFFER(temp,PATH_MAX); | 205 | RESERVE_CONFIG_BUFFER(temp,PATH_MAX); |
206 | 206 | ||
207 | /* Scan */ | 207 | /* Scan */ |
208 | 208 | ||
209 | if (argc == 2 && !strcmp(argv[1],"-s")) { | 209 | if (argc == 2 && !strcmp(argv[1],"-s")) { |
210 | strcpy(temp,"/sys/block"); | 210 | strcpy(temp,"/sys/block"); |
211 | find_dev(temp); | 211 | find_dev(temp); |
@@ -218,7 +218,7 @@ int mdev_main(int argc, char *argv[]) | |||
218 | action = getenv("ACTION"); | 218 | action = getenv("ACTION"); |
219 | env_path = getenv("DEVPATH"); | 219 | env_path = getenv("DEVPATH"); |
220 | if (!action || !env_path) bb_show_usage(); | 220 | if (!action || !env_path) bb_show_usage(); |
221 | 221 | ||
222 | if (!strcmp(action, "add")) { | 222 | if (!strcmp(action, "add")) { |
223 | sprintf(temp, "/sys%s", env_path); | 223 | sprintf(temp, "/sys%s", env_path); |
224 | make_device(temp); | 224 | make_device(temp); |
diff --git a/util-linux/mount.c b/util-linux/mount.c index 4777e470b..68542f9bc 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
@@ -32,7 +32,7 @@ | |||
32 | 32 | ||
33 | /* Consume standard mount options (from -o options or --options). | 33 | /* Consume standard mount options (from -o options or --options). |
34 | * Set appropriate flags and collect unrecognized ones as a comma separated | 34 | * Set appropriate flags and collect unrecognized ones as a comma separated |
35 | * string to pass to kernel */ | 35 | * string to pass to kernel */ |
36 | 36 | ||
37 | struct { | 37 | struct { |
38 | const char *name; | 38 | const char *name; |
@@ -104,7 +104,7 @@ extern int mount_main(int argc, char **argv) | |||
104 | *loopFile = 0, *buf = 0, | 104 | *loopFile = 0, *buf = 0, |
105 | *files[] = {"/etc/filesystems", "/proc/filesystems", 0}; | 105 | *files[] = {"/etc/filesystems", "/proc/filesystems", 0}; |
106 | int i, opt, all = FALSE, fakeIt = FALSE, allowWrite = FALSE, | 106 | int i, opt, all = FALSE, fakeIt = FALSE, allowWrite = FALSE, |
107 | rc = 1, useMtab = ENABLE_FEATURE_MTAB_SUPPORT; | 107 | rc = 1, useMtab = ENABLE_FEATURE_MTAB_SUPPORT; |
108 | int flags=0xc0ed0000; // Needed for linux 2.2, ignored by 2.4 and 2.6. | 108 | int flags=0xc0ed0000; // Needed for linux 2.2, ignored by 2.4 and 2.6. |
109 | FILE *file = 0,*f = 0; | 109 | FILE *file = 0,*f = 0; |
110 | char path[PATH_MAX*2]; | 110 | char path[PATH_MAX*2]; |
@@ -185,7 +185,7 @@ extern int mount_main(int argc, char **argv) | |||
185 | statbuf.st_mode=0; | 185 | statbuf.st_mode=0; |
186 | if(optind < argc) | 186 | if(optind < argc) |
187 | blockDevice = !stat(argv[optind], &statbuf) ? | 187 | blockDevice = !stat(argv[optind], &statbuf) ? |
188 | bb_simplify_path(argv[optind]) : | 188 | bb_simplify_path(argv[optind]) : |
189 | (ENABLE_FEATURE_CLEAN_UP ? strdup(argv[optind]) : argv[optind]); | 189 | (ENABLE_FEATURE_CLEAN_UP ? strdup(argv[optind]) : argv[optind]); |
190 | if(optind+1 < argc) directory = bb_simplify_path(argv[optind+1]); | 190 | if(optind+1 < argc) directory = bb_simplify_path(argv[optind+1]); |
191 | 191 | ||
@@ -206,7 +206,7 @@ extern int mount_main(int argc, char **argv) | |||
206 | bb_perror_msg("Can't find %s in /etc/fstab\n", blockDevice); | 206 | bb_perror_msg("Can't find %s in /etc/fstab\n", blockDevice); |
207 | break; | 207 | break; |
208 | } | 208 | } |
209 | 209 | ||
210 | // If we're mounting all and all doesn't mount this one, skip it. | 210 | // If we're mounting all and all doesn't mount this one, skip it. |
211 | 211 | ||
212 | if(all) { | 212 | if(all) { |
@@ -271,7 +271,7 @@ singlemount: | |||
271 | goto mount_it_now; | 271 | goto mount_it_now; |
272 | } | 272 | } |
273 | } else { | 273 | } else { |
274 | 274 | ||
275 | // Do we need to allocate a loopback device? | 275 | // Do we need to allocate a loopback device? |
276 | 276 | ||
277 | if(ENABLE_FEATURE_MOUNT_LOOP && !fakeIt && S_ISREG(statbuf.st_mode)) | 277 | if(ENABLE_FEATURE_MOUNT_LOOP && !fakeIt && S_ISREG(statbuf.st_mode)) |
@@ -297,7 +297,7 @@ singlemount: | |||
297 | if(fsType || (flags & (MS_REMOUNT | MS_BIND | MS_MOVE))) | 297 | if(fsType || (flags & (MS_REMOUNT | MS_BIND | MS_MOVE))) |
298 | goto mount_it_now; | 298 | goto mount_it_now; |
299 | } | 299 | } |
300 | 300 | ||
301 | // Loop through filesystem types until mount succeeds or we run out | 301 | // Loop through filesystem types until mount succeeds or we run out |
302 | 302 | ||
303 | for(i = 0; files[i] && rc; i++) { | 303 | for(i = 0; files[i] && rc; i++) { |
@@ -305,11 +305,11 @@ singlemount: | |||
305 | if(!f) continue; | 305 | if(!f) continue; |
306 | // Get next block device backed filesystem | 306 | // Get next block device backed filesystem |
307 | for(buf = 0; (buf = fsType = bb_get_chomped_line_from_file(f)); | 307 | for(buf = 0; (buf = fsType = bb_get_chomped_line_from_file(f)); |
308 | free(buf)) | 308 | free(buf)) |
309 | { | 309 | { |
310 | // Skip funky entries in /proc | 310 | // Skip funky entries in /proc |
311 | if(!strncmp(buf,"nodev",5) && isspace(buf[5])) continue; | 311 | if(!strncmp(buf,"nodev",5) && isspace(buf[5])) continue; |
312 | 312 | ||
313 | while(isspace(*fsType)) fsType++; | 313 | while(isspace(*fsType)) fsType++; |
314 | if(*buf=='#' || *buf=='*') continue; | 314 | if(*buf=='#' || *buf=='*') continue; |
315 | if(!*fsType) continue; | 315 | if(!*fsType) continue; |
diff --git a/util-linux/nfsmount.c b/util-linux/nfsmount.c index 75f341a92..e9d6dc635 100644 --- a/util-linux/nfsmount.c +++ b/util-linux/nfsmount.c | |||
@@ -151,11 +151,11 @@ static const int MS_NODIRATIME = 2048; /* Do not update directory access time | |||
151 | #define NFS_MOUNT_VERSION 4 | 151 | #define NFS_MOUNT_VERSION 4 |
152 | 152 | ||
153 | struct nfs2_fh { | 153 | struct nfs2_fh { |
154 | char data[32]; | 154 | char data[32]; |
155 | }; | 155 | }; |
156 | struct nfs3_fh { | 156 | struct nfs3_fh { |
157 | unsigned short size; | 157 | unsigned short size; |
158 | unsigned char data[64]; | 158 | unsigned char data[64]; |
159 | }; | 159 | }; |
160 | 160 | ||
161 | struct nfs_mount_data { | 161 | struct nfs_mount_data { |
@@ -687,7 +687,7 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
687 | mountprog, | 687 | mountprog, |
688 | mountvers, | 688 | mountvers, |
689 | proto, | 689 | proto, |
690 | mountport); | 690 | mountport); |
691 | 691 | ||
692 | /* contact the mount daemon via TCP */ | 692 | /* contact the mount daemon via TCP */ |
693 | mount_server_addr.sin_port = htons(pm_mnt->pm_port); | 693 | mount_server_addr.sin_port = htons(pm_mnt->pm_port); |
@@ -810,7 +810,7 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
810 | 810 | ||
811 | if (tcp) { | 811 | if (tcp) { |
812 | if (nfs_mount_version < 3) { | 812 | if (nfs_mount_version < 3) { |
813 | printf(_("NFS over TCP is not supported.\n")); | 813 | printf(_("NFS over TCP is not supported.\n")); |
814 | goto fail; | 814 | goto fail; |
815 | } | 815 | } |
816 | fsock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); | 816 | fsock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); |
diff --git a/util-linux/pivot_root.c b/util-linux/pivot_root.c index 85e180c46..c86e73cc1 100644 --- a/util-linux/pivot_root.c +++ b/util-linux/pivot_root.c | |||
@@ -16,7 +16,7 @@ extern int pivot_root(const char * new_root,const char * put_old); | |||
16 | int pivot_root_main(int argc, char **argv) | 16 | int pivot_root_main(int argc, char **argv) |
17 | { | 17 | { |
18 | if (argc != 3) | 18 | if (argc != 3) |
19 | bb_show_usage(); | 19 | bb_show_usage(); |
20 | 20 | ||
21 | if (pivot_root(argv[1],argv[2]) < 0) | 21 | if (pivot_root(argv[1],argv[2]) < 0) |
22 | bb_perror_msg_and_die("pivot_root"); | 22 | bb_perror_msg_and_die("pivot_root"); |
diff --git a/util-linux/rdate.c b/util-linux/rdate.c index cabcc7dbe..2b011ebb0 100644 --- a/util-linux/rdate.c +++ b/util-linux/rdate.c | |||
@@ -55,7 +55,7 @@ static time_t askremotedate(const char *host) | |||
55 | * the RFC 868 time 2,208,988,800 corresponds to 00:00 1 Jan 1970 GMT | 55 | * the RFC 868 time 2,208,988,800 corresponds to 00:00 1 Jan 1970 GMT |
56 | * Subtract the RFC 868 time to get Linux epoch | 56 | * Subtract the RFC 868 time to get Linux epoch |
57 | */ | 57 | */ |
58 | 58 | ||
59 | return(ntohl(nett) - RFC_868_BIAS); | 59 | return(ntohl(nett) - RFC_868_BIAS); |
60 | } | 60 | } |
61 | 61 | ||
@@ -63,10 +63,10 @@ int rdate_main(int argc, char **argv) | |||
63 | { | 63 | { |
64 | time_t remote_time; | 64 | time_t remote_time; |
65 | unsigned long flags; | 65 | unsigned long flags; |
66 | 66 | ||
67 | bb_opt_complementally = "-1"; | 67 | bb_opt_complementally = "-1"; |
68 | flags = bb_getopt_ulflags(argc, argv, "sp"); | 68 | flags = bb_getopt_ulflags(argc, argv, "sp"); |
69 | 69 | ||
70 | remote_time = askremotedate(argv[optind]); | 70 | remote_time = askremotedate(argv[optind]); |
71 | 71 | ||
72 | if (flags & 1) { | 72 | if (flags & 1) { |
@@ -78,9 +78,9 @@ int rdate_main(int argc, char **argv) | |||
78 | else | 78 | else |
79 | if (stime(&remote_time) < 0) | 79 | if (stime(&remote_time) < 0) |
80 | bb_perror_msg_and_die("Could not set time of day"); | 80 | bb_perror_msg_and_die("Could not set time of day"); |
81 | 81 | ||
82 | /* No need to check for the -p flag as it's the only option left */ | 82 | /* No need to check for the -p flag as it's the only option left */ |
83 | 83 | ||
84 | } else printf("%s", ctime(&remote_time)); | 84 | } else printf("%s", ctime(&remote_time)); |
85 | 85 | ||
86 | return EXIT_SUCCESS; | 86 | return EXIT_SUCCESS; |
diff --git a/util-linux/readprofile.c b/util-linux/readprofile.c index 80716d9f0..1612d7147 100644 --- a/util-linux/readprofile.c +++ b/util-linux/readprofile.c | |||
@@ -149,9 +149,9 @@ int readprofile_main(int argc, char **argv) | |||
149 | /* | 149 | /* |
150 | * Use an fd for the profiling buffer, to skip stdio overhead | 150 | * Use an fd for the profiling buffer, to skip stdio overhead |
151 | */ | 151 | */ |
152 | 152 | ||
153 | proFd = bb_xopen(proFile,O_RDONLY); | 153 | proFd = bb_xopen(proFile,O_RDONLY); |
154 | 154 | ||
155 | if (((int)(len=lseek(proFd,0,SEEK_END)) < 0) | 155 | if (((int)(len=lseek(proFd,0,SEEK_END)) < 0) |
156 | || (lseek(proFd,0,SEEK_SET) < 0)) | 156 | || (lseek(proFd,0,SEEK_SET) < 0)) |
157 | bb_perror_msg_and_die(proFile); | 157 | bb_perror_msg_and_die(proFile); |
diff --git a/util-linux/switch_root.c b/util-linux/switch_root.c index 0c86eec08..bcc4443ab 100644 --- a/util-linux/switch_root.c +++ b/util-linux/switch_root.c | |||
@@ -47,20 +47,20 @@ static void delete_contents(char *directory) | |||
47 | // Skip . and .. | 47 | // Skip . and .. |
48 | if(*newdir=='.' && (!newdir[1] || (newdir[1]=='.' && !newdir[2]))) | 48 | if(*newdir=='.' && (!newdir[1] || (newdir[1]=='.' && !newdir[2]))) |
49 | continue; | 49 | continue; |
50 | 50 | ||
51 | // Recurse to delete contents | 51 | // Recurse to delete contents |
52 | newdir = alloca(strlen(directory) + strlen(d->d_name) + 2); | 52 | newdir = alloca(strlen(directory) + strlen(d->d_name) + 2); |
53 | sprintf(newdir, "%s/%s", directory, d->d_name); | 53 | sprintf(newdir, "%s/%s", directory, d->d_name); |
54 | delete_contents(newdir); | 54 | delete_contents(newdir); |
55 | } | 55 | } |
56 | closedir(dir); | 56 | closedir(dir); |
57 | 57 | ||
58 | // Directory should now be empty. Zap it. | 58 | // Directory should now be empty. Zap it. |
59 | rmdir(directory); | 59 | rmdir(directory); |
60 | } | 60 | } |
61 | 61 | ||
62 | // It wasn't a directory. Zap it. | 62 | // It wasn't a directory. Zap it. |
63 | 63 | ||
64 | } else unlink(directory); | 64 | } else unlink(directory); |
65 | } | 65 | } |
66 | 66 | ||
@@ -74,18 +74,18 @@ int switch_root_main(int argc, char *argv[]) | |||
74 | 74 | ||
75 | bb_opt_complementally="-2"; | 75 | bb_opt_complementally="-2"; |
76 | bb_getopt_ulflags(argc,argv,"c:",&console); | 76 | bb_getopt_ulflags(argc,argv,"c:",&console); |
77 | 77 | ||
78 | // Change to new root directory and verify it's a different fs. | 78 | // Change to new root directory and verify it's a different fs. |
79 | 79 | ||
80 | newroot=argv[optind++]; | 80 | newroot=argv[optind++]; |
81 | 81 | ||
82 | if (chdir(newroot) || stat(".", &st1) || stat("/", &st2) || | 82 | if (chdir(newroot) || stat(".", &st1) || stat("/", &st2) || |
83 | st1.st_dev == st2.st_dev) | 83 | st1.st_dev == st2.st_dev) |
84 | { | 84 | { |
85 | bb_error_msg_and_die("bad newroot %s",newroot); | 85 | bb_error_msg_and_die("bad newroot %s",newroot); |
86 | } | 86 | } |
87 | rootdev=st2.st_dev; | 87 | rootdev=st2.st_dev; |
88 | 88 | ||
89 | // Additional sanity checks: we're about to rm -rf /, so be REALLY SURE | 89 | // Additional sanity checks: we're about to rm -rf /, so be REALLY SURE |
90 | // we mean it. (I could make this a CONFIG option, but I would get email | 90 | // we mean it. (I could make this a CONFIG option, but I would get email |
91 | // from all the people who WILL eat their filesystemss.) | 91 | // from all the people who WILL eat their filesystemss.) |
@@ -100,13 +100,13 @@ int switch_root_main(int argc, char *argv[]) | |||
100 | // Zap everything out of rootdev | 100 | // Zap everything out of rootdev |
101 | 101 | ||
102 | delete_contents("/"); | 102 | delete_contents("/"); |
103 | 103 | ||
104 | // Overmount / with newdir and chroot into it. The chdir is needed to | 104 | // Overmount / with newdir and chroot into it. The chdir is needed to |
105 | // recalculate "." and ".." links. | 105 | // recalculate "." and ".." links. |
106 | 106 | ||
107 | if (mount(".", "/", NULL, MS_MOVE, NULL) || chroot(".") || chdir("/")) | 107 | if (mount(".", "/", NULL, MS_MOVE, NULL) || chroot(".") || chdir("/")) |
108 | bb_error_msg_and_die("moving root"); | 108 | bb_error_msg_and_die("moving root"); |
109 | 109 | ||
110 | // If a new console specified, redirect stdin/stdout/stderr to that. | 110 | // If a new console specified, redirect stdin/stdout/stderr to that. |
111 | 111 | ||
112 | if (console) { | 112 | if (console) { |