[BusyBox] [PATCH] tune2fs size optimization
Tito
farmatito at tiscali.it
Tue Jun 28 20:52:54 UTC 2005
Hi Mike, Hi to all,
This patch contains just some trivial changes to reduce the size of tune2fs.
The changed code is left commented out so that it is easier to inspect it.
This is not intensively tested :)
Size reduction is:
text data bss dec hex filename
6931 20 144 7095 1bb7 tune2fs.o.orig
6737 20 144 6901 1af5 tune2fs.o
Ciao,
Tito
-------------- next part --------------
--- e2fsprogs/tune2fs_orig.c 2005-06-12 12:04:02.000000000 +0200
+++ e2fsprogs/tune2fs.c 2005-06-28 22:43:40.000000000 +0200
@@ -33,7 +33,7 @@
extern char *optarg;
extern int optind;
#endif
-#include <pwd.h>
+/*#include <pwd.h>*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -424,10 +424,10 @@
{
int c;
char * tmp;
- struct group * gr;
- struct passwd * pw;
+ /*struct group * gr;
+ struct passwd * pw;*/
- printf("tune2fs %s (%s)\n", E2FSPROGS_VERSION, E2FSPROGS_DATE);
+ printf("%s %s (%s)\n",bb_applet_name, E2FSPROGS_VERSION, E2FSPROGS_DATE);
while ((c = getopt(argc, argv, "c:e:fg:i:jlm:o:r:s:u:C:J:L:M:O:T:U:")) != EOF)
switch (c)
{
@@ -468,17 +468,18 @@
case 'g':
resgid = strtoul (optarg, &tmp, 0);
if (*tmp) {
- gr = getgrnam (optarg);
+ resgid = my_getgrnam (optarg);
+ /*gr = getgrnam (optarg);
if (gr == NULL)
tmp = optarg;
else {
resgid = gr->gr_gid;
*tmp =0;
- }
+ }*/
}
- if (*tmp) {
+ /*if (*tmp) {
bb_error_msg_and_die("bad gid/group name - %s", optarg);
- }
+ }*/
g_flag = 1;
open_flag = EXT2_FLAG_RW;
break;
@@ -578,17 +579,18 @@
case 'u':
resuid = strtoul (optarg, &tmp, 0);
if (*tmp) {
- pw = getpwnam (optarg);
+ resuid = my_getpwnam (optarg);
+ /*pw = getpwnam (optarg);
if (pw == NULL)
tmp = optarg;
else {
resuid = pw->pw_uid;
*tmp = 0;
- }
+ }*/
}
- if (*tmp) {
+ /*if (*tmp) {
bb_error_msg_and_die("bad uid/user name - %s", optarg);
- }
+ }*/
u_flag = 1;
open_flag = EXT2_FLAG_RW;
break;
@@ -601,10 +603,10 @@
default:
bb_show_usage();
}
- if (optind < argc - 1 || optind == argc)
- bb_show_usage();
- if (!open_flag && !l_flag)
+ if (optind < argc - 1 || optind == argc || (!open_flag && !l_flag))
bb_show_usage();
+ /*if (!open_flag && !l_flag)
+ bb_show_usage();*/
io_options = strchr(argv[optind], '?');
if (io_options)
*io_options++ = 0;
@@ -633,11 +635,16 @@
ext2_filsys fs;
struct ext2_super_block *sb;
io_manager io_ptr;
- char *program_name = basename(argv[0]);
+ /*char *program_name = basename(argv[0]);*/
- if (strcmp(program_name, "findfs") == 0)
+ /*if (strcmp(program_name, "findfs") == 0)
do_findfs(argc, argv);
if (strcmp(program_name, "e2label") == 0)
+ parse_e2label_options(argc, argv);*/
+
+ if(bb_applet_name[0] == 'f' /* findfs */)
+ do_findfs(argc, argv);
+ else if(bb_applet_name[0] == 'e' /* e2label */)
parse_e2label_options(argc, argv);
else
parse_tune2fs_options(argc, argv);
More information about the busybox
mailing list