Changeset 18964 in vbox for trunk/src/VBox/Devices/Storage
- Timestamp:
- Apr 16, 2009 8:08:44 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/VHDHDDCore.cpp
r18504 r18964 780 780 static int vhdRename(void *pBackendData, const char *pszFilename) 781 781 { 782 return VERR_NOT_IMPLEMENTED; 782 LogFlowFunc(("pBackendData=%#p pszFilename=%#p\n", pBackendData, pszFilename)); 783 784 int rc = VINF_SUCCESS; 785 PVHDIMAGEDESC pImage = (PVHDIMAGEDESC)pBackendData; 786 787 /* Check arguments. */ 788 if ( !pImage 789 || !pszFilename 790 || !*pszFilename) 791 { 792 rc = VERR_INVALID_PARAMETER; 793 goto out; 794 } 795 796 /* Close the file. vhdFreeImage would additionally free pImage. */ 797 vhdFlush(pImage); 798 RTFileClose(pImage->File); 799 800 /* Rename the file. */ 801 rc = RTFileMove(pImage->pszFilename, pszFilename, 0); 802 if (RT_FAILURE(rc)) 803 { 804 /* The move failed, try to reopen the original image. */ 805 int rc2 = vhdOpenImage(pImage, pImage->uOpenFlags); 806 if (RT_FAILURE(rc2)) 807 rc = rc2; 808 809 goto out; 810 } 811 812 /* Update pImage with the new information. */ 813 pImage->pszFilename = pszFilename; 814 815 /* Open the new image. */ 816 rc = vhdOpenImage(pImage, pImage->uOpenFlags); 817 if (RT_FAILURE(rc)) 818 goto out; 819 820 out: 821 LogFlowFunc(("returns %Rrc\n", rc)); 822 return rc; 783 823 } 784 824
Note:
See TracChangeset
for help on using the changeset viewer.