1.. uml:: 2 :caption: Control flow of ReserveDevice() 3 4 @startuml 5 |ReserveDevice| 6 start 7 #limegreen:if (device matches requested media_type?) then (yes) 8 if (device initialized?) then (no) 9 :InitDev()| 10 endif 11 if (device exists and is open?) then (yes) 12 #aqua:set suitable_device] 13 :initialize DCR; 14 if (append?) then (no) 15 :ReserveDeviceForRead()| 16 else (yes) 17 |ReserveDeviceForAppend| 18 if (CanRead()) then (no) 19 if (IsDeviceUnmounted()) then (no) 20 |CanReserveDrive| 21 if (IsMaxJobsOk()) then (yes) 22 #aqua:if (any_drive set?) then (no) 23 #aqua:if (try_low_use_drive set?) then (yes) 24 #aqua:if (low_use_drive is current drive?) then (yes) 25 (S) 26 detach 27 endif 28 endif 29 #aqua:if (PreferMountedVols set?) then (no) 30 if (isBusy()) then (yes) 31 #aqua:if (dev.num_writers + NumReserved() < num_writers) then (yes) 32 #aqua:set num_writers := dev.numwriters + NumReserved()] 33 #aqua:set low_use_drive := dev] 34 endif 35 (X) 36 detach 37 endif 38 else (yes) 39 if (IsTape() but no volume) then (yes) 40 (X) 41 detach 42 endif 43 endif 44 #aqua:if(exact_match set? and have_volume set?) then (yes) 45 #aqua:if(VolumeName matches mounted volume) then (no) 46 (X) 47 detach 48 endif 49 if (Can_i_use_volume()) then (no) 50 (X) 51 detach 52 endif 53 endif 54 :line 1080; 55 56 :line 1152; 57 endif 58 #aqua:if (autochanger_only) then (yes) 59 if (IsBusy()) then (no) 60 if (volume in drive) then (no) 61 (S) 62 detach 63 endif 64 endif 65 endif 66 if (num_writers == 0) then (yes) 67 if (NumReserved()) then (yes) 68 if (IsPoolOk()) then (yes) 69 (S) 70 detach 71 else (no) 72 (X) 73 detach 74 endif 75 elseif (CanAppend()) then (yes) 76 if (IsPoolOk()) then (no) 77 :UnloadAutoChanger()| 78 endif 79 (S) 80 detach 81 endif 82 endif 83 if (num_writers > 0 || CanAppend()) then (yes) 84 if (IsPoolOk()) then (yes) 85 (S) 86 #tomato:return success; 87 else (no) 88 (X) 89 detach 90 endif 91 else (no) 92 #tomato:cancel job (M_FATAL); 93 detach 94 endif 95 else (no) 96 (X) 97 #tomato:return failure; 98 endif 99 |ReserveDeviceForAppend| 100 if (success?) then (yes) 101 :reserve device; 102 :set have_device] 103 endif 104 endif 105 endif 106 |ReserveDevice| 107 if (have_device?) then (yes) 108 #aqua:if (have_volume set?) then (yes) 109 if (reserve_volume()) then (no) 110 (F) 111 detach 112 endif 113 else (no) 114 if (DirFindNextAppendableVolume()) then (yes) 115 #aqua:set have_volume] 116 #aqua:set VolumeName] 117 else (no) 118 #aqua:clear have_volume] 119 #aqua:clear VolumeName] 120 if (FoundInUse()) then (yes) 121 #aqua:if(PreferMountedVols set?) then (no) 122 #aqua:set PreferMountedVols] 123 if (dcr has volume?) then (yes) 124 :UnreserveDevice()| 125 endif 126 (F) 127 detach 128 endif 129 endif 130 if (num_writers != 0) then (yes) 131 if (dcr has volume?) then (yes) 132 :UnreserveDevice()| 133 endif 134 (F) 135 detach 136 endif 137 endif 138 endif 139 else (no) 140 (F) 141 detach 142 endif 143 endif 144 if (have_device?) then (yes) 145 :OK device message> 146 else (no) 147 (F) 148 #aqua:clear have_volume] 149 #aqua:clear VolumeName] 150 endif 151 endif 152 endif 153 154 @enduml 155