df: fix "df /"

also, clean up mount checks in mkfs/fsck.

function                                             old     new   delta
find_mount_point                                     243     261     +18
sha1_process_block64                                 497     510     +13
find_main                                            436     444      +8
display_speed                                         85      90      +5
df_main                                              795     793      -2
parse_command                                       1463    1460      -3
static.ignored_mounts                                  8       -      -8
mkfs_minix_main                                     2962    2937     -25
fsck_minix_main                                     3065    2970     -95
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 4/4 up/down: 44/-133)           Total: -89 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2009-07-05 04:50:36 +02:00
parent 9b1b62adc4
commit 09e63bb81f
8 changed files with 46 additions and 53 deletions

View File

@ -624,7 +624,6 @@ static void setup_tables(void)
int mkfs_minix_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int mkfs_minix_main(int argc UNUSED_PARAM, char **argv)
{
struct mntent *mp;
unsigned opt;
char *tmp;
struct stat statbuf;
@ -683,11 +682,8 @@ int mkfs_minix_main(int argc UNUSED_PARAM, char **argv)
G.total_blocks = 65535;
/* Check if it is mounted */
mp = find_mount_point(G.device_name, NULL);
if (mp && strcmp(G.device_name, mp->mnt_fsname) == 0)
bb_error_msg_and_die("%s is mounted on %s; "
"refusing to make a filesystem",
G.device_name, mp->mnt_dir);
if (find_mount_point(G.device_name))
bb_error_msg_and_die("can't format mounted filesystem");
xmove_fd(xopen(G.device_name, O_RDWR), dev_fd);
if (fstat(dev_fd, &statbuf) < 0)