summaryrefslogtreecommitdiff
path: root/legacy/eeze/src/bin/eeze_mount.c
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2011-02-11 03:12:34 +0000
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>2011-02-11 03:12:34 +0000
commit4697916227358f4c96cd6882d69fa8f827496857 (patch)
treea0f5c81182f5d37f5727905065efd739f075a987 /legacy/eeze/src/bin/eeze_mount.c
parentf53ca1a6ab8c5e7e42295583b73354204f5aef51 (diff)
add new option for verbose to print some debug info, parse options a bit better, grab+use fstab mount opts where available
SVN revision: 56946
Diffstat (limited to 'legacy/eeze/src/bin/eeze_mount.c')
-rw-r--r--legacy/eeze/src/bin/eeze_mount.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/legacy/eeze/src/bin/eeze_mount.c b/legacy/eeze/src/bin/eeze_mount.c
index 235c7ba2d6..c4fa02a6a7 100644
--- a/legacy/eeze/src/bin/eeze_mount.c
+++ b/legacy/eeze/src/bin/eeze_mount.c
@@ -16,6 +16,7 @@ static const Ecore_Getopt opts =
16 "Mount a disk using either its /sys/ path or its /dev/ path\n\n", 16 "Mount a disk using either its /sys/ path or its /dev/ path\n\n",
17 1, 17 1,
18 { 18 {
19 ECORE_GETOPT_STORE_TRUE('v', "verbose", "Enable debug output"),
19 ECORE_GETOPT_VERSION('V', "version"), 20 ECORE_GETOPT_VERSION('V', "version"),
20 ECORE_GETOPT_COPYRIGHT('R', "copyright"), 21 ECORE_GETOPT_COPYRIGHT('R', "copyright"),
21 ECORE_GETOPT_LICENSE('L', "license"), 22 ECORE_GETOPT_LICENSE('L', "license"),
@@ -49,11 +50,12 @@ main(int argc, char *argv[])
49{ 50{
50 int args; 51 int args;
51 const char *dev, *mount_point; 52 const char *dev, *mount_point;
52 Eina_Bool exit_option = EINA_FALSE; 53 Eina_Bool verbose = EINA_FALSE, exit_option = EINA_FALSE;
53 Eeze_Disk *disk; 54 Eeze_Disk *disk;
54 55
55 Ecore_Getopt_Value values[] = 56 Ecore_Getopt_Value values[] =
56 { 57 {
58 ECORE_GETOPT_VALUE_BOOL(verbose),
57 ECORE_GETOPT_VALUE_BOOL(exit_option), 59 ECORE_GETOPT_VALUE_BOOL(exit_option),
58 ECORE_GETOPT_VALUE_BOOL(exit_option), 60 ECORE_GETOPT_VALUE_BOOL(exit_option),
59 ECORE_GETOPT_VALUE_BOOL(exit_option), 61 ECORE_GETOPT_VALUE_BOOL(exit_option),
@@ -81,13 +83,13 @@ main(int argc, char *argv[])
81 ecore_getopt_help(stderr, &opts); 83 ecore_getopt_help(stderr, &opts);
82 exit(1); 84 exit(1);
83 } 85 }
84 86 if (verbose) eina_log_domain_level_set("eeze_disk", EINA_LOG_LEVEL_DBG);
85 dev = argv[args]; 87 dev = argv[args];
86 if (args + 1 < argc) 88 if (args + 1 < argc)
87 mount_point = argv[args + 1]; 89 mount_point = argv[args + 1];
88 if ((!strncmp(dev, "/sys/", 5)) || (!strncmp(dev, "/dev/", 5))) 90 if ((!strncmp(dev, "/sys/", 5)) || (!strncmp(dev, "/dev/", 5)))
89 disk = eeze_disk_new(dev); 91 disk = eeze_disk_new(dev);
90 else if ((argc == 2) && (ecore_file_is_dir(dev))) 92 else if ((args == argc - 1) && (ecore_file_is_dir(dev)))
91 disk = eeze_disk_new_from_mount(dev); 93 disk = eeze_disk_new_from_mount(dev);
92 else 94 else
93 { 95 {
@@ -100,7 +102,7 @@ main(int argc, char *argv[])
100 printf("[%s] is already mounted!", dev); 102 printf("[%s] is already mounted!", dev);
101 exit(1); 103 exit(1);
102 } 104 }
103 if (argc > 2) 105 if (argc - args > 1)
104 { 106 {
105 eeze_disk_mount_point_set(disk, mount_point); 107 eeze_disk_mount_point_set(disk, mount_point);
106 if (eina_str_has_extension(dev, "iso")) 108 if (eina_str_has_extension(dev, "iso"))
@@ -112,6 +114,7 @@ main(int argc, char *argv[])
112 } 114 }
113 ecore_event_handler_add(EEZE_EVENT_DISK_MOUNT, (Ecore_Event_Handler_Cb)_mount_cb, NULL); 115 ecore_event_handler_add(EEZE_EVENT_DISK_MOUNT, (Ecore_Event_Handler_Cb)_mount_cb, NULL);
114 ecore_event_handler_add(EEZE_EVENT_DISK_ERROR, (Ecore_Event_Handler_Cb)_error_cb, NULL); 116 ecore_event_handler_add(EEZE_EVENT_DISK_ERROR, (Ecore_Event_Handler_Cb)_error_cb, NULL);
117 eeze_disk_mountopts_get(disk);
115 if (!eeze_disk_mount(disk)) 118 if (!eeze_disk_mount(disk))
116 { 119 {
117 const char *mp; 120 const char *mp;