Commit Graph

140 Commits

Author SHA1 Message Date
Axel Dörfler 7333992516 On a media change, the KDiskDevice must do a bit more than it did:
* it now updates the partition data,
* the flags,
* and the disk geometry - and that now allows the session add-on to actually
  detect a newly inserted CD.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22918 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-11-13 12:18:06 +00:00
Axel Dörfler 88ef411154 * Added an UninitializeMedia() method to KDiskDevice that also resets the
device geometry.
* If SetTo() reports no media, and GetGeometry() fails, the device geometry
  is now reset as well.
* KDiskDeviceManager::_ScanPartition() no longer unmarks the partition busy;
  this is now done by the caller, and done independently from the outcome of
  _ScanPartition(). This also fixes the problem that devices with no media
  were never marked unbusy (and thus were ignored subsequently).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22912 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-11-12 23:20:33 +00:00
Ingo Weinhold b3a5629b9e axeld + bonefish:
* Unmount when uninitializing a partition.
* Finished the media checker implementation, i.e. we rescan when a media
  was inserted and uninitialize when ejected.
* Turned the disk device media checker from a kernel daemon into a thread.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22909 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-11-12 18:41:36 +00:00
Ingo Weinhold c9830ce0f5 * KDiskDeviceManager::{Find,Load}DiskSystem() can also find the disk
system by pretty name (not only module name) now.
* _user_initialize_partition() loads the disk system by pretty name.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22880 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-11-10 20:30:22 +00:00
Ingo Weinhold 7b45b55be1 * Added back and partially reimplemented the
K{Disk,File,Partitioning}System writing methods. It is now required
  that the caller has marked the concerned partitions busy, hence we can
  (read-)access them without needing a lock. The module interfaces will
  will be changed to take advantage of the fact as well. The methods take a
  disk_job_id instead of a KDiskDeviceJob* now, though I haven't quite
  decided, whether we need it at all or just want to add a special
  handling in the cases where notifications during the operation make
  sense.
* Reimplemented the disk device write support syscalls (save
  _user_move_partition() for which other module hooks are needed). They
  call the KDiskSystem methods, now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22832 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-11-05 00:42:47 +00:00
Ingo Weinhold 2128ea4f31 Added IsBusy(bool) version, which optionally also checks the
descendants.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22831 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-11-05 00:30:14 +00:00
Ingo Weinhold 53715fe060 * Got rid of the B_PARTITION_DESCENDANT_BUSY flag.
* Added CheckAndMarkBusy() and UnmarkBusy() methods to KPartition.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22801 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-11-02 00:29:46 +00:00
Ingo Weinhold 8354dac78e Folded KPhysicalPartition into KPartition. Removed the notion of shadow
partitions from the disk device manager.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22800 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-11-01 23:36:21 +00:00
Ingo Weinhold 327887959e * Moved partition scanning back to KDiskDeviceManager. ATM only
synchronous scanning is supported.
* Removed the disk device job support from the disk device manager.
* K{Disk,File,Partitioning}System:
  - Remove querying and validation methods.
  - Commented out the modification methods until their fate is decided.
* Removed obsolete _user_get_partitionable_spaces().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22799 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-11-01 22:41:22 +00:00
Ingo Weinhold 300868ce27 * Removed no longer needed disk device related syscalls
(_kern_{supports,validate}_*(), etc.).
* Adjusted the prototypes of the disk device modification syscalls.
  Commented out their implementations for the time -- they'll mostly
  have to be rewritten completely.
* Implemented the userland disk device jobs.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22781 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-10-31 21:16:22 +00:00
Axel Dörfler e544dd5915 * Fixed a possible dead lock between the kernel daemon and the DDM; the media
status checker now only tries to lock the manager, it won't wait anymore.
* Added MediaChanged() and UpdateMediaStatusIfNeeded() methods to KDiskDevice.
* KDiskDeviceManager::_CheckMediaStatus() now uses these new methods; it should
  no longer detect removed media more than once :-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22621 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-10-19 15:20:36 +00:00
Axel Dörfler 8047441723 The disk device manager now periodically checks for media changes - all it does
is dump its findings, but it's an (untested) start.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22598 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-10-17 17:05:48 +00:00
Ingo Weinhold bf95c9aee6 * The shadow_changed() FS and partitioning system hooks take an
additional partition_data* child parameter now.
* _user_get_partitionable_spaces() doesn't need to copy the buffer into
  the kernel, since it is no input parameter. It also copies back the
  actual partitionable spaces count on error, now -- B_BUFFER_OVERFLOW
  is returned when the buffer was too small, but then the count must be
  returned too.
* Fixed several instances of syscall implementations that unloaded a disk
  system, although they didn't load it in the first place. This screwed
  up the load count with undesirable consequences.
* _user_create_child_partition() would set the size to the supplied
  offset.
* Fixed broken loop in KPhysicalPartition::CreateShadowPartition().
* KPartition::RemoveChild() notified the listeners about the wrong
  event.
* Intel partitioning module:
  - The *_get_partitionable_spaces() correctly return B_BUFFER_OVERFLOW
    now, if the supplied buffer is too small.
  - Implemented a part of pm_shadow_changed(), which creates and updates
    the PartitionMap, so that the validate_*() hooks have a chance to
    work at all.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22475 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-10-07 15:39:35 +00:00
Ingo Weinhold a68ceab8df Fixed comment.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22474 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-10-07 15:17:38 +00:00
Ingo Weinhold db5c68ca46 * Added the partition size as parameter to the file and partitioning
system initialize() hooks. It's often the only info about the
  partition one needs and thus locking the partition just to get it is
  no longer necessary.
* intel partitioning system:
  - Removed passing around block sizes. We require 512 byte sectors
    anyway. In fact using the parent partition's block size was even
    wrong.
  - Simplified writing the partition map sector.
  - Simplified and corrected the partition map initialization.
  - We don't fail identifying a partition anymore, if the partition map
    contains no partitions. We would never identify a freshly
    initialized partition map before.
  - Made pm_identify() more intelligent: It determines the priority to
    return depending on whether the partition is the device itself and
    whether we have recognized child partitions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22447 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-10-04 23:48:18 +00:00
Ingo Weinhold 8c8f8c8420 Added scan_partition() function which can be used by disk systems (e.g.
in *_initialize()) to save some work.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22441 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-10-04 18:03:24 +00:00
Ingo Weinhold 6b6f6b7240 Partitions do now know whether they have already been published and
avoid attempts to publish a second time.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22198 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-09-07 00:05:06 +00:00
Ingo Weinhold 76a8ec23db * Added disk system flags for whether a partition name and partition
content name are supported.
* Added file_system_module_info::flags (analogously to
  partition_module_info::flags) which indicate which disk device
  features the FS supports.
* Replaced the
  file_system_module_info/partition_module_info::supports_*()
  hooks by a get_supported_operations() hook and for partitioning
  systems additionally a get_supported_child_operations() hook.
* Updated file and partitioning systems accordingly.
* Updated fs_shell accordingly.
* Updated the DDM accordingly. The syscall interface remains unchanged,
  though.
* _user_supports_initializing_partition() also checks whether the parent
  partitioning system is content now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22043 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-08-22 21:21:30 +00:00
Stephan Aßmus 86d8381f5f * fixed libbe_test build, I guess this was caused by Ingo's recent change
to the header path variable?


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21965 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-08-15 18:52:50 +00:00
Ingo Weinhold d86af8ce27 * Style cleanup.
* Moved method documentation from headers to source files.
* Fixed small problems (memory leaks, unsafe string duplication,...).
* Added TODOs where I spotted problems.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21721 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-27 16:32:47 +00:00
Ingo Weinhold 2dc6403ddc Addition of write support to the disk device manager. Courtesy of Tomas
Kucera and Jan Matejek.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21719 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-27 12:12:35 +00:00
Ingo Weinhold 16f392da37 Missing in the previous commit.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21656 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-19 13:33:41 +00:00
Jérôme Duval d564275ba7 added disk systems rescan to DiskDeviceManager, and called it in the post init phase
the next step would be to rescan the partition tree with a job to recognize unrecognized partitions (asynchronously ?)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18737 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-09-04 12:37:56 +00:00
Axel Dörfler 65bd831cbb * KDiskDeviceManager::_ScanPartition() can now run synchronously (and execute the
scan job in the calling thread).
* KDiskDeviceManager::InitialDeviceScan() now runs synchronously, so that
  get_boot_partitions() doesn't need to do this ugly wait hack.
* KDiskDeviceManager::CreateFileDevice() can now run synchronously as well, which
  fixes a deadlock in fs_mount() - note, mounting file devices still doesn't work,
  though as Haiku's BFS doesn't allow this right now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17334 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-05-05 10:54:10 +00:00
Ingo Weinhold 758b1d0e05 Fixes that make Haiku build with gcc 4. Mainly out of the following
categories:
* Missing includes (like <stdlib.h> and <string.h>).
* Linking against $(TARGET_LIBSTDC++) instead of libstdc++.r4.so.
* Local variables shadowing parameters.
* Default parameters in function definitions (as opposed to function
  declarations).
* All C++ stuff (nothrow, map, set, vector, min, max,...) must be imported
  explicitly from the std:: namespace now.
* "new (sometype)[...]" must read "new sometype[...]", even if sometype is
  something like "const char *".
* __FUNCTION__ is no longer a string literal (but a string expression), i.e.
  'printf(__FUNCTION__ ": ...\n")' is invalid code.
* A type cast results in a non-lvalue. E.g. "(char *)buffer += bytes"
  is an invalid expression.
* "friend class SomeClass" only works when SomeClass is known before.
  Otherwise the an inner class with that name is considered as friend.
  gcc 4 is much pickier about scopes.
* gcc 4 is generally stricter with respect to type conversions in C.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14878 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-12 23:27:14 +00:00
Axel Dörfler 47f39c93cb Merged the disk device manager module interface for file systems with the
VFS's interface, so that a file system only has to implement one interface.
As a side effect, the automatic file system detection may now work (not yet
tested, though).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12786 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-05-23 17:15:56 +00:00
Ingo Weinhold 831841e1c0 Moved generic autolocking code to <util/AutoLock.h>.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11158 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-01-30 16:09:57 +00:00
Ingo Weinhold c277ab01e6 Make the compiler happy. Shadowing super class methods with different signature is a very annoying C++ feature.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11069 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-01-26 14:57:35 +00:00
Axel Dörfler d790daa3cc The status field is no system field; it has to be set by the disk system
(it will be maintained by the system afterwards, though).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9849 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-11-08 11:29:12 +00:00
Ingo Weinhold 8ae2a1ef21 Include <storage/DiskDeviceDefs.h> instead of <DiskDeviceDefs.h>. So noone including <syscalls.h> needs to explicitly add the private storage kit header dir to the include search path.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9633 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-29 01:36:07 +00:00
Ingo Weinhold af327271cc Made C-safe. Now no longer declares the syscall prototypes, but the prototypes for the respective _user_*() functions.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9632 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-29 01:33:59 +00:00
Ingo Weinhold c06238cbd6 * Reworked publishing/unpublishing of the device. This is now basically
done by (currently not existing) devfs functions.
* Overridden GetMediaStatus() and GetGeometry() to return useful data.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9627 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-28 22:22:04 +00:00
Ingo Weinhold 1e2e4b3c71 Re-added support for file devices.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9626 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-28 22:18:20 +00:00
Ingo Weinhold 92221d2425 KPath is used now where possible.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9549 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-27 21:56:05 +00:00
Ingo Weinhold 3f3f9cb61a Added Unlock() (an nicer sounding alias for Unset()) and Detach() (the lock is kept when the object is destroyed) to AutoLocker.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9547 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-27 21:54:12 +00:00
Ingo Weinhold 1b5f626633 * Changes to use KPath where possible now.
* Made GetMediaStatus() a bit more robust. If the ioctl fails (e.g. if it
  is not implemented as in Thomas' drivers), it gets the device geometry
  and does not fail, if the device is not removable.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9546 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-27 21:52:33 +00:00
Ingo Weinhold 0707c10377 KPartition::GetPath() now uses the new KPath class, which makes it more convenient to use.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9545 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-27 21:48:47 +00:00
Ingo Weinhold 42b568aeb5 Moved to headers/private/kernel/disk_device_manager, since it is included by KDiskDevice.h.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9540 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-27 21:38:01 +00:00
Axel Dörfler f28a7f852d Static variables do have the "s" prefix.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7934 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-06-12 20:59:52 +00:00
Tyler Dauwalder a03a04e027 - Added/moved ddm string-length and buffer-size constants to DiskDeviceDefs.h
- Converted all uses of B_{FILE,OS}_NAME_LENGTH in ddm_userland_interface.cpp
  to appropriate ddm constants.
- Made module names B_PATH_NAME_LENGTH long.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5181 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-10-28 00:13:11 +00:00
Tyler Dauwalder e176a055ac Added max parameter-string buffer-size limit of 32KB.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5178 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-10-27 08:10:52 +00:00
Tyler Dauwalder 2094b5ffbb Updated to use new parametersSize params where applicable.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5156 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-10-25 08:36:17 +00:00
Ingo Weinhold 541c05cc85 We always resize the partition contents.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4867 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-09-29 21:43:11 +00:00
Ingo Weinhold 63c99af405 Added Unset(). Also added some new classes that don't work yet and are uncommented for that reason.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4866 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-09-29 21:42:33 +00:00
Ingo Weinhold 58bdbab626 Added a KPartition listener mechanism and made use of it to keep shadow partitions with the corresponding physical ones in sync.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4848 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-09-28 22:04:13 +00:00
Ingo Weinhold 583f8c1d02 Added set_disk_device_job_error_message() for setting an error message, when an error occurs while executing a job.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4843 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-09-28 19:29:36 +00:00
Ingo Weinhold ac8b60ce67 Added setter/getter for an error message. Should be set to something informative when while executing a job an error occurs.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4842 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-09-28 19:28:27 +00:00
Ingo Weinhold 69cb08c01c UninitializeContents() returns an error code now.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4841 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-09-28 19:26:18 +00:00
Ingo Weinhold 6e855f0317 Removed the resizeContents/force from the resize/move syscalls. Fixed resize/move related bugs (partition was not check for status uninitialized).
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4783 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-09-21 21:26:12 +00:00
Ingo Weinhold dafaf4c360 Added IsUninitialized() convenience method.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4781 a95241bf-73f2-0310-859d-f6bbb57e9c96
2003-09-21 21:21:10 +00:00