Changeset 68147 in vbox
- Timestamp:
- Jul 27, 2017 8:58:09 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
include/iprt/fsisomaker.h (modified) (1 diff)
-
include/iprt/mangling.h (modified) (1 diff)
-
src/VBox/Runtime/common/fs/isomaker.cpp (modified) (4 diffs)
-
src/VBox/Runtime/common/fs/isomakercmd.cpp (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/fsisomaker.h
r67800 r68147 118 118 */ 119 119 RTDECL(int) RTFsIsoMakerSetJolietRockRidgeLevel(RTFSISOMAKER hIsoMaker, uint8_t uLevel); 120 121 /** 122 * Sets the default file mode settings. 123 * 124 * @returns IRPT status code. 125 * @param hIsoMaker The ISO maker handle. 126 * @param fMode The default file mode. 127 */ 128 RTDECL(int) RTFsIsoMakerSetDefaultFileMode(RTFSISOMAKER hIsoMaker, RTFMODE fMode); 129 130 /** 131 * Sets the default dir mode settings. 132 * 133 * @returns IRPT status code. 134 * @param hIsoMaker The ISO maker handle. 135 * @param fMode The default dir mode. 136 */ 137 RTDECL(int) RTFsIsoMakerSetDefaultDirMode(RTFSISOMAKER hIsoMaker, RTFMODE fMode); 138 139 /** 140 * Sets the forced file mode, if @a fForce is true also the default mode is set. 141 * 142 * @returns IRPT status code. 143 * @param hIsoMaker The ISO maker handle. 144 * @param fMode The file mode. 145 * @param fForce Indicate whether forced mode is active or not. 146 */ 147 RTDECL(int) RTFsIsoMakerSetForcedFileMode(RTFSISOMAKER hIsoMaker, RTFMODE fMode, bool fForce); 148 149 /** 150 * Sets the forced dir mode, if @a fForce is true also the default mode is set. 151 * 152 * @returns IRPT status code. 153 * @param hIsoMaker The ISO maker handle. 154 * @param fMode The dir mode. 155 * @param fForce Indicate whether forced mode is active or not. 156 */ 157 RTDECL(int) RTFsIsoMakerSetForcedDirMode(RTFSISOMAKER hIsoMaker, RTFMODE fMode, bool fForce); 120 158 121 159 /** -
trunk/include/iprt/mangling.h
r68121 r68147 933 933 # define RTFsIsoMakerSetRockRidgeLevel RT_MANGLER(RTFsIsoMakerSetRockRidgeLevel) 934 934 # define RTFsIsoMakerSetJolietRockRidgeLevel RT_MANGLER(RTFsIsoMakerSetJolietRockRidgeLevel) 935 # define RTFsIsoMakerSetDefaultDirMode RT_MANGLER(RTFsIsoMakerSetDefaultDirMode) 936 # define RTFsIsoMakerSetDefaultFileMode RT_MANGLER(RTFsIsoMakerSetDefaultFileMode) 937 # define RTFsIsoMakerSetForcedDirMode RT_MANGLER(RTFsIsoMakerSetForcedDirMode) 938 # define RTFsIsoMakerSetForcedFileMode RT_MANGLER(RTFsIsoMakerSetForcedFileMode) 935 939 # define RTFsIsoMakerSetSysAreaContent RT_MANGLER(RTFsIsoMakerSetSysAreaContent) 936 940 # define RTFsIsoMakerSetStringProp RT_MANGLER(RTFsIsoMakerSetStringProp) -
trunk/src/VBox/Runtime/common/fs/isomaker.cpp
r68025 r68147 507 507 RTFMODE fDefaultDirMode; 508 508 509 /** Forced file mode mask (permissions only). */ 510 RTFMODE fForcedFileMode; 511 /** Set if fForcedFileMode is active. */ 512 bool fForcedFileModeActive; 513 /** Set if fForcedDirMode is active. */ 514 bool fForcedDirModeActive; 515 /** Forced directory mode mask (permissions only). */ 516 RTFMODE fForcedDirMode; 517 509 518 /** Number of common source files. */ 510 519 uint32_t cCommonSources; … … 818 827 pThis->fDefaultDirMode = 0555 | RTFS_TYPE_DIRECTORY | RTFS_DOS_DIRECTORY | RTFS_DOS_READONLY; 819 828 829 //pThis->fForcedFileMode = 0; 830 //pThis->fForcedFileModeActive = false; 831 //pThis->fForcedDirModeActive = false; 832 //pThis->fForcedDirMode = 0; 833 820 834 //pThis->cCommonSources = 0; 821 835 //pThis->paCommonSources = NULL; … … 1216 1230 1217 1231 pThis->Joliet.uRockRidgeLevel = uLevel; 1232 return VINF_SUCCESS; 1233 } 1234 1235 1236 /** 1237 * Sets the default file mode settings. 1238 * 1239 * @returns IRPT status code. 1240 * @param hIsoMaker The ISO maker handle. 1241 * @param fMode The default file mode. 1242 */ 1243 RTDECL(int) RTFsIsoMakerSetDefaultFileMode(RTFSISOMAKER hIsoMaker, RTFMODE fMode) 1244 { 1245 PRTFSISOMAKERINT pThis = hIsoMaker; 1246 RTFSISOMAKER_ASSERT_VALID_HANDLE_RET(pThis); 1247 Assert(!(fMode & ~RTFS_UNIX_ALL_PERMS)); 1248 1249 pThis->fDefaultFileMode &= ~RTFS_UNIX_ALL_PERMS; 1250 pThis->fDefaultFileMode |= fMode & RTFS_UNIX_ALL_PERMS; 1251 return VINF_SUCCESS; 1252 } 1253 1254 1255 /** 1256 * Sets the default dir mode settings. 1257 * 1258 * @returns IRPT status code. 1259 * @param hIsoMaker The ISO maker handle. 1260 * @param fMode The default dir mode. 1261 */ 1262 RTDECL(int) RTFsIsoMakerSetDefaultDirMode(RTFSISOMAKER hIsoMaker, RTFMODE fMode) 1263 { 1264 PRTFSISOMAKERINT pThis = hIsoMaker; 1265 RTFSISOMAKER_ASSERT_VALID_HANDLE_RET(pThis); 1266 Assert(!(fMode & ~RTFS_UNIX_ALL_PERMS)); 1267 1268 pThis->fDefaultDirMode &= ~RTFS_UNIX_ALL_PERMS; 1269 pThis->fDefaultDirMode |= fMode & RTFS_UNIX_ALL_PERMS; 1270 return VINF_SUCCESS; 1271 } 1272 1273 1274 /** 1275 * Sets the forced file mode, if @a fForce is true also the default mode is set. 1276 * 1277 * @returns IRPT status code. 1278 * @param hIsoMaker The ISO maker handle. 1279 * @param fMode The file mode. 1280 * @param fForce Indicate whether forced mode is active or not. 1281 */ 1282 RTDECL(int) RTFsIsoMakerSetForcedFileMode(RTFSISOMAKER hIsoMaker, RTFMODE fMode, bool fForce) 1283 { 1284 PRTFSISOMAKERINT pThis = hIsoMaker; 1285 RTFSISOMAKER_ASSERT_VALID_HANDLE_RET(pThis); 1286 Assert(!(fMode & ~RTFS_UNIX_ALL_PERMS)); 1287 1288 pThis->fForcedFileMode = fMode & RTFS_UNIX_ALL_PERMS; 1289 pThis->fForcedFileModeActive = fForce; 1290 if (fForce) 1291 { 1292 pThis->fDefaultFileMode &= ~RTFS_UNIX_ALL_PERMS; 1293 pThis->fDefaultFileMode |= fMode & RTFS_UNIX_ALL_PERMS; 1294 } 1295 return VINF_SUCCESS; 1296 } 1297 1298 1299 /** 1300 * Sets the forced dir mode, if @a fForce is true also the default mode is set. 1301 * 1302 * @returns IRPT status code. 1303 * @param hIsoMaker The ISO maker handle. 1304 * @param fMode The dir mode. 1305 * @param fForce Indicate whether forced mode is active or not. 1306 */ 1307 RTDECL(int) RTFsIsoMakerSetForcedDirMode(RTFSISOMAKER hIsoMaker, RTFMODE fMode, bool fForce) 1308 { 1309 PRTFSISOMAKERINT pThis = hIsoMaker; 1310 RTFSISOMAKER_ASSERT_VALID_HANDLE_RET(pThis); 1311 Assert(!(fMode & ~RTFS_UNIX_ALL_PERMS)); 1312 1313 pThis->fForcedDirModeActive = fForce; 1314 pThis->fForcedDirMode = fMode & RTFS_UNIX_ALL_PERMS; 1315 if (fForce) 1316 { 1317 pThis->fDefaultDirMode &= ~RTFS_UNIX_ALL_PERMS; 1318 pThis->fDefaultDirMode |= fMode & RTFS_UNIX_ALL_PERMS; 1319 } 1218 1320 return VINF_SUCCESS; 1219 1321 } … … 2888 2990 pObj->AccessedTime = pObjInfo->AccessTime; 2889 2991 pObj->fMode = pObjInfo->Attr.fMode; 2992 if (enmType == RTFSISOMAKEROBJTYPE_DIR ? pThis->fForcedDirModeActive : pThis->fForcedFileModeActive) 2993 pObj->fMode = (pObj->fMode & ~RTFS_UNIX_ALL_PERMS) 2994 | (enmType == RTFSISOMAKEROBJTYPE_DIR ? pThis->fForcedDirMode : pThis->fForcedFileMode); 2890 2995 pObj->uid = pObjInfo->Attr.u.Unix.uid != NIL_RTUID ? pObjInfo->Attr.u.Unix.uid : pThis->uidDefault; 2891 2996 pObj->gid = pObjInfo->Attr.u.Unix.gid != NIL_RTGID ? pObjInfo->Attr.u.Unix.gid : pThis->gidDefault; -
trunk/src/VBox/Runtime/common/fs/isomakercmd.cpp
r67871 r68147 113 113 RTFSISOMAKERCMD_OPT_ELTORITO_FLOPPY_144, 114 114 RTFSISOMAKERCMD_OPT_ELTORITO_FLOPPY_288, 115 116 RTFSISOMAKERCMD_OPT_NO_FILE_MODE, 117 RTFSISOMAKERCMD_OPT_NO_DIR_MODE, 115 118 116 119 /* … … 350 353 */ 351 354 uint32_t afNameSpecifiers[RTFSISOMAKERCMD_MAX_NAMES]; 355 /** The forced directory mode. */ 356 RTFMODE fDirMode; 357 /** Set if fDirMode should be applied. */ 358 bool fDirModeActive; 359 /** Set if fFileMode should be applied. */ 360 bool fFileModeActive; 361 /** The force file mode. */ 362 RTFMODE fFileMode; 352 363 /** @} */ 353 364 … … 456 467 { "--eltorito-floppy-144", RTFSISOMAKERCMD_OPT_ELTORITO_FLOPPY_144, RTGETOPT_REQ_NOTHING }, 457 468 { "--eltorito-floppy-288", RTFSISOMAKERCMD_OPT_ELTORITO_FLOPPY_288, RTGETOPT_REQ_NOTHING }, 469 470 { "--no-file-mode", RTFSISOMAKERCMD_OPT_NO_FILE_MODE, RTGETOPT_REQ_NOTHING }, 471 { "--no-dir-mode", RTFSISOMAKERCMD_OPT_NO_DIR_MODE, RTGETOPT_REQ_NOTHING }, 458 472 459 473 #define DD(a_szLong, a_chShort, a_fFlags) { a_szLong, a_chShort, a_fFlags }, { "-" a_szLong, a_chShort, a_fFlags } … … 485 499 { "--volume-id", RTFSISOMAKERCMD_OPT_VOLUME_ID, RTGETOPT_REQ_STRING }, /* should've been '-V' */ 486 500 DD("-volset", RTFSISOMAKERCMD_OPT_VOLUME_SET_ID, RTGETOPT_REQ_STRING ), 501 502 /* Other: */ 503 DD("-file-mode", RTFSISOMAKERCMD_OPT_FILE_MODE, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_OCT ), 504 DD("-dir-mode", RTFSISOMAKERCMD_OPT_DIR_MODE, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_OCT ), 505 DD("-new-dir-mode", RTFSISOMAKERCMD_OPT_NEW_DIR_MODE, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_OCT ), 487 506 488 507 /* … … 510 529 { "--dont-append-dot", 'd', RTGETOPT_REQ_NOTHING }, 511 530 { "--deep-directories", 'D', RTGETOPT_REQ_NOTHING }, 512 DD("-dir-mode", RTFSISOMAKERCMD_OPT_DIR_MODE, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_OCT ),513 531 DD("-dvd-video", RTFSISOMAKERCMD_OPT_DVD_VIDEO, RTGETOPT_REQ_NOTHING ), 514 532 DD("-follow-symlinks", 'f', RTGETOPT_REQ_NOTHING ), 515 DD("-file-mode", RTFSISOMAKERCMD_OPT_FILE_MODE, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_OCT ),516 533 DD("-gid", RTFSISOMAKERCMD_OPT_GID, RTGETOPT_REQ_UINT32 ), 517 534 DD("-gui", RTFSISOMAKERCMD_OPT_GUI, RTGETOPT_REQ_NOTHING ), … … 549 566 DD("-dev", 'M', RTGETOPT_REQ_STRING ), 550 567 { "--omit-version-numbers", 'N', RTGETOPT_REQ_NOTHING }, 551 DD("-new-dir-mode", RTFSISOMAKERCMD_OPT_NEW_DIR_MODE, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_OCT ),552 568 DD("-nobak", RTFSISOMAKERCMD_OPT_NO_BACKUP_FILES, RTGETOPT_REQ_NOTHING ), 553 569 DD("-no-bak", RTFSISOMAKERCMD_OPT_NO_BACKUP_FILES, RTGETOPT_REQ_NOTHING ), … … 2599 2615 2600 2616 /** 2617 * Handles the --dir-mode and --file-mode options. 2618 * 2619 * @returns IPRT status code. 2620 * @param pOpts The ISO maker command instance. 2621 * @param fDir True if applies to dir, false if applies to 2622 * files. 2623 * @param fMode The forced mode. 2624 */ 2625 static int rtFsIsoMakerCmdOptSetFileOrDirMode(PRTFSISOMAKERCMDOPTS pOpts, bool fDir, RTFMODE fMode) 2626 { 2627 /* Change the mode masks. */ 2628 int rc; 2629 if (fDir) 2630 rc = RTFsIsoMakerSetForcedDirMode(pOpts->hIsoMaker, fMode, true /*fForced*/); 2631 else 2632 rc = RTFsIsoMakerSetForcedFileMode(pOpts->hIsoMaker, fMode, true /*fForced*/); 2633 if (RT_SUCCESS(rc)) 2634 { 2635 /* Then enable rock.*/ 2636 rc = RTFsIsoMakerSetRockRidgeLevel(pOpts->hIsoMaker, 2); 2637 if (RT_SUCCESS(rc)) 2638 return VINF_SUCCESS; 2639 return rtFsIsoMakerCmdErrorRc(pOpts, rc, "Failed to enable rock ridge: %Rrc", rc); 2640 } 2641 return rtFsIsoMakerCmdErrorRc(pOpts, rc, "Failed to set %s force & default mode mask to %04o: %Rrc", 2642 fMode, fDir ? "directory" : "file", rc); 2643 } 2644 2645 2646 /** 2647 * Handles the --no-dir-mode and --no-file-mode options that counters 2648 * --dir-mode and --file-mode. 2649 * 2650 * @returns IPRT status code. 2651 * @param pOpts The ISO maker command instance. 2652 * @param fDir True if applies to dir, false if applies to 2653 * files. 2654 */ 2655 static int rtFsIsoMakerCmdOptDisableFileOrDirMode(PRTFSISOMAKERCMDOPTS pOpts, bool fDir) 2656 { 2657 int rc; 2658 if (fDir) 2659 rc = RTFsIsoMakerSetForcedDirMode(pOpts->hIsoMaker, 0, false /*fForced*/); 2660 else 2661 rc = RTFsIsoMakerSetForcedFileMode(pOpts->hIsoMaker, 0, true /*fForced*/); 2662 if (RT_SUCCESS(rc)) 2663 return VINF_SUCCESS; 2664 return rtFsIsoMakerCmdErrorRc(pOpts, rc, "Failed to disable forced %s mode mask: %Rrc", fDir ? "directory" : "file", rc); 2665 } 2666 2667 2668 2669 /** 2670 * Handles the --new-dir-mode option. 2671 * 2672 * @returns IPRT status code. 2673 * @param pOpts The ISO maker command instance. 2674 * @param fMode The forced mode. 2675 */ 2676 static int rtFsIsoMakerCmdOptSetNewDirMode(PRTFSISOMAKERCMDOPTS pOpts, RTFMODE fMode) 2677 { 2678 int rc = RTFsIsoMakerSetDefaultDirMode(pOpts->hIsoMaker, fMode); 2679 if (RT_SUCCESS(rc)) 2680 return VINF_SUCCESS; 2681 return rtFsIsoMakerCmdErrorRc(pOpts, rc, "Failed to set default dir mode mask to %04o: %Rrc", fMode, rc); 2682 } 2683 2684 2685 /** 2601 2686 * Loads an argument file (e.g. a .iso-file) and parses it. 2602 2687 * … … 2767 2852 break; 2768 2853 2854 case RTFSISOMAKERCMD_OPT_NO_FILE_MODE: 2855 rc = rtFsIsoMakerCmdOptDisableFileOrDirMode(pOpts, false /*fDir*/); 2856 break; 2857 case RTFSISOMAKERCMD_OPT_NO_DIR_MODE: 2858 rc = rtFsIsoMakerCmdOptDisableFileOrDirMode(pOpts, true /*fDir*/); 2859 break; 2860 2861 2769 2862 /* 2770 2863 * Joliet related options. … … 2885 2978 pOpts->pszOutFile = ValueUnion.psz; 2886 2979 break; 2980 2981 case RTFSISOMAKERCMD_OPT_DIR_MODE: 2982 rc = rtFsIsoMakerCmdOptSetFileOrDirMode(pOpts, true /*fDir*/, ValueUnion.u32); 2983 break; 2984 2985 case RTFSISOMAKERCMD_OPT_FILE_MODE: 2986 rc = rtFsIsoMakerCmdOptSetFileOrDirMode(pOpts, false /*fDir*/, ValueUnion.u32); 2987 break; 2988 2989 case RTFSISOMAKERCMD_OPT_NEW_DIR_MODE: 2990 rc = rtFsIsoMakerCmdOptSetNewDirMode(pOpts, ValueUnion.u32); 2991 break; 2992 2887 2993 2888 2994 /*
Note:
See TracChangeset
for help on using the changeset viewer.

