Commit Graph

80 Commits

Author SHA1 Message Date
Pawel Dziepak d0f2d8282f Merge branch 'scheduler'
Conflicts:
	build/jam/packages/Haiku
	headers/os/kernel/OS.h
	headers/os/opengl/GLRenderer.h
	headers/private/shared/cpu_type.h
	src/add-ons/kernel/drivers/power/acpi_battery/acpi_battery.h
	src/bin/sysinfo.cpp
	src/bin/top.c
	src/system/kernel/arch/x86/arch_system_info.cpp
	src/system/kernel/port.cpp
2014-01-17 04:06:15 +01:00
Axel Dörfler 99086aa323 trim: Target SCSI UNMAP command instead of WRITE SAME.
* The UNMAP command is theoretically much faster, as it can get many block
  ranges instead of just a single range.
* Furthermore, the ATA TRIM command resembles it much better.
* Therefore, fs_trim_data now gets an array of ranges, and we use SCSI UNMAP
  to trim.
* Updated BFS code to collect array ranges to fully support the new
  fs_trim_data possibilities.
2013-11-07 19:03:47 +01:00
Axel Dörfler 29a8450843 Added B_TRIM_DEVICE ioctl. 2013-11-07 19:01:24 +01:00
Pawel Dziepak 077c84eb27 kernel: atomic_*() functions rework
* No need for the atomically changed variables to be declared as
   volatile.
 * Drop support for atomically getting and setting unaligned data.
 * Introduce atomic_get_and_set[64]() which works the same as
   atomic_set[64]() used to. atomic_set[64]() does not return the
   previous value anymore.
2013-11-05 22:32:59 +01:00
Axel Dörfler 1674a53a45 Added recursive_lock_transfer_lock() to the fs_shell. 2012-03-31 00:09:47 +02:00
Ingo Weinhold a54f7dc250 Move B_MIME_STRING_TYPE to <TypeConstants.h> 2011-11-25 06:19:24 +01:00
Ingo Weinhold 90ade5e298 * Added file_system_module_info::uninitialize() analogously to
partition_module_info::uninitialize().
* Implemented the hook for BFS.
* Implemented KFileSystem::Uninitialize().

Fixes failure to initialize a BFS initialized device with an intel partition
map.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42142 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-06-13 01:53:11 +00:00
Clemens Zeidler 4a5a077ff7 Add a private B_ATTR_CHANGE_NOTIFICATION flag to the open query syscall to tell the query to send notifications when an entry attribute changed and the entry stays in the query. Previously you only get created and removed messages, now you can also get updated messages. Only implement it for bfs.
Fix copy right.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39131 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-10-24 20:47:46 +00:00
Jérôme Duval d63f4274b6 added a file system call preallocate() as described in #6285, currently unused
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39006 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-10-18 18:48:54 +00:00
Ingo Weinhold 4a57f84396 Introduced types [__haiku_]generic_{addr,size}_t which are wide enough for
virtual and physical addresses.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36996 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-06-02 18:22:38 +00:00
Ingo Weinhold ea021b94d8 * Moved phys_addr_t definition to SupportDefs.h.
* Added phys_size_t.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36934 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-25 11:18:38 +00:00
Ingo Weinhold a9139aa356 * FS shell: Use 64 bit [s]size_t on 64 bit platforms.
* SupportDefs.h (build platform): Define [s]size_t printf() macros correctly
  on 64 bit hosts.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36929 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-24 21:44:16 +00:00
Ingo Weinhold 9d570af7c8 Changed the type of the "op" parameter of the fs_vnode_ops::ioctl() hook and
the _kern_ioctl() syscall from ulong to uint32.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36927 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-24 21:04:22 +00:00
Ingo Weinhold d34daac82a * config/{HaikuConfig.h,types.h}:
- Added macro __HAIKU_ARCH_BITS specifying the architecture bitness (32/64)
    (might be more convenient to use than __HAIKU_ARCH_{32,64}_BIT).
  - Added macros __HAIKU_ARCH_PHYSICAL_BITS, __HAIKU_ARCH_PHYSICAL_{32,64}_BIT,
    and the types __haiku_phys_[s]addr_t. The intention is to use separate
    macros and types for virtual and physical addresses, since for some
    architectures (e.g. x86 with PAE) those actually differ.
* sys/types.h, BeBuild.h, SupportDefs.h:
  - Added types phys_[s]addr_t and respective printf() format macros.
  - Added public macros B_HAIKU_BITS, B_HAIKU_PHYSICAL_BITS,
    B_HAIKU_PHYSICAL_{32,64}_BIT.

Might break the build under older Haiku installations. Will test next.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36926 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-05-24 19:55:38 +00:00
Axel Dörfler aec945c959 * Removed the O_* modes that we currently don't and probably won't support
(O_MOUNT, O_EXLOCK, and O_SHLOCK). I only left the non-standard O_TEMPORARY
  for the time being (as it shouldn't fool anyone).
* Fixed libutil that already used O_EXLOCK, even though it did not do anything.
* Moved O_NOCACHE, and O_NOFOLLOW to the section with implemented modes.
* Added O_DIRECTORY.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34278 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-26 14:17:46 +00:00
Ingo Weinhold 318cb33fbf Undefine B_HAIKU_{32,64}_BIT macros before defining them. Fixes warning when
building on Haiku, since those will be defined already -- by way of the host
platform's <BeBuild.h>, which currently is included by the POSIX headers..


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34272 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-26 10:20:42 +00:00
Ingo Weinhold d1456cc2de Added new [FSSH]_B_HAIKU_{32,64}_BIT macros.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34256 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-25 21:21:58 +00:00
Ingo Weinhold cf844822db * Added B_PRIdTIME and B_PRIiTIME macros (for time_t).
* Added FSSH_[S]SIZE_MAX to headers/private/fs_shell/fssh_types.h.
* Fixed various 64 bit compiler warnings. Nothing too serious, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34241 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-25 12:02:20 +00:00
Ingo Weinhold 2222d0559d * Introduced new header directory "config", which ATM contains HaikuConfig.h
and types.h. The idea is to provide a basic architecture/compiler
  abstraction by defining types and macros that allow the posix/ and os/
  headers to be mostly architecture/compiler agnostic. 
* Adjusted the posix/ and os/ headers accordingly.
* <SupportDefs.h>: Introduced B_PRI* and B_SCN* macros similar to the PRI*
  and SCN* macros defined in <inttypes.h>, just for the BeOS/Haiku [u]int*
  types and some POSIX types (e.g. off_t, dev_t, ino_t) that don't have POSIX
  macros. Also the B_PRI* and B_SCN* macros are available unconditionally,
  unlike the <inttypes.h> macros, which require __STDC_FORMAT_MACROS to be
  defined in C++ mode.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34214 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-11-24 19:44:07 +00:00
Axel Dörfler 4ab3fa3b5a * Added real_time_clock(), and real_time_clock_usecs().
* Added support for timespec stat times.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31012 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-12 09:31:25 +00:00
Ingo Weinhold 3cf43c2651 Removed the fs_vnode_ops::create_dir() parameter for returning the ID of the
newly created dir. The VFS really doesn't need it and for some file systems
it might not be easy to get by. Several file systems (e.g. rootfs and fat)
were ignoring the parameter anyway.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29719 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-03-26 00:16:34 +00:00
Michael Lotz 49004dc730 Remove the additional fs_vnode_ops arugment from get_vnode() again as it's not
needed at all when used as intended. Thanks Ingo for the explanation on how this
is intended to work. Adjusted the overlay fs accordingly and updated/reverted
the changes to the other filesystems.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29250 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-19 18:13:01 +00:00
Michael Lotz 00405f2286 * Add an additional argument to get_vnode() that gets the fs_vnode_ops of the
node. That is needed for a layered filesystem to be able to construct a full
  fs_vnode out of a volume/inode pair.
* Adapt places where get_vnode is used. Sadly this is a C API and we can't just
  use a default NULL for that argument.
* Introduce a flag B_VNODE_WANTS_OVERLAY_SUB_NODE that can be returned in the
  flags field of a fs get_vnode call. A filesystem can use this flag to indicate
  that it doesn't support the full set of fs features (attributes, write support)
  and it'd like to have unsupported calls emulated by an overlay sub node.
* Add a perliminary overlay filesystem that emulates file attributes using files
  on a filesystem where attributes aren't supported. It does currently only
  support reading attributes/attribute directories though. All other calls are
  just passed through to the super filesystem.
* Adjust places where a HAS_FS_CALL() is taken as a guarantee that the operation
  is supported. For the overlay filesystem we may later return a B_UNSUPPORTED,
  so make sure that in that case proper fallback options are taken.
* Make the iso9660 filesystem request overlay sub nodes. This can be fine tuned
  later to only trigger where there are features on a CD that need emulation
  at all.

If you happened to know the attribute file format and location you could build
an iso with read-only attribute support now. Note that this won't be enough to
get a bootable iso-only image as the query and index support is yet missing.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29177 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-09 23:06:31 +00:00
Axel Dörfler 5b812019b4 * Added function block_cache_discard() that flushes blocks from the block cache,
discarding their changes. This functionality currently only works correctly
  when no transactions are used.
* Started test application for the block cache, doesn't do anything yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28496 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-04 14:49:33 +00:00
Axel Dörfler 057f999da6 * Added a flag B_DISK_SYSTEM_SUPPORTS_WRITING to determine whether or not a
file system can write to files before mounting.
* Set the flag for all file systems that actually can write.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28055 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-13 22:32:27 +00:00
Axel Dörfler b2ec044cb8 * Added stat::st_blocks field as required by POSIX. This also closes ticket
#2261.
* Made at least BFS report it more or less correctly (the attributes are
  ignored, though).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27791 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-09-30 14:16:39 +00:00
Ingo Weinhold ee1a1571a2 Implemented a simple directory entry cache to speed up path resolution.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27366 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-09-08 05:08:37 +00:00
Ingo Weinhold 4612433715 * Added parameter "size_t align" to file_map_translate(). If > 1, the
vector at the end of the file will be aligned to the given value.
* BFS uses an alignment of 512 bytes (should be block size of the
  underlying device or BFS block size, whatever is less), which should
  be fine, since file data are only stored in BFS blocks. This totally
  avoids any partial operations at the I/O scheduler level, thus saving
  disk operations. Not that I could measure any performance difference.
  Theoretically it should help a lot though, particularly when dealing
  with lots of small files, since we avoid using bounce buffers, which
  are (a) limited in number and (b) require copying of the data.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27246 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-30 23:06:28 +00:00
Axel Dörfler 3c1a3047a4 * Added file_cache_is_enabled() function.
* Added file_map_set_mode() function that you can use to keep a whole file
  cached. This is needed for the swap file support: FILE_MAP_CACHE_ALL will
  not only precache all file_io_vecs when called, but it will also cause all
  file_map_translate() calls to fail that would require further caching (ie.
  if the file size had changed).
* Updated the fs_shell file map code to the latest one (with several bug fixes).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26785 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-04 08:28:17 +00:00
Ingo Weinhold 7491000f20 Added functions file_cache_{disable,enable}(). They allow to disable
actual caching in the file cache, i.e. all reads and writes go directly
to the underlying device. The implementation is not quite complete,
since the VM can still add pages to the cache when the file is mmap()ed,
which can lead to inconsistencies.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26779 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-04 03:15:50 +00:00
Ingo Weinhold 2f462cb8e9 Copied AutoDeleter.h for use in the FS shell.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26778 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-04 03:03:31 +00:00
Axel Dörfler 6449b66e22 * As pointed out by Andreas, the previous patch wasn't really correct; ALLPERMS
should really contain all permission bits.
* It now uses S_ISVTX instead of S_ISTXT - this is how it works in Linux as
  well, while FreeBSD uses S_ISTXT there (but S_ISTXT and S_ISVTX have the
  same value there, too).
* Also fixed the fs_shell this time.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26761 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-03 16:30:30 +00:00
Axel Dörfler 9f6ae76f02 * Added acquire_vnode() call that you can use to get another reference to an
inode - unlike get_vnode() the busy flag won't prevent you from getting that
  reference.
* Changed put_vnode() to return an error in case the vnode couldn't be found.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26713 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-01 09:59:19 +00:00
Axel Dörfler aaad303e67 * Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26712 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-01 09:57:14 +00:00
Axel Dörfler f9ae429701 * Replaced our SinglyLinkedList with one that has a similar interface as the
DoublyLinkedList. Not yet tested.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26697 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-31 11:47:17 +00:00
Axel Dörfler 850b759925 * Updated the fs_shell version of DoublyLinkedList.h to contain the latest
fixes made by Ingo. 


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26696 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-31 11:21:47 +00:00
Ingo Weinhold 7f12cc54a7 * It is now supported that I/O operations and requests are only handled
partially (e.g. due to hitting the end of file). The respective
  classes have grown new methods and attributes to deal with that. The
  "finished" callbacks have got additional parameters to indicate
  whether the transfer was only partial and how much has been
  transferred. Other callbacks and functions have a size_t* in/out
  parameter instead of a simple size_t, now.
* vfs_{read,write}_pages() do now use the I/O request framework instead
  of the underlying FS's {read,write}_pages() hooks (those should be
  unused now). Furthermore they've got an additional "flags" parameter,
  which is passed to IORequest::Init(), i.e. it allows to specify that
  the given vecs refer to physical addresses.
* The file cache's read_into_cache() reads directly into physical
  pages, now.
* Fixed bug in DoIO::IO(): The offset was not adjusted, so that all
  pages were incorrectly transferred from/to the same location.
* Fixed broken subrequest scheduling loop head in
  do_iterative_fd_io_iterate().
* Adjusted the test driver and implemented its io() hook. Using this
  driver I/O requests are passed all the way from the VFS/VM to the
  driver and through the I/O scheduler. It even seems to work. :-)
* Added missing const to the iovec* parameter of the IORequest::Init()
  methods.
* Disabled some debug output by default. Added new optional debug
  output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26692 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-30 23:34:10 +00:00
Axel Dörfler 37de5a0d83 * The rw_lock now behaves just like a recursive locker if KDEBUG_RW_LOCK_DEBUG
is defined to 1; this allows asserting the read lock case, too.
* Added ASSERT_{READ|WRITE}_LOCKED_RW_LOCK() macros. The read assertion is only
  working when KDEBUG_RW_LOCK_DEBUG is defined to 1, the write assertion works
  always.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26686 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-30 15:27:58 +00:00
Ingo Weinhold 7e3c202478 Added fssh_volume_for_vnode() and fssh_do[_iterative]_fd_io() to the
FS shell. The latter two lack an implementation yet, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26670 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-28 23:36:08 +00:00
Ingo Weinhold ec598fe493 * Added FS interface hooks io() and cancel_io(). The former is supposed
to provide asynchrounous (or only synchronous, if asynchronous is not
  supported) I/O request support. It will eventually replace
  {read,write}_pages(). None of the FS implementations implement them
  yet.
* Implemented some support functions for request-based I/O. File system
  implementations can use do_fd_io() which passes an I/O request to the
  layer responsible for a given FD, and do_iterative_fd_io(), which
  translates a request for a file to subrequests for the underlying
  device and passes them on. Both fall back to synchrounous processing
  when the io() hook is not supported.
  Furthermore added vfs_synchronous_io() which should be handy for the
  devfs to perform io_requests synchronously for devices that don't
  support the io() hook.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26655 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-28 02:07:20 +00:00
Ingo Weinhold e6bd90c58d * bfs_fsync() was the only place which could cause the
fs_vnode_ops::write_pages() to be called with fsReenter = true. Since
  this is no longer the case, the argument has become superfluous. For
  read_pages() it always was. Removed the argument from the functions
  and all functions that propagated it.
* Some whitespace at the end of lines was removed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26579 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-23 15:47:47 +00:00
Axel Dörfler 78b32dd026 * The rw_lock is now able to nest read/write locks when you have a write lock.
It follows the semantics of the BFS R/W lock, though, that is, if you unlock
  your write lock before the read locks, the read locks effectively become
  write locks, too.
* Added a mutex_transfer_lock() function that will allow you to unlock a mutex
  in a different thread than the one which locked it (only matters if KDEBUG
  is enabled, though).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26316 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-08 07:56:49 +00:00
Axel Dörfler 06d5e1b3b6 * Added ReadLocker/WriteLocker classes to auto lock an rw_lock.
* Added *_init_etc() functions to the fs_shell.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26302 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-07 18:12:33 +00:00
Axel Dörfler e2dfe00484 * Replaced most of the error enums with #defines.
* fssh_auto_locker.h should probably better use an FS-Shell header instead of
  stddef.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26301 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-07 18:10:21 +00:00
Axel Dörfler e0fc5e7380 * The fssh_auto_locker.h header was not self-contained.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26299 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-07 16:26:57 +00:00
Axel Dörfler af370c702a * Added a recursive_lock_trylock() function.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26297 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-07 16:17:34 +00:00
Axel Dörfler 589f1a9133 * Made the private kernel locking primitives available to file systems as well.
* Applied Korli's mutex_unlock() fix to block_cache.cpp.
* Removed block_cache_priv.h, as it's no longer needed (moved its definitions
  into block_cache.cpp, as in the kernel file).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26296 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-07-07 15:19:19 +00:00
Ingo Weinhold 72e3b6ffd3 Missing prefix.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25712 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-29 20:51:59 +00:00
Axel Dörfler 9c20d5cb7d * Fixed the byte order definitions.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25671 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-27 12:42:04 +00:00
Axel Dörfler 1da9f5cea5 * Added BDiskSystem::ShortName() and everything needed to get it there.
* Added BDiskDeviceRoster::GetDiskSystem() method, that can get a disk system
  by short/pretty/module name - since they should all be unique, I put them
  in a single namespace, please complain if you don't like that :-)
* Cleaned up DiskSystem.h and DiskDeviceRoster.h according to the updated
  header guidelines.
* Renamed ntfs pretty name from "ntfs File System" to "Windows NT File System".


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25414 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-10 11:44:00 +00:00