Changeset 30319 in vbox
- Timestamp:
- Jun 21, 2010 8:29:08 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 62877
- Location:
- trunk/src/VBox/Frontends/VBoxManage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp
r29651 r30319 39 39 40 40 #include <iprt/file.h> 41 #include <iprt/ initterm.h>41 #include <iprt/getopt.h> 42 42 #include <iprt/stream.h> 43 43 #include <iprt/string.h> … … 84 84 #define PARTTYPE_IS_EXTENDED(x) ((x) == 0x05 || (x) == 0x0f || (x) == 0x85) 85 85 86 /* Maximum number of partitions we can deal with. Ridiculously large number,87 * but the memory consumption is rather low so who cares about never using88 * most entries. */86 /** Maximum number of partitions we can deal with. 87 * Ridiculously large number, but the memory consumption is rather low so who 88 * cares about never using most entries. */ 89 89 #define HOSTPARTITION_MAX 100 90 90 … … 136 136 "Commands:\n" 137 137 "\n" 138 "%s%s%s%s%s%s%s%s%s "138 "%s%s%s%s%s%s%s%s%s%s%s%s" 139 139 "WARNING: This is a development tool and shall only be used to analyse\n" 140 140 " problems. It is completely unsupported and will change in\n" 141 141 " incompatible ways without warning.\n", 142 (u64Cmd & USAGE_LOADSYMS) ? 143 " loadsyms <vmname>|<uuid> <symfile> [delta] [module] [module address]\n" 144 " This will instruct DBGF to load the given symbolfile\n" 145 " during initialization.\n" 146 "\n" 147 : "", 148 (u64Cmd & USAGE_UNLOADSYMS) ? 149 " unloadsyms <vmname>|<uuid> <symfile>\n" 150 " Removes <symfile> from the list of symbol files that\n" 151 " should be loaded during DBF initialization.\n" 152 "\n" 153 : "", 154 (u64Cmd & USAGE_SETHDUUID) ? 155 " sethduuid <filepath>\n" 156 " Assigns a new UUID to the given image file. This way, multiple copies\n" 157 " of a container can be registered.\n" 158 "\n" 159 : "", 160 (u64Cmd & USAGE_DUMPHDINFO) ? 161 " dumphdinfo <filepath>\n" 142 143 (u64Cmd & USAGE_LOADSYMS) 144 ? " loadsyms <vmname>|<uuid> <symfile> [delta] [module] [module address]\n" 145 " This will instruct DBGF to load the given symbolfile\n" 146 " during initialization.\n" 147 "\n" 148 : "", 149 (u64Cmd & USAGE_UNLOADSYMS) 150 ? " unloadsyms <vmname>|<uuid> <symfile>\n" 151 " Removes <symfile> from the list of symbol files that\n" 152 " should be loaded during DBF initialization.\n" 153 "\n" 154 : "", 155 (u64Cmd & USAGE_SETHDUUID) 156 ? " sethduuid <filepath>\n" 157 " Assigns a new UUID to the given image file. This way, multiple copies\n" 158 " of a container can be registered.\n" 159 "\n" 160 : "", 161 (u64Cmd & USAGE_DUMPHDINFO) 162 ? " dumphdinfo <filepath>\n" 162 163 " Prints information about the image at the given location.\n" 163 164 "\n" 164 165 (u64Cmd & USAGE_LISTPARTITIONS) ?166 167 168 169 170 (u64Cmd & USAGE_CREATERAWVMDK) ?171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 (u64Cmd & USAGE_RENAMEVMDK) ?189 190 191 192 193 (u64Cmd & USAGE_CONVERTTORAW) ?194 165 : "", 166 (u64Cmd & USAGE_LISTPARTITIONS) 167 ? " listpartitions -rawdisk <diskname>\n" 168 " Lists all partitions on <diskname>.\n" 169 "\n" 170 : "", 171 (u64Cmd & USAGE_CREATERAWVMDK) 172 ? " createrawvmdk -filename <filename> -rawdisk <diskname>\n" 173 " [-partitions <list of partition numbers> [-mbr <filename>] ]\n" 174 " [-register] [-relative]\n" 175 " Creates a new VMDK image which gives access to an entite host disk (if\n" 176 " the parameter -partitions is not specified) or some partitions of a\n" 177 " host disk. If access to individual partitions is granted, then the\n" 178 " parameter -mbr can be used to specify an alternative MBR to be used\n" 179 " (the partitioning information in the MBR file is ignored).\n" 180 " The diskname is on Linux e.g. /dev/sda, and on Windows e.g.\n" 181 " \\\\.\\PhysicalDrive0).\n" 182 " On Linux host the parameter -relative causes a VMDK file to be created\n" 183 " which refers to individual partitions instead to the entire disk.\n" 184 " Optionally the created image can be immediately registered.\n" 185 " The necessary partition numbers can be queried with\n" 186 " VBoxManage internalcommands listpartitions\n" 187 "\n" 188 : "", 189 (u64Cmd & USAGE_RENAMEVMDK) 190 ? " renamevmdk -from <filename> -to <filename>\n" 191 " Renames an existing VMDK image, including the base file and all its extents.\n" 192 "\n" 193 : "", 194 (u64Cmd & USAGE_CONVERTTORAW) 195 ? " converttoraw [-format <fileformat>] <filename> <outputfile>" 195 196 #ifdef ENABLE_CONVERT_RAW_TO_STDOUT 196 197 "|stdout" 197 198 #endif /* ENABLE_CONVERT_RAW_TO_STDOUT */ 198 199 199 "\n" 200 " Convert image to raw, writing to file" 200 201 #ifdef ENABLE_CONVERT_RAW_TO_STDOUT 201 202 " or stdout" 202 203 #endif /* ENABLE_CONVERT_RAW_TO_STDOUT */ 203 204 205 206 (u64Cmd & USAGE_CONVERTHD) ?207 208 209 210 211 212 204 ".\n" 205 "\n" 206 : "", 207 (u64Cmd & USAGE_CONVERTHD) 208 ? " converthd [-srcformat VDI|VMDK|VHD|RAW]\n" 209 " [-dstformat VDI|VMDK|VHD|RAW]\n" 210 " <inputfile> <outputfile>\n" 211 " converts hard disk images between formats\n" 212 "\n" 213 : "", 213 214 #ifdef RT_OS_WINDOWS 214 (u64Cmd & USAGE_MODINSTALL) ?215 216 217 218 219 (u64Cmd & USAGE_MODUNINSTALL) ?220 221 222 223 : ""215 (u64Cmd & USAGE_MODINSTALL) 216 ? " modinstall\n" 217 " Installs the neccessary driver for the host OS\n" 218 "\n" 219 : "", 220 (u64Cmd & USAGE_MODUNINSTALL) 221 ? " moduninstall\n" 222 " Deinstalls the driver\n" 223 "\n" 224 : "", 224 225 #else 225 226 ""226 "", 227 "", 227 228 #endif 229 (u64Cmd & USAGE_DEBUGLOG) 230 ? " debuglog <vmname>|<uuid> [--enable|--disable] [--flags todo]\n" 231 " [--groups todo] [--destinations todo]\n" 232 " Controls debug logging.\n" 233 "\n" 234 : "" 228 235 ); 229 236 } … … 1843 1850 } 1844 1851 1852 int CmdDebugLog(int argc, char **argv, ComPtr<IVirtualBox> aVirtualBox, ComPtr<ISession> aSession) 1853 { 1854 /* 1855 * The first parameter is the name or UUID of a VM with a direct session 1856 * that we wish to open. 1857 */ 1858 if (argc < 1) 1859 return errorSyntax(USAGE_DEBUGLOG, "Missing VM name/UUID"); 1860 1861 ComPtr<IMachine> ptrMachine; 1862 HRESULT rc = aVirtualBox->GetMachine(Bstr(argv[0]), ptrMachine.asOutParam()); 1863 if (FAILED(rc) || ptrMachine.isNull()) 1864 CHECK_ERROR_RET(aVirtualBox, FindMachine(Bstr(argv[0]), ptrMachine.asOutParam()), 1); 1865 1866 Bstr bstrMachineUuid; 1867 CHECK_ERROR_RET(ptrMachine, COMGETTER(Id)(bstrMachineUuid.asOutParam()), 1); 1868 CHECK_ERROR_RET(aVirtualBox, OpenExistingSession(aSession, bstrMachineUuid), 1); 1869 1870 /* 1871 * Get the debugger interface. 1872 */ 1873 ComPtr<IConsole> ptrConsole; 1874 CHECK_ERROR_RET(aSession, COMGETTER(Console)(ptrConsole.asOutParam()), 1); 1875 1876 ComPtr<IMachineDebugger> ptrDebugger; 1877 CHECK_ERROR_RET(ptrConsole, COMGETTER(Debugger)(ptrDebugger.asOutParam()), 1); 1878 1879 /* 1880 * Parse the command. 1881 */ 1882 bool fEnablePresent = false; 1883 bool fEnable = false; 1884 bool fFlagsPresent = false; 1885 iprt::MiniString strFlags; 1886 bool fGroupsPresent = false; 1887 iprt::MiniString strGroups; 1888 bool fDestsPresent = false; 1889 iprt::MiniString strDests; 1890 1891 static const RTGETOPTDEF s_aOptions[] = 1892 { 1893 { "--disable", 'E', RTGETOPT_REQ_NOTHING }, 1894 { "--enable", 'e', RTGETOPT_REQ_NOTHING }, 1895 { "--flags", 'f', RTGETOPT_REQ_STRING }, 1896 { "--groups", 'g', RTGETOPT_REQ_STRING }, 1897 { "--destinations", 'd', RTGETOPT_REQ_STRING } 1898 }; 1899 1900 int ch; 1901 RTGETOPTUNION ValueUnion; 1902 RTGETOPTSTATE GetState; 1903 RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1, 0); 1904 while ((ch = RTGetOpt(&GetState, &ValueUnion))) 1905 { 1906 switch (ch) 1907 { 1908 case 'e': 1909 fEnablePresent = true; 1910 fEnable = true; 1911 break; 1912 1913 case 'E': 1914 fEnablePresent = true; 1915 fEnable = false; 1916 break; 1917 1918 case 'f': 1919 fFlagsPresent = true; 1920 if (*ValueUnion.psz) 1921 { 1922 if (strFlags.isNotEmpty()) 1923 strFlags.append(' '); 1924 strFlags.append(ValueUnion.psz); 1925 } 1926 break; 1927 1928 case 'g': 1929 fGroupsPresent = true; 1930 if (*ValueUnion.psz) 1931 { 1932 if (strGroups.isNotEmpty()) 1933 strGroups.append(' '); 1934 strGroups.append(ValueUnion.psz); 1935 } 1936 break; 1937 1938 case 'd': 1939 fDestsPresent = true; 1940 if (*ValueUnion.psz) 1941 { 1942 if (strDests.isNotEmpty()) 1943 strDests.append(' '); 1944 strDests.append(ValueUnion.psz); 1945 } 1946 break; 1947 1948 default: 1949 return errorGetOpt(USAGE_DEBUGLOG , ch, &ValueUnion); 1950 } 1951 } 1952 1953 /* 1954 * Do the job. 1955 */ 1956 if (fEnablePresent && !fEnable) 1957 CHECK_ERROR_RET(ptrDebugger, COMSETTER(LogEnabled)(FALSE), 1); 1958 1959 /** @todo flags, groups destination. */ 1960 if (fFlagsPresent || fGroupsPresent || fDestsPresent) 1961 RTPrintf("WARNING: One or more of the requested features are not implemented! Feel free to do this... :-)\n"); 1962 1963 if (fEnablePresent && fEnable) 1964 CHECK_ERROR_RET(ptrDebugger, COMSETTER(LogEnabled)(FALSE), 1); 1965 return 0; 1966 } 1967 1845 1968 /** 1846 1969 * Wrapper for handling internal commands … … 1876 1999 if (!strcmp(pszCmd, "converthd")) 1877 2000 return CmdConvertHardDisk(a->argc - 1, &a->argv[1], a->virtualBox, a->session); 1878 1879 2001 if (!strcmp(pszCmd, "modinstall")) 1880 2002 return CmdModInstall(); 1881 2003 if (!strcmp(pszCmd, "moduninstall")) 1882 2004 return CmdModUninstall(); 2005 if (!strcmp(pszCmd, "debuglog")) 2006 return CmdDebugLog(a->argc - 1, &a->argv[1], a->virtualBox, a->session); 1883 2007 1884 2008 /* default: */ -
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h
r28800 r30319 78 78 #define USAGE_RENAMEVMDK RT_BIT_64(39) 79 79 #ifdef VBOX_WITH_GUEST_PROPS 80 # define USAGE_GUESTPROPERTYRT_BIT_64(40)80 # define USAGE_GUESTPROPERTY RT_BIT_64(40) 81 81 #endif /* VBOX_WITH_GUEST_PROPS defined */ 82 82 #define USAGE_CONVERTTORAW RT_BIT_64(41) … … 91 91 #define USAGE_STORAGECONTROLLER RT_BIT_64(50) 92 92 #ifdef VBOX_WITH_GUEST_CONTROL 93 # define USAGE_GUESTCONTROLRT_BIT_64(51)93 # define USAGE_GUESTCONTROL RT_BIT_64(51) 94 94 #endif /* VBOX_WITH_GUEST_CONTROL defined */ 95 #define USAGE_DEBUGLOG RT_BIT_64(52) 95 96 #define USAGE_ALL (~(uint64_t)0) 96 97 /** @} */
Note:
See TracChangeset
for help on using the changeset viewer.