Lines Matching refs:partition

143 move_descendants(KPartition *partition, off_t moveBy)
145 if (!partition)
147 partition->SetOffset(partition->Offset() + moveBy);
149 for (int32 i = 0; KPartition *child = partition->ChildAt(i); i++)
155 move_descendants_contents(KPartition *partition)
157 if (!partition)
160 KDiskSystem *diskSystem = partition->DiskSystem();
161 if (diskSystem || partition->AlgorithmData()) {
162 status_t error = diskSystem->ShadowPartitionChanged(partition,
168 for (int32 i = 0; KPartition *child = partition->ChildAt(i); i++) {
252 // find the partition
253 KPartition *partition = manager->RegisterPartition(filename);
254 if (partition == NULL)
256 PartitionRegistrar _(partition, true);
257 partition_id id = partition->ID();
259 // get and lock the partition's device
260 KDiskDevice *device = manager->RegisterDevice(partition->ID(), false);
321 chosen, on which the partition \a id refers to resides.
323 \param id The ID of an arbitrary partition on the disk device (including
343 is \c true) or not even a valid partition ID (if \a deviceOnly is
553 // get the partition
555 KPartition* partition = manager->WriteLockPartition(partitionID);
556 if (partition == NULL)
559 PartitionRegistrar registrar1(partition, true);
560 PartitionRegistrar registrar2(partition->Device(), true);
561 DeviceWriteLocker locker(partition->Device(), true);
564 if (changeCounter != partition->ChangeCounter())
567 // the partition must be initialized
568 KDiskSystem* diskSystem = partition->DiskSystem();
572 // mark the partition busy and unlock
573 if (!partition->CheckAndMarkBusy(false))
578 error = diskSystem->Defragment(partition, DUMMY_JOB_ID);
582 partition->UnmarkBusy(false);
588 return copy_to_user_value(_changeCounter, partition->ChangeCounter());
603 // get the partition
605 KPartition* partition = manager->WriteLockPartition(partitionID);
606 if (partition == NULL)
609 PartitionRegistrar registrar1(partition, true);
610 PartitionRegistrar registrar2(partition->Device(), true);
611 DeviceWriteLocker locker(partition->Device(), true);
614 if (changeCounter != partition->ChangeCounter())
617 // the partition must be initialized
618 KDiskSystem* diskSystem = partition->DiskSystem();
622 // mark the partition busy and unlock
623 if (!partition->CheckAndMarkBusy(false))
628 error = diskSystem->Repair(partition, checkOnly, DUMMY_JOB_ID);
632 partition->UnmarkBusy(false);
638 return copy_to_user_value(_changeCounter, partition->ChangeCounter());
657 // get the partition
659 KPartition* partition = manager->WriteLockPartition(partitionID);
660 if (partition == NULL)
663 PartitionRegistrar registrar1(partition, true);
664 PartitionRegistrar registrar2(partition->Device(), true);
665 DeviceWriteLocker locker(partition->Device(), true);
675 if (changeCounter != partition->ChangeCounter()
680 // the partition must be initialized
681 KDiskSystem* diskSystem = partition->DiskSystem();
685 // child must indeed be a child of partition
686 if (child->Parent() != partition)
691 || size > partition->ContentSize()) {
696 if (partition->IsBusy() || child->IsBusy())
698 partition->SetBusy(true);
706 // resize the partition
718 partition->SetBusy(false);
725 error = copy_to_user_value(_changeCounter, partition->ChangeCounter());
740 // get the partition
741 KPartition *partition = manager->WriteLockPartition(partitionID);
742 if (!partition)
744 PartitionRegistrar registrar1(partition, true);
745 PartitionRegistrar registrar2(partition->Device(), true);
746 DeviceWriteLocker locker(partition->Device(), true);
748 if (newOffset == partition->Offset())
751 status_t error = validate_move_partition(partition, changeCounter,
758 off_t moveBy = newOffset - partition->Offset();
759 move_descendants(partition, moveBy);
760 partition->Changed(B_PARTITION_CHANGED_OFFSET);
762 error = partition->Parent()->DiskSystem()->ShadowPartitionChanged(
763 partition->Parent(), partition, B_PARTITION_MOVE_CHILD);
767 return move_descendants_contents(partition);
790 // get the partition
792 KPartition* partition = manager->WriteLockPartition(partitionID);
793 if (partition == NULL)
796 PartitionRegistrar registrar1(partition, true);
797 PartitionRegistrar registrar2(partition->Device(), true);
798 DeviceWriteLocker locker(partition->Device(), true);
808 if (changeCounter != partition->ChangeCounter()
813 // the partition must be initialized
814 KDiskSystem* diskSystem = partition->DiskSystem();
818 // child must indeed be a child of partition
819 if (child->Parent() != partition)
823 if (partition->IsBusy() || child->IsBusy())
825 partition->SetBusy(true);
834 partition->SetBusy(false);
841 error = copy_to_user_value(_changeCounter, partition->ChangeCounter());
862 // get the partition
864 KPartition* partition = manager->WriteLockPartition(partitionID);
865 if (partition == NULL)
868 PartitionRegistrar registrar1(partition, true);
869 PartitionRegistrar registrar2(partition->Device(), true);
870 DeviceWriteLocker locker(partition->Device(), true);
873 if (changeCounter != partition->ChangeCounter())
876 // the partition must be initialized
877 KDiskSystem* diskSystem = partition->DiskSystem();
881 // mark the partition busy and unlock
882 if (!partition->CheckAndMarkBusy(false))
887 error = diskSystem->SetContentName(partition, name.value, DUMMY_JOB_ID);
891 partition->UnmarkBusy(false);
897 return copy_to_user_value(_changeCounter, partition->ChangeCounter());
919 // get the partition
921 KPartition* partition = manager->WriteLockPartition(partitionID);
922 if (partition == NULL)
925 PartitionRegistrar registrar1(partition, true);
926 PartitionRegistrar registrar2(partition->Device(), true);
927 DeviceWriteLocker locker(partition->Device(), true);
937 if (changeCounter != partition->ChangeCounter()
942 // the partition must be initialized
943 KDiskSystem* diskSystem = partition->DiskSystem();
947 // child must indeed be a child of partition
948 if (child->Parent() != partition)
951 // mark the partition busy and unlock
952 if (partition->IsBusy() || child->IsBusy())
954 partition->SetBusy(true);
963 partition->SetBusy(false);
970 error = copy_to_user_value(_changeCounter, partition->ChangeCounter());
995 // get the partition
997 KPartition* partition = manager->WriteLockPartition(partitionID);
998 if (partition == NULL)
1001 PartitionRegistrar registrar1(partition, true);
1002 PartitionRegistrar registrar2(partition->Device(), true);
1003 DeviceWriteLocker locker(partition->Device(), true);
1013 if (changeCounter != partition->ChangeCounter()
1018 // the partition must be initialized
1019 KDiskSystem* diskSystem = partition->DiskSystem();
1023 // child must indeed be a child of partition
1024 if (child->Parent() != partition)
1027 // mark the partition busy and unlock
1028 if (partition->IsBusy() || child->IsBusy())
1030 partition->SetBusy(true);
1039 partition->SetBusy(false);
1046 error = copy_to_user_value(_changeCounter, partition->ChangeCounter());
1068 // get the partition
1070 KPartition* partition = manager->WriteLockPartition(partitionID);
1071 if (partition == NULL)
1074 PartitionRegistrar registrar1(partition, true);
1075 PartitionRegistrar registrar2(partition->Device(), true);
1076 DeviceWriteLocker locker(partition->Device(), true);
1079 if (changeCounter != partition->ChangeCounter())
1082 // the partition must be initialized
1083 KDiskSystem* diskSystem = partition->DiskSystem();
1087 // mark the partition busy and unlock
1088 if (!partition->CheckAndMarkBusy(true))
1093 error = diskSystem->SetContentParameters(partition, parameters.value,
1098 partition->UnmarkBusy(true);
1104 return copy_to_user_value(_changeCounter, partition->ChangeCounter());
1129 // get the partition
1131 KPartition* partition = manager->WriteLockPartition(partitionID);
1132 if (partition == NULL)
1135 PartitionRegistrar registrar1(partition, true);
1136 PartitionRegistrar registrar2(partition->Device(), true);
1137 DeviceWriteLocker locker(partition->Device(), true);
1140 if (changeCounter != partition->ChangeCounter())
1143 // the partition must be uninitialized
1144 if (partition->DiskSystem() != NULL)
1154 // mark the partition busy and unlock
1155 if (!partition->CheckAndMarkBusy(true))
1159 // let the disk system initialize the partition
1160 error = diskSystem->Initialize(partition, name.value, parameters.value,
1165 partition->UnmarkBusy(true);
1171 // partition. Some disk systems just write the on-disk structures and let
1172 // the DDM rescan the partition, in which case the disk system will already
1176 // Not setting the new disk system will at least prevent that the partition
1178 if (partition->DiskSystem() == NULL)
1179 partition->SetDiskSystem(diskSystem);
1182 return copy_to_user_value(_changeCounter, partition->ChangeCounter());
1201 // get the partition
1203 KPartition* partition = manager->WriteLockPartition(partitionID);
1204 if (partition == NULL)
1207 PartitionRegistrar registrar1(partition, true);
1208 PartitionRegistrar registrar2(partition->Device(), true);
1209 DeviceWriteLocker locker(partition->Device(), true);
1219 if (changeCounter != partition->ChangeCounter())
1224 // the partition must be initialized
1225 if (partition->DiskSystem() == NULL)
1229 if (!partition->CheckAndMarkBusy(true))
1232 if (partition->IsMounted() || partition->IsChildMounted())
1235 KDiskSystem* diskSystem = partition->DiskSystem();
1239 // Let the disk system uninitialize the partition. This operation is not
1241 // that the disk system cannot accidentally identify the partition later on.
1243 diskSystem->Uninitialize(partition, DUMMY_JOB_ID);
1245 // re-lock and uninitialize the partition object
1247 error = partition->UninitializeContents(true);
1249 partition->UnmarkBusy(true);
1255 error = copy_to_user_value(_changeCounter, partition->ChangeCounter());
1283 // get the partition
1285 KPartition* partition = manager->WriteLockPartition(partitionID);
1286 if (partition == NULL)
1289 PartitionRegistrar registrar1(partition, true);
1290 PartitionRegistrar registrar2(partition->Device(), true);
1291 DeviceWriteLocker locker(partition->Device(), true);
1294 if (changeCounter != partition->ChangeCounter())
1297 // the partition must be initialized
1298 KDiskSystem* diskSystem = partition->DiskSystem();
1302 // mark the partition busy and unlock
1303 if (!partition->CheckAndMarkBusy(false))
1309 error = diskSystem->CreateChild(partition, offset, size, type.value,
1314 partition->UnmarkBusy(false);
1325 error = copy_to_user_value(_changeCounter, partition->ChangeCounter());
1343 // get the partition
1345 KPartition* partition = manager->WriteLockPartition(partitionID);
1346 if (partition == NULL)
1349 PartitionRegistrar registrar1(partition, true);
1350 PartitionRegistrar registrar2(partition->Device(), true);
1351 DeviceWriteLocker locker(partition->Device(), true);
1361 if (changeCounter != partition->ChangeCounter()
1366 // the partition must be initialized
1367 KDiskSystem* diskSystem = partition->DiskSystem();
1371 // child must indeed be a child of partition
1372 if (child->Parent() != partition)
1375 // mark the partition and child busy and unlock
1376 if (partition->IsBusy() || !child->CheckAndMarkBusy(true))
1378 partition->SetBusy(true);
1386 partition->SetBusy(false);
1393 return copy_to_user_value(_changeCounter, partition->ChangeCounter());