2 * The main file in fstk project
4 * Copyright (C) 2009 Liu Aleaxander -- All rights reserved. This file
5 * may be redistributed under the terms of the GNU Public License.
19 #include "fstk_malloc.h"
24 static void usage(void)
26 printf("USAGE: fstk -t fs_type fs.img\n");
27 printf("OR fstk fs.img, fstk will recognise it correct for you\n");
32 * Initialize the envrionments used by fstk, like this_dentry...
34 void init_fstk_env(struct fstk
*fs
)
36 set_current_dentry(fs
);
39 void free_fstk_env(void)
41 free_current_dentry();
44 int main(int argc
, char *argv
[])
53 fs_img
= argv
[1]; /* guess it first */
55 fs_type
= guess_fs(fs_img
);
56 else if (argc
== 4 && !strcmp(argv
[1], "-t")) {
65 /* Init fstk memory fisrt */
67 fs
= init_fs(fs_type
);
69 printf("Please input the correct file system type.\n");
70 printf("we currently suport EXT2/3/4 file systems\n\n");
73 if (fstk_mount(fs
, fs_img
)) {
74 printf("mount error, "
75 "maybe you haven't input the correct fs type\n");
81 /* Init the Environment used by fstk */
84 /* we all count on it */
85 res
= fstk_shell("fstk:> ", fs
);
86 if (res
== MOUNT_AGAIN
)
91 check_mem(); /* for debug use to check how much memory we lose */