You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(35) |
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(37) |
Feb
(10) |
Mar
|
Apr
(2) |
May
(17) |
Jun
(1) |
Jul
(14) |
Aug
(14) |
Sep
(4) |
Oct
|
Nov
(14) |
Dec
(4) |
2005 |
Jan
(6) |
Feb
|
Mar
|
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
(92) |
Dec
(12) |
2006 |
Jan
(3) |
Feb
(4) |
Mar
|
Apr
(5) |
May
(3) |
Jun
(15) |
Jul
(3) |
Aug
(1) |
Sep
(29) |
Oct
(1) |
Nov
(6) |
Dec
(5) |
2007 |
Jan
(2) |
Feb
(2) |
Mar
|
Apr
(3) |
May
(14) |
Jun
(2) |
Jul
(16) |
Aug
(73) |
Sep
(12) |
Oct
(9) |
Nov
(27) |
Dec
(3) |
2008 |
Jan
(4) |
Feb
(4) |
Mar
(3) |
Apr
(8) |
May
(23) |
Jun
(4) |
Jul
(1) |
Aug
(3) |
Sep
(7) |
Oct
(5) |
Nov
(1) |
Dec
(1) |
2009 |
Jan
|
Feb
(10) |
Mar
|
Apr
(4) |
May
(4) |
Jun
(10) |
Jul
|
Aug
(1) |
Sep
|
Oct
(7) |
Nov
|
Dec
(1) |
2010 |
Jan
|
Feb
(1) |
Mar
|
Apr
(6) |
May
|
Jun
(3) |
Jul
(11) |
Aug
(1) |
Sep
|
Oct
(15) |
Nov
(1) |
Dec
(5) |
2011 |
Jan
(4) |
Feb
(1) |
Mar
(6) |
Apr
|
May
(22) |
Jun
|
Jul
(8) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2012 |
Jan
|
Feb
(10) |
Mar
(1) |
Apr
(6) |
May
(27) |
Jun
(48) |
Jul
(30) |
Aug
(4) |
Sep
|
Oct
(3) |
Nov
(1) |
Dec
(11) |
2013 |
Jan
(4) |
Feb
(7) |
Mar
(6) |
Apr
(18) |
May
(28) |
Jun
(20) |
Jul
|
Aug
(4) |
Sep
(1) |
Oct
(1) |
Nov
(2) |
Dec
(7) |
2014 |
Jan
(3) |
Feb
(2) |
Mar
(4) |
Apr
(9) |
May
(11) |
Jun
(10) |
Jul
|
Aug
(18) |
Sep
(12) |
Oct
(17) |
Nov
(10) |
Dec
(16) |
2015 |
Jan
(5) |
Feb
(1) |
Mar
(5) |
Apr
(4) |
May
(28) |
Jun
(2) |
Jul
|
Aug
|
Sep
(6) |
Oct
|
Nov
(2) |
Dec
(1) |
2016 |
Jan
(14) |
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
(3) |
Jul
(4) |
Aug
(4) |
Sep
(1) |
Oct
(1) |
Nov
|
Dec
(1) |
2017 |
Jan
(11) |
Feb
|
Mar
(21) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(2) |
Sep
(4) |
Oct
(4) |
Nov
|
Dec
(1) |
2019 |
Jan
(1) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(13) |
Sep
(4) |
Oct
|
Nov
|
Dec
|
2020 |
Jan
(10) |
Feb
(9) |
Mar
(5) |
Apr
(4) |
May
(3) |
Jun
(18) |
Jul
(4) |
Aug
(2) |
Sep
(20) |
Oct
(2) |
Nov
|
Dec
|
2021 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2022 |
Jan
(1) |
Feb
(2) |
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
|
Oct
(1) |
Nov
|
Dec
(1) |
2023 |
Jan
(10) |
Feb
(7) |
Mar
(29) |
Apr
(31) |
May
(29) |
Jun
(34) |
Jul
(3) |
Aug
(24) |
Sep
(22) |
Oct
(10) |
Nov
(38) |
Dec
(27) |
2024 |
Jan
(15) |
Feb
(8) |
Mar
(4) |
Apr
(20) |
May
(33) |
Jun
(18) |
Jul
(15) |
Aug
(23) |
Sep
(26) |
Oct
(32) |
Nov
(6) |
Dec
(4) |
2025 |
Jan
(7) |
Feb
(1) |
Mar
(1) |
Apr
(4) |
May
(46) |
Jun
(19) |
Jul
(25) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Lawrence S. <ljs...@us...> - 2013-05-27 02:06:48
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 230f8ecb8121562534cfef55fccac2d6eb5d788c (commit) from 137c2ca7ad704991c1cab991408cace63bf315f2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 230f8ecb8121562534cfef55fccac2d6eb5d788c Author: Lawrence Sebald <ljs...@us...> Date: Sun May 26 22:06:26 2013 -0400 Clean up the generated stubs files on a make clean. ----------------------------------------------------------------------- Summary of changes: doc/CHANGELOG | 3 +++ kernel/Makefile | 1 + 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 9d4803a..e09d43f 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -2,6 +2,9 @@ Platform independent changes are marked with '***', otherwise the applicable platform is listed. If someone besides me found the bug or suggested the fix, I'll put their name in [ ]. +KallistiOS version 2.0.1 ----------------------------------------------- +- *** Clean up generated stubs files on a make clean [Lawrence Sebald = LS] + KallistiOS version 2.0.0 ----------------------------------------------- - DC Broadband Adapter driver fixes [Dan Potter == DP] - *** Imported a new version of lwIP, with proper sockets lib [DP] diff --git a/kernel/Makefile b/kernel/Makefile index baee03c..1701a81 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -24,6 +24,7 @@ include $(KOS_BASE)/Makefile.prefab clean: clean_subdirs rm -f build/*.o rm -f build/libc/*.o + rm -f stubs/*.o stubs/kernel_export_stubs.c stubs/arch_export_stubs.c run: hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-05-23 15:24:04
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The annotated tag, v2.0.0 has been created at 83165fa0d61a3318b0e1aafc58a6f55848e72e6e (tag) tagging 137c2ca7ad704991c1cab991408cace63bf315f2 (commit) tagged by Lawrence Sebald on Thu May 23 11:22:31 2013 -0400 - Log ----------------------------------------------------------------- Tag KallistiOS version 2.0.0. -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.19 (Darwin) Comment: GPGTools - http://gpgtools.org iQEcBAABCgAGBQJRnjRQAAoJEKVk4yedkkWVxIcH/3o1ivD+N9U8NExYshzdpRh7 7gPaW5uvypSgpwRXh9bftTQ8JAcQ22W5jFiHhGKmnurlC/AU0B4exC046aLN0u5P wV43J7ynHVgMGhZhSL4k8mVHActCcZtrXyKjAmxNRvNBYGhcHmDkXAMZxK5mMYIJ 6cJYChI3viByny7m8WzgS9jBOiLsr9v1nZaAWQBo37lCePVk6NOcSol4me9vGutE f0/p2kWaAcB9Ml44TFmp//fyrRLmHra0CPmuzeUz49SNlLZPMWwe7Tah0z9qEclh QXYjKGBBNr1ajEx5cDDSDTHGTP+mJFvUn+cW72Ez2M/m2I+LwSCmB0y2liKex3E= =wag7 -----END PGP SIGNATURE----- Atani (13): Adding ".svn" exclude to the genromfs call default paths update binutils version bump to 2.17, this fixes compilation with native gcc 4x use dc-chain style naming as default inline banner creation use make_banner.sh, #!/bin/bash instead of #!/bin/sh kos-ports hooks auto-set KOS_BASE for trac builds applying sector sizing patch from Quzar apply patch to use fnmatch.h for CYGWIN. Adding svn:ignore for most generated files Upgrade to newlib 1.15.0 fix LOCK_RECURSIVE Christian Groessler (12): fix SCSMR2 define; add support for baud rates < 9600 fix debug messages readdir: handle case if VMU is completely empty don't allow opening a file with O_DIR revert to r359, last check-in was by mistake create a map file vid_border_color() now returns the old color. Add dcache flush for when using DMA. Updated gitignore to ignore *.map files. close() returns a status now. 0 or -1 for success or failure. Information about New compiler (gcc 4.7.0) optimizes out the the delay loop in Add -N to linker switches in order not to pad .data section to a 32K Cyle Terry (6): Newlib 1.15 not quite stable yet kmg.h and zlib fixed in kmgenc forgot to set a 1.15 back to 1.12 DESTDIR patch Fixing hello-mp3 example's compiler warnings Adding BlueCrab's init fini Newlib patch. Dan Potter (148): Initial import of KOS 1.2.x Update eol-style properties on text files Testing permissions. Remove permissions test line Removed msg.h (never gonna finish that), did some rearranging Nifty new arch-centric auto-build system Use arch-specific dir for addons Don't auto-build examples for the moment since addons Updated changelog/relnotes, moved most addons into their own tree Removed defunct os-mode stuff, will re-add in 1.3.x branch Post-addons-scoot-around cleanup libc updates backported from KOS 1.3.x The rest of the kernel-main 1.3.x backports Happy new httpd example Incompletely ported ia32 port from old KOS 1.3.x Example porting to 1.3.x Fixes to enable lwIP compiling Couple more porting things, again Copied up from old 1.3.x tree Remove non-working dcload-ip for now Added new parallax example Updated basic lua example for Lua 5.0 and KOS 1.3.x Update conio examples to use infinite blocking More libc compatibility fixes for Lua 5.0 Fix for getc for broken g++v3 libs Added svnpush util Updates to svnpush.py, new svnpull.py "client" Fix a problem with checking for too many args Added email notification support to svnpush.py ANSI compliance fixes for KM_DBG in malloc.c Forgot to check in library.c Rename "struct vector" in vector.h to avoid clashing with STL in C++ Add -lz to vqenc compilation for Cygwin folks Removed stdint.h in gba-crcfix.c, seems to be non-portable currently :( Added stdlib.h to get_image_png.c in vqenc for malloc/free Renamed genexportshims.sh to genexportstubs.sh Added some more kernel exports for loadable modules Simplified DC examples Makefile Build system improvements, and finished kos-ports tree separation. Arch dirs for ia32 and ps2 in addons Adjusted 2ndmix demo to use prefab romdisk lines Finished updating build scripts and README Added exports generation for loadable prefab Added more core kernel exports Added "sinus" demo for Parallax Added Parallax delay_cube example Added Parallax rotocube example Improved MII/link status handling for BBA driver Add NONE thread mode, make thd_sleep sensitive to it Change usleep() to use thd_sleep() instead of timer_spin_sleep() since Add KOS 1.3.x includes to kos.h Change kos/exports.h to use ptr_t instead of unsigned long GDB stub fixes from Richard Moats: New bin2c from Gil Megidish: Updated genromfs from upstream 0.50. Fixes the "wrong parent" bug Fix and re-enable SPU DMA module Align allocated SPU RAM blocks to 32-byte boundaries for DMA usage Clean up PVR DMA functions, add support for 32/64-bit VRAM and TA DMAs Update exports.txt for recent DMA changes Floating point register support for gdbstub from Richard Moats Experimental DMA-based streamer for snd_stream Remove extraneous setting of lmmode0 in spu dma Add G2 DMA pausing (hacky) for g2 bus read/write calls Add DNS client test program, fix lwIP paths for httpd Be BSD-conformant on u_long and such by defining __u_long_t_defined Enable IRQ usage and buffering for serial receiving in dbgio Make flashrom_read_block non-static, and add ISP settings code. Add ISP settings example. This is technically a flash (not network) Update DNS example to use new lwip_gethostbyname Fix a typo in the "method" field for ISP flash settings Updated netcfg to be able to load settings from ISP flash Lots of misc DC modem code cleanups / updates, and also a new sq_cpy speedup patch from Jim Ursetto mat_trans_single speed up patch from Jim Ursetto Big rewrite of a bunch of stuff in the PVR module, preliminary Fixed DMA vertex support in PVR module. Rename pvr_set_vertex_buffer to pvr_set_vertbuf for consistency, remove Add mat_transform_sq from Jim Ursetto. Correct exports for pvr_set_vertbuf (forgot in last changelist) Add modified version of Jim Ursetto's "serpent" example to the - New and improved sound stream manager, with multiple stream support Fix an issue with the Makefiles where errors won't stop the build. New dbgio system (and corresponding fixes for various other pieces) KOS: Fix possible infinite loop while searching for a channel to play KOS: Another fix for the channel allocator in sndsfx kos: scif.c wasn't included in build (thanks quarn) kos/libc: Remove __unused tag from crtend ctor/dtor arrays so it works kos: Make frsqrt() specify fr0 as dirtied (thanks Jim Ursetto) kos: update bin2o to produce properly aligned files on the DC kos: Add support for setting fsaa at init in PVR kos: Always initialize DC's SCIF port even if we aren't using it for kos: Always initialize DC's SCIF (part 2) kos: Read the correct flag for using OCRAM on the DC at startup. kos: Add mat_trans_nodiv, fipr_magnitude_sqr, and fipr (thanks Jim kos: Allow init of fsaa at startup in PVR (part 2) kos: add gnu_wrappers tree with KOS wrappers for GNU tools kos: Fix enabling of incorrect ASIC event for SPU DMA (thanks Vincent kos: convert stuff to use Newlib instead of KOS libc/libm kos: remove broken half-finished stuff from fs_dcload.c (whoops) kos: still yet more joy of Newlib updates kos: add newlib KOS patch kos: add byteorder.c to koslib tree... apparently Newlib didn't bother kos: remove CVSID from bspline.c kos: add timer_us_gettime64() kos: patches from Jim Ursetto for multi-threaded libstdc++ compilation kos: add file headers to new libc/newlib files kos: allow free(NULL) to work fine in debug mode kos: fix a few issues with scif_init and dcload-serial kos: add info about user-entered date in syscfg_t (thanks Thierry Vermeylen) Modify KOS default rules to include regular CFLAGS and CXXFLAGS so ports can kos: leaner, meaner kosh sample kos: fix 'adventure' sample to work with new compilers and newlib kos: Modem driver version 1.2 from Nick Kochakian kos: fix AICA volume setting (Jim Ursetto) kos: fix RLE in gdb_stub (Richard Moats) kos: fix an image-garbling bug in vqenc (Richard Moats) kos: fix mipmap generation (Richard Moats) kos: DMA support for BBA, improved SPU DMA support, and G2 DMA generic kos: make vmu_pkg params const to avoid warnings/errors kos: update netcfg to support adding a VMU icon (Sam Steele) kos: update hello world Makefile VMUFS fixes from Tursi [partial] Add block write retrying to vmu block-level driver. This idea was suggested Add reverse-derivation comment for baud rate factor (useful for checking Move BBA thread creation to if_start/if_stop to avoid having an extra thread Fix for issues with inserting/removing purupuru packs at runtime kos: Make thd_sleep(0) work properly. kos: Return value is optional in pthread_join kos: Make kos-cc wrapper work with C++ autoconf tests kos: Fix kos-ranlib to not include a bunch of meaningless parameters kos: Patch #701892 from SourceForge: kos: Patch #1552702 from SourceForge: kos: Patch #1552720 from SourceForge: Patch #1553384 from SourceForge: Patch #1553421 from SourceForge: kos: Missed part of revision #358 (patch #1552702 from SF) kos: Fix romdisk name matching, from mailing list: kos: Some makefile fixes in examples kos: Still yet more joy of example fixes kos: More example fixes, some by me, some from here: kos: Add simple Blender model export plugin kos: Add dc-chain updated to GCC 3.4.6: kos: Add execve() stub kos: Add OSX build stuff to vqenc makefile kos: Revert limits.h change earlier.. breaks other stuff kos: realpath() is using the wrong getcwd()... need to fix in newlib probably kos: Don't try to shutdown net if it wasn't initted; causes crash in Fix commented out paths in dc-chain (thanks Christian Henz) Donald Haase (3): B and G values were swapped in the last update to screenshot.c. Fixed. Modified dc-chain make to allow kos to be in root folder other than 'kos' Merge branch 'master' of ssh://cadcdev.git.sourceforge.net/gitroot/cadcdev/KallistiOS Harley Laue (23): Applied patch that removes .stack during kos-objcopy. Opps, typo When is an unsigned char ever less than zero? Moved check for free(NULL) up in code to avoid potential problems. Removed legacy libc and libm. I should probably try to remember to update the CHANGELOG with every commit Fixed GBA arch/types.h so cross compiler can be made. Some more changes to allow the GBA port to compile. It's still far from working, but it's a start. Added some doxygen comments to the assert.h and cdrom.h A few more doxygen comments/updates KOS as of commit 657 requires newlib 1.15.0. We don't actually want multiple sourcing of environ.sh to keep old values. Documented a standard C header Changed flashrom_write's NOTE to doxygen \note Added Doxygen comments to sys/dirent.h Removed trailing whitespace Pull dreamcast specific ldscript from environ_base.sh Make formatting consistent across all files Add in required stubs directory Added a gitignore Attempt to fix a possible parallel build issue Updated gitignore to ignore some more things in examples Updated environ.sh.sample to reflect defaults in dc-chain Lawrence Sebald (302): Added support for PVR sprites. Adding in the new network system... Fixing a rather stupid error on my part here... Adding automatic configuration of bba from the flashrom Forgot to commit the updated header file, fixing that problem now. Adding in the maple microphone driver that I wrote a while ago... Finally adding a purupuru driver that makes a purupuru rumble on demand. Committing a change to the LA driver to make it work with the new network code Adding in skeleton Dreameye driver to make detection work. Committing waltervn's patch for the newlib patch Committing experimental render to texture support and an example using it. Adding in a minor change to kos-cc to make my copy of autoconf happy. Adding in a minor fix to the ARP handling code so that if an incomplete entry is encountered in the lookup code, it returns failure, rather than silently returning an invalid mac address. Adding in the first of the big network changes that I have been working on. Adding in some more networking changes. This set is some code formatting corrections, along with getting rid of net_ntohs and net_ntohl usage in many places. Another networking change coming up. This is a bit of cleaning in the net_ipv4.c file. This is the last of the big networking changes for now. This update adds a completely new UDP system, and a working sockets system to go along with it. Committing two fixes to the sockets and related code: Fixed a crashing issue in the ARP shutdown code and made the ARP code garbage collect expired entries on each lookup. Got rid of net_ntohl and net_ntohs, considering ntohl and ntohs have been in here for a while. Added in code to support polling receives on the BBA. Also, made it so that this new functionality works in an irq. Added in a short delay during initialization of the lan adapter. Mine seems to need a delay after initialization before sending anything out on it. Rearranged the network shutdown stuff so that it happens in a more correct order. Made it so that the IPv4 input code does not pass around ethernet headers. Also, fixed a few little issues with ping packet sending. Made net_ipv4_checksum accept the number of bytes in the data to be checksummed rather than the number of words. Made the UDP code so that it works in an irq properly. Adding in a few more inet functions for dealing with parsing and packing internet addresses. A small fix for the texture_render example. No more cast expressions as lvalues... A little cleaner way of dealing with those lvalue casts. Committing C-style comments patch from quzar. Changed what was /// comments (that got changed to /* ... */ in r551) to /** ... */ comments. Got rid of the condvar in the UDP code... It wasn't really right in the first place to use it, so now its gone. Committing patch 1900235 - Newlib patch for dc-chain. A little bit of reformatting, as well as a new function in net_ipv4.c A bunch of changes to the UDP code that all amount to just about nothing really gained. Included in this are the following: A slight modification to net_default_input, as well as a more sane way to handle loopback sends in net_ipv4 (sending it directly back into net_ipv4_input). Changing the behavior when a send is attempted to a host that does not have a cached ARP entry. Now, net_arp_lookup will return -2, signaling that an ARP query has been sent out. net_ipv4_send_packet detects this condition and returns this to the caller (net_udp_send_raw at this point). net_udp_send_raw sees this condition returned from net_ipv4_send_packet, and retries the transmission after 100ms. Thus, the first send to hosts won't fail in UDP any more, unless the host does not respond to the ARP query (i.e. its not actually there). Two things in this commit: Adding implementations of read, write, and seek on sockets. Adding in a new synchronization primitive: reader/writer semaphores, along with an example program for them. Oops... forgot a few things. Fix an extremely unlikely memory leak in the UDP sockets code. (Who would ever try to create a new socket in an interupt anyway?) Adding in VMU beeping support as written by Donald Haase (Tracker item #1961770). Add support for "upgrading" a reader/writer semaphore from a read lock to a write lock. So, uhh... the KOS CHANGELOG hadn't been updated since November of 2003. This commit fixes that issue. Hopefully I didn't miss any important changes (or credit them to the wrong person). Hopefully this will never happen again as it took far too long to go through all the SVN logs to do it after 4 and a half years. Adding in another new synchronization primitive: recursive locks, along with an example/test program for them. -fno-crossjumping has been needed for a while. I'm not quite sure why the environ file didn't have it in there, but its there now (thanks waltervn). Almost forgot to update the CHANGELOG... - Add g2_memset_8 function. Adding in rewritten microphone driver that now supports more than just the 16-bit signed @ 11025Hz encoding for samples. Add maple_enum_type_ex function and capability defines for the controller to go along with it. Committing Donald Haase's vid_screen_shot patch (Tracker Item #2088266). A few changes in the network code to support sending/receiving broadcast packets properly. Also, catch all of 127.x.y.z as loopback addresses, as it is supposed to be. Adding in code to fetch ISP settings that are set by PlanetWeb. Also, this commit includes various fixups for the fact that the flashrom_ispcfg_t struct got a bit of a makeover in the process so that it supports both PlanetWeb and DreamPassport in a generic fashion. Adding in an implementation of DHCP to the network stack. I apologize for the huge email this will probably generate, but it really needed to be done. Removing the old Maple API from a bunch of examples. Updating another bunch of examples to not use the old Maple API. More examples claned to not use the old Maple API. Mark the old Maple API compatibility functions as deprecated. Clean up a whole bunch of warnings. Fix maple_enum_type_ex so that it actually works as advertised. Prevent an infinite loop if maple_dev_status is called on a microphone before it has started sampling at all. Adding in a new Dreameye driver that can grab saved images off of the Dreameye. Committing most of patch #2581322 from the tracker -- A bit of a cleanup of the maple code (mostly dealing with attaching and detaching of devices). Divide up image transfers between all of the sub-devices on the Dreameye. Fix a bug in rlock_init if malloc were to return NULL for some reason. Adding functionality like pthread_once, along with an example for its use. Adding in thread-local storage support. Added missing __END_DECLS Remove two variables from thread.h that are actually static in thread.c. Initial GCC 4.x support and various warning cleanups Adding in a linker script to be used with GCC 4.x... The default one puts the .init segment in a rather stupid place (0x1000, I think), which of course won't work all that well. Also, this one prunes away the useless .stack segment. Adding in timed wait on a recursive lock. Adding support for untextured PVR sprites. Adding in support functions for modifier volumes and a simple example. Better support for modifier volumes (really for the polygons affected by them), and an example of how to use modifiers with textures. Adding in simple statistics system for IPv4 and UDP (and fixing comment at the top of the second modifier volume example). Add the MTU of the interface to the netif structure and some fixups for DHCP. Wait on an object that actually will exist when the DHCP request is fulfilled. Added IP fragmenting support. Adding in new network thread code. Various bits and pieces of the network stack are likely to need to use threads for some part of their operation now, so devote one thread to that purpose. Also, add the beginnings of IP reassembly (just reject fragments for now). Adding in IP reassembly support and some fixes to ICMP. Further work on IP reassembly: Support for multiple framebuffers when the PVR isn't being used. Initialize the target dbgio device when switching devices. Add biosfont-based framebuffer dbgio interface. Remove pointless underscores in the ping_pkt structure name. Fix stupid possible bug in cleaning up the fragment list. Reorder init/shutdown of the network components, don't allow net_init to be called twice without shutting it down, and fix some indentation issues. Fix a stupid bug with non-textured sprites. Add a couple of events related to GD-ROM DMA. Adding in an updated Doxygen configuration (it pretty much stays true to the old one in how everything's set up), but will play nicer with newer versions of Doxygen. Ok... I didn't really mean for this commit to be so large, but apparently I haven't committed anything in a long while... This seems a bit more sane for thd_schedule_next... Adding in "ping" example. Adding patches to support GCC 4.4.0 and 4.4.4. Remove the lock_common.h file, since its effectively the same thing as <sys/lock.h> anyway. Warning cleanup based on GCC 4.4.4. Adding Doxygen comments to sys/socket.h. Add Doxygen comments to the Dreameye driver. Add Doxygen comments to the SIP and Puru Puru drivers. Adding Doxygen comments to the rest of the maple device drivers. Add Doxygen comments to a bunch of things, and clean the ones in assert.h up a little bit. Add Doxygen comments to a few more files, and fix a few comments in other ones. More Doxygen comments... fs_builtin has been gone for a while now, why these remnants are here, I have no idea. More Doxygen comments, and some cleanup on existing ones. More Doxygen comments... Add support for sending ICMPv4 Destination Unreachable and Time Exceeded packets. Also, change how ICMPv4 Echo packets are handled slightly. Adding IPv6 address parsing support to inet_pton. Fix double colons with IPv4 address embedded inside an IPv6 address in inet_pton6. Add a few more IPv6-related macros to <netinet/in.h>. - Change the IPv4 checksum function a little bit, so that we'll be able to calculate checksums with pseudo-headers a bit easier. - Fix a major bug in net_udp. Add the rest of the IN6_IS_ADDR_* macros to <netinet/in.h> from IEEE 1003.1-2008. Clean up warnings on some of the IN6_IS_ADDR_* macros, and fix a few others so they actually work. Adding in a whole bunch of stuff that's been worked on over the past few days: Reverting r671 for stream.drv. It shouldn't have ever been changed in the first place. A few more networking things in this commit: - Add a net_ipv4_checksum_pseudo() function that calculates the checksum over just the pseudo header (like the net_ipv6_checksum_pseudo() function). Add struct sockaddr_storage. - Send an ICMPv6 parameter problem if we don't know how to handle a next_header value that we get in IPv6. Add doxygen comments to the modem driver headers. Adding in code to do MD5 checksums to libkosutils. A bit random, but I did originally write this for something that was for KOS... - Mark all children of the root directory as directories in a readdir. Adding in a little bit of a rework of the threading code that I decided to do. This new version has a few nice improvments, namely: Fix threading examples so they comply with the new threading system. Fix up a few more examples that use threads so that the new thread stuff doesn't cause problems with them directly. Adding in patches for GCC 4.5.2 and Newlib 1.19.0. These are updated for all the new stuff in the thread code. Fixing up dc-chain so it builds the latest version of everything... This is a little bit better version of stat(). At least this one will work for a few common use-cases of it... Add a note to the dc-chain README to not use multiple jobs with make. This aught to fix ARGB1555 support in kmgenc. Colorized biosfont code, based on that by Chilly Willy. Its not exactly the same as his version, but it is a bit more general this way. No real need to keep state about pings... Do the same for IPv4 pings. Add in pthread-mapped TLS functionality. Copy IPv6 addresses passed into inet_ntop into an internal buffer to deal with any sort of alignment issues... Add Doxygen comments to a bunch of sound-related stuff... Add in some more doxygen comments... Document the net.h file... Even more doxygen comments. Getting much closer to having everything documented... Fix something I inadvertantly broke... Committing the first big batch of documentation on pvr.h... This is not at all finished, but its a good start... 2002 called. They wanted to ask why this stuff was still around today. Finally its time to kill off the old Maple API... Fix a bug if you were to try to open the same list that is already open in the PVR code. Finished documentaton of pvr.h and fixed a few things in net.h. Fixing header file references on some structs... Doxygen comments in maple.h. Document most of g2bus.h, with the exception of the DMA stuff for now. Clean up the cdrom.h documentation a bit, and rename set_sector_size() to cdrom_set_sector_size() for consistency. Document asic.h and make a few asic-related internal functions actually static. Document arch.h. Document a few little files that really don't have much content to them. Document irq.h. Document mmu.h. A few small things in this commit: Documentation of threading stuff... Binutils 2.21 seems to have disappeared from the GNU FTP site, so use 2.22 instead. <Ayla> last patch, kernel/fs/fs.c:134 should return NULL, not 0 Protect fs_dup() and fs_dup2() against invalid file descriptors. Document kos/fs.h. Remove endian.h. Its unused and not needed. Document that this file is undocumented in the KOS docs and defer to the POSIX standard for documentation. Update the release notes... Things are starting to look a lot more like we might get a release done in the next year. ;) Finish doxygen documentation! Fix pvrmap example. #include <zlib.h> by itself, as it doesn't seem to be necessarily included by png.h. Link with libm, since some platforms need it and it probably won't hurt either way. Fix libtremor reliance on non-standard endian.h header, and provide the relevant parts elsewhere in header files. A few documentation updates... Fix compilation of two examples that didn't compile before. Fix a few things in the fs_dclsocket init before they become problems... Disable the dbgio interface when dclsocket is enabled, not when its disabled. Actually do 10 pings, like the comment says. Move the hop limit calculation up earlier in the IPv6 packet send function. This way, if we revert to IPv4, we have a sane ttl when the incoming hop limit was 0. Make dbgio_enable() and dbgio_disable() actually do something useful. Use dbgio_enable() and dbgio_disable() around fs_dclsocket, rather than doing things the hacky way they were done before. A few changes to how the internal networking stack works (some are quite major): Don't send spurrious protocol unreachable messages from IPv4... Make it so you can receive packets on UDP over IPv6. Add simple example of IPv6 UDP sockets. Rename the input function for UDP and add SOCK_STREAM to sys/socket.h. A bit of preliminary initial work on TCP. A few networking things in this revision: Make the make_banner.sh script show the SVN revision number on a copy of the repository checked out from SVN rather than the rather unhelpful ##version##. Treat destroying a recursive lock more like destroying any other sync primitive is. Free packets attached to an ARP request when we shut down. Make the network shutdown function so that it doesn't crash when called in an IRQ. Add ARP/NDP entries on incoming packets. Clarify a couple of error cases... Fix checksum calculation on packets with size >= 256. Slightly nicer checksum function. Two things here: Change the default stack size from 8192 bytes to 32768. Two small things in thread creation: Make DHCP shutdown clean things up a bit nicer... Have the echo server print out the IPv4 address as well, since IPv6 sockets work with IPv4 as well. Hrm, I wonder what this is. ;-) 1. Add setsockopt(), getsockopt() and fs_fcntl() functions. Add fcntl support to fs_romdisk, fs_ramdisk, and fs_pty. Support fcntl in fs_vmu, fs_dclsocket, fs_iso9660, and fs_dcload. Some of these are a bit hackish, but they should work for what we need them for. Add patches for GCC 4.7.0 and Newlib 1.20.0 to dc-chain, and update it to use them. A few changes to go along with the update for GCC 4.7.0 and Newlib 1.20.0. Add initializers for transient semaphores, condvars, and mutexes. Add poll() and its support work in the fs and network stuff. Add the select() function. Make it so that stdin/stdout/stderr will be set as line buffered (newlib has to think they're ttys if we have fcntl, which we do now). Change around how mutexes work. Old code should continue to work just fine, but should be updated to not use mutex_create() anymore. Also, if you were using the recursive lock stuff, update it to use a mutex of type MUTEX_TYPE_RECURSIVE. A few documentation fixups... A few new things in here: Revert to GCC 4.5.2 for now, due to issue with GCC 4.7.0 and frame pointers on sh-elf. Add genwait_wake_thd() function. Check the timeout value in mutex_lock_timed(), as the documentation implies we do. Actually document the select() function. Update reader/writer semaphores a bit (adding a few new functions and such). Two things: Fix the environ.sh.sample to more accurately match up with the state of things. Fix a few condvar functions to return int (and report possible errors), like their POSIX friends do. Updating the GCC patches... Back to GCC 4.7.0 we go, now that there's a working patch. No need for magic numbers for fsca and fsrra, considering binutils has supported them for sh4 since 2004. Add missing directories... Testing a commit from git... Testing again... sorry about the noise... Remove the testing file from earlier.... A bit less pointless of a test... Add a few things to the changelog... Hopefully this will be the last of the pointless noise... Sorry again... Add a few more things to the .gitignore file. Copy the kmg.h file into kmgenc and vqenc so that they can compile without needing kos-ports around. Make it so some of the util programs compile properly and add clean targets to some Makefiles. Instead of defining struct timeval ourselves in <sys/select.h>, just include <sys/time.h>, which defines it (and is allowed by the SUS). Remove pointless comment that I missed... Fix a mistake in the documentation for SPU DMA. Don't jump off the end of the keymaps in kbd_enqueue with non-US keyboards. Merge branch 'master' of ssh://cadcdev.git.sourceforge.net/gitroot/cadcdev/KallistiOS Grab the region/type of keyboard on keyboard attach. Fix a small documentation issue. A few changes to keyboard handling... Include dc/maple.h from any of the maple device headers that use maple_device_t. Add in low-level support for the SD card reader attached to the serial port. Add CRC16-CCITT to the net_crc.c file. Rename scif_sd -> scif_spi. Well, that was a rather silly bug... Move the delays before setting the CTS line. Add in raw block access to SD cards and fix a few random commenting issues... Add in some flags for send(), sendto(), recv(), and recvfrom(). Add missing __END_DECLS. Add symbolic links to the types that can be reported from fs_stat. Add basic block device interface. Add a SD card block device. Add in ext2fs. Adding in example of using ext2fs with the sd driver. This commit adds a few new things in libkosext2fs: Protect against infinite loops caused by circular symbolic links. Clean up a few paths in libkosext2fs where functions might return while still holding the mutex. Add a method to resolve all symlinks in a path except at the end of the path in the inode lookup function in libkosext2fs. A few changes to directory and inode handling in libkosext2fs. Add missing txrenv stuff to sprites. Add new inode cache to libkosext2fs. Fix a two rather stupid bugs with fs_ext2. Add authors list and update the license section in the README.KOS file. Change how threads are swapped a little bit. A few changes in libkosext2fs: Remove a stray printf... Use the git commit hash in the make_banner.sh script. Add a function to sync the filesystem back to the block device. At the moment, there's no other write support, so this doesn't really do much right now. Add support for unlink and rmdir to fs_ext2. Fix a small mistake in the last commit. Get rid of a debugging printf I left in by mistake... Furthering write support in libkosext2fs a bit... Furthering write support in libkosext2fs a bit... Merge branch 'master' of ssh://git.code.sf.net/p/cadcdev/kallistios Moving right along with write support, here comes renaming in libkosext2fs. Continuing with write support in libkosext2fs: Fix a few error conditions in libkosext2fs. Account for xattr blocks in ext2_inode_read_block and ext2_inode_alloc_block. Add write() support to fs_ext2. Make sure changes get written back to the block device when unmounting a fs in fs_ext2. Add the fs_ext2_sync() function to sync all changes to the block device. Optionally write a file in the ext2fs example. Revert stream.drv. Fix a silly issue with 2352 byte sector reads in the cdrom code. Add fs_link and fs_symlink now that they're somewhat relevant (with libkosext2fs). Add a symlink() function to koslib. Add support for creating hard links to libkosext2fs. Add support for creating symlinks to fs_ext2. Add a mke2fs program to the examples. In fs_copy, make sure to open the destination with the O_CREAT flag, otherwise some filesystems that require that flag for creating a file (fs_ext2) will fail to copy. Fix a rather stupid error in reading blocks from a file in fs_ext2. Fix a bunch of nasty bugs in fs_ext2: Update some documentation (FAQ, README, RELNOTES). Update the CHANGELOG. Add 64-bit versions of some VFS functions. 64-bit file access in fs_ext2, ahoy! Add example program using fs_ext2 to copy Dreameye images to. Oops... That was supposed to be uncommented. A few dc-chain updates: Fix the link for downloading Newlib. New banner code. This one also includes license and authors for easy access to display them in your programs. Richard Moats (4): GDB-over-dcload Hard breakpoints / watchpoints using User Break Controller fix staggered channel start that caused phase error in stereo streams switch order of include so aica.h has uint32 type Sam Steele (4): KOS: adjust makejitter Makefile so it can find the kos-ports headers KOS: fs_iso9660: fill in dirent.attr for directories, and apply Christian Grossler's patch for opening correct filenames Fix bitmask for mouse buttons so 3rd button is usable (thanks to Fragger) Support for building gdb and insight for dc-chain, patch contributed by Christian Henz ----------------------------------------------------------------------- hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-05-20 23:32:14
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 137c2ca7ad704991c1cab991408cace63bf315f2 (commit) from 2e6eabf986c1e560eb284c9c0a071686a27cb8d0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 137c2ca7ad704991c1cab991408cace63bf315f2 Author: Lawrence Sebald <ljs...@us...> Date: Mon May 20 19:30:45 2013 -0400 New banner code. This one also includes license and authors for easy access to display them in your programs. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/include/arch/arch.h | 38 +++++++++++++++++++ kernel/arch/dreamcast/kernel/Makefile | 14 +++++--- kernel/arch/dreamcast/kernel/banner.c | 48 +++++++++++++++++++++++++ kernel/arch/dreamcast/kernel/init.c | 5 +-- kernel/arch/dreamcast/kernel/make_authors.awk | 33 +++++++++++++++++ kernel/arch/dreamcast/kernel/make_banner.sh | 36 +++++++++--------- 6 files changed, 147 insertions(+), 27 deletions(-) create mode 100644 kernel/arch/dreamcast/kernel/banner.c create mode 100644 kernel/arch/dreamcast/kernel/make_authors.awk diff --git a/kernel/arch/dreamcast/include/arch/arch.h b/kernel/arch/dreamcast/include/arch/arch.h index 47f65ba..76413a8 100644 --- a/kernel/arch/dreamcast/include/arch/arch.h +++ b/kernel/arch/dreamcast/include/arch/arch.h @@ -2,6 +2,7 @@ arch/dreamcast/include/arch.h Copyright (C) 2001 Dan Potter + Copyright (C) 2013 Lawrence Sebald */ @@ -218,6 +219,43 @@ int hardware_periph_init(); */ void hardware_shutdown(); +/* These three aught to be in their own header file at some point, but for now, + they'll stay here. */ + +/** \brief Retrieve the banner printed at program initialization. + + This function retrieves the banner string that is printed at initialization + time by the kernel. This contains the version of KOS in use and basic + information about the environment in which it was compiled. + + \retval A pointer to the banner string. +*/ +const char *kos_get_banner(void); + +/** \brief Retrieve the license information for the compiled copy of KOS. + + This function retrieves a string containing the license terms that the + version of KOS in use is distributed under. This can be used to easily add + information to your program to be displayed at runtime. + + \retval A pointer to the license terms. +*/ +const char *kos_get_license(void); + +/** \brief Retrieve a list of authors and the dates of their contributions. + + This function retrieves the copyright information for the version of KOS in + use. This function can be used to add such information to the credits of + programs using KOS to give the appropriate credit to those that have worked + on KOS. + + Remember, you do need to give credit where credit is due, and this is an + easy way to do so. ;-) + + \retval A pointer to the authors' copyright information. +*/ +const char *kos_get_authors(void); + /** \brief Dreamcast specific sleep mode "function". */ #define arch_sleep() do { \ __asm__ __volatile__("sleep"); \ diff --git a/kernel/arch/dreamcast/kernel/Makefile b/kernel/arch/dreamcast/kernel/Makefile index c0132a6..c813216 100644 --- a/kernel/arch/dreamcast/kernel/Makefile +++ b/kernel/arch/dreamcast/kernel/Makefile @@ -19,15 +19,19 @@ SUBDIRS = myall: $(OBJS) -cp $(COPYOBJS) $(KOS_BASE)/kernel/build/ - -rm banner.c banner.o + -rm banner.h banner.o authors.h include $(KOS_BASE)/Makefile.prefab banner.o: banner.c -banner.c: make_banner.sh +banner.c: banner.h authors.h + +banner.h: make_banner.sh ./make_banner.sh - #echo 'char banner[] = "KallistiOS ##version##: $(shell date)\n $(shell whoami)@$(shell hostname):$(KOS_BASE)\n";'>$@ + +authors.h: make_authors.awk + awk -f make_authors.awk < ../../../../AUTHORS > authors.h arch_exports.o: arch_exports.c @@ -35,9 +39,9 @@ arch_exports.c: ../exports.txt $(KOS_BASE)/utils/genexports/genexports.sh ../exports.txt arch_exports.c arch_symtab clean: - -rm -f banner.c + -rm -f banner.h authors.h -rm -f $(OBJS) -rm -f arch_exports.c -rm -f arch_exports.c -.PHONY: banner.c +.PHONY: banner.h authors.h diff --git a/kernel/arch/dreamcast/kernel/banner.c b/kernel/arch/dreamcast/kernel/banner.c new file mode 100644 index 0000000..c69d85e --- /dev/null +++ b/kernel/arch/dreamcast/kernel/banner.c @@ -0,0 +1,48 @@ +/* KallistiOS ##version## + + banner.c + Copyright (C) 2013 Lawrence Sebald +*/ + +#include "banner.h" +#include "authors.h" + +static const char license[] = +"Copyright (C) 1997-2013 KallistiOS Contributors. All rights reserved.\n" +"\n" +"Redistribution and use in source and binary forms, with or without\n" +"modification, are permitted provided that the following conditions\n" +"are met:\n" +"1. Redistributions of source code must retain the above copyright\n" +" notice, this list of conditions and the following disclaimer.\n" +"2. Redistributions in binary form must reproduce the above copyright\n" +" notice, this list of conditions and the following disclaimer in the\n" +" documentation and/or other materials provided with the distribution.\n" +"3. Neither the name of Cryptic Allusion nor the names of its contributors\n" +" may be used to endorse or promote products derived from this software\n" +" without specific prior written permission.\n" +"\n" +"THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND\n" +"ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" +"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n" +"ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE\n" +"FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n" +"DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n" +"OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n" +"HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n" +"LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n" +"OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" +"SUCH DAMAGE."; + +const char *kos_get_banner(void) { + __asm__ __volatile__("nop" : : "r"(license), "r"(authors)); + return banner; +} + +const char *kos_get_license(void) { + return license; +} + +const char *kos_get_authors(void) { + return authors; +} diff --git a/kernel/arch/dreamcast/kernel/init.c b/kernel/arch/dreamcast/kernel/init.c index 0fd271b..b93e79e 100644 --- a/kernel/arch/dreamcast/kernel/init.c +++ b/kernel/arch/dreamcast/kernel/init.c @@ -32,9 +32,6 @@ void __verify_newlib_patch(); /* Ditto */ int main(int argc, char **argv); -/* Double-ditto */ -extern const char banner[]; - /* We have to put this here so we can include plat-specific devices */ dbgio_handler_t * dbgio_handlers[] = { &dbgio_dcload, @@ -72,7 +69,7 @@ int arch_auto_init() { else { // PTYs not initialized yet dbgio_write_str("\n--\n"); - dbgio_write_str(banner); + dbgio_write_str(kos_get_banner()); } timer_init(); /* Timers */ diff --git a/kernel/arch/dreamcast/kernel/make_authors.awk b/kernel/arch/dreamcast/kernel/make_authors.awk new file mode 100644 index 0000000..8306288 --- /dev/null +++ b/kernel/arch/dreamcast/kernel/make_authors.awk @@ -0,0 +1,33 @@ +# KallistiOS ##version## +# +# arch/dreamcast/kernel/make_authors.awk +# Copyright (C) 2013 Lawrence Sebald + +# This script processes the AUTHORS file in the root directory of the source +# distribution to create the authors.h file that is needed in banner.c. This +# gives a relatively easy way to give credit to the people who have made KOS +# what it is over the years in your programs by simply using the compiled-in +# string with copyright information. +# +# Since this script relies on the format of the file as it stands now, if the +# formatting of the AUTHORS list changes, this will need to be updated as well. +BEGIN { + FS = ":"; + phase = 0; +} +{ + if($0 == "Contributors list (under the normal KOS license):") { + phase = 1; + } + else if($0 == "-------------------------------------------------" && phase == 1) { + phase = 2; + print "static const char authors[] = "; + } + else if($0 == "Files with Specific licenses:") { + print ";\n"; + exit; + } + else if(phase == 2 && $0 != "") { + print "\"Copyright (C)" $2, $1 "\\n\""; + } +} diff --git a/kernel/arch/dreamcast/kernel/make_banner.sh b/kernel/arch/dreamcast/kernel/make_banner.sh index 0098d90..78416d7 100755 --- a/kernel/arch/dreamcast/kernel/make_banner.sh +++ b/kernel/arch/dreamcast/kernel/make_banner.sh @@ -1,31 +1,31 @@ #!/bin/bash -# Re-creates the banner.c file for each compilation run +# Re-creates the banner.h file for each compilation run -echo 'char banner[] = ' > banner.c +echo 'static const char banner[] = ' > banner.h -echo -n '"KallistiOS ' >> banner.c +echo -n '"KallistiOS ' >> banner.h if [ -d "$KOS_BASE/.git" ]; then - echo -n 'Git revision ' >> banner.c - echo -n `git rev-list --full-history --all --abbrev-commit | head -1` >> banner.c - echo -n ': ' >> banner.c + echo -n 'Git revision ' >> banner.h + echo -n `git rev-list --full-history --all --abbrev-commit | head -1` >> banner.h + echo -n ': ' >> banner.h else - echo -n '##version##: ' >> banner.c + echo -n '##version##: ' >> banner.h fi -echo -n `date` >> banner.c -echo '\n"' >> banner.c +echo -n `date` >> banner.h +echo '\n"' >> banner.h -echo -n '" ' >> banner.c -echo -n `whoami` >> banner.c -echo -n '@' >> banner.c +echo -n '" ' >> banner.h +echo -n `whoami` >> banner.h +echo -n '@' >> banner.h if [ `uname` = Linux ]; then - echo -n `hostname -f` >> banner.c + echo -n `hostname -f` >> banner.h else - echo -n `hostname` >> banner.c + echo -n `hostname` >> banner.h fi -echo -n ':' >> banner.c -echo -n $KOS_BASE >> banner.c -echo '\n"' >> banner.c +echo -n ':' >> banner.h +echo -n $KOS_BASE >> banner.h +echo '\n"' >> banner.h -echo ';' >> banner.c +echo ';' >> banner.h hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-05-18 22:52:13
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 2e6eabf986c1e560eb284c9c0a071686a27cb8d0 (commit) from 326499749579f54a820ad565627aa80ed6a52ae6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2e6eabf986c1e560eb284c9c0a071686a27cb8d0 Author: Lawrence Sebald <ljs...@us...> Date: Sat May 18 18:51:55 2013 -0400 Fix the link for downloading Newlib. ----------------------------------------------------------------------- Summary of changes: utils/dc-chain/download.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/utils/dc-chain/download.sh b/utils/dc-chain/download.sh index 3c0a5ae..b61cee4 100755 --- a/utils/dc-chain/download.sh +++ b/utils/dc-chain/download.sh @@ -1,5 +1,5 @@ #!/bin/sh wget -c ftp://ftp.gnu.org/gnu/binutils/binutils-2.23.2.tar.bz2 || exit 1 wget -c ftp://ftp.gnu.org/gnu/gcc/gcc-4.7.3/gcc-4.7.3.tar.bz2 || exit 1 -wget -c ftp://sources.redhat.com/pub/newlib/newlib-2.0.0.tar.gz || exit 1 +wget -c ftp://sourceware.org/pub/newlib/newlib-2.0.0.tar.gz || exit 1 hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-05-18 17:35:29
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 326499749579f54a820ad565627aa80ed6a52ae6 (commit) from 816c924ac59d3e9a47da4da993139a7490b8f59a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 326499749579f54a820ad565627aa80ed6a52ae6 Author: Lawrence Sebald <ljs...@us...> Date: Sat May 18 13:32:54 2013 -0400 A few dc-chain updates: 1. Update the packages to the following versions: Binutils 2.23.2 GCC 4.7.3 Newlib 2.0.0 2. Add a makejobs variable to the Makefile to allow multiple jobs to be spawned for building the tools. 3. Fix an issue that would cause the Makefile to not fail when verbose was set to 1 and one of the jobs spawned failed. This is probably the most often reported issue with this thing... ----------------------------------------------------------------------- Summary of changes: utils/dc-chain/00README | 7 +- utils/dc-chain/Makefile | 42 ++++-- utils/dc-chain/download.sh | 6 +- .../{gcc-4.7.0-kos.diff => gcc-4.7.3-kos.diff} | 56 +++----- ...ewlib-1.20.0-kos.diff => newlib-2.0.0-kos.diff} | 136 +++++++++++--------- utils/dc-chain/unpack.sh | 8 +- 6 files changed, 137 insertions(+), 118 deletions(-) copy utils/dc-chain/patches/{gcc-4.7.0-kos.diff => gcc-4.7.3-kos.diff} (96%) copy utils/dc-chain/patches/{newlib-1.20.0-kos.diff => newlib-2.0.0-kos.diff} (70%) diff --git a/utils/dc-chain/00README b/utils/dc-chain/00README index f3ef74a..73a1e4b 100644 --- a/utils/dc-chain/00README +++ b/utils/dc-chain/00README @@ -22,7 +22,10 @@ its path in the Makefile, because some KOS includes are copied over to newlib. Finally, run make. If anything goes wrong, check the output in logs/. Some patches are included in this package as well. As of this writing, -they patch newlib-1.19.0 and gcc-4.5.2 to work with KOS. +they patch newlib-2.0.0 and gcc-4.7.3 to work with KOS. You should not attempt to spawn multiple jobs with make. Using "make -j2" or any -other number after the -j will probably break things. +other number after the -j will probably break things. There is however now an +option inside the Makefile to set the number of jobs for the building phases. +Set the makejobs variable in the Makefile to whatever you would normally feel +the need to use on the command line, and it will do the right thing. diff --git a/utils/dc-chain/Makefile b/utils/dc-chain/Makefile index e64b847..4dc1184 100755 --- a/utils/dc-chain/Makefile +++ b/utils/dc-chain/Makefile @@ -5,7 +5,8 @@ # Interesting parameters: # erase=0|1 Erase build directories on the fly to save space # thread_model=posix|single|kos Set gcc threading model -# verbose=0|1 Display +# verbose=0|1 Display +# makejobs=-jn Set the number of jobs for calls to make to n # # Interesting targets (you can 'make' any of these): # all: patch build @@ -24,13 +25,13 @@ sh_target=sh-elf arm_target=arm-eabi sh_prefix := /opt/toolchains/dc/$(sh_target) arm_prefix := /opt/toolchains/dc/$(arm_target) -# kos_root: KOS subversion root (contains kos/ and kos-ports/) +# kos_root: KOS Git root (contains kos/ and kos-ports/) kos_root=$(CURDIR)/../../.. # kos_base: equivalent of KOS_BASE (contains include/ and kernel/) kos_base=$(CURDIR)/../.. -binutils_ver=2.22 -gcc_ver=4.7.0 -newlib_ver=1.20.0 +binutils_ver=2.23.2 +gcc_ver=4.7.3 +newlib_ver=2.0.0 gdb_ver=6.7.1 insight_ver=6.7.1 # With GCC 4.x versions, the patches provide a kos thread model, so you should @@ -38,14 +39,25 @@ insight_ver=6.7.1 # threading support for C++ (or Objective C/Objective C++), you can set this to # single (why you would is beyond me, though). thread_model=kos -erase=0 +erase=1 verbose=1 + +# Set this value to -jn where n is the number of jobs you want to run with make. +# If you only want one job, just set this to nothing (i.e, "makejobs="). +# Tracking down problems with multiple make jobs is much more difficult than +# with just one running at a time. So, if you run into trouble, then you should +# clear this variable and try again with just one job running. +makejobs=-j4 + # Set the languages to build for pass 2 of building gcc for sh-elf. The default # here is to build C, C++, Objective C, and Objective C++. You may want to take # out the latter two if you're not worried about them and/or you're short on # hard drive space. pass2_languages=c,c++,objc,obj-c++ +# Change this if you don't have Bash installed in /bin +SHELL = /bin/bash + # Makefile variables install=$(prefix)/bin pwd := $(shell pwd) @@ -125,7 +137,8 @@ $(build_binutils): logdir -mkdir -p $(build) > $(log) cd $(build); ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) $(to_log) - make -C $(build) all install DESTDIR=$(DESTDIR) $(to_log) + make $(makejobs) -C $(build) DESTDIR=$(DESTDIR) $(to_log) + make -C $(build) install DESTDIR=$(DESTDIR) $(to_log) $(clean_up) $(build_gcc_pass1) $(build_gcc_pass2): build = build-gcc-$(target)-$(gcc_ver) @@ -136,7 +149,8 @@ $(build_gcc_pass1): logdir -mkdir -p $(build) > $(log) cd $(build); ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) --without-headers --with-newlib --enable-languages=c --disable-libssp --disable-tls $(extra_configure_args) $(to_log) - make -C $(build) all install DESTDIR=$(DESTDIR) $(to_log) + make $(makejobs) -C $(build) DESTDIR=$(DESTDIR) $(to_log) + make -C $(build) install DESTDIR=$(DESTDIR) $(to_log) $(build_newlib): build = build-newlib-$(target)-$(newlib_ver) $(build_newlib): src_dir = newlib-$(newlib_ver) @@ -146,7 +160,8 @@ $(build_newlib): logdir -mkdir -p $(build) > $(log) cd $(build); ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) $(extra_configure_args) $(to_log) - make -C $(build) all install DESTDIR=$(DESTDIR) $(to_log) + make $(makejobs) -C $(build) DESTDIR=$(DESTDIR) $(to_log) + make -C $(build) install DESTDIR=$(DESTDIR) $(to_log) $(clean_up) fixup-sh4-newlib: newlib_inc=$(DESTDIR)$(sh_prefix)/$(sh_target)/include @@ -172,7 +187,8 @@ $(build_gcc_pass2): logdir > $(log) cd $(build); ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) --with-newlib --disable-libssp --disable-tls \ --enable-threads=$(thread_model) --enable-languages=$(pass2_languages) $(extra_configure_args) $(to_log) - make -C $(build) all install DESTDIR=$(DESTDIR) $(to_log) + make $(makejobs) -C $(build) DESTDIR=$(DESTDIR) $(to_log) + make -C $(build) install DESTDIR=$(DESTDIR) $(to_log) $(clean_up) # ---- }}}} @@ -206,7 +222,7 @@ build_gdb_stamp: cd build-gdb-$(gdb_ver); ../gdb-$(gdb_ver)/configure \ --prefix=$(sh_prefix) \ --target=$(sh_target) $(to_log) - make -C build-gdb-$(gdb_ver) $(to_log) + make $(makejobs) -C build-gdb-$(gdb_ver) $(to_log) touch $@ install_gdb: log = $(logdir)/gdb-$(gdb_ver).log @@ -250,7 +266,7 @@ build_insight_stamp: cd build-insight-$(insight_ver); ../insight-$(insight_ver)/configure \ --prefix=$(sh_prefix) \ --target=$(sh_target) $(to_log) - make -C build-insight-$(insight_ver) $(to_log) + make $(makejobs) -C build-insight-$(insight_ver) $(to_log) touch $@ install_insight: log = $(logdir)/insight-$(insight_ver).log @@ -296,7 +312,7 @@ endif # If verbose=1, display output to screen as well as log files ifeq (1,$(verbose)) - to_log = 2>&1 | tee -a $(log) + to_log = 2>&1 | tee -a $(log) && [ $$PIPESTATUS -eq 0 ] else to_log = >> $(log) 2>&1 endif diff --git a/utils/dc-chain/download.sh b/utils/dc-chain/download.sh index 6babb66..3c0a5ae 100755 --- a/utils/dc-chain/download.sh +++ b/utils/dc-chain/download.sh @@ -1,5 +1,5 @@ #!/bin/sh -wget -c ftp://ftp.gnu.org/gnu/binutils/binutils-2.22.tar.bz2 || exit 1 -wget -c ftp://ftp.gnu.org/gnu/gcc/gcc-4.7.0/gcc-4.7.0.tar.bz2 || exit 1 -wget -c ftp://sources.redhat.com/pub/newlib/newlib-1.20.0.tar.gz || exit 1 +wget -c ftp://ftp.gnu.org/gnu/binutils/binutils-2.23.2.tar.bz2 || exit 1 +wget -c ftp://ftp.gnu.org/gnu/gcc/gcc-4.7.3/gcc-4.7.3.tar.bz2 || exit 1 +wget -c ftp://sources.redhat.com/pub/newlib/newlib-2.0.0.tar.gz || exit 1 diff --git a/utils/dc-chain/patches/gcc-4.7.0-kos.diff b/utils/dc-chain/patches/gcc-4.7.3-kos.diff similarity index 96% copy from utils/dc-chain/patches/gcc-4.7.0-kos.diff copy to utils/dc-chain/patches/gcc-4.7.3-kos.diff index ee592f3..cd3a5c4 100644 --- a/utils/dc-chain/patches/gcc-4.7.0-kos.diff +++ b/utils/dc-chain/patches/gcc-4.7.3-kos.diff @@ -1,19 +1,7 @@ -diff -ruN gcc-4.7.0/gcc/config/sh/sh.c gcc-4.7.0-kos/gcc/config/sh/sh.c ---- gcc-4.7.0/gcc/config/sh/sh.c 2012-03-05 13:52:44.000000000 -0500 -+++ gcc-4.7.0-kos/gcc/config/sh/sh.c 2012-06-09 21:58:01.000000000 -0400 -@@ -747,8 +747,6 @@ - if (! VALID_REGISTER_P (ADDREGNAMES_REGNO (regno))) - sh_additional_register_names[regno][0] = '\0'; - -- flag_omit_frame_pointer = (PREFERRED_DEBUGGING_TYPE == DWARF2_DEBUG); -- - if ((flag_pic && ! TARGET_PREFERGOT) - || (TARGET_SHMEDIA && !TARGET_PT_FIXED)) - flag_no_function_cse = 1; -diff -ruN gcc-4.7.0/gcc/configure gcc-4.7.0-kos/gcc/configure ---- gcc-4.7.0/gcc/configure 2012-03-08 08:54:54.000000000 -0500 -+++ gcc-4.7.0-kos/gcc/configure 2012-06-11 12:38:05.000000000 -0400 -@@ -11262,7 +11262,7 @@ +diff -ruN gcc-4.7.3/gcc/configure gcc-4.7.3-kos/gcc/configure +--- gcc-4.7.3/gcc/configure 2013-02-06 10:23:55.000000000 -0500 ++++ gcc-4.7.3-kos/gcc/configure 2013-05-17 21:30:40.000000000 -0400 +@@ -11338,7 +11338,7 @@ target_thread_file='single' ;; aix | dce | lynx | mipssde | posix | rtems | \ @@ -22,9 +10,9 @@ diff -ruN gcc-4.7.0/gcc/configure gcc-4.7.0-kos/gcc/configure target_thread_file=${enable_threads} ;; *) -diff -ruN gcc-4.7.0/libgcc/config/sh/crt1.S gcc-4.7.0-kos/libgcc/config/sh/crt1.S ---- gcc-4.7.0/libgcc/config/sh/crt1.S 2011-11-02 10:33:56.000000000 -0400 -+++ gcc-4.7.0-kos/libgcc/config/sh/crt1.S 2012-06-11 12:38:05.000000000 -0400 +diff -ruN gcc-4.7.3/libgcc/config/sh/crt1.S gcc-4.7.3-kos/libgcc/config/sh/crt1.S +--- gcc-4.7.3/libgcc/config/sh/crt1.S 2011-11-02 10:33:56.000000000 -0400 ++++ gcc-4.7.3-kos/libgcc/config/sh/crt1.S 2013-05-17 21:34:42.000000000 -0400 @@ -1,1369 +1,202 @@ -/* Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2009, 2011 - Free Software Foundation, Inc. @@ -1576,9 +1564,9 @@ diff -ruN gcc-4.7.0/libgcc/config/sh/crt1.S gcc-4.7.0-kos/libgcc/config/sh/crt1. - .ualong 0x0 -#endif /* VBR_SETUP */ -#endif /* ! __SH5__ */ -diff -ruN gcc-4.7.0/libgcc/config/sh/fake-kos.S gcc-4.7.0-kos/libgcc/config/sh/fake-kos.S ---- gcc-4.7.0/libgcc/config/sh/fake-kos.S 1969-12-31 19:00:00.000000000 -0500 -+++ gcc-4.7.0-kos/libgcc/config/sh/fake-kos.S 2012-06-11 13:31:28.000000000 -0400 +diff -ruN gcc-4.7.3/libgcc/config/sh/fake-kos.S gcc-4.7.3-kos/libgcc/config/sh/fake-kos.S +--- gcc-4.7.3/libgcc/config/sh/fake-kos.S 1969-12-31 19:00:00.000000000 -0500 ++++ gcc-4.7.3-kos/libgcc/config/sh/fake-kos.S 2013-05-17 21:34:42.000000000 -0400 @@ -0,0 +1,75 @@ +! Weakly linked symbols used to get GCC to hopefully compile itself properly. +! These will be replaced by the real symbols in actual compiled programs. @@ -1656,9 +1644,9 @@ diff -ruN gcc-4.7.0/libgcc/config/sh/fake-kos.S gcc-4.7.0-kos/libgcc/config/sh/f + mov #-1, r0 + \ No newline at end of file -diff -ruN gcc-4.7.0/libgcc/config/sh/gthr-kos.h gcc-4.7.0-kos/libgcc/config/sh/gthr-kos.h ---- gcc-4.7.0/libgcc/config/sh/gthr-kos.h 1969-12-31 19:00:00.000000000 -0500 -+++ gcc-4.7.0-kos/libgcc/config/sh/gthr-kos.h 2012-06-11 20:06:32.000000000 -0400 +diff -ruN gcc-4.7.3/libgcc/config/sh/gthr-kos.h gcc-4.7.3-kos/libgcc/config/sh/gthr-kos.h +--- gcc-4.7.3/libgcc/config/sh/gthr-kos.h 1969-12-31 19:00:00.000000000 -0500 ++++ gcc-4.7.3-kos/libgcc/config/sh/gthr-kos.h 2013-05-17 21:36:10.000000000 -0400 @@ -0,0 +1,355 @@ +/* Copyright (C) 2009, 2010, 2011, 2012 Lawrence Sebald */ + @@ -1719,7 +1707,7 @@ diff -ruN gcc-4.7.0/libgcc/config/sh/gthr-kos.h gcc-4.7.0-kos/libgcc/config/sh/g +#define __GTHREAD_COND_INIT COND_INITIALIZER + +static inline int __gthread_active_p(void) { -+ return 1; ++ return 1; +} + +#ifdef _LIBOBJC @@ -2015,9 +2003,9 @@ diff -ruN gcc-4.7.0/libgcc/config/sh/gthr-kos.h gcc-4.7.0-kos/libgcc/config/sh/g +#endif /* _LIBOBJC */ + +#endif /* ! GCC_GTHR_KOS_H */ -diff -ruN gcc-4.7.0/libgcc/config/sh/t-sh gcc-4.7.0-kos/libgcc/config/sh/t-sh ---- gcc-4.7.0/libgcc/config/sh/t-sh 2011-11-07 12:14:32.000000000 -0500 -+++ gcc-4.7.0-kos/libgcc/config/sh/t-sh 2012-06-11 13:30:55.000000000 -0400 +diff -ruN gcc-4.7.3/libgcc/config/sh/t-sh gcc-4.7.3-kos/libgcc/config/sh/t-sh +--- gcc-4.7.3/libgcc/config/sh/t-sh 2011-11-07 12:14:32.000000000 -0500 ++++ gcc-4.7.3-kos/libgcc/config/sh/t-sh 2013-05-17 21:33:11.000000000 -0400 @@ -24,6 +24,8 @@ $(LIB1ASMFUNCS_CACHE) LIB1ASMFUNCS_CACHE = _ic_invalidate _ic_invalidate_array @@ -2027,14 +2015,14 @@ diff -ruN gcc-4.7.0/libgcc/config/sh/t-sh gcc-4.7.0-kos/libgcc/config/sh/t-sh crt1.o: $(srcdir)/config/sh/crt1.S $(gcc_compile) -c $< -diff -ruN gcc-4.7.0/libgcc/configure gcc-4.7.0-kos/libgcc/configure ---- gcc-4.7.0/libgcc/configure 2012-01-23 01:25:28.000000000 -0500 -+++ gcc-4.7.0-kos/libgcc/configure 2012-06-11 12:38:05.000000000 -0400 -@@ -4801,6 +4801,7 @@ +diff -ruN gcc-4.7.3/libgcc/configure gcc-4.7.3-kos/libgcc/configure +--- gcc-4.7.3/libgcc/configure 2012-08-06 10:34:27.000000000 -0400 ++++ gcc-4.7.3-kos/libgcc/configure 2013-05-17 21:32:08.000000000 -0400 +@@ -4480,6 +4480,7 @@ tpf) thread_header=config/s390/gthr-tpf.h ;; vxworks) thread_header=config/gthr-vxworks.h ;; win32) thread_header=config/i386/gthr-win32.h ;; -+ kos) thread_header=config/sh/gthr-kos.h ;; ++ kos) thread_header=config/sh/gthr-kos.h ;; esac # Substitute configuration variables diff --git a/utils/dc-chain/patches/newlib-1.20.0-kos.diff b/utils/dc-chain/patches/newlib-2.0.0-kos.diff similarity index 70% copy from utils/dc-chain/patches/newlib-1.20.0-kos.diff copy to utils/dc-chain/patches/newlib-2.0.0-kos.diff index fbe71fc..fdb0e09 100644 --- a/utils/dc-chain/patches/newlib-1.20.0-kos.diff +++ b/utils/dc-chain/patches/newlib-2.0.0-kos.diff @@ -1,7 +1,7 @@ -diff -ruN newlib-1.20.0/newlib/configure.host newlib-1.20.0-kos/newlib/configure.host ---- newlib-1.20.0/newlib/configure.host 2011-11-29 01:33:48.000000000 -0500 -+++ newlib-1.20.0-kos/newlib/configure.host 2012-06-04 18:39:45.000000000 -0400 -@@ -237,6 +237,7 @@ +diff -ruN newlib-2.0.0/newlib/configure.host newlib-2.0.0-kos/newlib/configure.host +--- newlib-2.0.0/newlib/configure.host 2012-12-04 16:43:20.000000000 -0500 ++++ newlib-2.0.0-kos/newlib/configure.host 2013-05-18 00:16:34.000000000 -0400 +@@ -245,6 +245,7 @@ ;; sh | sh64) machine_dir=sh @@ -9,9 +9,9 @@ diff -ruN newlib-1.20.0/newlib/configure.host newlib-1.20.0-kos/newlib/configure ;; sparc*) machine_dir=sparc -diff -ruN newlib-1.20.0/newlib/libc/include/assert.h newlib-1.20.0-kos/newlib/libc/include/assert.h ---- newlib-1.20.0/newlib/libc/include/assert.h 2008-07-17 16:56:51.000000000 -0400 -+++ newlib-1.20.0-kos/newlib/libc/include/assert.h 2012-06-04 18:34:57.000000000 -0400 +diff -ruN newlib-2.0.0/newlib/libc/include/assert.h newlib-2.0.0-kos/newlib/libc/include/assert.h +--- newlib-2.0.0/newlib/libc/include/assert.h 2012-10-16 15:00:30.000000000 -0400 ++++ newlib-2.0.0-kos/newlib/libc/include/assert.h 2013-05-18 00:17:28.000000000 -0400 @@ -13,8 +13,8 @@ #ifdef NDEBUG /* required by ANSI standard */ # define assert(__e) ((void)0) @@ -34,12 +34,24 @@ diff -ruN newlib-1.20.0/newlib/libc/include/assert.h newlib-1.20.0-kos/newlib/li +void _EXFUN(__assert, (const char *, int, const char *, const char *, + const char *) _ATTRIBUTE ((__noreturn__))); - #ifdef __cplusplus - } -diff -ruN newlib-1.20.0/newlib/libc/include/sys/types.h newlib-1.20.0-kos/newlib/libc/include/sys/types.h ---- newlib-1.20.0/newlib/libc/include/sys/types.h 2011-08-01 13:22:18.000000000 -0400 -+++ newlib-1.20.0-kos/newlib/libc/include/sys/types.h 2012-06-04 18:34:57.000000000 -0400 -@@ -283,7 +283,7 @@ + #if __STDC_VERSION__ >= 201112L && !defined __cplusplus + # define static_assert _Static_assert +diff -ruN newlib-2.0.0/newlib/libc/include/machine/_default_types.h newlib-2.0.0-kos/newlib/libc/include/machine/_default_types.h +--- newlib-2.0.0/newlib/libc/include/machine/_default_types.h 2012-10-16 14:45:23.000000000 -0400 ++++ newlib-2.0.0-kos/newlib/libc/include/machine/_default_types.h 2013-05-18 01:00:45.000000000 -0400 +@@ -9,6 +9,8 @@ + extern "C" { + #endif + ++#include <sys/features.h> ++ + /* + * Guess on types by examining *_MIN / *_MAX defines. + */ +diff -ruN newlib-2.0.0/newlib/libc/include/sys/types.h newlib-2.0.0-kos/newlib/libc/include/sys/types.h +--- newlib-2.0.0/newlib/libc/include/sys/types.h 2012-07-06 06:41:21.000000000 -0400 ++++ newlib-2.0.0-kos/newlib/libc/include/sys/types.h 2013-05-18 00:23:09.000000000 -0400 +@@ -286,7 +286,7 @@ #if defined(__XMK__) typedef unsigned int pthread_t; /* identify a thread */ @@ -48,65 +60,65 @@ diff -ruN newlib-1.20.0/newlib/libc/include/sys/types.h newlib-1.20.0-kos/newlib typedef __uint32_t pthread_t; /* identify a thread */ #endif -@@ -301,6 +301,7 @@ +@@ -304,6 +304,7 @@ #define PTHREAD_CREATE_DETACHED 0 #define PTHREAD_CREATE_JOINABLE 1 -+#ifndef _arch_dreamcast ++#if !defined(_arch_dreamcast) #if defined(__XMK__) typedef struct pthread_attr_s { int contentionscope; -@@ -334,6 +335,7 @@ +@@ -337,6 +338,7 @@ } pthread_attr_t; #endif /* !defined(__XMK__) */ -+#endif ++#endif /* !defined(_arch_dreamcast) */ #if defined(_POSIX_THREAD_PROCESS_SHARED) /* NOTE: P1003.1c/D10, p. 81 defines following values for process_shared. */ -@@ -410,6 +412,7 @@ +@@ -413,6 +415,7 @@ } pthread_mutexattr_t; #else /* !defined(__XMK__) */ -+#ifndef _arch_dreamcast ++#if !defined(_arch_dreamcast) typedef __uint32_t pthread_mutex_t; /* identify a mutex */ typedef struct { -@@ -426,10 +429,12 @@ +@@ -429,10 +432,12 @@ #endif int recursive; } pthread_mutexattr_t; -+#endif /* !_arch_dreamcast */ ++#endif /* !defined(_arch_dreamcast) */ #endif /* !defined(__XMK__) */ /* Condition Variables */ -+#ifndef _arch_dreamcast ++#if !defined(_arch_dreamcast) typedef __uint32_t pthread_cond_t; /* identify a condition variable */ typedef struct { -@@ -438,15 +443,18 @@ +@@ -441,15 +446,18 @@ int process_shared; /* allow this to be shared amongst processes */ #endif } pthread_condattr_t; /* a condition attribute object */ -+#endif ++#endif /* !defined(_arch_dreamcast) */ /* Keys */ -+#ifndef _arch_dreamcast ++#if !defined(_arch_dreamcast) typedef __uint32_t pthread_key_t; /* thread-specific data keys */ typedef struct { int is_initialized; /* is this structure initialized? */ int init_executed; /* has the initialization routine been run? */ } pthread_once_t; /* dynamic package initialization */ -+#endif ++#endif /* !defined(_arch_dreamcast) */ #else #if defined (__CYGWIN__) #include <cygwin/types.h> -diff -ruN newlib-1.20.0/newlib/libc/stdlib/assert.c newlib-1.20.0-kos/newlib/libc/stdlib/assert.c ---- newlib-1.20.0/newlib/libc/stdlib/assert.c 2009-10-08 12:44:10.000000000 -0400 -+++ newlib-1.20.0-kos/newlib/libc/stdlib/assert.c 2012-06-04 18:34:57.000000000 -0400 +diff -ruN newlib-2.0.0/newlib/libc/stdlib/assert.c newlib-2.0.0-kos/newlib/libc/stdlib/assert.c +--- newlib-2.0.0/newlib/libc/stdlib/assert.c 2009-10-08 12:44:10.000000000 -0400 ++++ newlib-2.0.0-kos/newlib/libc/stdlib/assert.c 2013-05-18 00:23:54.000000000 -0400 @@ -47,6 +47,8 @@ #include <stdlib.h> #include <stdio.h> @@ -121,23 +133,23 @@ diff -ruN newlib-1.20.0/newlib/libc/stdlib/assert.c newlib-1.20.0-kos/newlib/lib /* NOTREACHED */ } +#endif -diff -ruN newlib-1.20.0/newlib/libc/sys/sh/ftruncate.c newlib-1.20.0-kos/newlib/libc/sys/sh/ftruncate.c ---- newlib-1.20.0/newlib/libc/sys/sh/ftruncate.c 2003-07-10 11:31:30.000000000 -0400 -+++ newlib-1.20.0-kos/newlib/libc/sys/sh/ftruncate.c 2012-06-04 18:34:57.000000000 -0400 -@@ -2,8 +2,8 @@ - #include <sys/types.h> - #include "sys/syscall.h" - +diff -ruN newlib-2.0.0/newlib/libc/sys/sh/ftruncate.c newlib-2.0.0-kos/newlib/libc/sys/sh/ftruncate.c +--- newlib-2.0.0/newlib/libc/sys/sh/ftruncate.c 2003-07-10 11:31:30.000000000 -0400 ++++ newlib-2.0.0-kos/newlib/libc/sys/sh/ftruncate.c 2013-05-18 00:27:35.000000000 -0400 +@@ -1,9 +1 @@ +-#include <_ansi.h> +-#include <sys/types.h> +-#include "sys/syscall.h" +- -int -+/* int - ftruncate (int file, off_t length) - { - return __trap34 (SYS_ftruncate, file, length, 0); +-ftruncate (int file, off_t length) +-{ +- return __trap34 (SYS_ftruncate, file, length, 0); -} -+} */ -diff -ruN newlib-1.20.0/newlib/libc/sys/sh/sys/lock.h newlib-1.20.0-kos/newlib/libc/sys/sh/sys/lock.h ---- newlib-1.20.0/newlib/libc/sys/sh/sys/lock.h 1969-12-31 19:00:00.000000000 -0500 -+++ newlib-1.20.0-kos/newlib/libc/sys/sh/sys/lock.h 2012-06-04 18:34:57.000000000 -0400 ++/* Nothing here. */ +diff -ruN newlib-2.0.0/newlib/libc/sys/sh/sys/lock.h newlib-2.0.0-kos/newlib/libc/sys/sh/sys/lock.h +--- newlib-2.0.0/newlib/libc/sys/sh/sys/lock.h 1969-12-31 19:00:00.000000000 -0500 ++++ newlib-2.0.0-kos/newlib/libc/sys/sh/sys/lock.h 2013-05-18 00:26:13.000000000 -0400 @@ -0,0 +1,51 @@ +/* KallistiOS ##version## + @@ -190,9 +202,9 @@ diff -ruN newlib-1.20.0/newlib/libc/sys/sh/sys/lock.h newlib-1.20.0-kos/newlib/l + + +#endif // __NEWLIB_LOCK_COMMON_H -diff -ruN newlib-1.20.0/newlib/libc/sys/sh/syscalls.c newlib-1.20.0-kos/newlib/libc/sys/sh/syscalls.c ---- newlib-1.20.0/newlib/libc/sys/sh/syscalls.c 2008-01-21 19:24:45.000000000 -0500 -+++ newlib-1.20.0-kos/newlib/libc/sys/sh/syscalls.c 2012-06-04 18:34:57.000000000 -0400 +diff -ruN newlib-2.0.0/newlib/libc/sys/sh/syscalls.c newlib-2.0.0-kos/newlib/libc/sys/sh/syscalls.c +--- newlib-2.0.0/newlib/libc/sys/sh/syscalls.c 2008-01-21 19:24:45.000000000 -0500 ++++ newlib-2.0.0-kos/newlib/libc/sys/sh/syscalls.c 2013-05-18 00:26:46.000000000 -0400 @@ -1,228 +1,2 @@ -#include <_ansi.h> -#include <sys/types.h> @@ -424,9 +436,9 @@ diff -ruN newlib-1.20.0/newlib/libc/sys/sh/syscalls.c newlib-1.20.0-kos/newlib/l -} +// This is put in here to cause link errors if a proper newlib isn't present. +int __newlib_kos_patch = 1; -diff -ruN newlib-1.20.0/newlib/libc/sys/sh/trap.S newlib-1.20.0-kos/newlib/libc/sys/sh/trap.S ---- newlib-1.20.0/newlib/libc/sys/sh/trap.S 2002-02-08 02:11:13.000000000 -0500 -+++ newlib-1.20.0-kos/newlib/libc/sys/sh/trap.S 2012-06-04 18:34:57.000000000 -0400 +diff -ruN newlib-2.0.0/newlib/libc/sys/sh/trap.S newlib-2.0.0-kos/newlib/libc/sys/sh/trap.S +--- newlib-2.0.0/newlib/libc/sys/sh/trap.S 2002-02-08 02:11:13.000000000 -0500 ++++ newlib-2.0.0-kos/newlib/libc/sys/sh/trap.S 2013-05-18 00:27:04.000000000 -0400 @@ -1,43 +0,0 @@ -#if __SH5__ - .mode SHmedia @@ -471,17 +483,17 @@ diff -ruN newlib-1.20.0/newlib/libc/sys/sh/trap.S newlib-1.20.0-kos/newlib/libc/ -perrno: - .long _errno -#endif /* ! __SH5__ */ -diff -ruN newlib-1.20.0/newlib/libc/sys/sh/truncate.c newlib-1.20.0-kos/newlib/libc/sys/sh/truncate.c ---- newlib-1.20.0/newlib/libc/sys/sh/truncate.c 2003-07-10 11:31:30.000000000 -0400 -+++ newlib-1.20.0-kos/newlib/libc/sys/sh/truncate.c 2012-06-04 18:34:57.000000000 -0400 -@@ -2,8 +2,8 @@ - #include <sys/types.h> - #include "sys/syscall.h" - +diff -ruN newlib-2.0.0/newlib/libc/sys/sh/truncate.c newlib-2.0.0-kos/newlib/libc/sys/sh/truncate.c +--- newlib-2.0.0/newlib/libc/sys/sh/truncate.c 2003-07-10 11:31:30.000000000 -0400 ++++ newlib-2.0.0-kos/newlib/libc/sys/sh/truncate.c 2013-05-18 00:27:23.000000000 -0400 +@@ -1,9 +1 @@ +-#include <_ansi.h> +-#include <sys/types.h> +-#include "sys/syscall.h" +- -int -+/* int - truncate (const char *path, off_t length) - { - return __trap34 (SYS_truncate, path, length, 0); ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-05-17 22:28:03
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 816c924ac59d3e9a47da4da993139a7490b8f59a (commit) from 7442dc8a291c94d0ee20d615567d9d32c89af6cb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 816c924ac59d3e9a47da4da993139a7490b8f59a Author: Lawrence Sebald <ljs...@us...> Date: Fri May 17 18:27:45 2013 -0400 Oops... That was supposed to be uncommented. ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/dreameye/sd/dreameye-sd.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/examples/dreamcast/dreameye/sd/dreameye-sd.c b/examples/dreamcast/dreameye/sd/dreameye-sd.c index bfe4bc8..86344b2 100644 --- a/examples/dreamcast/dreameye/sd/dreameye-sd.c +++ b/examples/dreamcast/dreameye/sd/dreameye-sd.c @@ -38,7 +38,7 @@ int main(int argc, char *argv[]) { /* Comment this out if you'd rather that debug output went to dcload. Of course, you'll need to be using dcload-ip, but you should have already known that. ;-) */ - //dbgio_dev_select("fb"); + dbgio_dev_select("fb"); printf("KallistiOS Dreameye Image Dump program\n"); printf("Attempting to find a connected Dreameye device...\n"); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-05-17 22:26:34
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 7442dc8a291c94d0ee20d615567d9d32c89af6cb (commit) from 6cdb72360ed29a9043c38f06747623ce4037c669 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7442dc8a291c94d0ee20d615567d9d32c89af6cb Author: Lawrence Sebald <ljs...@us...> Date: Fri May 17 18:26:08 2013 -0400 Add example program using fs_ext2 to copy Dreameye images to. ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/dreameye/Makefile | 3 + .../{basic/stacktrace => dreameye/sd}/Makefile | 15 +- examples/dreamcast/dreameye/sd/dreameye-sd.c | 143 ++++++++++++++++++++ 3 files changed, 154 insertions(+), 7 deletions(-) copy examples/dreamcast/{basic/stacktrace => dreameye/sd}/Makefile (50%) create mode 100644 examples/dreamcast/dreameye/sd/dreameye-sd.c diff --git a/examples/dreamcast/dreameye/Makefile b/examples/dreamcast/dreameye/Makefile index c072d23..826dd38 100644 --- a/examples/dreamcast/dreameye/Makefile +++ b/examples/dreamcast/dreameye/Makefile @@ -6,10 +6,13 @@ all: $(KOS_MAKE) -C basic + $(KOS_MAKE) -C sd clean: $(KOS_MAKE) -C basic clean + $(KOS_MAKE) -C sd clean dist: $(KOS_MAKE) -C basic dist + $(KOS_MAKE) -C sd dist diff --git a/examples/dreamcast/basic/stacktrace/Makefile b/examples/dreamcast/dreameye/sd/Makefile similarity index 50% copy from examples/dreamcast/basic/stacktrace/Makefile copy to examples/dreamcast/dreameye/sd/Makefile index 00c04ae..5f2ca60 100644 --- a/examples/dreamcast/basic/stacktrace/Makefile +++ b/examples/dreamcast/dreameye/sd/Makefile @@ -1,10 +1,13 @@ +# KallistiOS ##version## # -# Stack trace test -# (c)2002 Dan Potter +# examples/dreamcast/dreameye/sd/Makefile # -TARGET = stacktrace.elf -OBJS = stacktrace.o +TARGET = dreameye-sd.elf +OBJS = dreameye-sd.o + +# Compile cleanly, or die trying! +KOS_CFLAGS += -Werror -W -std=gnu99 all: rm-elf $(TARGET) @@ -17,8 +20,7 @@ rm-elf: -rm -f $(TARGET) $(TARGET): $(OBJS) - $(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o $(TARGET) $(KOS_START) \ - $(OBJS) $(OBJEXTRA) $(KOS_LIBS) + kos-cc -o $(TARGET) $(OBJS) -lkosext2fs run: $(TARGET) $(KOS_LOADER) $(TARGET) @@ -26,4 +28,3 @@ run: $(TARGET) dist: rm -f $(OBJS) $(KOS_STRIP) $(TARGET) - diff --git a/examples/dreamcast/dreameye/sd/dreameye-sd.c b/examples/dreamcast/dreameye/sd/dreameye-sd.c new file mode 100644 index 0000000..bfe4bc8 --- /dev/null +++ b/examples/dreamcast/dreameye/sd/dreameye-sd.c @@ -0,0 +1,143 @@ +/* KallistiOS ##version## + + dreameye-sd.c + Copyright (C) 2013 Lawrence Sebald + + This example simply dumps all the images on the first connected Dreameye to + the SD card. It creates a new directory and saves the images in it. +*/ + +#include <stdio.h> +#include <errno.h> +#include <string.h> +#include <stdlib.h> +#include <dirent.h> + +#include <dc/sd.h> +#include <kos/blockdev.h> +#include <ext2/fs_ext2.h> +#include <dc/maple.h> +#include <dc/maple/dreameye.h> +#include <kos/dbgio.h> + +int main(int argc, char *argv[]) { + maple_device_t *dreameye; + dreameye_state_t *state; + uint8 *buf; + int size, err; + FILE *fp; + int img_count, i; + char fn[64]; + kos_blockdev_t sd_dev; + uint8 partition_type; + + /* We're not using these, obviously... */ + (void)argc; + (void)argv; + + /* Comment this out if you'd rather that debug output went to dcload. Of + course, you'll need to be using dcload-ip, but you should have already + known that. ;-) */ + //dbgio_dev_select("fb"); + + printf("KallistiOS Dreameye Image Dump program\n"); + printf("Attempting to find a connected Dreameye device...\n"); + + dreameye = maple_enum_type(0, MAPLE_FUNC_CAMERA); + + if(!dreameye) { + printf("Couldn't find any attached devices, bailing out.\n"); + exit(EXIT_FAILURE); + } + + state = (dreameye_state_t *)maple_dev_status(dreameye); + + printf("Attempting to grab the number of saved images...\n"); + dreameye_get_image_count(dreameye, 1); + + printf("Image Count is %s -- (%d)\n", + state->image_count_valid ? "valid" : "invalid", state->image_count); + img_count = state->image_count; + + /* Initialize the low-level SD card stuff. */ + if(sd_init()) { + printf("Could not initialize the SD card. Please make sure that you " + "have an SD card adapter plugged in and an SD card inserted.\n"); + exit(EXIT_FAILURE); + } + + /* Grab the block device for the first partition on the SD card. Note that + you must have the SD card formatted with an MBR partitioning scheme. */ + if(sd_blockdev_for_partition(0, &sd_dev, &partition_type)) { + printf("Could not find the first partition on the SD card!\n"); + exit(EXIT_FAILURE); + } + + /* Check to see if the MBR says that we have a Linux partition. */ + if(partition_type != 0x83) { + printf("MBR indicates a non-ext2 filesystem. Will try to mount " + "anyway\n"); + } + + /* Initialize fs_ext2 and attempt to mount the device. */ + if(fs_ext2_init()) { + printf("Could not initialize fs_ext2!\n"); + exit(EXIT_FAILURE); + } + + if(fs_ext2_mount("/sd", &sd_dev, FS_EXT2_MOUNT_READWRITE)) { + printf("Could not mount SD card as ext2fs. Please make sure the card " + "has been properly formatted.\n"); + exit(EXIT_FAILURE); + } + + /* Try to make a "dreameye" directory on the root of the card and move to + the new directory. */ + if(mkdir("/sd/dreameye", 0777)) { + printf("Cannot create a dreameye directory: %s\n", strerror(errno)); + exit(EXIT_FAILURE); + } + + if(chdir("/sd/dreameye")) { + printf("Cannot set current working directory: %s\n", strerror(errno)); + exit(EXIT_FAILURE); + } + + for(i = 0; i < img_count; ++i) { + printf("Reading image %d...\n", i + 1); + err = dreameye_get_image(dreameye, i + 2, &buf, &size); + + if(err != MAPLE_EOK) { + printf("Error was: %d\n", err); + free(buf); + continue; + } + + printf("Image received successfully, size %d bytes\n", size); + sprintf(fn, "image%02d.jpg", i + 1); + + if(!(fp = fopen(fn, "wb"))) { + printf("Cannot open /sd/dreameye/%s: %s\n", fn, strerror(errno)); + free(buf); + continue; + } + + if(fwrite(buf, 1, size, fp) != (size_t)size) { + printf("Cannot write image to file: %s\n", strerror(errno)); + free(buf); + fclose(fp); + continue; + } + + fclose(fp); + free(buf); + } + + /* Clean up the filesystem and everything else */ + fs_ext2_unmount("/sd"); + fs_ext2_shutdown(); + sd_shutdown(); + + printf("Complete!\n"); + return 0; +} hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-05-17 20:45:12
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 6cdb72360ed29a9043c38f06747623ce4037c669 (commit) from dbb485648c56bbeb6c6abc61a41e8b81fe63485e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 6cdb72360ed29a9043c38f06747623ce4037c669 Author: Lawrence Sebald <ljs...@us...> Date: Fri May 17 16:44:45 2013 -0400 64-bit file access in fs_ext2, ahoy! ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/fs_ext2.c | 55 +++++++++++++++++++++------------------- addons/libkosext2fs/inode.c | 9 ++++++- addons/libkosext2fs/inode.h | 8 +++++- 3 files changed, 44 insertions(+), 28 deletions(-) diff --git a/addons/libkosext2fs/fs_ext2.c b/addons/libkosext2fs/fs_ext2.c index 7856b09..deec570 100644 --- a/addons/libkosext2fs/fs_ext2.c +++ b/addons/libkosext2fs/fs_ext2.c @@ -203,7 +203,7 @@ created: } /* Fix the times/sizes up. */ - fh[fd].inode->i_size = 0; + ext2_inode_set_size(fh[fd].inode, 0); fh[fd].inode->i_dtime = 0; fh[fd].inode->i_mtime = time(NULL); ext2_inode_mark_dirty(fh[fd].inode); @@ -241,6 +241,7 @@ static ssize_t fs_ext2_read(void *h, void *buf, size_t cnt) { uint8_t *block; uint8_t *bbuf = (uint8_t *)buf; ssize_t rv; + uint64_t sz; int mode; mutex_lock(&ext2_mutex); @@ -268,8 +269,9 @@ static ssize_t fs_ext2_read(void *h, void *buf, size_t cnt) { } /* Do we have enough left? */ - if((fh[fd].ptr + cnt) > fh[fd].inode->i_size) - cnt = fh[fd].inode->i_size - fh[fd].ptr; + sz = ext2_inode_size(fh[fd].inode); + if((fh[fd].ptr + cnt) > sz) + cnt = sz - fh[fd].ptr; fs = fh[fd].fs->fs; bs = ext2_block_size(fs); @@ -331,6 +333,7 @@ static ssize_t fs_ext2_write(void *h, const void *buf, size_t cnt) { uint8_t *block; uint8_t *bbuf = (uint8_t *)buf; ssize_t rv; + uint64_t sz; int err, mode; mutex_lock(&ext2_mutex); @@ -354,19 +357,18 @@ static ssize_t fs_ext2_write(void *h, const void *buf, size_t cnt) { bs = ext2_block_size(fs); lbs = ext2_log_block_size(fs); rv = (ssize_t)cnt; + sz = ext2_inode_size(fh[fd].inode); /* Reset the file pointer to the end of the file if we've got the append flag set. */ if(fh[fd].mode & O_APPEND) - fh[fd].ptr = fh[fd].inode->i_size; + fh[fd].ptr = sz; /* If we have already moved beyond the end of the file with a seek operation, allocate any blank blocks we need to to satisfy that. */ - if(fh[fd].ptr > fh[fd].inode->i_size) { - bo = fh[fd].inode->i_size; - + if(fh[fd].ptr > sz) { /* Are we staying within the same block? */ - if(((bo - 1) >> lbs) == ((fh[fd].ptr - 1) >> lbs)) { + if(((sz - 1) >> lbs) == ((fh[fd].ptr - 1) >> lbs)) { if(!(block = ext2_inode_read_block(fs, fh[fd].inode, (fh[fd].ptr - 1) >> lbs, &bn, &errno))) { @@ -374,43 +376,40 @@ static ssize_t fs_ext2_write(void *h, const void *buf, size_t cnt) { return -1; } - memset(block + (bo & (bs - 1)), 0, fh[fd].ptr - bo); + memset(block + (sz & (bs - 1)), 0, fh[fd].ptr - sz); ext2_block_mark_dirty(fs, bn); } /* Nope, we need to allocate a new one... */ else { /* Do we need to clear the end of the current last block? */ - if(fh[fd].inode->i_size & (bs - 1)) { + if(sz & (bs - 1)) { if(!(block = ext2_inode_read_block(fs, fh[fd].inode, - fh[fd].inode->i_size >> lbs, + (sz - 1) >> lbs, &bn, &errno))) { mutex_unlock(&ext2_mutex); return -1; } - memset(block + (fh[fd].inode->i_size & (bs - 1)), 0, - fh[fd].ptr - fh[fd].inode->i_size); + memset(block + (sz & (bs - 1)), 0, bs - (sz & (bs - 1))); ext2_block_mark_dirty(fs, bn); - fh[fd].inode->i_size &= (bs - 1); - fh[fd].inode->i_size += bs; + sz &= (bs - 1); + sz += bs; } /* The size should now be nicely at a block boundary... */ - bo = fh[fd].inode->i_size; - - while(bo < fh[fd].ptr) { + while(sz < fh[fd].ptr) { if(!(block = ext2_inode_alloc_block(fs, fh[fd].inode, - bo >> lbs, &errno))) { + sz >> lbs, &errno))) { mutex_unlock(&ext2_mutex); return -1; } - bo += bs; - fh[fd].inode->i_size += bs; + sz += bs; } } - fh[fd].inode->i_size = fh[fd].ptr; + ext2_inode_set_size(fh[fd].inode, fh[fd].ptr); + sz = fh[fd].ptr; } /* Handle the first block specially if we are offset within it. */ @@ -470,8 +469,8 @@ static ssize_t fs_ext2_write(void *h, const void *buf, size_t cnt) { } /* Update the file's size and modification time. */ - if(fh[fd].ptr > fh[fd].inode->i_size) - fh[fd].inode->i_size = (uint32_t)fh[fd].ptr; + if(fh[fd].ptr > sz) + ext2_inode_set_size(fh[fd].inode, fh[fd].ptr); fh[fd].inode->i_mtime = time(NULL); ext2_inode_mark_dirty(fh[fd].inode); @@ -504,7 +503,7 @@ static _off64_t fs_ext2_seek64(void *h, _off64_t offset, int whence) { break; case SEEK_END: - fh[fd].ptr = fh[fd].inode->i_size + offset; + fh[fd].ptr = ext2_inode_size(fh[fd].inode) + offset; break; default: @@ -1036,7 +1035,6 @@ static int fs_ext2_stat(vfs_handler_t *vfs, const char *fn, stat_t *rv) { /* Fill in the easy parts of the structure. */ rv->dev = vfs; rv->unique = inode_num; - rv->size = inode->i_size; rv->time = inode->i_mtime; rv->attr = 0; @@ -1044,14 +1042,17 @@ static int fs_ext2_stat(vfs_handler_t *vfs, const char *fn, stat_t *rv) { switch(inode->i_mode & 0xF000) { case EXT2_S_IFLNK: rv->type = STAT_TYPE_SYMLINK; + rv->size = inode->i_size; break; case EXT2_S_IFREG: rv->type = STAT_TYPE_FILE; + rv->size = ext2_inode_size(inode); break; case EXT2_S_IFDIR: rv->type = STAT_TYPE_DIR; + rv->size = inode->i_size; break; case EXT2_S_IFSOCK: @@ -1059,10 +1060,12 @@ static int fs_ext2_stat(vfs_handler_t *vfs, const char *fn, stat_t *rv) { case EXT2_S_IFBLK: case EXT2_S_IFCHR: rv->type = STAT_TYPE_PIPE; + rv->size = 0; break; default: rv->type = STAT_TYPE_NONE; + rv->size = 0; break; } diff --git a/addons/libkosext2fs/inode.c b/addons/libkosext2fs/inode.c index a54205b..f5d568b 100644 --- a/addons/libkosext2fs/inode.c +++ b/addons/libkosext2fs/inode.c @@ -1256,9 +1256,16 @@ uint8_t *ext2_inode_read_block(ext2_fs_t *fs, const ext2_inode_t *inode, uint32_t blks_per_ind, ibn; uint32_t *iblock; int shift = 1 + fs->sb.s_log_block_size; + uint64_t sz; + + /* Grab the size */ + if((inode->i_mode & 0xF000) == EXT2_S_IFREG) + sz = ext2_inode_size(inode); + else + sz = (uint64_t)inode->i_size; /* Check to be sure we're not being asked to do something stupid... */ - if((block_num << (shift + 9)) >= inode->i_size) { + if((block_num << (shift + 9)) >= sz) { *err = EINVAL; return NULL; } diff --git a/addons/libkosext2fs/inode.h b/addons/libkosext2fs/inode.h index c3fc37e..ea3768c 100644 --- a/addons/libkosext2fs/inode.h +++ b/addons/libkosext2fs/inode.h @@ -105,10 +105,16 @@ typedef struct ext2_xattr_hdr { #define EXT2_XATTR_MAGIC 0xEA020000 /* Get the size of a regular file inode as a 64-bit integer. */ -static inline uint64_t ext2_inode_size(ext2_inode_t *inode) { +static inline uint64_t ext2_inode_size(const ext2_inode_t *inode) { return (uint64_t)(inode->i_size) | ((uint64_t)(inode->i_dir_acl) << 32); } +/* Set the size of a regular file from a 64-bit integer. */ +static inline void ext2_inode_set_size(ext2_inode_t *inode, uint64_t sz) { + inode->i_size = (uint32_t)sz; + inode->i_dir_acl = (uint32_t)(sz >> 32); +} + /* Initialize the inode cache. This will be called by ext2_init(). */ void ext2_inode_init(void); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-05-17 19:38:32
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via dbb485648c56bbeb6c6abc61a41e8b81fe63485e (commit) from a02c5325966700979a559ab0634efec260099b7e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit dbb485648c56bbeb6c6abc61a41e8b81fe63485e Author: Lawrence Sebald <ljs...@us...> Date: Fri May 17 15:38:12 2013 -0400 Add 64-bit versions of some VFS functions. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/fs_ext2.c | 23 ++++++---- addons/libkosext2fs/inode.h | 5 ++ include/kos/fs.h | 46 ++++++++++++++++++++ kernel/fs/fs.c | 93 ++++++++++++++++++++++++++++++++++++++--- 4 files changed, 151 insertions(+), 16 deletions(-) diff --git a/addons/libkosext2fs/fs_ext2.c b/addons/libkosext2fs/fs_ext2.c index c042f28..7856b09 100644 --- a/addons/libkosext2fs/fs_ext2.c +++ b/addons/libkosext2fs/fs_ext2.c @@ -480,7 +480,7 @@ static ssize_t fs_ext2_write(void *h, const void *buf, size_t cnt) { return rv; } -static off_t fs_ext2_seek(void *h, off_t offset, int whence) { +static _off64_t fs_ext2_seek64(void *h, _off64_t offset, int whence) { file_t fd = ((file_t)h) - 1; off_t rv; @@ -512,12 +512,12 @@ static off_t fs_ext2_seek(void *h, off_t offset, int whence) { return -1; } - rv = (off_t)fh[fd].ptr; + rv = (_off64_t)fh[fd].ptr; mutex_unlock(&ext2_mutex); return rv; } -static off_t fs_ext2_tell(void *h) { +static _off64_t fs_ext2_tell64(void *h) { file_t fd = ((file_t)h) - 1; off_t rv; @@ -529,12 +529,12 @@ static off_t fs_ext2_tell(void *h) { return -1; } - rv = (off_t)fh[fd].ptr; + rv = (_off64_t)fh[fd].ptr; mutex_unlock(&ext2_mutex); return rv; } -static size_t fs_ext2_total(void *h) { +static uint64 fs_ext2_total64(void *h) { file_t fd = ((file_t)h) - 1; size_t rv; @@ -546,7 +546,7 @@ static size_t fs_ext2_total(void *h) { return -1; } - rv = fh[fd].inode->i_size; + rv = ext2_inode_size(fh[fd].inode); mutex_unlock(&ext2_mutex); return rv; } @@ -1662,9 +1662,9 @@ static vfs_handler_t vh = { fs_ext2_close, /* close */ fs_ext2_read, /* read */ fs_ext2_write, /* write */ - fs_ext2_seek, /* seek */ - fs_ext2_tell, /* tell */ - fs_ext2_total, /* total */ + NULL, /* seek */ + NULL, /* tell */ + NULL, /* total */ fs_ext2_readdir, /* readdir */ NULL, /* ioctl */ fs_ext2_rename, /* rename */ @@ -1677,7 +1677,10 @@ static vfs_handler_t vh = { fs_ext2_fcntl, /* fcntl */ NULL, /* poll */ fs_ext2_link, /* link */ - fs_ext2_symlink /* symlink */ + fs_ext2_symlink, /* symlink */ + fs_ext2_seek64, /* seek64 */ + fs_ext2_tell64, /* tell64 */ + fs_ext2_total64 /* total64 */ }; static int initted = 0; diff --git a/addons/libkosext2fs/inode.h b/addons/libkosext2fs/inode.h index 9b29394..c3fc37e 100644 --- a/addons/libkosext2fs/inode.h +++ b/addons/libkosext2fs/inode.h @@ -104,6 +104,11 @@ typedef struct ext2_xattr_hdr { /* This should be in the h_magic of an xattr */ #define EXT2_XATTR_MAGIC 0xEA020000 +/* Get the size of a regular file inode as a 64-bit integer. */ +static inline uint64_t ext2_inode_size(ext2_inode_t *inode) { + return (uint64_t)(inode->i_size) | ((uint64_t)(inode->i_dir_acl) << 32); +} + /* Initialize the inode cache. This will be called by ext2_init(). */ void ext2_inode_init(void); diff --git a/include/kos/fs.h b/include/kos/fs.h index 15bceb0..abb6684 100644 --- a/include/kos/fs.h +++ b/include/kos/fs.h @@ -181,6 +181,18 @@ typedef struct vfs_handler { /** \brief Create a symbolic link */ int (*symlink)(struct vfs_handler *vfs, const char *path1, const char *path2); + + /* 64-bit file access functions. Generally, you should only define one of + the 64-bit or 32-bit versions of these functions. */ + + /** \brief Seek in a previously opened file (64-bit offsets) */ + _off64_t (*seek64)(void *hnd, _off64_t offset, int whence); + + /** \brief Return the current position in an opened file (64-bit offset) */ + _off64_t (*tell64)(void *hnd); + + /** \brief Return the size of an opened file as a 64-bit integer */ + uint64 (*total64)(void *hnd); } vfs_handler_t; /** \brief The number of distinct file descriptors that can be in use at a @@ -288,6 +300,19 @@ ssize_t fs_write(file_t hnd, const void *buffer, size_t cnt); */ off_t fs_seek(file_t hnd, off_t offset, int whence); +/** \brief Seek to a new position within a file (64-bit offsets). + + This function moves the file pointer to the specified position within the + file (the base of this position is determined by the whence parameter). + + \param hnd The file descriptor to move the pointer for. + \param offset The offset in bytes from the specified base. + \param whence The base of the pointer move. This should be one of + the \ref seek_modes values. + \return The new position of the file pointer. +*/ +_off64_t fs_seek64(file_t hnd, _off64_t offset, int whence); + /** \brief Retrieve the position of the pointer within a file. This function retrieves the current location of the file pointer within an @@ -298,6 +323,16 @@ off_t fs_seek(file_t hnd, off_t offset, int whence); */ off_t fs_tell(file_t hnd); +/** \brief Retrieve the position of the 64-bit pointer within a file. + + This function retrieves the current location of the file pointer within an + opened file. This is an offset in bytes from the start of the file. + + \param hnd The file descriptor to retrieve the pointer from. + \return The offset within the file for the pointer. +*/ +_off64_t fs_tell64(file_t hnd); + /** \brief Retrieve the length of an opened file. This file retrieves the length of the file associated with the given file @@ -308,6 +343,17 @@ off_t fs_tell(file_t hnd); */ size_t fs_total(file_t hnd); +/** \brief Retrieve the length of an opened file as a 64-bit integer. + + This file retrieves the length of the file associated with the given file + descriptor. + + \param hnd The file descriptor to retrieve the size from. + \return The length of the file on success, -1 on failure. +*/ +uint64 fs_total64(file_t hnd); + + /** \brief Read an entry from an opened directory. This function reads the next entry from the directory specified by the given diff --git a/kernel/fs/fs.c b/kernel/fs/fs.c index 9d74b63..ca36da1 100644 --- a/kernel/fs/fs.c +++ b/kernel/fs/fs.c @@ -392,12 +392,39 @@ off_t fs_seek(file_t fd, off_t offset, int whence) { if(h == NULL) return -1; - if(h->handler == NULL || h->handler->seek == NULL) { + if(h->handler == NULL) { errno = EINVAL; return -1; } - return h->handler->seek(h->hnd, offset, whence); + /* Prefer the 32-bit version, but fall back if needed to the 64-bit one. */ + if(h->handler->seek) + return h->handler->seek(h->hnd, offset, whence); + else if(h->handler->seek64) + return (off_t)h->handler->seek64(h->hnd, (_off64_t)offset, whence); + + errno = EINVAL; + return -1; +} + +_off64_t fs_seek64(file_t fd, _off64_t offset, int whence) { + fs_hnd_t *h = fs_map_hnd(fd); + + if(h == NULL) return -1; + + if(h->handler == NULL) { + errno = EINVAL; + return -1; + } + + /* Prefer the 64-bit version, but fall back if needed to the 32-bit one. */ + if(h->handler->seek64) + return h->handler->seek64(h->hnd, offset, whence); + else if(h->handler->seek) + return (_off64_t)h->handler->seek(h->hnd, (off_t)offset, whence); + + errno = EINVAL; + return -1; } off_t fs_tell(file_t fd) { @@ -405,12 +432,39 @@ off_t fs_tell(file_t fd) { if(h == NULL) return -1; - if(h->handler == NULL || h->handler->tell == NULL) { + if(h->handler == NULL) { + errno = EINVAL; + return -1; + } + + /* Prefer the 32-bit version, but fall back if needed to the 64-bit one. */ + if(h->handler->tell) + return h->handler->tell(h->hnd); + else if(h->handler->tell64) + return (off_t)h->handler->tell64(h->hnd); + + errno = EINVAL; + return -1; +} + +_off64_t fs_tell64(file_t fd) { + fs_hnd_t *h = fs_map_hnd(fd); + + if(h == NULL) return -1; + + if(h->handler == NULL) { errno = EINVAL; return -1; } - return h->handler->tell(h->hnd); + /* Prefer the 64-bit version, but fall back if needed to the 32-bit one. */ + if(h->handler->tell64) + return h->handler->tell64(h->hnd); + else if(h->handler->tell) + return (_off64_t)h->handler->tell(h->hnd); + + errno = EINVAL; + return -1; } size_t fs_total(file_t fd) { @@ -418,12 +472,39 @@ size_t fs_total(file_t fd) { if(h == NULL) return -1; - if(h->handler == NULL || h->handler->total == NULL) { + if(h->handler == NULL) { + errno = EINVAL; + return -1; + } + + /* Prefer the 32-bit version, but fall back if needed to the 64-bit one. */ + if(h->handler->total) + return h->handler->total(h->hnd); + else if(h->handler->total64) + return (size_t)h->handler->total64(h->hnd); + + errno = EINVAL; + return -1; +} + +uint64 fs_total64(file_t fd) { + fs_hnd_t *h = fs_map_hnd(fd); + + if(h == NULL) return -1; + + if(h->handler == NULL) { errno = EINVAL; return -1; } - return h->handler->total(h->hnd); + /* Prefer the 64-bit version, but fall back if needed to the 32-bit one. */ + if(h->handler->total64) + return h->handler->total64(h->hnd); + else if(h->handler->total) + return (uint64)h->handler->total(h->hnd); + + errno = EINVAL; + return -1; } dirent_t *fs_readdir(file_t fd) { hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-05-17 06:04:27
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via a02c5325966700979a559ab0634efec260099b7e (commit) from bfa643acab1192d3cc1c8e047d12c52f24b4c6a2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a02c5325966700979a559ab0634efec260099b7e Author: Lawrence Sebald <ljs...@us...> Date: Fri May 17 02:04:08 2013 -0400 Update the CHANGELOG. Hopefully, I didn't miss anything important... ----------------------------------------------------------------------- Summary of changes: doc/CHANGELOG | 37 +++++++++++++++++++++++++++++++++++++ 1 files changed, 37 insertions(+), 0 deletions(-) diff --git a/doc/CHANGELOG b/doc/CHANGELOG index f670f6f..9d4803a 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -198,6 +198,43 @@ KallistiOS version 2.0.0 ----------------------------------------------- - *** Added rudimentary IP reassembly support [LS] - *** Added support for IPv6 in the network stack [LS] - *** Added support for TCP in the network stack [LS] +- *** Added setsockopt(), getsockopt(), and fcntl() functions, mainly for + dealing with sockets. Removed the (now useless) fs_socket_setflags() + function [LS] +- *** Updated patches to use GCC 4.7.0 and Newlib 1.12.0 [LS] +- *** Added initializers for transient semaphores, condvars, and mutexes and + changed the way that they should be initialized in general [LS] +- *** Added a poll() function, as well as select() [LS] +- *** Added the ability to wake a certain thread with genwait and to specify + an error code to wake them with [LS] +- DC Use the fsca and fsrra asm mnemonics in the fmath code since they've + been supported by binutils since 2004 [LS] +- DC Detect the region/type of keyboard on attach and map keys in an + appropriate manner [LS] +- DC Give each keyboard its own queue of keys [LS] +- DC Added low-level SPI support on the serial port as well as a block device + interface for using an SD card with the homebrew adapter [LS] +- *** Added a CRC16-CCITT function [LS] +- *** Added dontwait, waitall, and peek flags for use with sending and receiving + data on sockets [LS] +- *** Added fs_ext2 to be used with the SD card code (and fixed a lot of bugs + with it along the way) [LS] +- DC Added missing txrenv stuff to PVR sprites (thanks to Tvspelsfreak at the + DCEmulation forums for pointing out it was missing) [LS] +- *** Change how threads are swapped to prevent a high priority thread from + starving everyone else [LS] +- DC Create a map file for the ARM code during compilation [CG] +- DC Return the old border color from vid_border_color() [CG] +- *** Return status codes from fs_close() as is expected in POSIX [CG] +- DC Actually support 2352 byte sector reads in the cdrom code (thanks to + Multimedia Mike for noticing it was broken) [LS] +- *** Added fs_symlink() and fs_link() functions to the VFS [LS] +- DC Fixed a delay loop in aica_get_pos() that was optimized away [CG] +- DC Added -N to the ARM linker switches to prevent .data from being padded to + a 32KiB boundary [CG] +- *** Use the O_CREAT flag in fs_copy() on the destination file [LS] +- DC Added fs_ext2/SD examples sd/ext2fs (basic example showing mounting and + file I/O) and sd/mke2fs (create a new ext2 filesystem on the SD card) [LS] KallistiOS version 1.2.0 ----------------------------------------------- - DC Fix to use DCARM7_CFLAGS when compiling ARM driver [Christian Groessler == CG] hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-05-17 05:37:35
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via bfa643acab1192d3cc1c8e047d12c52f24b4c6a2 (commit) from 9a7b067430752d25741707cb63be98f105095779 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit bfa643acab1192d3cc1c8e047d12c52f24b4c6a2 Author: Lawrence Sebald <ljs...@us...> Date: Fri May 17 01:37:15 2013 -0400 Update some documentation (FAQ, README, RELNOTES). ----------------------------------------------------------------------- Summary of changes: doc/FAQ | 16 ++++++++++++---- doc/README | 39 +++++++++++++++++++++++---------------- doc/RELNOTES | 30 +++++++++++++++++++++++++----- 3 files changed, 60 insertions(+), 25 deletions(-) diff --git a/doc/FAQ b/doc/FAQ index 5c6c608..67d281e 100644 --- a/doc/FAQ +++ b/doc/FAQ @@ -1,6 +1,6 @@ KallistiOS ##version## FAQ Copyright (C) 2001 Dan Potter -Copyright (C) 2012 Lawrence Sebald +Copyright (C) 2012, 2013 Lawrence Sebald Here you may find some answers to some common questions we hear regarding the usage of KOS. We will be adding more to this file over @@ -223,7 +223,7 @@ support), and is slowly being worked out. Q) What VFS modules are available? -A) Presently there are six: +A) Presently there are six (and one in an addon library): - ISO9660 -- mounts on /cd, and is a decent implementation of the ISO9660 file system standard used on CDs. Note that because of the @@ -257,6 +257,13 @@ It is used to allow network sockets to use the normal VFS functions (write(), read(), close()) for its operation. There are never any visible files on this VFS, so you can't use open() to access it. +- ext2 -- mounts wherever you tell it to. This one is implemented in the +libkosext2fs library in the addons tree. It was primarily added to provide a +freely-usable (not patent-encumbered) filesystem that could be used on SD cards. +It is usable with more than just SD cards though, if you want to provide a block +device for using it with other things. There probably isn't much of a good +reason to do so, however. + 1.5 @@ -318,8 +325,9 @@ A) Yes. There is a very primitive and rudimentary driver for the Sega broadband adapter (an RTL8193C based 10/100 card) and the Lan Adapter on the DC. With regards to TCP/IP and friends, there are two choices: either you can use the built-in network stack or you can use lwIP, which is in -the kos-ports tree. Note though that currently the built-in network stack -does not actually support TCP (UDP is there though). +the kos-ports tree. Note that lwIP is pretty much considered deprecated +now, and isn't actively tested anymore. You should use the internal +network stack for all new code. 3.2 diff --git a/doc/README b/doc/README index 16982fc..78ec43c 100644 --- a/doc/README +++ b/doc/README @@ -1,7 +1,7 @@ KallistiOS ##version## README Copyright (C) 2000-2003 Dan Potter -Copyright (C) 2012 Lawrence Sebald +Copyright (C) 2012-2013 Lawrence Sebald OVERVIEW -------- @@ -105,6 +105,7 @@ GCC, Binutils, and Newlib versions in the utils/dc-chain directory. If you don't have any of the above, please see one of the following sites for some more instructions (and perhaps a build script that may help you): +DC: http://gamedev.allusion.net/softprj/kos/setup.php DC: http://dcemulation.org/ GBA: http://www.gbadev.org/ PS2: http://wiki.ps2dev.org/ @@ -172,28 +173,34 @@ VERSION CODES All KOS versions are composed of three sections: major, minor, micro. Major revisions are generally something that changes the OS fundamentally, or -when we run out of single-digit major version numbers =). For example, in -the 1.0.x -> 1.1.x transition we moved from an OS style target to a library -style target. The minor version number is used to denote a development -series. Even numbered minor versions are considered stable, while -odd-number versions are considered unstable, incomplete, etc. When we feel -like significant progress has been made since the last stable release, -we'll make a new stable release. Finally, the micro version denotes a -sequence in the development series. 1.1.0 would be the first snapshot of -the 1.1 development series. +when we wait several years between releases =). The minor version number +is used to denote a development series. This gets incremented basically +whenever we feel that it is relevant to do so. Finally, the micro version +denotes a sequence in the development series. 1.1.0 would be the first +snapshot of the 1.1 development series. -And as always, if you want to be on the bleeding edge, use the Subversion -tree hosted via SourceForge and the svnpush/svnpull scripts. +And as always, if you want to be on the bleeding edge, use the Git +repository hosted at SourceForge. HACKING ------- If you are planning on doing your own hacking and potentially submitting patches for me to include, then I'd very much appreciate it if you would do -this against the SVN tree rather than a release tree. You can generate -patches for me like so: - -svn diff -ruN +this against the Git repository rather than a release tree. The general +workflow to do this is to add/commit the changes to your local git repo +and then send a patch for the revisions in question like so (where n is the +number of commits you have made): + +git format-patch -n + +This will write a number of .patch files to the current directory for the n +most recent commits you have made. You can then upload those patches to the +SourceForge patch tracker to get them to us. You should ensure that your git +setup is relatively sane and that you have your name/email address filled in +properly, or I will probably reject your patches. You should also provide +useful commit messages, with a summary on the first line to make it easier +on me later. I don't guarantee that any patch will get included (especially if your patch contains a lot of reformatting, sloppy coding, things at cross-purposes with diff --git a/doc/RELNOTES b/doc/RELNOTES index c51813f..b60a233 100644 --- a/doc/RELNOTES +++ b/doc/RELNOTES @@ -1,6 +1,6 @@ KallistiOS ##version## Copyright (C) 2002, 2003 Dan Potter -Copyright (C) 2012 Lawrence Sebald +Copyright (C) 2012, 2013 Lawrence Sebald RELEASE NOTES for 2.0.0 ----------------------- @@ -53,10 +53,10 @@ need to add -lkosutils to your link line somewhere. KOS now has a built-in network stack in the kernel/net directory. This is only usable at the moment with the Broadband Adapter or the Lan Adapter for the -Dreamcast. Also, right now it only supports UDP. You also have an almost -complete set of sockets functions so that you can use the networking support -just like you would on any other OS. Add INIT_NET to your KOS_INIT_FLAGS to -initialize the network support on startup. +Dreamcast. It suports UDP and TCP over both IPv4 and IPv6. You also have an +almost complete set of sockets functions so that you can use the networking +support just like you would on any other OS. Add INIT_NET to your KOS_INIT_FLAGS +to initialize the network support on startup. If you are using the networking support on the Dreamcast, it is now possible to use dcload debugging through KOS' network stack. This is automatically set up @@ -81,6 +81,26 @@ possible that there are parts of the code that do not work properly anymore. Please, if you find anything that doesn't work properly anymore, report an issue on the Sourceforge bug tracker! +Many changes were made to the synchronization primitives and other threading- +related things. Make sure to take a look at the documentation on them. + +Support for the homebrew serial port SD card reader has been added. There is a +block-level driver for SD cards, as well as a lower-level driver for using the +serial port as a generic SPI bus. + +If you would like a ready-to-use filesystem to go with your SD card support, +look no farther than libkosext2fs (in the addons tree). This provides support +for reading and writing to ext2 filesystems. This library is still pretty raw +and could use a lot more testing, but it seems to work fairly well as long as +you respect the few limitations in it (no files >= 4GiB in size being the big +one, absolute paths in symlinks don't work either). As a result of adding this +filesystem into the tree, there were a bunch of other changes made in the VFS +code. Specifically, fs_link() and fs_symlink() were added. + +The GBA, ia32, and PS2 ports of KOS are all considered abandoned and are likely +to be removed in the future. If you would like to step up to maintain/improve +them, please let us know! + There's probably a whole bunch of other stuff that should be mentioned in here, but its been so long since anyone has updated this document... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-05-17 03:29:17
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 9a7b067430752d25741707cb63be98f105095779 (commit) from 2d4496d48a77eddda6711d3545c7bbc32c852f81 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9a7b067430752d25741707cb63be98f105095779 Author: Lawrence Sebald <ljs...@us...> Date: Thu May 16 23:26:43 2013 -0400 Fix a bunch of nasty bugs in fs_ext2: From least to most nasty: 1. Allow seeking beyond the end of the file. 2. Fix writes when the file pointer is beyond the end of the file (related to the first one, obviously). 3. Re-work the inode block deallocation code to clean up indirect blocks properly. 4. Re-work the inode block allocation code to properly allocate and account for indirect blocks. 5. Fix a few other major problems with writing that showed their face when indirect blocks were used. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/directory.c | 4 +- addons/libkosext2fs/fs_ext2.c | 71 +++++++++++++++++++++++++++--------- addons/libkosext2fs/inode.c | 76 ++++++++++++++------------------------ addons/libkosext2fs/inode.h | 3 +- 4 files changed, 85 insertions(+), 69 deletions(-) diff --git a/addons/libkosext2fs/directory.c b/addons/libkosext2fs/directory.c index a5add86..cbce1ab 100644 --- a/addons/libkosext2fs/directory.c +++ b/addons/libkosext2fs/directory.c @@ -229,7 +229,7 @@ int ext2_dir_add_entry(ext2_fs_t *fs, struct ext2_inode *dir, const char *fn, /* No space in the existing blocks... Guess we'll have to allocate a new block to store this in. */ - if(!(buf = ext2_inode_alloc_block(fs, dir, &err))) + if(!(buf = ext2_inode_alloc_block(fs, dir, blocks, &err))) return -err; dent = (ext2_dirent_t *)buf; @@ -272,7 +272,7 @@ int ext2_dir_create_empty(ext2_fs_t *fs, struct ext2_inode *dir, uint32_t bg; /* Allocate a block for the directory structure. */ - if(!(dir_buf = ext2_inode_alloc_block(fs, dir, &err))) + if(!(dir_buf = ext2_inode_alloc_block(fs, dir, 0, &err))) return -err; /* Fill in "." */ diff --git a/addons/libkosext2fs/fs_ext2.c b/addons/libkosext2fs/fs_ext2.c index 475bca1..c042f28 100644 --- a/addons/libkosext2fs/fs_ext2.c +++ b/addons/libkosext2fs/fs_ext2.c @@ -331,7 +331,6 @@ static ssize_t fs_ext2_write(void *h, const void *buf, size_t cnt) { uint8_t *block; uint8_t *bbuf = (uint8_t *)buf; ssize_t rv; - uint64_t nblocks; int err, mode; mutex_lock(&ext2_mutex); @@ -355,31 +354,67 @@ static ssize_t fs_ext2_write(void *h, const void *buf, size_t cnt) { bs = ext2_block_size(fs); lbs = ext2_log_block_size(fs); rv = (ssize_t)cnt; - bo = fh[fd].ptr & ((1 << lbs) - 1); /* Reset the file pointer to the end of the file if we've got the append flag set. */ - if(fh[fd].mode & O_APPEND) { + if(fh[fd].mode & O_APPEND) fh[fd].ptr = fh[fd].inode->i_size; - } /* If we have already moved beyond the end of the file with a seek operation, allocate any blank blocks we need to to satisfy that. */ if(fh[fd].ptr > fh[fd].inode->i_size) { - nblocks = (fh[fd].ptr - fh[fd].inode->i_size) >> lbs; + bo = fh[fd].inode->i_size; - while(nblocks--) { - if(!(block = ext2_inode_alloc_block(fs, fh[fd].inode, &errno))) { + /* Are we staying within the same block? */ + if(((bo - 1) >> lbs) == ((fh[fd].ptr - 1) >> lbs)) { + if(!(block = ext2_inode_read_block(fs, fh[fd].inode, + (fh[fd].ptr - 1) >> lbs, &bn, + &errno))) { mutex_unlock(&ext2_mutex); return -1; } + + memset(block + (bo & (bs - 1)), 0, fh[fd].ptr - bo); + ext2_block_mark_dirty(fs, bn); + } + /* Nope, we need to allocate a new one... */ + else { + /* Do we need to clear the end of the current last block? */ + if(fh[fd].inode->i_size & (bs - 1)) { + if(!(block = ext2_inode_read_block(fs, fh[fd].inode, + fh[fd].inode->i_size >> lbs, + &bn, &errno))) { + mutex_unlock(&ext2_mutex); + return -1; + } + + memset(block + (fh[fd].inode->i_size & (bs - 1)), 0, + fh[fd].ptr - fh[fd].inode->i_size); + ext2_block_mark_dirty(fs, bn); + fh[fd].inode->i_size &= (bs - 1); + fh[fd].inode->i_size += bs; + } + + /* The size should now be nicely at a block boundary... */ + bo = fh[fd].inode->i_size; + + while(bo < fh[fd].ptr) { + if(!(block = ext2_inode_alloc_block(fs, fh[fd].inode, + bo >> lbs, &errno))) { + mutex_unlock(&ext2_mutex); + return -1; + } + + bo += bs; + fh[fd].inode->i_size += bs; + } } fh[fd].inode->i_size = fh[fd].ptr; } /* Handle the first block specially if we are offset within it. */ - if(bo) { + if((bo = fh[fd].ptr & ((1 << lbs) - 1))) { if(!(block = ext2_inode_read_block(fs, fh[fd].inode, fh[fd].ptr >> lbs, &bn, &errno))) { mutex_unlock(&ext2_mutex); @@ -410,8 +445,9 @@ static ssize_t fs_ext2_write(void *h, const void *buf, size_t cnt) { errno = err; return -1; } - else if(!(block = ext2_inode_alloc_block(fs, fh[fd].inode, - &errno))) { + + if(!(block = ext2_inode_alloc_block(fs, fh[fd].inode, + fh[fd].ptr >> lbs, &errno))) { mutex_unlock(&ext2_mutex); return -1; } @@ -434,9 +470,8 @@ static ssize_t fs_ext2_write(void *h, const void *buf, size_t cnt) { } /* Update the file's size and modification time. */ - if(fh[fd].ptr > fh[fd].inode->i_size) { + if(fh[fd].ptr > fh[fd].inode->i_size) fh[fd].inode->i_size = (uint32_t)fh[fd].ptr; - } fh[fd].inode->i_mtime = time(NULL); ext2_inode_mark_dirty(fh[fd].inode); @@ -477,9 +512,6 @@ static off_t fs_ext2_seek(void *h, off_t offset, int whence) { return -1; } - /* Check bounds */ - if(fh[fd].ptr > fh[fd].inode->i_size) fh[fd].ptr = fh[fd].inode->i_size; - rv = (off_t)fh[fd].ptr; mutex_unlock(&ext2_mutex); return rv; @@ -1452,7 +1484,7 @@ static int fs_ext2_symlink(vfs_handler_t *vfs, const char *path1, const char *path2) { fs_ext2_fs_t *fs = (fs_ext2_fs_t *)vfs->privdata; ext2_inode_t *inode, *pinode; - uint32_t inode_num, pinode_num, bs; + uint32_t inode_num, pinode_num, bs, lbs; int rv; char *nd, *cp; size_t len; @@ -1561,11 +1593,12 @@ static int fs_ext2_symlink(vfs_handler_t *vfs, const char *path1, else { /* We will never leak into the indirect pointers, so this is relatively simple to deal with. */ - inode->i_size = (uint32_t)len; bs = ext2_block_size(fs->fs); + lbs = ext2_log_block_size(fs->fs); while(len) { - if(!(block = ext2_inode_alloc_block(fs->fs, inode, &rv))) { + if(!(block = ext2_inode_alloc_block(fs->fs, inode, + inode->i_size >> lbs, &rv))) { ext2_inode_put(pinode); ext2_inode_deref(fs->fs, inode_num, 1); free(cp); @@ -1577,10 +1610,12 @@ static int fs_ext2_symlink(vfs_handler_t *vfs, const char *path1, memcpy(block, path1, bs); len -= bs; path1 += bs; + inode->i_size += bs; } else { memcpy(block, path1, len); memset(block + len, 0, bs - len); + inode->i_size += len; len = 0; } } diff --git a/addons/libkosext2fs/inode.c b/addons/libkosext2fs/inode.c index d3a0ecd..a54205b 100644 --- a/addons/libkosext2fs/inode.c +++ b/addons/libkosext2fs/inode.c @@ -398,8 +398,9 @@ static int free_ind_block(ext2_fs_t *fs, ext2_inode_t *inode, uint32_t iblk) { uint32_t blks_per_ind = fs->block_size >> 2; uint32_t i, blk; uint32_t *iblock; - uint32_t blks_left = inode->i_blocks; - int rv, sub = (2 << fs->sb.s_log_block_size); + int rv; + + (void)inode; if(!iblk) { /* ????: This really shouldn't happen! */ @@ -412,7 +413,7 @@ static int free_ind_block(ext2_fs_t *fs, ext2_inode_t *inode, uint32_t iblk) { if(!(iblock = (uint32_t *)malloc(fs->block_size))) /* Uh oh... */ return -ENOMEM; - + /* Read the indirect block in. No need to cache this, since we're going to be releasing it very soon anyway... */ if(ext2_block_read_nc(fs, iblk, (uint8_t *)iblock)) { @@ -420,26 +421,16 @@ static int free_ind_block(ext2_fs_t *fs, ext2_inode_t *inode, uint32_t iblk) { return -EIO; } - for(i = 0; i < blks_per_ind && blks_left; ++i) { - if(!(blk = iblock[i])) { - /* ????: This really shouldn't happen! */ - dbglog(DBG_ERROR, "ext2_inode_free_all: inode indicates use of " - "block 0. Run fsck ASAP!\n"); + for(i = 0; i < blks_per_ind; ++i) { + if(!(blk = iblock[i])) continue; - } if((rv = mark_block_free(fs, blk))) { free(iblock); return rv; } - - /* Subtract out however many blocks we freed up along the way. */ - blks_left -= sub; } - /* Update the number of blocks remaining. */ - inode->i_blocks = blks_left; - /* Mark the indirect block itself free... */ rv = mark_block_free(fs, iblk); free(iblock); @@ -472,8 +463,8 @@ static int free_dind_block(ext2_fs_t *fs, ext2_inode_t *inode, uint32_t iblk) { } /* Go through each entry in the block and free all of its blocks. */ - for(j = 0; j < blks_per_ind && inode->i_blocks; ++j) { - if((rv = free_ind_block(fs, inode, ib2[j]))) { + for(j = 0; j < blks_per_ind; ++j) { + if(ib2[j] && (rv = free_ind_block(fs, inode, ib2[j]))) { free(ib2); return rv; } @@ -511,8 +502,8 @@ static int free_tind_block(ext2_fs_t *fs, ext2_inode_t *inode, uint32_t iblk) { } /* Go through each entry in the block and free all of its blocks. */ - for(j = 0; j < blks_per_ind && inode->i_blocks; ++j) { - if((rv = free_dind_block(fs, inode, ib2[j]))) { + for(j = 0; j < blks_per_ind; ++j) { + if(ib2[j] && (rv = free_dind_block(fs, inode, ib2[j]))) { free(ib2); return rv; } @@ -579,59 +570,40 @@ int ext2_inode_free_all(ext2_fs_t *fs, ext2_inode_t *inode, } ext2_block_mark_dirty(fs, inode->i_file_acl); - inode->i_blocks -= sub; - } - else if(inode->i_file_acl) { - /* We need to do this for now... We will reverse it later. */ - inode->i_blocks -= sub; } /* Free the direct data blocks. Note that since fast symlinks have the i_blocks field in their inodes set to 0, we don't have to do anything special to handle them in this code. */ - for(i = 0; i < 12 && inode->i_blocks; ++i) { - if(!(blk = inode->i_block[i])) { - /* ????: This really shouldn't happen! */ - dbglog(DBG_ERROR, "ext2_inode_free_all: inode indicates use of " - "block 0. Run fsck ASAP!\n"); + for(i = 0; i < 12; ++i) { + if(!(blk = inode->i_block[i])) continue; - } if((rv = mark_block_free(fs, blk))) goto done; - inode->i_blocks -= sub; inode->i_block[i] = 0; fs->flags |= EXT2_FS_FLAG_SB_DIRTY; } - /* See if we're done already... */ - if(!inode->i_blocks) - goto done; - /* Handle the singly-indirect block */ - if((rv = free_ind_block(fs, inode, inode->i_block[12]))) + if(inode->i_block[12] && + (rv = free_ind_block(fs, inode, inode->i_block[12]))) goto done; inode->i_block[12] = 0; - /* See if we're done now... */ - if(!inode->i_blocks) - goto done; - /* Time to go through the doubly-indirect block... */ - if((rv = free_dind_block(fs, inode, inode->i_block[13]))) + if(inode->i_block[13] && + (rv = free_dind_block(fs, inode, inode->i_block[13]))) goto done; inode->i_block[13] = 0; - /* See if we're done now... */ - if(!inode->i_blocks) - goto done; - /* Ugh... Really... A trebly-indirect block? At least we know we're done at this point... */ - rv = free_tind_block(fs, inode, inode->i_block[14]); + if(inode->i_block[14]) + rv = free_tind_block(fs, inode, inode->i_block[14]); inode->i_block[14] = 0; @@ -639,6 +611,8 @@ done: /* Restore the xattr block to the block count if needed. */ if(inode->i_file_acl && !for_del) inode->i_blocks = sub; + else + inode->i_blocks = 0; return rv; } @@ -722,6 +696,8 @@ static uint8_t *alloc_ind_blk(ext2_fs_t *fs, struct int_inode *inode, buf32[0] = bn2; *rbn = bn; + inode->inode.i_blocks += 2 << fs->sb.s_log_block_size; + inode->flags |= INODE_FLAG_DIRTY; return buf; } @@ -746,6 +722,8 @@ static uint8_t *alloc_dind_blk(ext2_fs_t *fs, struct int_inode *inode, buf32[0] = bn2; *rbn = bn; + inode->inode.i_blocks += 2 << fs->sb.s_log_block_size; + inode->flags |= INODE_FLAG_DIRTY; return buf; } @@ -771,13 +749,15 @@ static uint8_t *alloc_tind_blk(ext2_fs_t *fs, struct int_inode *inode, buf32[0] = bn2; *rbn = bn; + inode->inode.i_blocks += 2 << fs->sb.s_log_block_size; + inode->flags |= INODE_FLAG_DIRTY; return buf; } -uint8_t *ext2_inode_alloc_block(ext2_fs_t *fs, ext2_inode_t *inode, int *err) { +uint8_t *ext2_inode_alloc_block(ext2_fs_t *fs, ext2_inode_t *inode, + uint32_t blocks, int *err) { struct int_inode *iinode = (struct int_inode *)inode; - uint32_t blocks = inode->i_blocks >> (fs->sb.s_log_block_size + 1); uint8_t *buf; uint32_t *ind, *ind2, *ind3; uint32_t bg, ibn, ibn2, ibn3; diff --git a/addons/libkosext2fs/inode.h b/addons/libkosext2fs/inode.h index e6eac29..9b29394 100644 --- a/addons/libkosext2fs/inode.h +++ b/addons/libkosext2fs/inode.h @@ -136,7 +136,8 @@ int ext2_inode_deref(ext2_fs_t *fs, uint32_t inode_num, int isdir); /* Allocate a new data block for an inode, filling in the blocks array and updating the block count. It is the caller's responsibility to update the i_size and any timestamps needed. */ -uint8_t *ext2_inode_alloc_block(ext2_fs_t *fs, ext2_inode_t *inode, int *err); +uint8_t *ext2_inode_alloc_block(ext2_fs_t *fs, ext2_inode_t *inode, + uint32_t blocks,int *err); uint8_t *ext2_inode_read_block(ext2_fs_t *fs, const ext2_inode_t *inode, uint32_t block_num, uint32_t *r_block, hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-05-16 16:02:02
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 2d4496d48a77eddda6711d3545c7bbc32c852f81 (commit) via 2493b52c3b8253b9ec207d71d155f758a119ff60 (commit) from 87003ea0be91297fd777f846544096be3a9c0964 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2d4496d48a77eddda6711d3545c7bbc32c852f81 Author: Lawrence Sebald <ljs...@us...> Date: Thu May 16 12:01:25 2013 -0400 Fix a rather stupid error in reading blocks from a file in fs_ext2. commit 2493b52c3b8253b9ec207d71d155f758a119ff60 Author: Lawrence Sebald <ljs...@us...> Date: Thu May 16 11:59:47 2013 -0400 In fs_copy, make sure to open the destination with the O_CREAT flag, otherwise some filesystems that require that flag for creating a file (fs_ext2) will fail to copy. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/inode.c | 8 ++------ kernel/fs/fs_utils.c | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/addons/libkosext2fs/inode.c b/addons/libkosext2fs/inode.c index 6c47396..d3a0ecd 100644 --- a/addons/libkosext2fs/inode.c +++ b/addons/libkosext2fs/inode.c @@ -1275,14 +1275,10 @@ uint8_t *ext2_inode_read_block(ext2_fs_t *fs, const ext2_inode_t *inode, int *err) { uint32_t blks_per_ind, ibn; uint32_t *iblock; - int shift = (1 << fs->sb.s_log_block_size); - int sub = 0; - - if(inode->i_file_acl) - sub = 1 << shift; + int shift = 1 + fs->sb.s_log_block_size; /* Check to be sure we're not being asked to do something stupid... */ - if((block_num << shift) >= inode->i_blocks - sub) { + if((block_num << (shift + 9)) >= inode->i_size) { *err = EINVAL; return NULL; } diff --git a/kernel/fs/fs_utils.c b/kernel/fs/fs_utils.c index 03c8f5f..7cee835 100644 --- a/kernel/fs/fs_utils.c +++ b/kernel/fs/fs_utils.c @@ -31,7 +31,7 @@ ssize_t fs_copy(const char * src, const char * dst) { return -1; } - fd = fs_open(dst, O_WRONLY | O_TRUNC); + fd = fs_open(dst, O_WRONLY | O_TRUNC | O_CREAT); if(fd == FILEHND_INVALID) { fs_close(fs); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-05-16 00:02:49
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 87003ea0be91297fd777f846544096be3a9c0964 (commit) from f4796a2464b352b4b660bcb68af4c0e825365805 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 87003ea0be91297fd777f846544096be3a9c0964 Author: Lawrence Sebald <ljs...@us...> Date: Wed May 15 20:02:22 2013 -0400 Add a mke2fs program to the examples. ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/sd/Makefile | 6 +- examples/dreamcast/sd/{ext2fs => mke2fs}/Makefile | 13 +- examples/dreamcast/sd/mke2fs/Makefile.nonkos | 17 + examples/dreamcast/sd/mke2fs/mke2fs.c | 991 +++++++++++++++++++++ 4 files changed, 1020 insertions(+), 7 deletions(-) copy examples/dreamcast/sd/{ext2fs => mke2fs}/Makefile (51%) create mode 100644 examples/dreamcast/sd/mke2fs/Makefile.nonkos create mode 100644 examples/dreamcast/sd/mke2fs/mke2fs.c diff --git a/examples/dreamcast/sd/Makefile b/examples/dreamcast/sd/Makefile index 032f319..31bfab0 100644 --- a/examples/dreamcast/sd/Makefile +++ b/examples/dreamcast/sd/Makefile @@ -5,9 +5,13 @@ all: $(KOS_MAKE) -C ext2fs + $(KOS_MAKE) -C mke2fs clean: $(KOS_MAKE) -C ext2fs clean - + $(KOS_MAKE) -C mke2fs clean + dist: $(KOS_MAKE) -C ext2fs dist + $(KOS_MAKE) -C mke2fs dist + diff --git a/examples/dreamcast/sd/ext2fs/Makefile b/examples/dreamcast/sd/mke2fs/Makefile similarity index 51% copy from examples/dreamcast/sd/ext2fs/Makefile copy to examples/dreamcast/sd/mke2fs/Makefile index 8d6a71d..75a0045 100644 --- a/examples/dreamcast/sd/ext2fs/Makefile +++ b/examples/dreamcast/sd/mke2fs/Makefile @@ -1,13 +1,14 @@ # KallistiOS ##version## # -# examples/dreamcast/sd/ext2fs/Makefile +# examples/dreamcast/sd/mke2fs/Makefile # -TARGET = sd-ext2fs.elf -OBJS = sd-ext2fs.o +TARGET = mke2fs.elf +OBJS = mke2fs.o -# Uncomment the next line to enable write support in the example. -#KOS_CFLAGS += -DENABLE_WRITE +# We need the private headers from libkosext2fs, since we're not using the +# facilities of fs_ext2 here. +KOS_CFLAGS += -I$(KOS_BASE)/addons/libkosext2fs -Werror -W -std=gnu99 all: rm-elf $(TARGET) @@ -20,7 +21,7 @@ rm-elf: -rm -f $(TARGET) romdisk.* $(TARGET): $(OBJS) - kos-cc -o $(TARGET) $(OBJS) -lkosext2fs + kos-cc -o $(TARGET) $(OBJS) run: $(TARGET) $(KOS_LOADER) $(TARGET) diff --git a/examples/dreamcast/sd/mke2fs/Makefile.nonkos b/examples/dreamcast/sd/mke2fs/Makefile.nonkos new file mode 100644 index 0000000..c824416 --- /dev/null +++ b/examples/dreamcast/sd/mke2fs/Makefile.nonkos @@ -0,0 +1,17 @@ +# KallistiOS ##version## +# +# mke2fs/Makefile.nonkos +# Copyright (C) 2013 Lawrence Sebald +# + +all: mke2fs.kos +CFLAGS += -I$(KOS_BASE)/addons/libkosext2fs -DEXT2_NOT_IN_KOS -Wall -std=gnu99 +#CFLAGS += -DEXT2FS_DEBUG + +mke2fs.kos: mke2fs.c + $(CC) $(CFLAGS) -g -o mke2fs.kos mke2fs.c + +clean: + -rm -f mke2fs.kos + -rm -rf mke2fs.kos.dSYM + diff --git a/examples/dreamcast/sd/mke2fs/mke2fs.c b/examples/dreamcast/sd/mke2fs/mke2fs.c new file mode 100644 index 0000000..18fcd6e --- /dev/null +++ b/examples/dreamcast/sd/mke2fs/mke2fs.c @@ -0,0 +1,991 @@ +/* KallistiOS ##version## + + mke2fs.c + Copyright (C) 2013 Lawrence Sebald + + This example shows how to format a SD card with a new ext2 filesystem using + pretty much no functionality from libkosext2fs (other than the definitions in + the headers). No functions in the library itself are called (hence the + library isn't linked in). + + At some point I'll probably move some of this functionality into libkosext2fs + so that there's less manual work to be done, but for the time being, this + gets the job done. +*/ + +#include <time.h> +#include <stdio.h> +#include <errno.h> +#include <string.h> +#include <stdlib.h> +#include <inttypes.h> +#include <unistd.h> + +#ifdef _arch_dreamcast +#include <kos/dbgio.h> +#include <kos/blockdev.h> + +#include <arch/arch.h> + +#include <dc/sd.h> +#include <dc/maple.h> +#include <dc/maple/controller.h> +#endif + +#include "ext2fs.h" +#include "block.h" +#include "inode.h" +#include "superblock.h" +#include "utils.h" + +#define KiB 1024LLU +#define MiB (KiB * 1024LLU) +#define GiB (MiB * 1024LLU) + +/* We don't make any blocks more than 4KiB in size, so this works as a full-size + block buffer quite nicely. */ +static uint8_t block[4096] __attribute__((aligned(4))); + +static ext2_bg_desc_t *bg_descs; +static int bg_count; +static uint32_t *rsvd_inodes, *rsvd_blocks; + +/* <= 128MiB -> 1024 byte blocks + <= 4GiB -> 2048 byte blocks + > 4GiB -> 4096 byte blocks + + While libkosext2fs should handle larger block sizes than 4096 bytes, Linux on + most platforms will not, so we don't go above it. + + Note that these ranges are somewhat arbitrary, but work out nicely. */ +static inline uint32_t pick_ext2_bs(uint64_t total_size) { + if(total_size > 4 * GiB) + return 4096; + else if(total_size > 128 * MiB) + return 2048; + else + return 1024; +} + +static inline int sb_tst(int group, int root) { + for(;;) { + if(group == 1) + return 1; + if(group % root) + return 0; + group /= root; + } +} + +static inline int has_superblock(int group) { + if(group == 0 || sb_tst(group, 3) || sb_tst(group, 5) || sb_tst(group, 7)) + return 1; + return 0; +} + +static void __attribute__((__noreturn__)) exit_with_error(const char *err) { +#ifdef _arch_dreamcast + maple_device_t *dev; + cont_state_t *state; + + printf("%s\n\nPress any button to exit.\n", err); + + for(;;) { + dev = maple_enum_type(0, MAPLE_FUNC_CONTROLLER); + + if(dev) { + state = (cont_state_t *)maple_dev_status(dev); + + if(state) { + if(state->buttons) + arch_exit(); + } + } + } +#else + printf("%s\n", err); + exit(EXIT_FAILURE); +#endif +} + +static int write_fs_block(ext2_superblock_t *sb, kos_blockdev_t *bd, + uint32_t block_num, const uint8_t *buf) { + int fs_per_block = 10 + sb->s_log_block_size - bd->l_block_size; + + if(fs_per_block < 0) + /* This should never happen, as the ext2 block size must be at least + as large as the sector size of the block device itself. */ + return -EINVAL; + + if(sb->s_blocks_count <= block_num) + return -EINVAL; + + if(bd->write_blocks(bd, block_num << fs_per_block, 1 << fs_per_block, buf)) + return -EIO; + + return 0; +} + +static int read_fs_block(ext2_superblock_t *sb, kos_blockdev_t *bd, + uint32_t block_num, uint8_t *buf) { + int fs_per_block = 10 + sb->s_log_block_size - bd->l_block_size; + + if(fs_per_block < 0) + /* This should never happen, as the ext2 block size must be at least + as large as the sector size of the block device itself. */ + return -EINVAL; + + if(sb->s_blocks_count <= block_num) + return -EINVAL; + + if(bd->read_blocks(bd, block_num << fs_per_block, 1 << fs_per_block, buf)) + return -EIO; + + return 0; +} + +static int read_inode_block(ext2_superblock_t *sb, kos_blockdev_t *bd, + uint32_t inode_num, uint8_t *buf, + ext2_inode_t **rino, uint32_t *rblk) { + uint32_t bg, index, blk; + uint16_t ino_sz; + uint32_t block_size = 1024 << sb->s_log_block_size; + int rv; + + if(sb->s_rev_level >= EXT2_DYNAMIC_REV) + ino_sz = sb->s_inode_size; + else + ino_sz = 128; + + bg = (inode_num - 1) / sb->s_inodes_per_group; + index = (inode_num - 1) % sb->s_inodes_per_group; + + blk = index / (block_size / ino_sz); + index %= (block_size / ino_sz); + *rblk = blk + bg_descs[bg].bg_inode_table; + + if((rv = read_fs_block(sb, bd, *rblk, buf))) + return rv; + + *rino = (ext2_inode_t *)(buf + index * ino_sz); + + return 0; +} + +static int write_superblock(ext2_superblock_t *bsb, kos_blockdev_t *bd, + uint32_t bg) { + uint8_t *buf; + ext2_superblock_t *sb; + uint32_t blk, nblks; + int fs_per_block = 10 + bsb->s_log_block_size - bd->l_block_size; + int rv; + + /* Allocate enough space for one filesystem block. */ + if(!(buf = (uint8_t *)malloc(1024 << bsb->s_log_block_size))) + return -ENOMEM; + + sb = (ext2_superblock_t *)buf; + memset(buf, 0, 1024 << bsb->s_log_block_size); + + /* If we're working with the first block group, we need to offset within + the block, potentially. */ + if(!bg) { + if(bd->l_block_size > 10) { + /* Read what's there already, in case we have a boot block or some + other nonsense. */ + if(bd->read_blocks(bd, 0, 1, buf)) + return -EIO; + + /* Fix the pointer. */ + sb = (ext2_superblock_t *)(buf + 1024); + + /* Clear out anything after the superblock */ + if(bd->l_block_size > 11) + memset(buf + 2048, 0, (1 << bd->l_block_size) - 2048); + + blk = 0; + nblks = 1; + } + else { + nblks = blk = 1024 >> bd->l_block_size; + } + } + else { + blk = (bg * bsb->s_blocks_per_group + bsb->s_first_data_block) << + (fs_per_block); + nblks = 1 << fs_per_block; + } + + /* Copy in the superblock */ + memcpy(sb, bsb, sizeof(ext2_superblock_t)); + + /* Fix things up, depending on the revision of the filesystem. */ + if(bsb->s_rev_level >= EXT2_DYNAMIC_REV) + /* Write the block group number. */ + sb->s_block_group_nr = (uint16_t)bg; + else + /* Clear everything that's not in rev0 out. */ + memset(&sb->s_first_ino, 0, 176); + + printf("Writing superblock for group %" PRIu32 " @ %" PRIu32 "\n", bg, + blk >> fs_per_block); + + /* Write the data. */ + rv = bd->write_blocks(bd, blk, nblks, buf); + + /* Clean up, we're done. */ + free(buf); + return rv; +} + +static int write_bg_descs(ext2_superblock_t *sb, kos_blockdev_t *bd, + uint32_t bg) { + uint32_t blk, nblks, bg_per_block, i; + uint32_t block_size = (1024 << sb->s_log_block_size); + uint8_t *buf; + int rv = 0; + + /* The block group descriptors appear right after the superblock (backup) */ + blk = bg * sb->s_blocks_per_group + sb->s_first_data_block + 1; + + /* Figure out how big each superblock (or backup thereof) is */ + bg_per_block = block_size / sizeof(ext2_bg_desc_t); + nblks = bg_count / bg_per_block; + + if(bg_count % bg_per_block) + ++nblks; + + if(!(buf = (uint8_t *)malloc(block_size * nblks))) + return -ENOMEM; + + memset(buf, 0, block_size * nblks); + memcpy(buf, bg_descs, bg_count * sizeof(ext2_bg_desc_t)); + + printf("Writing block group descriptors for group %" PRIu32 " @ %" PRIu32 + " (%" PRIu32 " block(s))\n", bg, blk, nblks); + + /* Write them */ + for(i = 0; i < nblks && !rv; ++i) { + rv = write_fs_block(sb, bd, blk + i, buf); + } + + free(buf); + return rv; +} + +static int write_superblocks(ext2_superblock_t *sb, kos_blockdev_t *bd) { + int i; + + printf("Writing superblocks\n"); + + if(sb->s_rev_level < EXT2_DYNAMIC_REV || + !(sb->s_feature_ro_compat & EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER)) { + for(i = 0; i < bg_count; ++i) { + if(write_superblock(sb, bd, i)) + exit_with_error("Error writing superblock\n"); + + if(write_bg_descs(sb, bd, i)) + exit_with_error("Error writing block group descriptors\n"); + } + } + else { + if(write_superblock(sb, bd, 0)) + exit_with_error("Error writing superblock\n"); + + if(write_bg_descs(sb, bd, 0)) + exit_with_error("Error writing block group descriptors\n"); + + for(i = 1; i < bg_count; ++i) { + if(has_superblock(i)) { + if(write_superblock(sb, bd, i)) + exit_with_error("Error writing superblock\n"); + + if(write_bg_descs(sb, bd, i)) + exit_with_error("Error writing block group descriptors\n"); + } + } + } + + return -ENOSYS; +} + +static int write_blank_inode_tables(ext2_superblock_t *sb, kos_blockdev_t *bd) { + int i, rv; + uint32_t j, blk; + + memset(block, 0, 1024 << sb->s_log_block_size); + + for(i = 0; i < bg_count; ++i) { + blk = i * sb->s_blocks_per_group + rsvd_blocks[i] + + sb->s_first_data_block; + printf("Writing inode tables for block group %d\n" + "\t%" PRIu32 " blocks (%" PRIu16 " inodes), start @ block %" + PRIu32 "\n", i, rsvd_inodes[i], bg_descs[i].bg_free_inodes_count, + blk); + bg_descs[i].bg_inode_table = blk; + + for(j = 0; j < rsvd_inodes[i]; ++j) { + if((rv = write_fs_block(sb, bd, blk++, block))) + exit_with_error("Error writing inode tables!\n"); + } + } + + return 0; +} + +static int create_bg_descs(ext2_superblock_t *sb) { + uint32_t bc = sb->s_blocks_count - sb->s_first_data_block; + int odd_count = 0, i; + + /* Figure out how many block groups we'll have. */ + bg_count = bc / sb->s_blocks_per_group; + if(bc % sb->s_blocks_per_group) { + odd_count = 1; + ++bg_count; + } + + /* Allocate space for them */ + if(!(bg_descs = (ext2_bg_desc_t *)malloc(sizeof(ext2_bg_desc_t) * + bg_count))) + return -ENOMEM; + + if(!(rsvd_blocks = (uint32_t *)malloc(sizeof(uint32_t) * bg_count))) { + free(bg_descs); + return -ENOMEM; + } + + if(!(rsvd_inodes = (uint32_t *)malloc(sizeof(uint32_t) * bg_count))) { + free(rsvd_blocks); + free(bg_descs); + return -ENOMEM; + } + + memset(bg_descs, 0, sizeof(ext2_bg_desc_t) * bg_count); + memset(rsvd_blocks, 0, sizeof(uint32_t) * bg_count); + memset(rsvd_inodes, 0, sizeof(uint32_t) * bg_count); + + sb->s_inodes_per_group = ((sb->s_inodes_count / bg_count) + 7) & ~7; + sb->s_inodes_count = sb->s_inodes_per_group * bg_count; + sb->s_free_inodes_count = sb->s_inodes_count - 11; + + /* Set up what we know for sure, we'll get the rest later. */ + for(i = 0; i < bg_count - odd_count; ++i) { + bg_descs[i].bg_free_blocks_count = sb->s_blocks_per_group; + bg_descs[i].bg_free_inodes_count = sb->s_inodes_per_group; + } + + /* Handle the last group specially... */ + if(odd_count) { + bg_descs[i].bg_free_blocks_count = sb->s_blocks_count - + (sb->s_blocks_per_group * (bg_count - 1)) - + sb->s_first_data_block; + bg_descs[i].bg_free_inodes_count = sb->s_inodes_per_group; + } + + return 0; +} + +static int reserve_blocks(ext2_superblock_t *sb) { + int i; + uint32_t bc = sb->s_blocks_count - sb->s_first_data_block; + uint32_t block_size = (1024 << sb->s_log_block_size); + uint32_t bg_per_block, sb_blocks, in_per_block, inode_blocks; + uint32_t total_reserved = 0; + + /* Figure out how big each superblock (or backup thereof) is */ + bg_per_block = block_size / sizeof(ext2_bg_desc_t); + sb_blocks = 1 + (bg_count / bg_per_block); + + if(bg_count % bg_per_block) + ++sb_blocks; + + /* Figure out how many blocks we have to reserve beyond that in each + block group for inodes. */ + in_per_block = block_size / sizeof(ext2_inode_t); + inode_blocks = sb->s_inodes_per_group / in_per_block; + + if(sb->s_inodes_per_group % in_per_block) + ++inode_blocks; + + /* Make sure we have sufficient space in the last block group and that we + aren't going to have to readjust things... */ + if(bc % sb->s_blocks_per_group) { + /* Make sure there's actually enough blocks in the last block group to + make things work properly... */ + if(bg_descs[bg_count - 1].bg_free_blocks_count <= + sb_blocks + inode_blocks + 32) { + printf("Dropping last block group due to insufficient space!\n"); + printf("This lowers the filesystem size by %" PRIu16 " blocks\n", + bg_descs[bg_count - 1].bg_free_blocks_count); ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-05-15 21:02:22
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via f4796a2464b352b4b660bcb68af4c0e825365805 (commit) from 4d4894348c501fc556cad4c1be7c280b95600687 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f4796a2464b352b4b660bcb68af4c0e825365805 Author: Lawrence Sebald <ljs...@us...> Date: Wed May 15 17:02:00 2013 -0400 Add support for creating symlinks to fs_ext2. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/fs_ext2.c | 184 ++++++++++++++++++++++++++++++++++++++-- kernel/libc/koslib/symlink.c | 3 +- 2 files changed, 176 insertions(+), 11 deletions(-) diff --git a/addons/libkosext2fs/fs_ext2.c b/addons/libkosext2fs/fs_ext2.c index e33e7ad..475bca1 100644 --- a/addons/libkosext2fs/fs_ext2.c +++ b/addons/libkosext2fs/fs_ext2.c @@ -936,15 +936,18 @@ static int fs_ext2_unlink(vfs_handler_t *vfs, const char *fn) { return -1; } - /* Make sure we don't have any open file descriptors to the file. */ - for(irv = 0; irv < MAX_EXT2_FILES; ++irv) { - if(fh[irv].inode_num == dent->inode) { - ext2_inode_put(pinode); - ext2_inode_put(inode); - mutex_unlock(&ext2_mutex); - free(cp); - errno = EBUSY; - return -1; + /* Make sure we don't have any open file descriptors to the file if we're + going to be actually deleting the data this time. */ + if(inode->i_links_count == 1) { + for(irv = 0; irv < MAX_EXT2_FILES; ++irv) { + if(fh[irv].inode_num == dent->inode) { + ext2_inode_put(pinode); + ext2_inode_put(inode); + mutex_unlock(&ext2_mutex); + free(cp); + errno = EBUSY; + return -1; + } } } @@ -1445,6 +1448,167 @@ static int fs_ext2_link(vfs_handler_t *vfs, const char *path1, return 0; } +static int fs_ext2_symlink(vfs_handler_t *vfs, const char *path1, + const char *path2) { + fs_ext2_fs_t *fs = (fs_ext2_fs_t *)vfs->privdata; + ext2_inode_t *inode, *pinode; + uint32_t inode_num, pinode_num, bs; + int rv; + char *nd, *cp; + size_t len; + time_t now; + uint8_t *block; + + /* Make sure that the fs is mounted read/write. */ + if(!(fs->mount_flags & FS_EXT2_MOUNT_READWRITE)) { + errno = EROFS; + return -1; + } + + /* Make sure there is a string given */ + if(!path1) { + errno = EFAULT; + return -1; + } + + /* Make sure it is not too long. Linux doesn't allow symlinks to be more + than one page in length, so we'll respect that limit too. */ + len = strlen(path1); + if(len >= 4096) { + errno = ENAMETOOLONG; + return -1; + } + + /* Make sure the second path is valid */ + if(!path2) { + errno = EFAULT; + return -1; + } + else if(!*path2) { + errno = EEXIST; + return -1; + } + + /* Make a writable copy of the new link's filename */ + if(!(cp = strdup(path2))) { + errno = ENOMEM; + return -1; + } + + /* Separate our copy into the parent and the link we want to create */ + if(!(nd = strrchr(cp, '/'))) { + free(cp); + errno = ENOENT; + return -1; + } + + /* Split the string. */ + *nd++ = 0; + + mutex_lock(&ext2_mutex); + + /* Find the parent directory of the new link */ + if((rv = ext2_inode_by_path(fs->fs, cp, &pinode, &pinode_num, 1, NULL))) { + mutex_unlock(&ext2_mutex); + free(cp); + errno = -rv; + return -1; + } + + /* If the entry we get back is not a directory, then we've got problems. */ + if((pinode->i_mode & 0xF000) != EXT2_S_IFDIR) { + ext2_inode_put(pinode); + mutex_unlock(&ext2_mutex); + free(cp); + errno = ENOTDIR; + return -1; + } + + /* See if the new link already exists */ + if(ext2_dir_entry(fs->fs, pinode, nd)) { + ext2_inode_put(pinode); + mutex_unlock(&ext2_mutex); + free(cp); + errno = EEXIST; + return -1; + } + + /* Allocate a new inode for the new symlink. */ + if(!(inode = ext2_inode_alloc(fs->fs, pinode_num, &rv, &inode_num))) { + ext2_inode_put(pinode); + mutex_unlock(&ext2_mutex); + free(cp); + errno = rv; + return -1; + } + + /* Fill in the inode. Copy most of the interesting parts from the parent. */ + now = time(NULL); + inode->i_mode = (pinode->i_mode & ~EXT2_S_IFDIR) | EXT2_S_IFLNK; + inode->i_uid = pinode->i_uid; + inode->i_atime = inode->i_ctime = inode->i_mtime = now; + inode->i_gid = pinode->i_gid; + inode->i_osd2.l_i_uid_high = pinode->i_osd2.l_i_uid_high; + inode->i_osd2.l_i_gid_high = pinode->i_osd2.l_i_gid_high; + inode->i_links_count = 1; + + /* Will the link fit in the inode? */ + if(len < 60) { + /* We can make a fast symlink. */ + strncpy((char *)inode->i_block, path1, 60); + inode->i_size = (uint32_t)len; + } + else { + /* We will never leak into the indirect pointers, so this is relatively + simple to deal with. */ + inode->i_size = (uint32_t)len; + bs = ext2_block_size(fs->fs); + + while(len) { + if(!(block = ext2_inode_alloc_block(fs->fs, inode, &rv))) { + ext2_inode_put(pinode); + ext2_inode_deref(fs->fs, inode_num, 1); + free(cp); + errno = rv; + return -1; + } + + if(len >= bs) { + memcpy(block, path1, bs); + len -= bs; + path1 += bs; + } + else { + memcpy(block, path1, len); + memset(block + len, 0, bs - len); + len = 0; + } + } + } + + /* Add an entry to the parent directory. */ + if((rv = ext2_dir_add_entry(fs->fs, pinode, nd, inode_num, inode, NULL))) { + ext2_inode_put(pinode); + ext2_inode_deref(fs->fs, inode_num, 1); + free(cp); + errno = rv; + return -1; + } + + /* Clean this up, since we're done with it. */ + free(cp); + + /* Update the parent inode and mark both as dirty... */ + pinode->i_ctime = pinode->i_mtime = now; + ext2_inode_mark_dirty(pinode); + ext2_inode_mark_dirty(inode); + + ext2_inode_put(pinode); + ext2_inode_put(inode); + mutex_unlock(&ext2_mutex); + return 0; +} + /* This is a template that will be used for each mount */ static vfs_handler_t vh = { /* Name Handler */ @@ -1478,7 +1642,7 @@ static vfs_handler_t vh = { fs_ext2_fcntl, /* fcntl */ NULL, /* poll */ fs_ext2_link, /* link */ - NULL /* symlink */ + fs_ext2_symlink /* symlink */ }; static int initted = 0; diff --git a/kernel/libc/koslib/symlink.c b/kernel/libc/koslib/symlink.c index 8fa4b5a..d2101bf 100644 --- a/kernel/libc/koslib/symlink.c +++ b/kernel/libc/koslib/symlink.c @@ -8,4 +8,5 @@ int symlink(const char *path1, const char *path2) { return fs_symlink(path1, path2); -} \ No newline at end of file +} + hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-05-15 15:46:00
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 4d4894348c501fc556cad4c1be7c280b95600687 (commit) via a0d1ffc15f7c8623fd8fb50c6dace2e22c5e8422 (commit) from 98106fee8d59142513f179b1536b4bdbb77c4a59 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4d4894348c501fc556cad4c1be7c280b95600687 Author: Lawrence Sebald <ljs...@us...> Date: Wed May 15 11:45:24 2013 -0400 Add support for creating hard links to libkosext2fs. commit a0d1ffc15f7c8623fd8fb50c6dace2e22c5e8422 Author: Lawrence Sebald <ljs...@us...> Date: Wed May 15 11:44:20 2013 -0400 Add a symlink() function to koslib. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/Makefile.nonkos | 2 +- addons/libkosext2fs/fs_ext2.c | 132 +++++++++++++++++++++++++++++++++- include/kos/fs.h | 4 +- kernel/libc/koslib/Makefile | 2 +- kernel/libc/koslib/symlink.c | 11 +++ 5 files changed, 143 insertions(+), 8 deletions(-) create mode 100644 kernel/libc/koslib/symlink.c diff --git a/addons/libkosext2fs/Makefile.nonkos b/addons/libkosext2fs/Makefile.nonkos index e415374..f1bf9ec 100644 --- a/addons/libkosext2fs/Makefile.nonkos +++ b/addons/libkosext2fs/Makefile.nonkos @@ -4,7 +4,7 @@ OBJS = ext2fs.o bitops.o block.o inode.o superblock.o symlink.o directory.o # Make sure everything compiles nice and cleanly (or not at all). -CFLAGS += -W -pedantic -Werror -std=gnu99 -DEXT2_NOT_IN_KOS +CFLAGS += -W -pedantic -Werror -std=gnu99 -DEXT2_NOT_IN_KOS -g libkosext2fs.a: $(OBJS) $(AR) rcs $@ $^ diff --git a/addons/libkosext2fs/fs_ext2.c b/addons/libkosext2fs/fs_ext2.c index 16b868b..e33e7ad 100644 --- a/addons/libkosext2fs/fs_ext2.c +++ b/addons/libkosext2fs/fs_ext2.c @@ -122,9 +122,9 @@ static void *fs_ext2_open(vfs_handler_t *vfs, const char *fn, int mode) { read/write. */ if((mode & (O_TRUNC | O_WRONLY | O_RDWR)) && !(mnt->mount_flags & FS_EXT2_MOUNT_READWRITE)) { - errno = EROFS; - return NULL; - } + errno = EROFS; + return NULL; + } /* Find a free file handle */ mutex_lock(&ext2_mutex); @@ -1321,6 +1321,130 @@ static int fs_ext2_fcntl(void *h, int cmd, va_list ap) { return rv; } +static int fs_ext2_link(vfs_handler_t *vfs, const char *path1, + const char *path2) { + fs_ext2_fs_t *fs = (fs_ext2_fs_t *)vfs->privdata; + ext2_inode_t *inode, *pinode; + uint32_t inode_num, pinode_num; + int rv; + char *nd, *cp; + + /* Make sure that the fs is mounted read/write. */ + if(!(fs->mount_flags & FS_EXT2_MOUNT_READWRITE)) { + errno = EROFS; + return -1; + } + + /* Make sure there is a filename given */ + if(!path1) { + errno = EFAULT; + return -1; + } + /* Make sure they're not trying to make a link to the root directory. */ + else if(!*path1) { + errno = EPERM; + return -1; + } + + /* Make sure the second path is valid too */ + if(!path2) { + errno = EFAULT; + return -1; + } + else if(!*path2) { + errno = EEXIST; + return -1; + } + + /* Make a writable copy of the new link's filename */ + if(!(cp = strdup(path2))) { + errno = ENOMEM; + return -1; + } + + /* Separate our copy into the parent and the link we want to create */ + if(!(nd = strrchr(cp, '/'))) { + free(cp); + errno = ENOENT; + return -1; + } + + /* Split the string. */ + *nd++ = 0; + + mutex_lock(&ext2_mutex); + + /* Find the object in question */ + if((rv = ext2_inode_by_path(fs->fs, path1, &inode, &inode_num, 2, NULL))) { + mutex_unlock(&ext2_mutex); + free(cp); + errno = -rv; + return -1; + } + + /* Make sure that the object in question isn't a directory. */ + if((inode->i_mode & 0xF000) == EXT2_S_IFDIR) { + ext2_inode_put(inode); + mutex_unlock(&ext2_mutex); + free(cp); + errno = EPERM; + return -1; + } + + /* Find the parent directory of the new link */ + if((rv = ext2_inode_by_path(fs->fs, cp, &pinode, &pinode_num, 1, NULL))) { + ext2_inode_put(inode); + mutex_unlock(&ext2_mutex); + free(cp); + errno = -rv; + return -1; + } + + /* If the entry we get back is not a directory, then we've got problems. */ + if((pinode->i_mode & 0xF000) != EXT2_S_IFDIR) { + ext2_inode_put(pinode); + ext2_inode_put(inode); + mutex_unlock(&ext2_mutex); + free(cp); + errno = ENOTDIR; + return -1; + } + + /* See if the new link already exists */ + if(ext2_dir_entry(fs->fs, pinode, nd)) { + ext2_inode_put(pinode); + ext2_inode_put(inode); + mutex_unlock(&ext2_mutex); + free(cp); + errno = EEXIST; + return -1; + } + + /* Add the link's entry to its parent directory. */ + if((rv = ext2_dir_add_entry(fs->fs, pinode, nd, inode_num, inode, NULL))) { + ext2_inode_put(pinode); + ext2_inode_put(inode); + mutex_unlock(&ext2_mutex); + free(cp); + errno = -rv; + return -1; + } + + /* Clean this up, since we're done with it. */ + free(cp); + + /* Update the inodes... */ + ++inode->i_links_count; + inode->i_ctime = pinode->i_ctime = pinode->i_mtime = time(NULL); + ext2_inode_mark_dirty(inode); + ext2_inode_mark_dirty(pinode); + + ext2_inode_put(pinode); + ext2_inode_put(inode); + mutex_unlock(&ext2_mutex); + return 0; +} + /* This is a template that will be used for each mount */ static vfs_handler_t vh = { /* Name Handler */ @@ -1353,7 +1477,7 @@ static vfs_handler_t vh = { fs_ext2_rmdir, /* rmdir */ fs_ext2_fcntl, /* fcntl */ NULL, /* poll */ - NULL, /* link */ + fs_ext2_link, /* link */ NULL /* symlink */ }; diff --git a/include/kos/fs.h b/include/kos/fs.h index bbdfd8f..15bceb0 100644 --- a/include/kos/fs.h +++ b/include/kos/fs.h @@ -2,7 +2,7 @@ kos/fs.h Copyright (C) 2000, 2001, 2002, 2003 Dan Potter - Copyright (C) 2012 Lawrence Sebald + Copyright (C) 2012, 2013 Lawrence Sebald */ @@ -243,7 +243,7 @@ file_t fs_open(const char *fn, int mode); associated with the descriptor. \param hnd The file descriptor to close. - \return 0 for success, -1 for error (detailed error in errno) + \return 0 for success, -1 for error */ int fs_close(file_t hnd); diff --git a/kernel/libc/koslib/Makefile b/kernel/libc/koslib/Makefile index 28918ae..e13506b 100644 --- a/kernel/libc/koslib/Makefile +++ b/kernel/libc/koslib/Makefile @@ -12,6 +12,6 @@ OBJS = abort.o byteorder.o memset2.o memset4.o memcpy2.o memcpy4.o \ opendir.o readdir.o closedir.o rewinddir.o scandir.o seekdir.o \ telldir.o usleep.o inet_addr.o realpath.o getcwd.o chdir.o mkdir.o \ creat.o sleep.o rmdir.o rename.o inet_pton.o inet_ntop.o \ - inet_ntoa.o inet_aton.o poll.o select.o + inet_ntoa.o inet_aton.o poll.o select.o symlink.o include $(KOS_BASE)/Makefile.prefab diff --git a/kernel/libc/koslib/symlink.c b/kernel/libc/koslib/symlink.c new file mode 100644 index 0000000..8fa4b5a --- /dev/null +++ b/kernel/libc/koslib/symlink.c @@ -0,0 +1,11 @@ +/* KallistiOS ##version## + + symlink.c + Copyright (C) 2013 Lawrence Sebald +*/ + +#include <kos/fs.h> + +int symlink(const char *path1, const char *path2) { + return fs_symlink(path1, path2); +} \ No newline at end of file hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Christian G. <sa...@us...> - 2013-05-15 07:59:37
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 98106fee8d59142513f179b1536b4bdbb77c4a59 (commit) via d793fac0b2d160ba5e9b4501d5c89a13c12c740d (commit) from fb653a8a3c230e08de16c5cffabd139317ec830b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 98106fee8d59142513f179b1536b4bdbb77c4a59 Author: Christian Groessler <ch...@gr...> Date: Wed May 15 09:58:34 2013 +0200 Add -N to linker switches in order not to pad .data section to a 32K boundary. commit d793fac0b2d160ba5e9b4501d5c89a13c12c740d Author: Christian Groessler <ch...@gr...> Date: Wed May 15 09:56:31 2013 +0200 New compiler (gcc 4.7.0) optimizes out the the delay loop in aica_get_pos(). Add a inline "nop" to prevent this. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/sound/arm/Makefile | 2 +- kernel/arch/dreamcast/sound/arm/aica.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/arch/dreamcast/sound/arm/Makefile b/kernel/arch/dreamcast/sound/arm/Makefile index b77d6da..eab400e 100644 --- a/kernel/arch/dreamcast/sound/arm/Makefile +++ b/kernel/arch/dreamcast/sound/arm/Makefile @@ -11,7 +11,7 @@ stream.drv: prog.elf $(DC_ARM_OBJCOPY) -O binary prog.elf stream.drv prog.elf: crt0.o main.o aica.o - $(DC_ARM_CC) -Wl,-Ttext,0x00000000,-Map,prog.map -nostartfiles -nostdlib -e reset -o prog.elf crt0.o main.o aica.o -lgcc + $(DC_ARM_CC) -Wl,-Ttext,0x00000000,-Map,prog.map,-N -nostartfiles -nostdlib -e reset -o prog.elf crt0.o main.o aica.o -lgcc %.o: %.c $(DC_ARM_CC) $(DC_ARM_CFLAGS) $(DC_ARM_INCS) -c $< -o $@ diff --git a/kernel/arch/dreamcast/sound/arm/aica.c b/kernel/arch/dreamcast/sound/arm/aica.c index 8eaf8db..84428ac 100644 --- a/kernel/arch/dreamcast/sound/arm/aica.c +++ b/kernel/arch/dreamcast/sound/arm/aica.c @@ -221,7 +221,8 @@ int aica_get_pos(int ch) { SNDREG8(0x280d) = ch; /* Wait a while */ - for(i = 0; i < 20; i++); + for(i = 0; i < 20; i++) + __asm__ volatile ("nop"); /* Prevent loop from being optimized out */ /* Update position counters */ chans[ch].pos = SNDREG32(0x2814) & 0xffff; hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-05-14 15:45:38
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via fb653a8a3c230e08de16c5cffabd139317ec830b (commit) from 298d30d5690e14dea483ae343b0d2b5a1aa04b69 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit fb653a8a3c230e08de16c5cffabd139317ec830b Author: Lawrence Sebald <ljs...@us...> Date: Tue May 14 11:44:29 2013 -0400 Add fs_link and fs_symlink now that they're somewhat relevant (with libkosext2fs). Note that this doesn't actually add support to libkosext2fs for these two syscalls just yet. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/fs_ext2.c | 4 ++- include/kos/fs.h | 48 +++++++++++++++++++++++++++-- kernel/fs/fs.c | 63 +++++++++++++++++++++++++++++++++++++- kernel/libc/newlib/newlib_link.c | 7 ++-- 4 files changed, 114 insertions(+), 8 deletions(-) diff --git a/addons/libkosext2fs/fs_ext2.c b/addons/libkosext2fs/fs_ext2.c index a016f52..16b868b 100644 --- a/addons/libkosext2fs/fs_ext2.c +++ b/addons/libkosext2fs/fs_ext2.c @@ -1352,7 +1352,9 @@ static vfs_handler_t vh = { fs_ext2_mkdir, /* mkdir */ fs_ext2_rmdir, /* rmdir */ fs_ext2_fcntl, /* fcntl */ - NULL /* poll */ + NULL, /* poll */ + NULL, /* link */ + NULL /* symlink */ }; static int initted = 0; diff --git a/include/kos/fs.h b/include/kos/fs.h index 833aba7..bbdfd8f 100644 --- a/include/kos/fs.h +++ b/include/kos/fs.h @@ -156,7 +156,8 @@ typedef struct vfs_handler { /** \brief "Memory map" a previously opened file */ void *(*mmap)(void *fd); - /** \brief Perform an I/O completion (async I/O) for a previously opened file */ + /** \brief Perform an I/O completion (async I/O) for a previously opened + file */ int (*complete)(void *fd, ssize_t *rv); /** \brief Get status information on a file on the given VFS */ @@ -168,11 +169,18 @@ typedef struct vfs_handler { /** \brief Remove a directory from the given VFS */ int (*rmdir)(struct vfs_handler *vfs, const char *fn); - /** \brief Manipulate file control flags on the given file. */ + /** \brief Manipulate file control flags on the given file */ int (*fcntl)(void *fd, int cmd, va_list ap); - /** \brief Check if an event is pending on the given file. */ + /** \brief Check if an event is pending on the given file */ short (*poll)(void *fd, short events); + + /** \brief Create a hard link */ + int (*link)(struct vfs_handler *vfs, const char *path1, const char *path2); + + /** \brief Create a symbolic link */ + int (*symlink)(struct vfs_handler *vfs, const char *path1, + const char *path2); } vfs_handler_t; /** \brief The number of distinct file descriptors that can be in use at a @@ -426,6 +434,40 @@ int fs_rmdir(const char *fn); */ int fs_fcntl(file_t fd, int cmd, ...); +/** \brief Create a hard link. + + This function implements the POSIX function link(), which creates a hard + link for an existing file. + + \param path1 An existing file to create a new link to. + \param path2 The pathname of the new link to be created. + \return 0 on success, -1 on failure. + + \note Most filesystems in KallistiOS do not support hard + links. Unlike most other VFS functions, this one + does not set errno to ENOSYS in that case, but + rather to EMLINK to preserve existing the original + behavior in KOS. +*/ +int fs_link(const char *path1, const char *path2); + +/** \brief Create a symbolic link. + + This function implements the POSIX function symlink(), which creates a + symbolic link on the filesystem. Symbolic links are not required to point to + an existing file (per POSIX) and may result in circular links if care is not + taken. For now, symbolic links cannot cross filesystem boundaries in KOS. + + \param path1 The content of the link (i.e, what to point at). + \param path2 The pathname of the new link to be created. + \return 0 on success, -1 on failure. + + \note Most filesystems in KallistiOS do not support + symbolic links. Filesystems that do not support + symlinks will simply set errno to ENOSYS. +*/ +int fs_symlink(const char *path1, const char *path2); + /** \brief Duplicate a file descriptor. This function duplicates the specified file descriptor, returning a new file diff --git a/kernel/fs/fs.c b/kernel/fs/fs.c index d2124d7..9d74b63 100644 --- a/kernel/fs/fs.c +++ b/kernel/fs/fs.c @@ -2,7 +2,7 @@ fs.c Copyright (C) 2000, 2001, 2002, 2003 Dan Potter - Copyright (C) 2012 Lawrence Sebald + Copyright (C) 2012, 2013 Lawrence Sebald */ @@ -651,6 +651,67 @@ int fs_fcntl(file_t fd, int cmd, ...) { return rv; } +int fs_link(const char *path1, const char *path2) { + vfs_handler_t *fh1, *fh2; + char rfn1[PATH_MAX], rfn2[PATH_MAX]; + + if(!realpath(path1, rfn1) || !realpath(path2, rfn2)) + return -1; + + /* Look for handlers */ + fh1 = fs_verify_handler(rfn1); + + if(!fh1) { + errno = ENOENT; + return -1; + } + + fh2 = fs_verify_handler(rfn2); + + if(!fh2) { + errno = ENOENT; + return -1; + } + + if(fh1 != fh2) { + errno = EXDEV; + return -1; + } + + if(fh1->link) { + return fh1->link(fh1, rfn1 + strlen(fh1->nmmgr.pathname), + rfn2 + strlen(fh1->nmmgr.pathname)); + } + else { + errno = EMLINK; + return -1; + } +} + +int fs_symlink(const char *path1, const char *path2) { + vfs_handler_t *vfs; + char rfn[PATH_MAX]; + + if(!realpath(path2, rfn)) + return -1; + + /* Look for the handler */ + vfs = fs_verify_handler(rfn); + + if(!vfs) { + errno = ENOENT; + return -1; + } + + if(vfs->symlink) { + return vfs->symlink(vfs, path1, rfn + strlen(vfs->nmmgr.pathname)); + } + else { + errno = ENOSYS; + return -1; + } +} + /* Initialize FS structures */ int fs_init() { return 0; diff --git a/kernel/libc/newlib/newlib_link.c b/kernel/libc/newlib/newlib_link.c index c63414d..4290f35 100644 --- a/kernel/libc/newlib/newlib_link.c +++ b/kernel/libc/newlib/newlib_link.c @@ -1,14 +1,15 @@ /* KallistiOS ##version## newlib_link.c - Copyright (C)2004 Dan Potter + Copyright (C) 2004 Dan Potter + Copyright (C) 2013 Lawrence Sebald */ +#include <kos/fs.h> #include <sys/reent.h> #include <errno.h> int _link_r(struct _reent * reent, const char * oldf, const char * newf) { - reent->_errno = EMLINK; - return -1; + return fs_link(oldf, newf); } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-05-14 13:07:32
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 298d30d5690e14dea483ae343b0d2b5a1aa04b69 (commit) from fad7eb3e22e3e724a6ad2aeea4b860cfad92c159 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 298d30d5690e14dea483ae343b0d2b5a1aa04b69 Author: Lawrence Sebald <ljs...@us...> Date: Tue May 14 09:05:59 2013 -0400 Fix a silly issue with 2352 byte sector reads in the cdrom code. Thanks to Multimedia Mike at DCEmulation for noticing that it wasn't working (http://dcemulation.org/phpBB/viewtopic.php?p=1035273#p1035273). ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/hardware/cdrom.c | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) diff --git a/kernel/arch/dreamcast/hardware/cdrom.c b/kernel/arch/dreamcast/hardware/cdrom.c index 90fefba..6b4e66f 100644 --- a/kernel/arch/dreamcast/hardware/cdrom.c +++ b/kernel/arch/dreamcast/hardware/cdrom.c @@ -208,11 +208,19 @@ int cdrom_reinit() { /* Check disc type and set parameters */ gdc_get_drv_stat(params); - cdxa = params[1] == 32; - params[0] = 0; /* 0 = set, 1 = get */ - params[1] = 8192; /* ? */ - params[2] = cdxa ? 2048 : 1024; /* CD-XA mode 1/2 */ - params[3] = sector_size; /* sector size */ + if(sector_size != 2352) { + cdxa = params[1] == 32; + params[0] = 0; /* 0 = set, 1 = get */ + params[1] = 8192; /* ? */ + params[2] = cdxa ? 2048 : 1024; /* CD-XA mode 1/2 */ + params[3] = sector_size; /* sector size */ + } + else { + params[0] = 0; + params[1] = 4096; + params[2] = 1024; + params[3] = 2352; + } if(gdc_change_data_type(params) < 0) { rv = ERR_SYS; hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-05-14 12:52:00
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via fad7eb3e22e3e724a6ad2aeea4b860cfad92c159 (commit) from a6c9031a5792b513a3695b766a3759e091f0efbe (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit fad7eb3e22e3e724a6ad2aeea4b860cfad92c159 Author: Lawrence Sebald <ljs...@us...> Date: Tue May 14 08:51:40 2013 -0400 Revert stream.drv. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/sound/arm/stream.drv | Bin 36080 -> 3620 bytes 1 files changed, 0 insertions(+), 0 deletions(-) diff --git a/kernel/arch/dreamcast/sound/arm/stream.drv b/kernel/arch/dreamcast/sound/arm/stream.drv index ed86dec..0c8dc0c 100755 Binary files a/kernel/arch/dreamcast/sound/arm/stream.drv and b/kernel/arch/dreamcast/sound/arm/stream.drv differ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Christian G. <sa...@us...> - 2013-05-14 12:46:46
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via a6c9031a5792b513a3695b766a3759e091f0efbe (commit) from b8de0b1bd785e976f71aa1c51cdee5c474b52614 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a6c9031a5792b513a3695b766a3759e091f0efbe Author: Christian Groessler <ch...@gr...> Date: Tue May 14 14:43:02 2013 +0200 close() returns a status now. 0 or -1 for success or failure. Information about the failure can be obtained by inspecting error. With this change one can detect if a file was successfully written to the VMU. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/fs_ext2.c | 3 ++- include/kos/fs.h | 5 +++-- kernel/arch/dreamcast/fs/fs_dclnative.c | 3 ++- kernel/arch/dreamcast/fs/fs_dcload.c | 9 ++++++--- kernel/arch/dreamcast/fs/fs_dclsocket.c | 5 +++-- kernel/arch/dreamcast/fs/fs_iso9660.c | 3 ++- kernel/arch/dreamcast/fs/fs_vmu.c | 19 +++++++++++++++---- kernel/arch/dreamcast/fs/vmufs.c | 10 +++++++--- kernel/arch/dreamcast/include/dc/fs_dcload.h | 2 +- kernel/arch/dreamcast/sound/arm/stream.drv | Bin 3620 -> 36080 bytes kernel/arch/ps2/fs/fs_ps2load.c | 3 ++- kernel/fs/fs.c | 19 +++++++++++++------ kernel/fs/fs_pty.c | 3 ++- kernel/fs/fs_ramdisk.c | 3 ++- kernel/fs/fs_romdisk.c | 3 ++- kernel/fs/fs_socket.c | 5 +++-- kernel/libc/koslib/realpath.c | 3 --- kernel/libc/newlib/newlib_close.c | 3 +-- 18 files changed, 66 insertions(+), 35 deletions(-) diff --git a/addons/libkosext2fs/fs_ext2.c b/addons/libkosext2fs/fs_ext2.c index cd452b6..a016f52 100644 --- a/addons/libkosext2fs/fs_ext2.c +++ b/addons/libkosext2fs/fs_ext2.c @@ -219,7 +219,7 @@ created: return (void *)(fd + 1); } -static void fs_ext2_close(void *h) { +static int fs_ext2_close(void *h) { file_t fd = ((file_t)h) - 1; mutex_lock(&ext2_mutex); @@ -231,6 +231,7 @@ static void fs_ext2_close(void *h) { } mutex_unlock(&ext2_mutex); + return 0; } static ssize_t fs_ext2_read(void *h, void *buf, size_t cnt) { diff --git a/include/kos/fs.h b/include/kos/fs.h index 6963346..833aba7 100644 --- a/include/kos/fs.h +++ b/include/kos/fs.h @@ -124,7 +124,7 @@ typedef struct vfs_handler { void *(*open)(struct vfs_handler *vfs, const char *fn, int mode); /** \brief Close a previously opened file */ - void (*close)(void *hnd); + int (*close)(void *hnd); /** \brief Read from a previously opened file */ ssize_t (*read)(void *hnd, void *buffer, size_t cnt); @@ -235,8 +235,9 @@ file_t fs_open(const char *fn, int mode); associated with the descriptor. \param hnd The file descriptor to close. + \return 0 for success, -1 for error (detailed error in errno) */ -void fs_close(file_t hnd); +int fs_close(file_t hnd); /** \brief Read from an opened file. diff --git a/kernel/arch/dreamcast/fs/fs_dclnative.c b/kernel/arch/dreamcast/fs/fs_dclnative.c index f5f2d20..852c32b 100644 --- a/kernel/arch/dreamcast/fs/fs_dclnative.c +++ b/kernel/arch/dreamcast/fs/fs_dclnative.c @@ -260,7 +260,7 @@ uint32 dclnative_open(vfs_handler_t * vfs, const char *fn, int mode) { return h; } -void dclnative_close(uint32 hnd) { +int dclnative_close(uint32 hnd) { mutex_lock(mutex); if(hnd) { @@ -273,6 +273,7 @@ void dclnative_close(uint32 hnd) { } mutex_unlock(mutex); + return 0; } ssize_t dclnative_read(uint32 hnd, void *buf, size_t cnt) { diff --git a/kernel/arch/dreamcast/fs/fs_dcload.c b/kernel/arch/dreamcast/fs/fs_dcload.c index c02a3bf..e853549 100644 --- a/kernel/arch/dreamcast/fs/fs_dcload.c +++ b/kernel/arch/dreamcast/fs/fs_dcload.c @@ -152,11 +152,13 @@ void *dcload_open(vfs_handler_t * vfs, const char *fn, int mode) { return (void *)h; } -void dcload_close(void * h) { +int dcload_close(void * h) { uint32 hnd = (uint32)h; - if(lwip_dclsc && irq_inside_int()) - return; + if(lwip_dclsc && irq_inside_int()) { + errno = EINTR; + return -1; + } spinlock_lock(&mutex); @@ -170,6 +172,7 @@ void dcload_close(void * h) { } spinlock_unlock(&mutex); + return 0; } ssize_t dcload_read(void * h, void *buf, size_t cnt) { diff --git a/kernel/arch/dreamcast/fs/fs_dclsocket.c b/kernel/arch/dreamcast/fs/fs_dclsocket.c index d5b5111..edac0a0 100644 --- a/kernel/arch/dreamcast/fs/fs_dclsocket.c +++ b/kernel/arch/dreamcast/fs/fs_dclsocket.c @@ -281,7 +281,7 @@ static void *dcls_open(struct vfs_handler *vfs, const char *fn, int mode) { return (void *)hnd; } -static void dcls_close(void *hnd) { +static int dcls_close(void *hnd) { int fd = (int) hnd, locked; command_int_t *cmd = (command_int_t *)pktbuf; @@ -289,7 +289,7 @@ static void dcls_close(void *hnd) { if(locked == -1 && irq_inside_int()) { errno = EAGAIN; - return; + return -1; } else if(locked == -1) { mutex_lock(&mutex); @@ -313,6 +313,7 @@ static void dcls_close(void *hnd) { } mutex_unlock(&mutex); + return 0; } static ssize_t dcls_read(void *hnd, void *buf, size_t cnt) { diff --git a/kernel/arch/dreamcast/fs/fs_iso9660.c b/kernel/arch/dreamcast/fs/fs_iso9660.c index 4c563b5..b8f449b 100644 --- a/kernel/arch/dreamcast/fs/fs_iso9660.c +++ b/kernel/arch/dreamcast/fs/fs_iso9660.c @@ -638,7 +638,7 @@ static void * iso_open(vfs_handler_t * vfs, const char *fn, int mode) { } /* Close a file or directory */ -static void iso_close(void * h) { +static int iso_close(void * h) { file_t fd = (file_t)h; /* Check that the fd is valid */ @@ -646,6 +646,7 @@ static void iso_close(void * h) { /* No need to lock the mutex: this is an atomic op */ fh[fd].first_extent = 0; } + return 0; } /* Read from a file */ diff --git a/kernel/arch/dreamcast/fs/fs_vmu.c b/kernel/arch/dreamcast/fs/fs_vmu.c index 485d39e..16d2258 100644 --- a/kernel/arch/dreamcast/fs/fs_vmu.c +++ b/kernel/arch/dreamcast/fs/fs_vmu.c @@ -10,6 +10,7 @@ #include <string.h> #include <stdlib.h> #include <malloc.h> +#include <errno.h> #include <time.h> #include <arch/types.h> #include <kos/mutex.h> @@ -302,12 +303,15 @@ static int vmu_write_close(void * hnd) { } /* close a file */ -static void vmu_close(void * hnd) { +static int vmu_close(void * hnd) { vmu_fh_t *fh; + int st, retval = 0; /* Check the handle */ - if(!vmu_verify_hnd(hnd, VMU_ANY)) - return; + if(!vmu_verify_hnd(hnd, VMU_ANY)) { + errno = EBADF; + return -1; + } fh = (vmu_fh_t *)hnd; @@ -325,7 +329,13 @@ static void vmu_close(void * hnd) { if((fh->mode & O_MODE_MASK) == O_WRONLY || (fh->mode & O_MODE_MASK) == O_RDWR) { - vmu_write_close(hnd); + if ((st = vmu_write_close(hnd))) { + if (st == -7) + errno = ENOSPC; + else + errno = EIO; + retval = -1; + } } free(fh->data); @@ -339,6 +349,7 @@ static void vmu_close(void * hnd) { mutex_unlock(&fh_mutex); free(fh); + return retval; } /* read function */ diff --git a/kernel/arch/dreamcast/fs/vmufs.c b/kernel/arch/dreamcast/fs/vmufs.c index ebdc07f..752b5d3 100644 --- a/kernel/arch/dreamcast/fs/vmufs.c +++ b/kernel/arch/dreamcast/fs/vmufs.c @@ -694,11 +694,12 @@ int vmufs_read_dirent(maple_device_t * dev, vmu_dir_t * dirent, void ** outbuf, return rv; } +/* Returns 0 for success, -7 for 'not enough space', and other values for other errors. :-) */ int vmufs_write(maple_device_t * dev, const char * fn, void * inbuf, int insize, int flags) { vmu_root_t root; vmu_dir_t * dir = NULL, nd; uint16 * fat = NULL; - int oldinsize, fatsize, dirsize, idx, rv = 0; + int oldinsize, fatsize, dirsize, idx, rv = 0, st; /* Round up the size if necessary */ oldinsize = insize; @@ -749,8 +750,11 @@ int vmufs_write(maple_device_t * dev, const char * fn, void * inbuf, int insize, // If any of these fail, the action to take can be decided by the caller. /* Write out the data and update our structs */ - if(vmufs_file_write(dev, &root, fat, dir, &nd, inbuf, insize / 512) < 0) { - rv = -4; + if((st = vmufs_file_write(dev, &root, fat, dir, &nd, inbuf, insize / 512)) < 0) { + if (st == -2) + rv = -7; + else + rv = -4; goto ex; } diff --git a/kernel/arch/dreamcast/include/dc/fs_dcload.h b/kernel/arch/dreamcast/include/dc/fs_dcload.h index 9131040..774d798 100644 --- a/kernel/arch/dreamcast/include/dc/fs_dcload.h +++ b/kernel/arch/dreamcast/include/dc/fs_dcload.h @@ -121,7 +121,7 @@ size_t dcload_gdbpacket(const char* in_buf, size_t in_size, char* out_buf, size_ /* File functions */ void* dcload_open(vfs_handler_t * vfs, const char *fn, int mode); -void dcload_close(void * hnd); +int dcload_close(void * hnd); ssize_t dcload_read(void * hnd, void *buf, size_t cnt); off_t dcload_seek(void * hnd, off_t offset, int whence); off_t dcload_tell(void * hnd); diff --git a/kernel/arch/dreamcast/sound/arm/stream.drv b/kernel/arch/dreamcast/sound/arm/stream.drv index 0c8dc0c..ed86dec 100755 Binary files a/kernel/arch/dreamcast/sound/arm/stream.drv and b/kernel/arch/dreamcast/sound/arm/stream.drv differ diff --git a/kernel/arch/ps2/fs/fs_ps2load.c b/kernel/arch/ps2/fs/fs_ps2load.c index ed3c562..4fbbf5c 100644 --- a/kernel/arch/ps2/fs/fs_ps2load.c +++ b/kernel/arch/ps2/fs/fs_ps2load.c @@ -116,7 +116,7 @@ uint32 ps2load_open(vfs_handler_t * vfs, const char *fn, int mode) { return h; } -void ps2load_close(uint32 hnd) { +int ps2load_close(uint32 hnd) { /* if (lwip_dclsc && irq_inside_int()) return; */ @@ -132,6 +132,7 @@ void ps2load_close(uint32 hnd) { } spinlock_unlock(&mutex); + return 0; } ssize_t ps2load_read(uint32 hnd, void *buf, size_t cnt) { diff --git a/kernel/fs/fs.c b/kernel/fs/fs.c index 2288782..d2124d7 100644 --- a/kernel/fs/fs.c +++ b/kernel/fs/fs.c @@ -176,20 +176,22 @@ static void fs_hnd_ref(fs_hnd_t * ref) { to a raw handle is no longer applicable. This function may destroy the file handle, so under no circumstances should you presume that it will still exist later. */ -static void fs_hnd_unref(fs_hnd_t * ref) { +static int fs_hnd_unref(fs_hnd_t * ref) { + int retval = 0; assert(ref); assert(ref->refcnt > 0); ref->refcnt--; if(ref->refcnt == 0) { if(ref->handler != NULL) { - if(ref->handler->close == NULL) return; + if(ref->handler->close == NULL) return retval; - ref->handler->close(ref->hnd); + retval = ref->handler->close(ref->hnd); } free(ref); } + return retval; } /* Assigns a file descriptor (index) to a file handle (pointer). Will auto- @@ -334,14 +336,19 @@ static fs_hnd_t * fs_map_hnd(file_t fd) { } /* Close a file and clean up the handle */ -void fs_close(file_t fd) { +int fs_close(file_t fd) { + int retval; fs_hnd_t * hnd = fs_map_hnd(fd); - if(!hnd) return; + if(!hnd) { + errno = EBADF; + return -1; + } /* Deref it and remove it from our table */ - fs_hnd_unref(hnd); + retval = fs_hnd_unref(hnd); fd_table[fd] = NULL; + return retval ? -1 : 0; } /* The rest of these pretty much map straight through */ diff --git a/kernel/fs/fs_pty.c b/kernel/fs/fs_pty.c index 8194c7e..71ad38e 100644 --- a/kernel/fs/fs_pty.c +++ b/kernel/fs/fs_pty.c @@ -386,7 +386,7 @@ static void * pty_open(vfs_handler_t * vfs, const char * fn, int mode) { } /* Close pty or dirlist */ -static void pty_close(void * h) { +static int pty_close(void * h) { pipefd_t * fdobj; assert(h); @@ -413,6 +413,7 @@ static void pty_close(void * h) { } free(fdobj); + return 0; } /* Read from a pty endpoint, kernel console special case */ diff --git a/kernel/fs/fs_ramdisk.c b/kernel/fs/fs_ramdisk.c index 1bb44a1..2c4d631 100644 --- a/kernel/fs/fs_ramdisk.c +++ b/kernel/fs/fs_ramdisk.c @@ -336,7 +336,7 @@ error_out: } /* Close a file or directory */ -static void ramdisk_close(void * h) { +static int ramdisk_close(void * h) { rd_file_t *f; file_t fd = (file_t)h; @@ -358,6 +358,7 @@ static void ramdisk_close(void * h) { } mutex_unlock(&rd_mutex); + return 0; } /* Read from a file */ diff --git a/kernel/fs/fs_romdisk.c b/kernel/fs/fs_romdisk.c index 947b723..c426cc2 100644 --- a/kernel/fs/fs_romdisk.c +++ b/kernel/fs/fs_romdisk.c @@ -241,7 +241,7 @@ static void * romdisk_open(vfs_handler_t * vfs, const char *fn, int mode) { } /* Close a file or directory */ -static void romdisk_close(void * h) { +static int romdisk_close(void * h) { file_t fd = (file_t)h; /* Check that the fd is valid */ @@ -249,6 +249,7 @@ static void romdisk_close(void * h) { /* No need to lock the mutex: this is an atomic op */ fh[fd].index = 0; } + return 0; } /* Read from a file */ diff --git a/kernel/fs/fs_socket.c b/kernel/fs/fs_socket.c index ecc4c79..16119f6 100644 --- a/kernel/fs/fs_socket.c +++ b/kernel/fs/fs_socket.c @@ -29,13 +29,13 @@ static struct socket_list sockets; static mutex_t proto_rlock = RECURSIVE_MUTEX_INITIALIZER; static mutex_t list_rlock = RECURSIVE_MUTEX_INITIALIZER; -static void fs_socket_close(void *hnd) { +static int fs_socket_close(void *hnd) { net_socket_t *sock = (net_socket_t *)hnd; if(irq_inside_int()) { if(mutex_trylock(&list_rlock)) { errno = EWOULDBLOCK; - return; + return -1; } } else { @@ -50,6 +50,7 @@ static void fs_socket_close(void *hnd) { sock->protocol->close(sock); free(sock); + return 0; } static ssize_t fs_socket_read(void *hnd, void *buffer, size_t cnt) { diff --git a/kernel/libc/koslib/realpath.c b/kernel/libc/koslib/realpath.c index 5be42e5..0fcd4d5 100644 --- a/kernel/libc/koslib/realpath.c +++ b/kernel/libc/koslib/realpath.c @@ -50,11 +50,8 @@ char * realpath(const char *path, char resolved[PATH_MAX]) { char *p, *q, *s; size_t left_len, resolved_len; - int serrno; char left[PATH_MAX], next_token[PATH_MAX]; - serrno = errno; - if(path[0] == '/') { resolved[0] = '/'; resolved[1] = '\0'; diff --git a/kernel/libc/newlib/newlib_close.c b/kernel/libc/newlib/newlib_close.c index c29e6c6..ca12b2f 100644 --- a/kernel/libc/newlib/newlib_close.c +++ b/kernel/libc/newlib/newlib_close.c @@ -9,6 +9,5 @@ #include <kos/fs.h> int _close_r(struct _reent * reent, int f) { - fs_close(f); - return 0; + return fs_close(f); } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Christian G. <sa...@us...> - 2013-05-07 22:10:48
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via b8de0b1bd785e976f71aa1c51cdee5c474b52614 (commit) from d6e99c1a38a527d1f1cf09acf1f2951f83419ecf (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b8de0b1bd785e976f71aa1c51cdee5c474b52614 Author: Christian Groessler <ch...@gr...> Date: Wed May 8 00:10:23 2013 +0200 Updated gitignore to ignore *.map files. ----------------------------------------------------------------------- Summary of changes: .gitignore | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.gitignore b/.gitignore index 104824b..4b54d9d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *.o *.elf +*.map *~ .*.swp doc/reference/ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Christian G. <sa...@us...> - 2013-04-30 10:48:10
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via d6e99c1a38a527d1f1cf09acf1f2951f83419ecf (commit) from 80f6256f705d5365ae19c89d807e2c47e3ccff33 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d6e99c1a38a527d1f1cf09acf1f2951f83419ecf Author: Christian Groessler <ch...@gr...> Date: Tue Apr 30 12:47:59 2013 +0200 Add dcache flush for when using DMA. ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/pvr/plasma/plasma.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/examples/dreamcast/pvr/plasma/plasma.c b/examples/dreamcast/pvr/plasma/plasma.c index b44e758..1fb3ea6 100644 --- a/examples/dreamcast/pvr/plasma/plasma.c +++ b/examples/dreamcast/pvr/plasma/plasma.c @@ -101,7 +101,8 @@ void plasma_drawtex() { // Switch these around to try out texture DMA pvr_txr_load(txr_buf[txr_cur], txr[txr_cur], 64 * 64 * 2); - // pvr_txr_load_dma(txr_buf[txr_cur], txr[txr_cur], 64*64*2, 1); + // dcache_flush_range((uint32)txr_buf[txr_cur], 64*64*2); // dcache flush is needed when using DMA + // pvr_txr_load_dma(txr_buf[txr_cur], txr[txr_cur], 64*64*2, 1, NULL, 0); } int check_start() { hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Christian G. <sa...@us...> - 2013-04-27 12:52:37
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 80f6256f705d5365ae19c89d807e2c47e3ccff33 (commit) via 3b63e4a577008ae9ff90a4a2264f0e35269e9ec2 (commit) from 2a3e7dbe4623809e8307b20ee170dfde8ca8732f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 80f6256f705d5365ae19c89d807e2c47e3ccff33 Author: Christian Groessler <ch...@gr...> Date: Sat Apr 27 14:51:47 2013 +0200 vid_border_color() now returns the old color. commit 3b63e4a577008ae9ff90a4a2264f0e35269e9ec2 Author: Christian Groessler <ch...@gr...> Date: Sat Apr 27 14:50:52 2013 +0200 create a map file ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/hardware/video.c | 4 +++- kernel/arch/dreamcast/include/dc/video.h | 3 ++- kernel/arch/dreamcast/sound/arm/Makefile | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/kernel/arch/dreamcast/hardware/video.c b/kernel/arch/dreamcast/hardware/video.c index b8f38e7..8b344b0 100644 --- a/kernel/arch/dreamcast/hardware/video.c +++ b/kernel/arch/dreamcast/hardware/video.c @@ -676,10 +676,12 @@ void vid_flip(int fb) { } /*-----------------------------------------------------------------------------*/ -void vid_border_color(int r, int g, int b) { +uint32 vid_border_color(int r, int g, int b) { + uint32 obc = regs[0x0040 / 4]; regs[0x0040 / 4] = ((r & 0xFF) << 16) | ((g & 0xFF) << 8) | (b & 0xFF); + return obc; } /*-----------------------------------------------------------------------------*/ diff --git a/kernel/arch/dreamcast/include/dc/video.h b/kernel/arch/dreamcast/include/dc/video.h index 404f309..2d248e1 100644 --- a/kernel/arch/dreamcast/include/dc/video.h +++ b/kernel/arch/dreamcast/include/dc/video.h @@ -212,8 +212,9 @@ void vid_flip(int fb); \param r The red value of the color (0-255). \param g The green value of the color (0-255). \param b The blue value of the color (0-255). + \return Old border color value (RGB888) */ -void vid_border_color(int r, int g, int b); +uint32 vid_border_color(int r, int g, int b); /** \brief Clear the display. diff --git a/kernel/arch/dreamcast/sound/arm/Makefile b/kernel/arch/dreamcast/sound/arm/Makefile index 54d7097..b77d6da 100644 --- a/kernel/arch/dreamcast/sound/arm/Makefile +++ b/kernel/arch/dreamcast/sound/arm/Makefile @@ -11,7 +11,7 @@ stream.drv: prog.elf $(DC_ARM_OBJCOPY) -O binary prog.elf stream.drv prog.elf: crt0.o main.o aica.o - $(DC_ARM_CC) -Wl,-Ttext,0x00000000 -nostartfiles -nostdlib -e reset -o prog.elf crt0.o main.o aica.o -lgcc + $(DC_ARM_CC) -Wl,-Ttext,0x00000000,-Map,prog.map -nostartfiles -nostdlib -e reset -o prog.elf crt0.o main.o aica.o -lgcc %.o: %.c $(DC_ARM_CC) $(DC_ARM_CFLAGS) $(DC_ARM_INCS) -c $< -o $@ @@ -20,6 +20,6 @@ prog.elf: crt0.o main.o aica.o $(DC_ARM_AS) $(DC_ARM_AFLAGS) $< -o $@ clean: - -rm -f *.o *.srec *.elf 1ST_READ.BIN prog.bin *.bck + -rm -f *.o *.srec *.elf 1ST_READ.BIN prog.bin *.bck prog.map hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-04-24 18:14:25
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 2a3e7dbe4623809e8307b20ee170dfde8ca8732f (commit) from e89ecd7b4aff0547687d602c57728337352db2d5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2a3e7dbe4623809e8307b20ee170dfde8ca8732f Author: Lawrence Sebald <ljs...@us...> Date: Wed Apr 24 14:14:06 2013 -0400 Optionally write a file in the ext2fs example. ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/sd/ext2fs/Makefile | 3 ++ examples/dreamcast/sd/ext2fs/sd-ext2fs.c | 35 +++++++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/examples/dreamcast/sd/ext2fs/Makefile b/examples/dreamcast/sd/ext2fs/Makefile index d87097f..8d6a71d 100644 --- a/examples/dreamcast/sd/ext2fs/Makefile +++ b/examples/dreamcast/sd/ext2fs/Makefile @@ -6,6 +6,9 @@ TARGET = sd-ext2fs.elf OBJS = sd-ext2fs.o +# Uncomment the next line to enable write support in the example. +#KOS_CFLAGS += -DENABLE_WRITE + all: rm-elf $(TARGET) include $(KOS_BASE)/Makefile.rules diff --git a/examples/dreamcast/sd/ext2fs/sd-ext2fs.c b/examples/dreamcast/sd/ext2fs/sd-ext2fs.c index 812e38e..a2de1e8 100644 --- a/examples/dreamcast/sd/ext2fs/sd-ext2fs.c +++ b/examples/dreamcast/sd/ext2fs/sd-ext2fs.c @@ -9,6 +9,9 @@ About all this example program does is to mount the SD card (if one is found and it is detected to be ext2fs) on /sd of the VFS and print a directory listing of the root directory of the SD card. + + In addition, if you add -DENABLE_WRITE to the CFLAGS while compiling, this + program will write a text file out on the root of the SD card. */ #include <stdio.h> @@ -21,11 +24,22 @@ #include <kos/blockdev.h> #include <ext2/fs_ext2.h> +/* Add -DENABLE_WRITE to the KOS_CFLAGS in the Makefile to enable writing a + small file out on the SD card. */ +#ifdef ENABLE_WRITE +#define MNT_MODE FS_EXT2_MOUNT_READWRITE +#else +#define MNT_MODE FS_EXT2_MOUNT_READONLY +#endif + int main(int argc, char *argv[]) { kos_blockdev_t sd_dev; uint8 partition_type; DIR *d; struct dirent *entry; +#ifdef ENABLE_WRITE + FILE *fp; +#endif if(sd_init()) { printf("Could not initialize the SD card. Please make sure that you " @@ -52,7 +66,7 @@ int main(int argc, char *argv[]) { exit(EXIT_FAILURE); } - if(fs_ext2_mount("/sd", &sd_dev, 0)) { + if(fs_ext2_mount("/sd", &sd_dev, MNT_MODE)) { printf("Could not mount SD card as ext2fs. Please make sure the card " "has been properly formatted.\n"); exit(EXIT_FAILURE); @@ -75,6 +89,23 @@ int main(int argc, char *argv[]) { exit(EXIT_FAILURE); } +#ifdef ENABLE_WRITE + /* Create a new file on the root of the SD card. */ + if(!(fp = fopen("/sd/hello.txt", "w"))) { + printf("Could not create file: %s\n", strerror(errno)); + exit(EXIT_FAILURE); + } + + if(fprintf(fp, "Hello World!\nTesting, testing, 1, 2, 3...") < 0) { + printf("Failed to write to file: %s\n", strerror(errno)); + } + else { + printf("Wrote to file \"hello.txt\"\n"); + } + + fclose(fp); +#endif + /* Clean up the filesystem and everything else */ fs_ext2_unmount("/sd"); fs_ext2_shutdown(); @@ -82,5 +113,3 @@ int main(int argc, char *argv[]) { return 0; } - - hooks/post-receive -- A pseudo Operating System for the Dreamcast. |