blob: db3f16ad96b62a219e93a20cd62702ef3a99b18c [file] [log] [blame]
Koushik Dutta68df48c2010-09-13 15:04:54 -07001#include <ctype.h>
2#include <errno.h>
3#include <fcntl.h>
4#include <getopt.h>
5#include <limits.h>
6#include <linux/input.h>
7#include <stdio.h>
8#include <stdlib.h>
9#include <string.h>
10#include <sys/reboot.h>
11#include <sys/types.h>
12#include <time.h>
13#include <unistd.h>
14
15#include <sys/wait.h>
16#include <sys/limits.h>
17#include <dirent.h>
18#include <sys/stat.h>
19
20#include <signal.h>
21#include <sys/wait.h>
22
23int
24__system(const char *command);
25
Koushik Duttae5c7e0e2010-11-11 01:19:10 -080026int restore_raw_partition(const char *partition, const char *filename)
27{
Koushik Dutta68df48c2010-09-13 15:04:54 -070028 char tmp[PATH_MAX];
Koushik Duttae5c7e0e2010-11-11 01:19:10 -080029 sprintf("dd if=%s of=/dev/block/bml7 bs=4096", filename);
Koushik Dutta68df48c2010-09-13 15:04:54 -070030 return __system(tmp);
31}
Koushik Dutta56c1b3b2010-09-13 15:08:49 -070032
Koushik Duttae5c7e0e2010-11-11 01:19:10 -080033int backup_raw_partition(const char *partition, const char *filename)
34{
Koushik Dutta56c1b3b2010-09-13 15:08:49 -070035 char tmp[PATH_MAX];
Koushik Duttae5c7e0e2010-11-11 01:19:10 -080036 sprintf("dd of=%s if=/dev/block/bml7 bs=4096", filename);
Koushik Dutta56c1b3b2010-09-13 15:08:49 -070037 return __system(tmp);
38}
Koushik Duttae5c7e0e2010-11-11 01:19:10 -080039
40int erase_raw_partition(const char *partition)
41{
42 // TODO: implement raw wipe
43 return 0;
44}
45
46int erase_partition(const char *partition, const char *filesystem)
47{
48 return -1;
49}
50
51int mount_partition(const char *partition, const char *mount_point, const char *filesystem, int read_only)
52{
53 return -1;
54}
55
56int get_partition_device(const char *partition, char *device)
57{
58 return -1;
59}