diff options
author | Richard Jones <rjones@redhat.com> | 2009-04-15 13:59:07 +0100 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2009-04-15 13:59:07 +0100 |
commit | ad5abc8d367c9c410051062cae066b1b141b4c76 (patch) | |
tree | 9b22bc0900d83ac5a79a8bed7c3283f2fc742536 /fish | |
parent | d5ae4a54e83018687ec05255bc39e7f5ab71a453 (diff) | |
download | libguestfs-ad5abc8d367c9c410051062cae066b1b141b4c76.tar.gz libguestfs-ad5abc8d367c9c410051062cae066b1b141b4c76.tar.xz libguestfs-ad5abc8d367c9c410051062cae066b1b141b4c76.zip |
Generated code for tune2fs-l command and RHashtable return type.
Diffstat (limited to 'fish')
-rw-r--r-- | fish/cmds.c | 24 | ||||
-rw-r--r-- | fish/completion.c | 1 | ||||
-rw-r--r-- | fish/fish.c | 9 | ||||
-rw-r--r-- | fish/fish.h | 1 |
4 files changed, 35 insertions, 0 deletions
diff --git a/fish/cmds.c b/fish/cmds.c index 60aee8c1..c68924a3 100644 --- a/fish/cmds.c +++ b/fish/cmds.c @@ -90,6 +90,7 @@ void list_commands (void) printf ("%-20s %s\n", "statvfs", "get file system statistics"); printf ("%-20s %s\n", "sync", "sync disks, writes are flushed through to the disk image"); printf ("%-20s %s\n", "touch", "update file timestamps or create a new file"); + printf ("%-20s %s\n", "tune2fs-l", "get ext2/ext3 superblock details"); printf ("%-20s %s\n", "umount", "unmount a filesystem"); printf ("%-20s %s\n", "umount-all", "unmount all filesystems"); printf ("%-20s %s\n", "vgcreate", "create an LVM volume group"); @@ -296,6 +297,9 @@ void display_command (const char *cmd) if (strcasecmp (cmd, "statvfs") == 0) pod2text ("statvfs - get file system statistics", " statvfs <path>\n\nReturns file system statistics for any mounted file system.\nC<path> should be a file or directory in the mounted file system\n(typically it is the mount point itself, but it doesn't need to be).\n\nThis is the same as the C<statvfs(2)> system call."); else + if (strcasecmp (cmd, "tune2fs_l") == 0 || strcasecmp (cmd, "tune2fs-l") == 0) + pod2text ("tune2fs-l - get ext2/ext3 superblock details", " tune2fs-l <device>\n\nThis returns the contents of the ext2 or ext3 filesystem superblock\non C<device>.\n\nIt is the same as running C<tune2fs -l device>. See L<tune2fs(8)>\nmanpage for more details. The list of fields returned isn't\nclearly defined, and depends on both the version of C<tune2fs>\nthat libguestfs was built against, and the filesystem itself."); + else display_builtin_command (cmd); } @@ -1435,6 +1439,23 @@ static int run_statvfs (const char *cmd, int argc, char *argv[]) return 0; } +static int run_tune2fs_l (const char *cmd, int argc, char *argv[]) +{ + char **r; + const char *device; + if (argc != 1) { + fprintf (stderr, "%s should have 1 parameter(s)\n", cmd); + fprintf (stderr, "type 'help %s' for help on %s\n", cmd, cmd); + return -1; + } + device = argv[0]; + r = guestfs_tune2fs_l (g, device); + if (r == NULL) return -1; + print_table (r); + free_strings (r); + return 0; +} + int run_action (const char *cmd, int argc, char *argv[]) { if (strcasecmp (cmd, "launch") == 0 || strcasecmp (cmd, "run") == 0) @@ -1632,6 +1653,9 @@ int run_action (const char *cmd, int argc, char *argv[]) if (strcasecmp (cmd, "statvfs") == 0) return run_statvfs (cmd, argc, argv); else + if (strcasecmp (cmd, "tune2fs_l") == 0 || strcasecmp (cmd, "tune2fs-l") == 0) + return run_tune2fs_l (cmd, argc, argv); + else { fprintf (stderr, "%s: unknown command\n", cmd); return -1; diff --git a/fish/completion.c b/fish/completion.c index 7b4f818a..cee2b399 100644 --- a/fish/completion.c +++ b/fish/completion.c @@ -98,6 +98,7 @@ static const char *commands[] = { "statvfs", "sync", "touch", + "tune2fs-l", "umount", "umount-all", "unmount", diff --git a/fish/fish.c b/fish/fish.c index b825626b..e506f7ef 100644 --- a/fish/fish.c +++ b/fish/fish.c @@ -645,6 +645,15 @@ print_strings (char * const * const argv) printf ("%s\n", argv[argc]); } +void +print_table (char * const * const argv) +{ + int i; + + for (i = 0; argv[i] != NULL; i += 2) + printf ("%s: %s\n", argv[i], argv[i+1]); +} + int is_true (const char *str) { diff --git a/fish/fish.h b/fish/fish.h index 86e5e357..6cd4d976 100644 --- a/fish/fish.h +++ b/fish/fish.h @@ -31,6 +31,7 @@ extern void list_builtin_commands (void); extern void display_builtin_command (const char *cmd); extern void free_strings (char **argv); extern void print_strings (char * const * const argv); +extern void print_table (char * const * const argv); extern int launch (guestfs_h *); extern int is_true (const char *str); extern char **parse_string_list (const char *str); |