Commit Graph

57783 Commits

Author SHA1 Message Date
hyche 8042a045b0 BTRFS: Implement Remove() in Inode that removes inode_item.
Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2017-12-10 11:03:02 -05:00
hyche b44d924df4 BTRFS: Implement MakeReference() in Inode that will link file name to inode.
Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2017-12-10 11:03:02 -05:00
hyche 371935de18 BTRFS: Implement Insert() in Inode that inserts inode_item.
Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2017-12-10 11:03:01 -05:00
hyche 36a24fb34e BTRFS: Implement Create() that allocate new Inode object.
Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2017-12-10 11:03:01 -05:00
hyche 20185bb9c3 BTRFS: Implement RemoveEntries() for BTree that will remove consecutive items and its data.
Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2017-12-10 11:03:00 -05:00
hyche 84bc447cae BTRFS: Implement InsertEntries() that will insert consecutive items and its data.
Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2017-12-10 11:03:00 -05:00
hyche 02bce792d8 BTRFS: Added function to convert standard filetypes to btrfs filetypes.
Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2017-12-10 11:03:00 -05:00
hyche 2b6c2ec390 fs_shell: Added socket filetype.
Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2017-12-10 11:02:59 -05:00
hyche 883b9bf29f BTRFS: Implement CopyOnWrite relevant functions, and BTree holds new attribute that record its root level.
CopyOnWrite works like this:
* Cache original node
* Allocating new block
* Cache new block to be writable
* Copy original node to new node, and changing.
Also if a node is already be COW-ed it cannot be COW-ed again, it will be changed in-place instead.

InternalCopy does CopyOnWrite all the nodes that we don't need to change anything on them.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2017-12-10 11:02:59 -05:00
hyche 89484dc08d BTRFS: Implement some copy relevant helpers.
Copy() copys data from other node, MoveEntries() changes data on the current node.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2017-12-10 11:02:58 -05:00
hyche 27ffe0583b BTRFS: Implement some space relevant helpers.
Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2017-12-10 11:02:58 -05:00
hyche 4368661f03 BTRFS: Implement GetNewBlock() function that will find the logical address for allocating and convert it to physical block.
Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2017-12-10 11:02:57 -05:00
hyche c1320b3a33 BTRFS: Implement a simple journaling approach, this is not finished and mostly satisfy the need for passing Transaction object for many functions.
Some details about the current Journal:
* Journal can only end transaction.
* It holds a transaction id of fs (fCurrentGeneration) that increments each time a transaction starts.
* _TransactionWritten now just printing message.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2017-12-10 11:02:57 -05:00
hyche 1750cd1e92 block_cache: Implement cache_has_block_in_transaction function that will check the existence of block in one specific transaction.
Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2017-12-10 11:02:56 -05:00
hyche 8137f447cb BTRFS: Fix memory leak
Missing delete for some tree roots.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2017-12-10 11:02:55 -05:00
hyche 0deb03560f BTRFS: Fix mismatched type of index in inode_ref item.
Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2017-12-10 11:02:54 -05:00
hyche af419b0e98 BTRFS: Implement ExtentAllocator
There are 4 new classes, structs:
* CachedExtent, is a AVLTreeNode, caches the extent locating in extent tree, a extent can be free, allocated, metadata or a data extent. It also hold a references count,
that is incremented each time a new extent refer to it (COW) and item data, that is only for allocated extent (NULL for free).
* CachedTreeExtent, is a AVLTree, cache the whole extent tree and has CachedExtent as its node.
* BlockGroup represents the group of extents that represent the region for each type of allocated extent. For example, region for data extents, metada blocks. It
responsible for inserting nodes in CachedTreeExtent.
* And the final, ExtentAllocator it knows how to allocate/deallocate extents, but for now only the allocating is implemented, actually allocating and deallocating works
are already implemented, they are in functions _AddFreeExtent, _AddAllocatedExtent in CachedTreeExtent. However the deallocating is not needed for now, so it will be
finished later then.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2017-12-10 10:56:12 -05:00
hyche bfd7a4fb42 BTRFS: Reimplement TreeIterator, add some error checks and remove redundancies.
Add BTree::Path as a attribute so enhance performance, so that everytime we iterate through items it wont search all the root to leaf
again. The Iterator is initialized without rewinding to make more flexible.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2017-12-10 10:56:11 -05:00
hyche 3216460dec BTRFS: Implement BTree::Path and change _Find.
Remove attribute fCurrentSlot in BTree::Node as it will be handled by Path explicitly. BTree control Path by passing its type in
BTree's method, Path also hold BTree type as its attribute to do some internal actions.
Add constant BTREE_KEY_TYPE_ANY, find search key has this type will success regardless of the found key's type.

Split the  the _Find function into Traverse and GetEntry. Traverse will fill in the Path (nodes and slots) along way its finding,
GetEntry will get the item data, item size, key from leaf, if the slot is valid, that we have from Traverse. The _Find function also
check type if is correct and then retrieve. Doing this way there will be more flexible, the "read" flag is not needed as we only
need Path to manipulate tree, and it also enhance the performance at some points, because Path caches all the nodes from root to leaf,
so that we don't have to block_cache_put and block_cache_get after each finding.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2017-12-10 10:56:11 -05:00
hyche 8160f31fc1 BTRFS: Node now holding Volume instead of cache to retrieve more values
Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2017-12-10 10:56:10 -05:00
hyche 16de9db54b BTRFS: Fix mismatched type of item size (should be uint32), and ObjectID of first subvolume when lookup directory (described in commit bd2dab1)
Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2017-12-10 10:56:09 -05:00
hyche 2ed88a489c BTRFS: Fix node search slot
* Not handle traversing type correctly (looks for the graph).
* Reorder the codes because *slot is uninitialized if type is BTREE_EXACT.
* Incorrect return type: int32 -> status_t

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2017-12-10 10:56:08 -05:00
hyche e715614613 AVLTree: forward LeftMost and RightMost method from AVLTreeBase
Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2017-12-10 10:56:08 -05:00
Adrien Destugues d87218f79e Add test for stack alignment. 2017-12-10 09:28:49 +01:00
Adrien Destugues 6a028821b6 x86 glue code: keep stack aligned.
The glue code pushed 12 bytes to the stack, breaking the 16-byte stack
alignment requirement. This would be fixed by the main() prologue from
gcc, but all "init" and "fini" code (static/global constructors/ destructors)
would run with a misaligned stack.

This was already fixed for x86_64 in hrev49731. Note that the fix here
is slightly different, the pointer is realigned after it is saved to EBP
and the function epilogue restores it from EBP, so no changes to crtn.S are
needed.
2017-12-10 09:23:22 +01:00
Owen 9e53d4e91b Accepts URLs as command line arguments.
Fixes #9793

Signed-off-by: Kacper Kasper <kacperkasper@gmail.com>
2017-12-09 20:02:06 +01:00
Janus da9188ac28 StyledEdit: avoid crash on replace window
* Fixes #13842
2017-12-08 15:08:43 +01:00
Adrien Destugues 2d10453741 Add a simple video decoding test
This application tests the BMediaTrack/BMediaFile API and underlying
ffmpeg plugin for video decoding. You can press (or hold) any key to go
through frames in a video. This avoids debugging both MediaPlayer and
the underlying libraries at the same time.

It shows that ReadFrames is getting video frames out of PTS order.
2017-12-07 22:45:44 +01:00
Adrien Destugues a9020afcb6 BHttpHeaders: fix gcc5 build. 2017-12-07 22:45:44 +01:00
Adrien Destugues ed8f28a480 Move HeadersReceived hook after parsing of cookies
I still don't get what's happening, but doing the cookie parsing at the
same time as the main thread is handling HeadersReceived seems to
trigger a memory corruption, and it will escape all my attempts to debug
it (adding printfs or any other slight change to the code will make it
go away). So just chage the order we do things and hope that's enough to
always avoid it.

As a side effect, HeadersReceived can now rely on the cookies being
already stored in the cookie jar, which I think makes more sense.

I still plan to rewrite the HTTP request code as a proper state machine,
instead of one long Run() function. This would allow to run it in
smaller steps, and thus group multiple requests in a single thread
(triggering them from poll, select, or similar).
2017-12-07 22:45:44 +01:00
Automatic Committer 0ba5f365d0 Update pci.ids from pciids.sourceforge.net 2017-12-07 05:20:14 +01:00
Augustin Cavalier dfaaa345ff get_package_dependencies: When adding a package fails, actually report why.
e.Details() gives "additional details" and not the real failure
message, which is in e.Message(), so actually print that.
2017-12-05 20:15:49 -05:00
Augustin Cavalier f3114cade7 Tracker: Add shortcut_catcher to UseHeaders.
Tracker uses KeyInfos.h from it. Previously this wasn't needed
due to the SEARCH_SOURCE added in the Shortcuts preferences,
but as that is now just a UseHeaders, we need it here (if only
for the DoCatalogs.)
2017-12-05 20:14:21 -05:00
Augustin Cavalier 06b79f5509 build/Errors.h: Synchronize with the non-build one.
This file was apparenly based off the BeOS one (as is evidenced
by the "Be Incorporated" copyright ... which is problematic.)
Now it's directly based off of the non-build one.
2017-12-05 18:36:11 -05:00
Augustin Cavalier fc2c93fbec configure: Enable use-xattr or use-xattr-ref automatically.
The previous commit only checked that they worked if the user
enabled them, but now they will be enabled automatically if the
underlying filesystem supports them.

The ReadMe.Compiling has been updated accordingly.
2017-12-05 17:14:28 -05:00
Augustin Cavalier a5c952db0d configure: Actually check the host's support for extended attributes.
Previously the helptext just displayed a warning to "make sure your
file system supports sufficient attribute sizes", and left the
actual checks to libroot_build at runtime.

Now we use the native command-line tools of each platform to make sure
that we can actually set attributes large enough for --use-xattr and
--use-xattr-ref respectively.
2017-12-05 17:14:02 -05:00
Augustin Cavalier 825700d34a configure: Rewrite implementation of --update.
Previously --update was kind of a hack, as it just dumped all
the variables from BuildConfig back into ./configure and attempted
to rerun from there.

Instead, now we store all of the variables and environs configure
was invoked with in the top of BuildConfig and re-call it using them.
This is much more robust, as configure will actually recompute
all of the values from the BuildConfig.

As a side effect, if configure was originally invoked to build crosstools,
it would have done so again, so instead add a check to see if they
exist, and skip them if they do. It's easy enough to delete the
directory if you want to force a crosstools rebuild.

Briefly discussed with mmlr on IRC.
2017-12-04 20:14:18 -05:00
A-star-ayush bf1a86c199 TCP: Fixed RTO update and dup ACKs generation.
i) there was an integer promotion problem in updating the retransmission
timeout : a signed int was being divided by an unsigned int. This was causing
the values to overflow. Thus leading to huge values for timeout which
manifested in the perception of pause in data flow.

ii) for an ack to be recognised as a duplicate ack, the advertised window
must remain same. This was not taken care of in the code so I added it.

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>

Helps with #13769 but does not fix it completely (upload gets
farther but still stalls.)
2017-12-04 15:12:03 -05:00
Michael Lotz a88944c86e bootstrap: Add missing noto package to cross repos. 2017-12-04 19:52:04 +01:00
Michael Lotz 1484b2336a bootstrap: Update cross packages for make, bash, icu. 2017-12-04 19:52:04 +01:00
Michael Lotz 22271bfdc2 bootstrap: Strip build down by removing unneeded packages.
Don't include makefile_engine, userguide, welcome, netfs and userland_fs
in the build for bootstrap.
2017-12-04 19:52:04 +01:00
Augustin Cavalier f1e8af173c net_socket: control op should be uint32.
Where it is called from stack_interface_ioctl, the parameter
is already a uint32 there.

Fixes #13826.
2017-12-03 13:57:26 -05:00
Augustin Cavalier acf02fd2cf locale: Fix another class/struct mixup. 2017-12-03 13:44:30 -05:00
Augustin Cavalier 8b222e6272 IORequest: NULL check does not belong in method body.
Found by Clang's -Wtautological-undefined-compare.
2017-12-03 13:44:16 -05:00
Augustin Cavalier 9c292427ec configure: Remove totally useless --enable-multiuser switch.
It's not used anywhere in the build system at all.
2017-12-02 23:27:09 -05:00
Augustin Cavalier 47bedf1601 PackageDataInlineReader: Do not use fData before it has been set.
Spotted by Clang.
2017-12-02 22:24:55 -05:00
Augustin Cavalier 7c234361eb Fix more class/struct mixups. 2017-12-02 22:24:06 -05:00
Augustin Cavalier bf77c15232 kernel/vm: Correct virtual function declarations.
The base VMCache class changed to the generic_ types with their
introduction in in *2011* (435c43f591),
but these classes were never properly adapted. These functions should not
be called here (they panic() -- but the base class only returns B_ERROR,
so that is a difference at least.)

Found by Clang's -Woverloaded-virtual.
2017-12-02 21:42:50 -05:00
Augustin Cavalier e33d3563dc RepositoryRules: Restore mistakenly deleted local variable. 2017-12-02 18:48:21 -05:00
Augustin Cavalier 8dcb910a20 RepositoryRules: Do not use the downloaded repo.info.
Instead build the one in-tree from src/data/package_infos/. Fixes the
"HaikuPorts repos have wrong URL" problem that has occured since the
switch to buildmaster repos.
2017-12-02 18:36:26 -05:00