Commit Graph

4830 Commits

Author SHA1 Message Date
Ingo Weinhold 6140f897d4 TextSnifferAddon: Use MIME DB directly
A DatabaseLocation is passed to the constructor and used to verify that
the sniffed MIME type is installed instead of BMimeType::IsInstalled().
This makes the add-on independent of the default MIME DB.
2013-11-22 12:24:13 +01:00
Ingo Weinhold 85835e4186 registrar: Move more classes to libstorage_kit_mime.a
Move MimeSnifferAddon, MimeSnifferAddonManager, and TextSnifferAddon to
libstorage_kit_mime.a, so we can reuse them.
2013-11-22 12:24:12 +01:00
Ingo Weinhold ee8e91583e BPackageManager::UserInteractionHandler: Make non-abstract
Most of the hooks don't strictly need a non-empty implementation. The
defaults now simply throw exceptions in those that do. This allows the
class to be instantiated, which is useful when a BPackageManager is only
used for finding packages.
2013-11-21 13:29:21 +01:00
Ingo Weinhold 6722e1ae43 BPackageManager: Add mandatory constructor parameters
Require the installation interface and the user interaction handle to
be passed to the constructor. Formerly, derived classes set them
manually in their constructors. This makes using the class without
having to subclass it possible.
2013-11-21 13:29:20 +01:00
Ingo Weinhold c04f3a625a boot loader: Add safe mode blacklist submenu
It's a browser for the system package content, where entries can be
selected to blacklist them. The selected entries are removed from the
packagefs instance in the boot loader, so that e.g. selected drivers
won't be picked up. The paths are also added to the safe mode driver
settings and will be interpreted when the system packagefs instance is
mounted by the kernel.
2013-11-20 16:00:35 +01:00
Ingo Weinhold 6c7abe9829 boot loader: Menu[Item] API improvements
* Make Menu and MenuItem polymorphic.
* MenuItem:
  - Make SetMarked() virtual, so it can be overridden.
  - Add SetSubmenu() and Supermenu().
  - Delete the submenu in the destructor.
* Menu:
  - Add Entered()/Exited() hooks. They frame the time the user navigates
    the menu or any of its submenus. The hooks allow for subclasses
    populating their item list dynamically.
  - Add SortItems().
* Update boot loader menu copyright text to include 2013, now that it is
  over soon. :-)
2013-11-20 16:00:34 +01:00
Ingo Weinhold 435fb01509 DoublyLinkedList: Add Sort() 2013-11-20 16:00:34 +01:00
Ingo Weinhold 7e7f482590 SinglyLinkedList: Missing include 2013-11-20 16:00:34 +01:00
Ingo Weinhold 3a7e0b0014 packagefs: Support blacklisting entries in packages
In each installation location, it is now possible to create a settings
file "packages" that allows to blacklist entries contained in packages.
The format is:

Package <package name> {
	EntryBlacklist {
		<entry path>
		...
	}
}
...

<package name> is the base name (no version) of the respective package
(e.g. "haiku"), <entry path> is an installation location relative path
(e.g. "add-ons/Translators/FooTranslator").

Blacklisted entries will be ignored by packagefs, i.e. they won't appear
in the file system. This addresses the issue that it may be necessary to
remove a problematic file (e.g. driver, add-on, or library), which would
otherwise require editing the containing package file.

The settings file is not not "live". Changes take effect only after
reboot (respectively when remounting the concerned packagefs volume).
2013-11-19 15:30:34 +01:00
Ingo Weinhold 2fdd1d9ef1 khash: Move string hash functions to own header/source file
Unlike khash they shouldn't be phased out (only renamed).
2013-11-19 15:08:34 +01:00
Stefano Ceccherini 0bc615438a Style fixes.
Style fixes pointed out by Axel. I'm rusty, and it shows.
Hope I got it right.
Also moved get_route() into BPrivate.
2013-11-18 20:01:35 +01:00
Stefano Ceccherini 41d4206692 Added family parameter to the GetRoutes() API.
Moved common code to a private file.
2013-11-18 10:13:26 +01:00
Ingo Weinhold 94fb954c53 find_path*(): Support user specific home directory
No longer hard-code the home directory path. Instead ask
find_directory(), so we get the correct one for the current user.
2013-11-18 01:50:49 +01:00
Ingo Weinhold 8a3fe6d1bf Add private __getenv_reentrant()
A reentrant variant of getenv().
2013-11-17 19:11:02 +01:00
Ingo Weinhold c39c9283aa Add get_architectures() and C++ versions
* get_architectures() returns the primary and the secondary
  architectures in one array. That turned out to be convenient.
* Add C++ versions for get[_secondary]_architectures(), returning a
  BStringList.
2013-11-17 02:09:37 +01:00
Ingo Weinhold 60b39cd741 Add get_*architecture() API, extend find_path*() API
* Add get_architecture(), get_primary_architecture(),
  get_secondary_architectures(), guess_architecture_for_path() to get
  the caller's architecture, the primary architecture, all secondary
  architectures, or the architecture associated with a specified path
  respectively.
* Rename the find_path*() functions to find_path*_etc() and add an
  optional architecture parameter. Add simplified find_path*()
  functions.
* BPathFinder: Add FindPath[s]() versions with an architecture
  parameter.
2013-11-17 02:09:36 +01:00
Ingo Weinhold cf7e2ad812 runtime loader: Export get_executable_architecture() function
Given a path of an ELF file, it tries to determine its architecture.
2013-11-17 02:09:36 +01:00
John Scipione 1c776bfe37 Lock screensaver window directly
By passing the window pointer to ScreenSaverRunner contructor and using that
to lock the window when drawing instead of getting the window from the
Window() method of the view. This is safer.
2013-11-15 21:27:13 -05:00
John Scipione d34a680c04 Screen Saver: fix race condition
Start the screensaver in the window thread instead of the runner
thread so that there is no lock contention for the window lock in
the runner thread when the saver starts.

The view that gets drawn into is assumed to have been prepared before
being passed to the runner thread, and this assumption has been made
true for the screensaver preview and screen_blanker apps.

Eliminate fHasStarted and the corresponding HasStarted() method in
ScreenSaverRunner as they are no longer needed.

Drawing still happens in the runner thread, and still needs to lock
the window thread potentially causing contention, yet, there
is a timeout here so the contention won't freeze the screensaver window,
only delay drawing the screensaver.

Drawing could be moved to the window thread via message passing to avoid
lock contention with the window but this would defeat a big part of the
purpose of having a separate rendering thread.

This fixes #10125 and #4260
2013-11-14 23:30:26 -05:00
John Scipione 5d023095c2 ScreenSaverRunner: Suspend() and Resume() return status_t 2013-11-14 23:30:13 -05:00
John Scipione e22c01af03 Screen Saver: style fixes 2013-11-14 23:30:10 -05:00
Ingo Weinhold e5f6591382 VM: vm_memset_physical(): Correct length parameter type 2013-11-11 22:27:52 +01:00
Axel Dörfler 547cd462f8 trim: Added is_called_via_syscall() function.
* And use it in get_trim_data_from_user(), formerly known as copy_*().
* This fixes differentiating between user and kernel buffers.
2013-11-07 19:06:13 +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 960c56aea5 This gets the trim command as WRITE SAME operation to SCSI
* Neither hardware nor driver to test it; AHCI/IDE support is next
  on the table.
2013-11-07 19:03:35 +01:00
Axel Dörfler 29a8450843 Added B_TRIM_DEVICE ioctl. 2013-11-07 19:01:24 +01:00
Ingo Weinhold 986e4abce4 Add new API find_path[s](), find_path_for_path()
The new functions are meant to replace many uses of find_directory():
* find_paths() is supposed to be used when the directories of a certain
  kind in all installation directories are needed (e.g. font
  directories, add-on directory, etc.). Using this API makes code
  robust wrt addition or removal of installation locations.
* find_path() is supposed to be used when files/directories associated
  with a loaded program, library, or add-on need to be found (e.g. data
  files or global settings).
* find_path_for_path() is similar to find_path(), but it starts from a
  given path instead of an image.
2013-11-05 21:40:43 +01:00
Jérôme Duval e2183a14c4 Increased kernel stack size by another page for 64-bit
* USB boot now works on x86_64 with PM.
2013-11-04 18:53:49 +01:00
Julian Harnath 7f64b301b1 Reduce lock contention in kernel port subsystem.
* Replace ports list mutex with R/W-lock.

* Move team port list protection to separate array of mutexes.
  Relieve contention on sPortsLock by removing Team::port_list from its
  protected items. With this, set_port_owner() only needs to acquire the
  sPortsLock for reading.

* Add another hash table holding the ports by name. Used by find_port()
  so it doesn't have to iterate over the list anymore.

* Use slab-based memory allocator for port messages. sPortQuotaLock was
  acquired on every message send or receive and was thus another point
  of contention. The lock is not necessary anymore.

* Lock for port hashes and Port::lock are no longer locked in a nested
  fashion to reduce chances of blocking other threads.

* Make operations concurrency-safe by adding an atomically accessed
  Port::state which provides linearization points to port creation and
  deletion. Both operations are now divided into logical and physical
  parts, the logical part just updating the state and the physical part
  adding/remove it to/from the port hash and team port list.

* set_port_owner() is the only remaining function which still locks
  Port::lock and one or two of sTeamListLock[] in a nested fashion.
  Since it needs to move the port from one team list to another and
  change Port::owner, there's no way around.

* Ports are now reference counted to make accesses to already-deleted
  ports safe.

* Should fix #8007.
2013-10-26 16:10:03 +02:00
Ingo Weinhold 3f40dcb6b4 PackageWriterImpl::_AttributeRemoved(): Update string cache
When removing a string attribute, decrement the referenced string's
usage count in the string cache. This fixes the potentially incorrect
usage counts in update mode. Not a serious problem, but it could lead
to only singly (or no longer) used strings to be written to the string
subsection instead of encoding them inline and thus to slightly greater
file sizes.
2013-10-25 22:54:44 +02:00
Ingo Weinhold b8f713e904 PackageReaderImpl: Add public TOC section accessor 2013-10-25 22:54:44 +02:00
Ingo Weinhold e07b8bd2df package kit: ReaderImplBase: Add public attrs section accessor 2013-10-25 22:54:43 +02:00
Ingo Weinhold 06064b9b4f RangeArray::AddRange(): Fix joining with single subsequent range
When joining with a single range, firstRange would be the same as
RangeAt(endIndex - 1) and we would overwrite its offset field before
getting its end offset, thus possibly resulting in a wrong joined range
size.
2013-10-25 22:54:43 +02:00
Ingo Weinhold df266f1c93 BDaemonClient::CommitTransaction(): Align with documentation
The method is supposed to return B_OK as long as the _result object has
been initialized, even if committing the transaction failed. Fixes the
unhelpful error messages of pkgman when committing the transaction
failed for some reason.
2013-10-22 01:12:02 +02:00
John Scipione bd336e3abc Update semantic shortcuts
Update BKeymap::GetModifiedCharacters() to translate a given character
and set of modifiers filling out a list of all characters that match for another
set of modifiers.

This allows us to, for example, get all characters in the normal map that
have the '+' character in the corresponding shift map.

It is fully generic allowing one to get a list of characters in any map given
a character and modifiers of another map.

Also I converted from using a BList to using a BObjectList.

With this, along with BWindow::HasShortcut(), the semantic shortcuts now
work not only with Command+'=', but any key in the normal map that has
'+' in it's shift map as long as it isn't already taken by another shortcut.
2013-10-19 19:30:47 -04:00
Jérôme Duval 6180dde498 Revert "usb_disk: retry when usb disk not ready"
This reverts commit d46d383800.

Regression: CD/DVD-ROM media changes are not recognized anymore.
2013-10-19 22:06:10 +02:00
John Scipione 1d04310459 Keymap: Add a method to get modified characters for a key
This method fills out the passed-in BList of modified utf-8 characters for
a given utf-8 character and set of modifiers.

For example if you pass in "=" and B_SHIFT_KEY the list will get filled
out with each character in the shift map that has "=" in the normal map.

Each supported keymap modifier combination is available.

The reason this is useful will soon become apparent.

A BList is used because the character might be mapped multiple times,
for example if you have a Mac keyboard you've got two "=" keys, one in
0x1d and one in 0x6a.

The caller is responsible for creating the BList and destroying it as well as
freeing the resulting character strings.
2013-10-18 03:10:00 -04:00
John Scipione 916be2df3c Consolidate adding add-on directories
This builds off of hrev46243 adding add-on directories all in one place
in AddOnMonitorHandler instead of repeating the code 3 times in
IndexServer, AddOnManager, and MediaAddOnServer.

The safe mode checking in InputServer is now redundant since it all
gets funneled into AddOnMonitorHandler::AddAddOnDirectories()
and the safe mode flags are checked there.

We should probably remove the InputServer::SafeMode() method, but,
I didn't want to break anything that depended on it so I left it.
2013-10-17 01:28:31 -04:00
François Revol bc1184c253 bootloader: Add an arguments_count field to stage2_args
Some boot platforms pass a non-NULL-terminated list of args
to the loader, so store the count here to avoid having to copy
the list itself.
2013-10-15 22:15:03 +02:00
Ingo Weinhold 066d508682 boot loader: Support loading haiku-*.hpkg
... i.e. properly canonically named Haiku system packages.
2013-10-09 03:48:25 +02:00
Ingo Weinhold bd3bb3cf58 boot loader vfs.h: small cleanup 2013-10-09 03:48:25 +02:00
John Scipione fb6cc6d855 Move Thread classes from Tracker to shared
So that they may be utilized outside of Tracker
2013-10-08 20:25:15 -04:00
Ingo Weinhold 908ce69d6e IteratableSplayTree: Add FindClosest() 2013-10-08 21:03:49 +02:00
Ingo Weinhold de49e34927 Add symbol versioning for find_directory()
Should already have been done back when the semantics for the
B_COMMON_*DIRECTORY constants was changed.

Currently old and new version behave the same. So this is just a
contingency measure ATM.
2013-10-05 01:33:26 +02:00
Ingo Weinhold 38fa81bf8f Remove B_COMMON*_DIRECTORY and kCommon*Directory constants
* This does intentionally break source compatibility, so that a review
  of concerned code is forced.
* Binary compatibility should be maintained in most cases. The values
  of the constants for the writable directories are now used for the
  writable system directories. The values for the non-writable
  directories are mapped to "/boot/system/data/empty/...", an empty or
  non-existent directory, so that they will simply be skipped in search
  paths. Only code that explicitly expects to find something in a
  B_COMMON_* directory, will fail.
2013-10-04 02:30:30 +02:00
Ingo Weinhold 4b7e219688 Remove /boot/common for good
* Remove support for the "common" installation location from packagefs,
  package kit, package daemon, package managers.
* Rename the B_COMMON_*_DIRECTORY constants referring to writable
  directories to B_SYSTEM_*_DIRECTORY.
* Remove/adjust the use of various B_COMMON_*_DIRECTORY constants.
  I'm sure some occurrence still remain. They can be adjusted when the
  remaining B_COMMON_*_DIRECTORY constants are removed.
2013-10-03 21:52:25 +02:00
Ingo Weinhold f73f5d4c42 Initial changes to remove /boot/common
* find_directory() and hard-coded paths use /boot/system instead of
  /boot/common.
* The build system creates the writable directories in /boot/system
  instead of /boot/common.
* The build system no longer installs any packages in /boot/common.
2013-10-03 21:52:25 +02:00
Julian Harnath d46d383800 usb_disk: retry when usb disk not ready
* Resolves #10043
* Fixes a non-booting issue due to hrev46099
2013-09-30 22:32:48 -05:00
Alexander von Gluck IV df0a1762ab usb_disk: fix line endings; no functional change
* Occurred in hrev46099
* Line endings dos2unix
* Remove extra lines at end of file
* Jerome! Get a better text editor :-)
2013-09-30 22:32:47 -05:00
Axel Dörfler cf06f96628 libshared: Factored out driver settings class from net_server.
* The new class is called DriverSettingsMessageAdapter which can translate
  between a driver_settings file, and a BMessage.
* The net_server Settings class is now just using this class.
2013-09-30 01:13:13 +02:00