Commit Graph

6532 Commits

Author SHA1 Message Date
Ingo Weinhold d0c417848b BString::Private class to access BString internals 2011-07-17 16:55:20 +02:00
Ingo Weinhold 10e1bc5267 BRepositoryCache: Add iteration, etc.
* Remove InitCheck() and the initializing constructor.
* Rename PackageCount() to CountPackages().
* Use BOpenHashTable instead of HashMap for the internal PackageMap.
* Allow multiple packages with the same name. Equally named packages are
  in a singly linked list after the first package with that name.
* Add an Iterator inner class and a GetIterator() method, so one can now
  iterate through the packages in the repository.
2011-07-17 16:55:20 +02:00
Ingo Weinhold 5a54e156e5 Add HashValue() methods to BString 2011-07-17 16:55:19 +02:00
Ingo Weinhold f19957b8e5 Add a package info "install-path" attribute
The attribute is intended for simplifying package building. The
package's install path will be used for the package's .self package
symlink, allowing installation to a temporary directory when building
the package.
2011-07-17 16:55:14 +02:00
Ingo Weinhold d7227dfa9e BPackageWriter: Add SetCheckLicenses()
The default is still "true", but now it is possible to disable the
license check.
2011-07-17 16:55:14 +02:00
Ingo Weinhold 407c09e2d9 Create /packages symlink on boot
Rename the package links directory from /package-links to just /packages
and create it when booting.
2011-07-17 16:55:13 +02:00
Ingo Weinhold 70de928ed8 Move <directories.h> to headers/private/system 2011-07-17 16:55:13 +02:00
Ingo Weinhold 3e29244600 Move B_MIME_STRING_TYPE to <TypeConstants.h> 2011-07-17 16:55:09 +02:00
Ingo Weinhold 901749cff2 Remove TwoKeyAVLTree from kernel utils again
It's not ready for shared use yet.
2011-07-17 16:55:09 +02:00
Ingo Weinhold 01f7f92aef Move helper function out of QueryParser.h
They live in the new QueryParserUtils.{h,cpp} now.
2011-07-17 16:55:08 +02:00
Ingo Weinhold 3877a7f4a0 AVLTreeMap fixes
* AVLTreeMap::_GetKey(): Change return type from const Key& to Key, so
  the strategy can do that as well and doesn't have have a Key object in
  the node.
* Fix the Auto strategy: It was using the undefined _GetKey() instead
  of GetKey().
2011-07-17 16:55:08 +02:00
Ingo Weinhold 28559a4e24 Build fix 2011-07-17 16:55:08 +02:00
Ingo Weinhold 8c8e925a0a QueryParser: The last_modified index is time_t
* Changed value type from B_INT64_TYPE to B_INT32_TYPE.
* Changed QueryPolicy::NodeGetLastModifiedTime() return value from
  bigtime_t to time_t.
2011-07-17 16:55:07 +02:00
Ingo Weinhold a058fbe8a1 TwoKeyAVLTree: Add FindFirstClosest() 2011-07-17 16:55:06 +02:00
Ingo Weinhold 46368f46f3 Small cleanup 2011-07-17 16:55:06 +02:00
Ingo Weinhold 9811f22cab QueryParser: Explicitly suspend/resume iterators
Extended policy by IndexIteratorSuspend() and IndexIteratorResume()
methods that are invoked for the index iterator by Query::GetNextEntry()
after entering respectively before exiting.
2011-07-17 16:55:04 +02:00
Ingo Weinhold 0c19263c85 AVLTreeMap/TwoKeyAVLTree: More access to nodes
both:
* Add Previous()/Next().
* Add Insert() version that returns a Node* instead of an Iterator.
* Add Remove() version that takes a Node* instead of a key.

TwoKeyAVLTree:
* Add GetIterator() version that takes an additional Node*, i.e.
  initializing an iterator to point to the node.
* Add Iterator::CurrentNode().
2011-07-17 16:55:03 +02:00
Ingo Weinhold 20b22dfc3d AVLTree: Add Previous()/Next() 2011-07-17 16:55:03 +02:00
Ingo Weinhold 44de97031e Add TwoKeyAVLTree to kernel utils
This is a tree implementation with elements with primary and secondary
key. The code is a cleaned up version of ramfs's implementation. ramfs
doesn't use this version yet.
2011-07-17 16:55:01 +02:00
Ingo Weinhold 7210d7aa58 Create a generalized version of BFS's query code
The new version is templatized over a QueryPolicy which provides the
interface to the file system specifics.
2011-07-17 16:55:01 +02:00
Ingo Weinhold 6f785748aa Write uncompressed package file TOC, if necessary 2011-07-17 16:54:57 +02:00
Ingo Weinhold 327b38d69c Add support for adding/updating package entries
Add flags parameter to BPackageWriter::Init() (and the private
implementation classes) to indicate that an existing package file shall
be updated instead of created. Currently that always happens in-place.
2011-07-17 16:54:56 +02:00
Ingo Weinhold 7b6bcdb146 Write uncompressed package attributes if necessary
When compression doesn't save space, using it nonetheless results in a
file that the reader complains about. So we fall back to writing an
uncompressed package attributes section in such a case.

The same still needs to be done for the TOC section.
2011-07-17 16:54:56 +02:00
Ingo Weinhold c83c5423aa Add PackageReaderImpl heapOffset/Size getters 2011-07-17 16:54:55 +02:00
Ingo Weinhold 97aabbede9 Add BLowLevelPackageContentHandler section hooks
* Add hooks HandleSectionStart() and HandleSectionEnd(). They are
  invoked to bracket package file section, so the handler can
  discriminate which section the attributes belong to.
  HandleSectionStart() features a return parameter _handleSection, which
  allows to handler to pick which sections it wants to handle.
* "package dump" does now print the section names.
2011-07-17 16:54:55 +02:00
Ingo Weinhold b3211314fc Define IDs for package section 2011-07-17 16:54:54 +02:00
Ingo Weinhold fce74facea Add Array.h and RangeArray.h build headers 2011-07-17 16:54:54 +02:00
Ingo Weinhold 85759ab92f Add RangeArray utility class
Templatized class for managing a set of sorted non-overlapping integer
ranges. Merges and splits ranges as necessary.
2011-07-17 16:54:54 +02:00
Ingo Weinhold 5518472255 Declare Array destructor inline 2011-07-17 16:54:54 +02:00
Ingo Weinhold eb601f803e Move Debugger's Array class to headers/shared 2011-07-17 16:54:53 +02:00
Ingo Weinhold 697b9545b1 BLowLevelPackageContentHandler interface extension
HandleAttributeDone(): Add parentToken parameter.
2011-07-17 16:54:53 +02:00
Ingo Weinhold 4512e8d566 Add optional FD parameter to AddEntry()
If a FD is specified, instead of using the file with the given the FD is
used. Allows for adding entries without first copying them into the
directory structure.
2011-07-17 16:54:51 +02:00
Ingo Weinhold bfbb410d1a BPackageInfo::ReadFromConfigFile() BFile& version 2011-07-17 16:54:50 +02:00
Ingo Weinhold 5b486787aa Improve FileDescriptorCloser
* Add SetTo()/Unset() methods and no-argument constructor.
* Detach() returns the FD now.
2011-07-17 16:54:50 +02:00
Ingo Weinhold 4cf5f9293f Cleanup 2011-07-17 16:54:50 +02:00
Ingo Weinhold 4dbc245798 Wrap POSIX FD functions in libroot_build
This makes opening symlinks work universally in the build system tools.
Two mechanisms have been implemented, both of which don't always work.
The first is remapping via preprocessor macros. This fails where equally
named methods are used (e.g. STL fstream::open()). The other is using
hidden functions in the new libroot_build_function_remapper.a that is
linked into everything that is linked against libroot_build.so. This one
fails for functions that are defined inline in headers (Linux/glibc does
that). Together they seem to cover our build system needs ATM.
2011-07-17 16:54:47 +02:00
Ingo Weinhold df18eb8718 Fix gcc 2 build by making Parser a friend 2011-07-17 16:54:46 +02:00
Ingo Weinhold 8b684dd363 Add URL/source URL hpkg package attributes 2011-07-17 16:54:44 +02:00
Ingo Weinhold ee453e8bbc Add url and sourceURL properties to BPackageInfo
Also extend the parser to accept "url" and "source-url" attributes.
2011-07-17 16:54:44 +02:00
Ingo Weinhold b2709d8a0a Write resolvable compatible version to the package
To avoid a clash with the regular version or an extra attribute level we
use the "package:provides.compatible" package attribute instead of
"package:version.major".
2011-07-17 16:54:39 +02:00
Ingo Weinhold 22e1ec0e30 Add package attribute for compatible version 2011-07-17 16:54:38 +02:00
Ingo Weinhold c2f56ca020 BPackageResolvable: Add compatibleVersion property 2011-07-17 16:54:38 +02:00
Ingo Weinhold 3a56aaeeb9 BPackageResolvableData: Compatible version field
Add fields haveCompatibleVersion and compatibleVersion. This allows us
to have a minimum version a resolvable is backwards compatible with.
2011-07-17 16:54:38 +02:00
Ingo Weinhold ed6d59a9a9 Introduce a pre-release version component
* The version string pattern is now:
  <major>[.<minor>[.<micro>]][-<pre>][-<release>]
* Introduce B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_PRE_RELEASE package
  attribute.
* Add "preRelease" field to BPackageVersionData.
* Add "preRelease" property to BPackageVersion and packagefs's Version.
* Adjust package reader and writer code accordingly.
2011-07-17 16:54:37 +02:00
Ingo Weinhold d61a8548f9 Add support for bind-mounting directories
* Add support function vfs_get_mount_point(), so a file system can get
  its own mount point (i.e. the node it covers). Re-added
  fs_mount::covers_vnode for that purpose -- the root node isn't know to
  the VFS before the mount() hook returns.
* Add function vfs_bind_mount_directory() which bind-mounts a directory
  to another. The Vnode::covers/covered_by mechanism is used, so this
  isn't true bind-mounting, but sufficient for what we need ATM and
  cheaper as well. The vnodes connected thus aren't tracked yet, which
  is needed for undoing the connection when unmounting.
* get_vnode_name(): Don't use dir_read() to read the directory. Since we
  have already resolved vnode to the covered vnode, we don't want the
  dirents to be "fixed" to refer to the covering nodes. Such a vnode
  simply wouldn't be found.
2011-07-17 16:54:21 +02:00
Ingo Weinhold 313e1e37f2 Add vfs_ prefix to resolve_vnode_to_covering_vnode() 2011-07-17 16:54:20 +02:00
Ingo Weinhold 2e21fc5436 Generalize use of Vnode::covered_by/covers
* Introduce Vnode flags for covered and covering. Can be used as a quick
  check when one doesn't already hold sVnodeLock.
* Rename resolve_mount_point_to_volume_root() to
  resolve_vnode_to_covering_vnode().
* Adjust all code that deals with transitions between mount points and
  volume root vnodes to generally support covered/covering vnodes.
2011-07-17 16:54:20 +02:00
Ingo Weinhold 533833f646 Add kernel args boot volume "packaged" flag
* Add BOOT_VOLUME_PACKAGED boot volume message field name constant.
* register_boot_file_system():
  - Now takes a BootVolume& parameter.
  - If the boot volume is packaged, add that info to the boot volume
    message.
2011-07-17 16:54:15 +02:00
Ingo Weinhold cbc85916fb Add boot loader packagefs support
* Add pread().
* Add Node::ReadLink() to read a symbolic link path.
* Add Directory::LookupDontTraverse() and make Lookup() non-abstract.
  Lookup() is implemented via LookupDontTraverse() and Node::ReadLink().
* Adjust all FS implementations accordingly.
* Add a packagefs implementation. Unlike other FS implementations it
  isn't a pseudo-module, but provides a function to explicitly mount a
  package file (packagefs_mount_file()).
* Finish BootVolume::SetTo() implementation, mounting the package file
  and replacing fSystemDirectory.

Now the boot loader can load the kernel and boot modules from a packaged
system. The kernel boots up to the point where the boot volume is
mounted.
2011-07-17 16:54:15 +02:00
Ingo Weinhold d11ea2b5ed Introduce BootVolume abstraction class
BootVolume is initialized from a root directory of a volume. It finds
the system directory, and -- not implemented yet -- mounts the system
package, if the system is packaged, replacing the system directory with
it. Adjusted several functionality (main(), the loader functions,
user_menu()) to use BootVolume instead of the root directory.
2011-07-17 16:54:13 +02:00