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-04-24 18:12: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 e89ecd7b4aff0547687d602c57728337352db2d5 (commit) from 5d101ffceb89cd67b6536158974725c556c39216 (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 e89ecd7b4aff0547687d602c57728337352db2d5 Author: Lawrence Sebald <ljs...@us...> Date: Wed Apr 24 14:12:14 2013 -0400 Add the fs_ext2_sync() function to sync all changes to the block device. ----------------------------------------------------------------------- Summary of changes: addons/include/ext2/fs_ext2.h | 24 +++++++++++++++++++----- addons/libkosext2fs/fs_ext2.c | 27 +++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 5 deletions(-) diff --git a/addons/include/ext2/fs_ext2.h b/addons/include/ext2/fs_ext2.h index 2722af5..e0803de 100644 --- a/addons/include/ext2/fs_ext2.h +++ b/addons/include/ext2/fs_ext2.h @@ -1,7 +1,7 @@ /* KallistiOS ##version## ext2/fs_ext2.h - Copyright (C) 2012 Lawrence Sebald + Copyright (C) 2012, 2013 Lawrence Sebald */ #ifndef __EXT2_FS_EXT2_H @@ -103,10 +103,6 @@ int fs_ext2_shutdown(void); \param flags Mount flags. Bitwise OR of values from ext2_mount_flags \retval 0 On success. \retval -1 On error. - - \note All filesystems will currently be mounted as read-only, - regardless of the flags value. The lower-level ext2fs - code does not support writing at this time. */ int fs_ext2_mount(const char *mp, kos_blockdev_t *dev, uint32_t flags); @@ -121,5 +117,23 @@ int fs_ext2_mount(const char *mp, kos_blockdev_t *dev, uint32_t flags); */ int fs_ext2_unmount(const char *mp); +/** \brief Sync an ext2 filesystem, flushing all pending writes to the block + device. + + This function completes all pending writes on the filesystem, making sure + all data and metadata are in a consistent state on the block device. As both + inode and block writes are normally postponed until they are either evicted + from the cache or the filesystem is unmounted, doing this periodically may + be a good idea if there is a chance that the filesystem will not be + unmounted cleanly. + + \param mp The mount point of the filesystem to be synced. + \retval 0 On success. + \retval -1 On error. + + \note This function has no effect if the filesystem was mounted read-only. +*/ +int fs_ext2_sync(const char *mp); + __END_DECLS #endif /* !__EXT2_FS_EXT2_H */ diff --git a/addons/libkosext2fs/fs_ext2.c b/addons/libkosext2fs/fs_ext2.c index bdc4f7c..cd452b6 100644 --- a/addons/libkosext2fs/fs_ext2.c +++ b/addons/libkosext2fs/fs_ext2.c @@ -1453,6 +1453,33 @@ int fs_ext2_unmount(const char *mp) { return rv; } +int fs_ext2_sync(const char *mp) { + fs_ext2_fs_t *i; + int found = 0, rv = 0; + + /* Find the fs in question */ + mutex_lock(&ext2_mutex); + LIST_FOREACH(i, &ext2_fses, entry) { + if(!strcmp(mp, i->vfsh->nmmgr.pathname)) { + found = 1; + break; + } + } + + if(found) { + /* ext2_fs_sync() will set errno if there's a problem. */ + rv = ext2_fs_sync(i->fs); + } + else { + errno = ENOENT; + rv = -1; + } + + mutex_unlock(&ext2_mutex); + return rv; +} + + int fs_ext2_init(void) { if(initted) return 0; hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-04-18 20:17: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 5d101ffceb89cd67b6536158974725c556c39216 (commit) from 46bf14554b178047deb7f6b78c086e4405067c0a (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 5d101ffceb89cd67b6536158974725c556c39216 Author: Lawrence Sebald <ljs...@us...> Date: Thu Apr 18 16:17:20 2013 -0400 Make sure changes get written back to the block device when unmounting a fs in fs_ext2. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/fs_ext2.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/addons/libkosext2fs/fs_ext2.c b/addons/libkosext2fs/fs_ext2.c index d0be238..bdc4f7c 100644 --- a/addons/libkosext2fs/fs_ext2.c +++ b/addons/libkosext2fs/fs_ext2.c @@ -1440,6 +1440,7 @@ int fs_ext2_unmount(const char *mp) { /* XXXX: We should probably do something with open files... */ nmmgr_handler_remove(&i->vfsh->nmmgr); + ext2_fs_shutdown(i->fs); free(i->vfsh); free(i); } @@ -1478,6 +1479,7 @@ int fs_ext2_shutdown(void) { /* XXXX: We should probably do something with open files... */ nmmgr_handler_remove(&i->vfsh->nmmgr); + ext2_fs_shutdown(i->fs); free(i->vfsh); free(i); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-04-18 18:21:45
|
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 46bf14554b178047deb7f6b78c086e4405067c0a (commit) from d405eb6a7c1ef5163bee53ba7f7c40affb42f369 (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 46bf14554b178047deb7f6b78c086e4405067c0a Author: Lawrence Sebald <ljs...@us...> Date: Thu Apr 18 14:21:21 2013 -0400 Add write() support to fs_ext2. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/fs_ext2.c | 143 +++++++++++++++++++++++++++++++++++++---- 1 files changed, 129 insertions(+), 14 deletions(-) diff --git a/addons/libkosext2fs/fs_ext2.c b/addons/libkosext2fs/fs_ext2.c index b8305b5..d0be238 100644 --- a/addons/libkosext2fs/fs_ext2.c +++ b/addons/libkosext2fs/fs_ext2.c @@ -120,7 +120,7 @@ static void *fs_ext2_open(vfs_handler_t *vfs, const char *fn, int mode) { /* Make sure if we're going to be writing to the file that the fs is mounted read/write. */ - if((mode & (O_TRUNC | O_WRONLY)) && + if((mode & (O_TRUNC | O_WRONLY | O_RDWR)) && !(mnt->mount_flags & FS_EXT2_MOUNT_READWRITE)) { errno = EROFS; return NULL; @@ -192,7 +192,7 @@ static void *fs_ext2_open(vfs_handler_t *vfs, const char *fn, int mode) { created: /* Do we need to truncate the file? */ - if((mode & O_WRONLY) && (mode & O_TRUNC)) { + if((mode & (O_WRONLY | O_RDWR)) && (mode & O_TRUNC)) { if((rv = ext2_inode_free_all(mnt->fs, fh[fd].inode, fh[fd].inode_num, 0))) { errno = -rv; @@ -214,11 +214,6 @@ created: fh[fd].ptr = 0; fh[fd].fs = mnt; - /* Are we appending (and writing, of course... appending without writing is - kinda silly, after all)? */ - if((mode & O_WRONLY) && (mode & O_APPEND)) - fh[fd].ptr = fh[fd].inode->i_size; - mutex_unlock(&ext2_mutex); return (void *)(fd + 1); @@ -233,9 +228,6 @@ static void fs_ext2_close(void *h) { ext2_inode_put(fh[fd].inode); fh[fd].inode_num = 0; fh[fd].mode = 0; - - /* This will require more work probably when we support writing, but for - now this is enough... */ } mutex_unlock(&ext2_mutex); @@ -248,18 +240,20 @@ 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; + int mode; mutex_lock(&ext2_mutex); /* Check that the fd is valid */ if(fd >= MAX_EXT2_FILES || !fh[fd].inode_num) { mutex_unlock(&ext2_mutex); - errno = EINVAL; + errno = EBADF; return -1; } - /* Make sure we're not trying to read a file not opened for reading. */ - if(!(fh[fd].mode & O_RDONLY)) { + /* Make sure the fd is open for reading */ + mode = fh[fd].mode & O_MODE_MASK; + if(mode != O_RDONLY && mode != O_RDWR) { mutex_unlock(&ext2_mutex); errno = EBADF; return -1; @@ -329,6 +323,127 @@ static ssize_t fs_ext2_read(void *h, void *buf, size_t cnt) { return rv; } +static ssize_t fs_ext2_write(void *h, const void *buf, size_t cnt) { + file_t fd = ((file_t)h) - 1; + ext2_fs_t *fs; + uint32_t bs, lbs, bo, bn; + uint8_t *block; + uint8_t *bbuf = (uint8_t *)buf; + ssize_t rv; + uint64_t nblocks; + int err, mode; + + mutex_lock(&ext2_mutex); + + /* Check that the fd is valid */ + if(fd >= MAX_EXT2_FILES || !fh[fd].inode_num) { + mutex_unlock(&ext2_mutex); + errno = EBADF; + return -1; + } + + /* Make sure the fd is open for writing */ + mode = fh[fd].mode & O_MODE_MASK; + if(mode != O_WRONLY && mode != O_RDWR) { + mutex_unlock(&ext2_mutex); + errno = EBADF; + return -1; + } + + fs = fh[fd].fs->fs; + 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) { + 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; + + while(nblocks--) { + if(!(block = ext2_inode_alloc_block(fs, fh[fd].inode, &errno))) { + mutex_unlock(&ext2_mutex); + return -1; + } + } + + fh[fd].inode->i_size = fh[fd].ptr; + } + + /* Handle the first block specially if we are offset within it. */ + if(bo) { + if(!(block = ext2_inode_read_block(fs, fh[fd].inode, fh[fd].ptr >> lbs, + &bn, &errno))) { + mutex_unlock(&ext2_mutex); + return -1; + } + + if(cnt > bs - bo) { + memcpy(block + bo, bbuf, bs - bo); + fh[fd].ptr += bs - bo; + cnt -= bs - bo; + bbuf += bs - bo; + } + else { + memcpy(block + bo, bbuf, cnt); + fh[fd].ptr += cnt; + cnt = 0; + } + + ext2_block_mark_dirty(fs, bn); + } + + /* While we still have more to write, do it. */ + while(cnt) { + if(!(block = ext2_inode_read_block(fs, fh[fd].inode, fh[fd].ptr >> lbs, + &bn, &err))) { + if(err != EINVAL) { + mutex_unlock(&ext2_mutex); + errno = err; + return -1; + } + else if(!(block = ext2_inode_alloc_block(fs, fh[fd].inode, + &errno))) { + mutex_unlock(&ext2_mutex); + return -1; + } + } + else { + ext2_block_mark_dirty(fs, bn); + } + + if(cnt > bs) { + memcpy(block, bbuf, bs); + fh[fd].ptr += bs; + cnt -= bs; + bbuf += bs; + } + else { + memcpy(block, bbuf, cnt); + fh[fd].ptr += cnt; + cnt = 0; + } + } + + /* 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; + } + + fh[fd].inode->i_mtime = time(NULL); + ext2_inode_mark_dirty(fh[fd].inode); + + mutex_unlock(&ext2_mutex); + return rv; +} + static off_t fs_ext2_seek(void *h, off_t offset, int whence) { file_t fd = ((file_t)h) - 1; off_t rv; @@ -1222,7 +1337,7 @@ static vfs_handler_t vh = { fs_ext2_open, /* open */ fs_ext2_close, /* close */ fs_ext2_read, /* read */ - NULL, /* write */ + fs_ext2_write, /* write */ fs_ext2_seek, /* seek */ fs_ext2_tell, /* tell */ fs_ext2_total, /* total */ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-04-18 18:10:28
|
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 d405eb6a7c1ef5163bee53ba7f7c40affb42f369 (commit) from 4f338fd7a8bcc34f241a39555d09d25db2e9674f (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 d405eb6a7c1ef5163bee53ba7f7c40affb42f369 Author: Lawrence Sebald <ljs...@us...> Date: Thu Apr 18 14:09:50 2013 -0400 Account for xattr blocks in ext2_inode_read_block and ext2_inode_alloc_block. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/inode.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/addons/libkosext2fs/inode.c b/addons/libkosext2fs/inode.c index 885cb27..6c47396 100644 --- a/addons/libkosext2fs/inode.c +++ b/addons/libkosext2fs/inode.c @@ -789,6 +789,10 @@ uint8_t *ext2_inode_alloc_block(ext2_fs_t *fs, ext2_inode_t *inode, int *err) { return NULL; } + /* Subtract out the xattr block if there is one. */ + if(inode->i_file_acl) + blocks -= 1; + bg = (iinode->inode_num - 1) / fs->sb.s_inodes_per_group; /* First, see if we have a slot in the direct blocks open still. */ @@ -1271,9 +1275,14 @@ 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; /* Check to be sure we're not being asked to do something stupid... */ - if(block_num >= inode->i_blocks) { + if((block_num << shift) >= inode->i_blocks - sub) { *err = EINVAL; return NULL; } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-04-18 16:00:58
|
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 4f338fd7a8bcc34f241a39555d09d25db2e9674f (commit) from 5989a9630505b63b3b167b5609b0d30a0c58e532 (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 4f338fd7a8bcc34f241a39555d09d25db2e9674f Author: Lawrence Sebald <ljs...@us...> Date: Thu Apr 18 12:00:35 2013 -0400 Fix a few error conditions in libkosext2fs. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/fs_ext2.c | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-) diff --git a/addons/libkosext2fs/fs_ext2.c b/addons/libkosext2fs/fs_ext2.c index e936d67..b8305b5 100644 --- a/addons/libkosext2fs/fs_ext2.c +++ b/addons/libkosext2fs/fs_ext2.c @@ -252,12 +252,26 @@ static ssize_t fs_ext2_read(void *h, void *buf, size_t cnt) { mutex_lock(&ext2_mutex); /* Check that the fd is valid */ - if(fd >= MAX_EXT2_FILES || !fh[fd].inode_num || (fh[fd].mode & O_DIR)) { + if(fd >= MAX_EXT2_FILES || !fh[fd].inode_num) { mutex_unlock(&ext2_mutex); errno = EINVAL; return -1; } + /* Make sure we're not trying to read a file not opened for reading. */ + if(!(fh[fd].mode & O_RDONLY)) { + mutex_unlock(&ext2_mutex); + errno = EBADF; + return -1; + } + + /* Make sure we're not trying to read a directory with read */ + if(fh[fd].mode & O_DIR) { + mutex_unlock(&ext2_mutex); + errno = EISDIR; + return -1; + } + /* Do we have enough left? */ if((fh[fd].ptr + cnt) > fh[fd].inode->i_size) cnt = fh[fd].inode->i_size - fh[fd].ptr; @@ -403,7 +417,7 @@ static dirent_t *fs_ext2_readdir(void *h) { /* Check that the fd is valid */ if(fd >= MAX_EXT2_FILES || !fh[fd].inode_num || !(fh[fd].mode & O_DIR)) { mutex_unlock(&ext2_mutex); - errno = EINVAL; + errno = EBADF; return NULL; } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-04-18 02:00:41
|
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 5989a9630505b63b3b167b5609b0d30a0c58e532 (commit) from d6bd897b816bd5efc6525b3618b1ddbb008c1a1a (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 5989a9630505b63b3b167b5609b0d30a0c58e532 Author: Lawrence Sebald <ljs...@us...> Date: Wed Apr 17 21:59:02 2013 -0400 Continuing with write support in libkosext2fs: 1. Allow creating new blank files with open (and O_CREAT). 2. Allow truncation of existing files with open (and O_TRUNC). 3. Allow opening files for writing (although write isn't implemented, so it is still a bit silly to do except to create blank files or truncate existing ones). ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/fs_ext2.c | 122 +++++++++++++++++++++++++++++++++++++--- addons/libkosext2fs/inode.c | 73 ++++++++++++++++--------- addons/libkosext2fs/inode.h | 4 + 3 files changed, 163 insertions(+), 36 deletions(-) diff --git a/addons/libkosext2fs/fs_ext2.c b/addons/libkosext2fs/fs_ext2.c index b87b56f..e936d67 100644 --- a/addons/libkosext2fs/fs_ext2.c +++ b/addons/libkosext2fs/fs_ext2.c @@ -47,16 +47,84 @@ static struct { fs_ext2_fs_t *fs; } fh[MAX_EXT2_FILES]; +static int create_empty_file(fs_ext2_fs_t *fs, const char *fn, + ext2_inode_t **rinode, uint32_t *rinode_num) { + int irv; + ext2_inode_t *inode, *ninode; + uint32_t inode_num, ninode_num; + char *cp, *nd; + time_t now = time(NULL); + + if(!(fs->mount_flags & FS_EXT2_MOUNT_READWRITE)) + return -EROFS; + + /* Make a writable copy of the filename */ + if(!(cp = strdup(fn))) + return -ENOMEM; + + /* Separate our copy into the parent and the directory we want to create */ + if(!(nd = strrchr(cp, '/'))) { + free(cp); + return -ENOENT; + } + + /* Split the string. */ + *nd++ = 0; + + /* Find the parent of the directory we want to create. */ + if((irv = ext2_inode_by_path(fs->fs, cp, &inode, &inode_num, 1, NULL))) { + free(cp); + return -irv; + } + + /* Allocate a new inode for the new directory. */ + if(!(ninode = ext2_inode_alloc(fs->fs, inode_num, &irv, &ninode_num))) { + ext2_inode_put(inode); + free(cp); + return -irv; + } + + /* Fill in the inode. Copy most of the interesting parts from the parent. */ + ninode->i_mode = (inode->i_mode & ~EXT2_S_IFDIR) | EXT2_S_IFREG; + ninode->i_uid = inode->i_uid; + ninode->i_atime = ninode->i_ctime = ninode->i_mtime = now; + ninode->i_gid = inode->i_gid; + ninode->i_osd2.l_i_uid_high = inode->i_osd2.l_i_uid_high; + ninode->i_osd2.l_i_gid_high = inode->i_osd2.l_i_gid_high; + ninode->i_links_count = 1; + + /* Add an entry to the parent directory. */ + if((irv = ext2_dir_add_entry(fs->fs, inode, nd, ninode_num, ninode, + NULL))) { + ext2_inode_put(inode); + ext2_inode_deref(fs->fs, ninode_num, 1); + free(cp); + return -irv; + } + + /* Update the parent directory's times. */ + inode->i_mtime = inode->i_ctime = now; + ext2_inode_mark_dirty(inode); + + ext2_inode_put(inode); + free(cp); + *rinode = ninode; + *rinode_num = ninode_num; + return 0; +} + static void *fs_ext2_open(vfs_handler_t *vfs, const char *fn, int mode) { file_t fd; fs_ext2_fs_t *mnt = (fs_ext2_fs_t *)vfs->privdata; int rv; - /* We don't support writing for now... */ - if((mode & (O_WRONLY | O_TRUNC))) { - errno = EROFS; - return NULL; - } + /* Make sure if we're going to be writing to the file that the fs is mounted + read/write. */ + if((mode & (O_TRUNC | O_WRONLY)) && + !(mnt->mount_flags & FS_EXT2_MOUNT_READWRITE)) { + errno = EROFS; + return NULL; + } /* Find a free file handle */ mutex_lock(&ext2_mutex); @@ -78,19 +146,28 @@ static void *fs_ext2_open(vfs_handler_t *vfs, const char *fn, int mode) { if((rv = ext2_inode_by_path(mnt->fs, fn, &fh[fd].inode, &fh[fd].inode_num, 1, NULL))) { fh[fd].inode_num = 0; - ext2_inode_put(fh[fd].inode); - mutex_unlock(&ext2_mutex); if(rv == -ENOENT) { - if(mode & O_CREAT) - errno = EROFS; - else + if(mode & O_CREAT) { + if((rv = create_empty_file(mnt, fn, &fh[fd].inode, + &fh[fd].inode_num))) { + fh[fd].inode_num = 0; + mutex_unlock(&ext2_mutex); + errno = -rv; + return NULL; + } + + goto created; + } + else { errno = ENOENT; + } } else { errno = -rv; } + mutex_unlock(&ext2_mutex); return NULL; } @@ -113,10 +190,35 @@ static void *fs_ext2_open(vfs_handler_t *vfs, const char *fn, int mode) { return NULL; } +created: + /* Do we need to truncate the file? */ + if((mode & O_WRONLY) && (mode & O_TRUNC)) { + if((rv = ext2_inode_free_all(mnt->fs, fh[fd].inode, fh[fd].inode_num, + 0))) { + errno = -rv; + fh[fd].inode_num = 0; + ext2_inode_put(fh[fd].inode); + mutex_unlock(&ext2_mutex); + return NULL; + } + + /* Fix the times/sizes up. */ + fh[fd].inode->i_size = 0; + fh[fd].inode->i_dtime = 0; + fh[fd].inode->i_mtime = time(NULL); + ext2_inode_mark_dirty(fh[fd].inode); + } + /* Fill in the rest of the handle */ fh[fd].mode = mode; fh[fd].ptr = 0; fh[fd].fs = mnt; + + /* Are we appending (and writing, of course... appending without writing is + kinda silly, after all)? */ + if((mode & O_WRONLY) && (mode & O_APPEND)) + fh[fd].ptr = fh[fd].inode->i_size; + mutex_unlock(&ext2_mutex); return (void *)(fd + 1); diff --git a/addons/libkosext2fs/inode.c b/addons/libkosext2fs/inode.c index 7a3fca5..885cb27 100644 --- a/addons/libkosext2fs/inode.c +++ b/addons/libkosext2fs/inode.c @@ -524,8 +524,8 @@ static int free_tind_block(ext2_fs_t *fs, ext2_inode_t *inode, uint32_t iblk) { return rv; } -static int ext2_inode_free_all(ext2_fs_t *fs, ext2_inode_t *inode, - uint32_t inode_num) { +int ext2_inode_free_all(ext2_fs_t *fs, ext2_inode_t *inode, + uint32_t inode_num, int for_del) { uint32_t bg, index, blk; uint8_t *buf; uint32_t i; @@ -537,32 +537,34 @@ static int ext2_inode_free_all(ext2_fs_t *fs, ext2_inode_t *inode, if((rv = ext2_block_cache_wb(fs))) return rv; - /* Figure out what block group and index within that group the inode in - question is. */ - bg = (inode_num - 1) / fs->sb.s_inodes_per_group; - index = (inode_num - 1) % fs->sb.s_inodes_per_group; + if(for_del) { + /* Figure out what block group and index within that group the inode in + question is. */ + bg = (inode_num - 1) / fs->sb.s_inodes_per_group; + index = (inode_num - 1) % fs->sb.s_inodes_per_group; - if(!(buf = ext2_block_read(fs, fs->bg[bg].bg_inode_bitmap, &rv))) - return -EIO; + if(!(buf = ext2_block_read(fs, fs->bg[bg].bg_inode_bitmap, &rv))) + return -EIO; - /* Mark the inode as free in the bitmap and increase the counters. */ - ext2_bit_clear((uint32_t *)buf, index); - ext2_block_mark_dirty(fs, fs->bg[bg].bg_inode_bitmap); + /* Mark the inode as free in the bitmap and increase the counters. */ + ext2_bit_clear((uint32_t *)buf, index); + ext2_block_mark_dirty(fs, fs->bg[bg].bg_inode_bitmap); - ++fs->bg[bg].bg_free_inodes_count; - ++fs->sb.s_free_inodes_count; - fs->flags |= EXT2_FS_FLAG_SB_DIRTY; + ++fs->bg[bg].bg_free_inodes_count; + ++fs->sb.s_free_inodes_count; + fs->flags |= EXT2_FS_FLAG_SB_DIRTY; - /* Set the deletion time of the inode */ - inode->i_dtime = (uint32_t)time(NULL); - iinode->flags |= INODE_FLAG_DIRTY; + /* Set the deletion time of the inode */ + inode->i_dtime = (uint32_t)time(NULL); + iinode->flags |= INODE_FLAG_DIRTY; + } /* First look to see if there's any extended attributes... If so, free them up first. TODO: Should this only be checked for files, or can directories have extended attributes too? For now, assume that both can until we find some reason that assumption fails. */ - if(inode->i_file_acl) { + if(inode->i_file_acl && for_del) { if(!(buf = ext2_block_read(fs, inode->i_file_acl, &rv))) return -EIO; @@ -579,6 +581,10 @@ static 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 @@ -592,34 +598,49 @@ static int ext2_inode_free_all(ext2_fs_t *fs, ext2_inode_t *inode, } if((rv = mark_block_free(fs, blk))) - return rv; + 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) - return 0; + goto done; /* Handle the singly-indirect block */ if((rv = free_ind_block(fs, inode, inode->i_block[12]))) - return rv; + goto done; + + inode->i_block[12] = 0; /* See if we're done now... */ if(!inode->i_blocks) - return 0; + goto done; /* Time to go through the doubly-indirect block... */ if((rv = free_dind_block(fs, inode, inode->i_block[13]))) - return rv; + goto done; + + inode->i_block[13] = 0; /* See if we're done now... */ if(!inode->i_blocks) - return 0; + goto done; /* Ugh... Really... A trebly-indirect block? At least we know we're done at this point... */ - return free_tind_block(fs, inode, inode->i_block[14]); + rv = free_tind_block(fs, inode, inode->i_block[14]); + + inode->i_block[14] = 0; + +done: + /* Restore the xattr block to the block count if needed. */ + if(inode->i_file_acl && !for_del) + inode->i_blocks = sub; + + return rv; } int ext2_inode_deref(ext2_fs_t *fs, uint32_t inode_num, int isdir) { @@ -658,7 +679,7 @@ int ext2_inode_deref(ext2_fs_t *fs, uint32_t inode_num, int isdir) { /* If the inode is not referenced anywhere anymore, free it */ if(!inode->i_links_count) - rv = ext2_inode_free_all(fs, inode, inode_num); + rv = ext2_inode_free_all(fs, inode, inode_num, 1); /* Release our reference to the inode, putting it in the free pool */ ext2_inode_put(inode); diff --git a/addons/libkosext2fs/inode.h b/addons/libkosext2fs/inode.h index 78787b7..e6eac29 100644 --- a/addons/libkosext2fs/inode.h +++ b/addons/libkosext2fs/inode.h @@ -125,6 +125,10 @@ int ext2_inode_cache_wb(ext2_fs_t *fs); ext2_inode_t *ext2_inode_alloc(ext2_fs_t *fs, uint32_t parent, int *err, uint32_t *ninode); +/* Free all data blocks associated with an inode. */ +int ext2_inode_free_all(ext2_fs_t *fs, ext2_inode_t *inode, + uint32_t inode_num, int fxattr); + /* Decrease the reference count on an inode. If the reference count reaches zero, deallocate the inode and all of its blocks. */ int ext2_inode_deref(ext2_fs_t *fs, uint32_t inode_num, int isdir); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-04-18 00:17:45
|
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 d6bd897b816bd5efc6525b3618b1ddbb008c1a1a (commit) from 6b25a44cd0919820e6b0495bcf455da9d1d5d155 (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 d6bd897b816bd5efc6525b3618b1ddbb008c1a1a Author: Lawrence Sebald <ljs...@us...> Date: Wed Apr 17 20:17:12 2013 -0400 Moving right along with write support, here comes renaming in libkosext2fs. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/directory.c | 50 ++++++++ addons/libkosext2fs/directory.h | 4 + addons/libkosext2fs/fs_ext2.c | 254 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 306 insertions(+), 2 deletions(-) diff --git a/addons/libkosext2fs/directory.c b/addons/libkosext2fs/directory.c index fe7d6dc..a5add86 100644 --- a/addons/libkosext2fs/directory.c +++ b/addons/libkosext2fs/directory.c @@ -313,3 +313,53 @@ int ext2_dir_create_empty(ext2_fs_t *fs, struct ext2_inode *dir, /* And, we're done. */ return 0; } + +int ext2_dir_redir_entry(ext2_fs_t *fs, struct ext2_inode *dir, const char *fn, + uint32_t inode_num, ext2_dirent_t **rv) { + uint32_t off, i, blocks, bn; + ext2_dirent_t *dent; + uint8_t *buf; + size_t nlen = strlen(fn); + int err; + + /* Don't even bother if we're mounted read-only. */ + if(!(fs->mnt_flags & EXT2FS_MNT_FLAG_RW)) + return -EROFS; + + blocks = dir->i_blocks / (2 << fs->sb.s_log_block_size); + + for(i = 0; i < blocks; ++i) { + off = 0; + dent = NULL; + + if(!(buf = ext2_inode_read_block(fs, dir, i, &bn, &err))) + return -err; + + while(off < fs->block_size) { + dent = (ext2_dirent_t *)(buf + off); + + /* Make sure we don't trip and fall on a malformed entry. */ + if(!dent->rec_len) + return -EIO; + + /* If the entry is filled in, check if it is the entry we're trying + to modify. */ + if(dent->inode) { + if(dent->name_len == nlen && !memcmp(dent->name, fn, nlen)) { + dent->inode = inode_num; + ext2_block_mark_dirty(fs, bn); + + if(rv) + *rv = dent; + + return 0; + } + } + + off += dent->rec_len; + } + } + + /* Didn't find it... */ + return -ENOENT; +} diff --git a/addons/libkosext2fs/directory.h b/addons/libkosext2fs/directory.h index 5a917a2..92effe1 100644 --- a/addons/libkosext2fs/directory.h +++ b/addons/libkosext2fs/directory.h @@ -56,5 +56,9 @@ int ext2_dir_add_entry(ext2_fs_t *fs, struct ext2_inode *dir, const char *fn, int ext2_dir_create_empty(ext2_fs_t *fs, struct ext2_inode *dir, uint32_t inode_num, uint32_t parent_inode); +/* Redirect an entry in a directory to a different inode. */ +int ext2_dir_redir_entry(ext2_fs_t *fs, struct ext2_inode *dir, const char *fn, + uint32_t inode_num, ext2_dirent_t **rv); + __END_DECLS #endif /* !__EXT2_DIRECTORY_H */ diff --git a/addons/libkosext2fs/fs_ext2.c b/addons/libkosext2fs/fs_ext2.c index 24315bb..b87b56f 100644 --- a/addons/libkosext2fs/fs_ext2.c +++ b/addons/libkosext2fs/fs_ext2.c @@ -122,7 +122,7 @@ static void *fs_ext2_open(vfs_handler_t *vfs, const char *fn, int mode) { return (void *)(fd + 1); } -static void fs_ext2_close(void * h) { +static void fs_ext2_close(void *h) { file_t fd = ((file_t)h) - 1; mutex_lock(&ext2_mutex); @@ -363,6 +363,256 @@ retry: return &fh[fd].dent; } +static int int_rename(fs_ext2_fs_t *fs, const char *fn1, const char *fn2, + ext2_inode_t *pinode, ext2_inode_t *finode, + uint32_t finode_num, int isfile) { + ext2_inode_t *dpinode, *dinode; + uint32_t dpinode_num, tmp; + char *cp, *ent; + int irv, isdir = 0; + ext2_dirent_t *dent; + + /* Make a writable copy of the destination filename. */ + if(!(cp = strdup(fn2))) { + return -ENOMEM; + } + + /* Separate our copy into the parent and the entry we want to create. */ + if(!(ent = strrchr(cp, '/'))) { + free(cp); + return -EINVAL; + } + + /* Split the string. */ + *ent++ = 0; + + /* Look up the parent of the destination. */ + if((irv = ext2_inode_by_path(fs->fs, cp, &dpinode, &dpinode_num, 1, + NULL))) { + free(cp); + return irv; + } + + /* If the entry we get back is not a directory, then we've got problems. */ + if((dpinode->i_mode & 0xF000) != EXT2_S_IFDIR) { + ext2_inode_put(dpinode); + free(cp); + return -ENOTDIR; + } + + /* Grab the directory entry for the new filename, if it exists. */ + dent = ext2_dir_entry(fs->fs, dpinode, ent); + + /* If the entry exists, we have a bit more error checking to do. */ + if(dent) { + if(!(dinode = ext2_inode_get(fs->fs, dent->inode, &irv))) { + free(cp); + ext2_inode_put(dpinode); + return -EIO; + } + + /* Do we have a directory? */ + if((dinode->i_mode & 0xF000) == EXT2_S_IFDIR) { + isdir = 1; + + if(isfile) { + /* We have a directory... Return error. */ + free(cp); + ext2_inode_put(dinode); + ext2_inode_put(dpinode); + return -EISDIR; + } + else { + /* We have a directory... Make sure it is empty. */ + if(!(irv = ext2_dir_is_empty(fs->fs, dinode))) { + free(cp); + ext2_inode_put(dinode); + ext2_inode_put(dpinode); + return -ENOTEMPTY; + } + else if(irv == -1) { + free(cp); + ext2_inode_put(dinode); + ext2_inode_put(dpinode); + return -EIO; + } + } + } + + /* Make sure we don't have any open file descriptors to what will be + replaced at the destination. */ + for(irv = 0; irv < MAX_EXT2_FILES; ++irv) { + if(fh[irv].inode_num == dent->inode) { + free(cp); + ext2_inode_put(dinode); + ext2_inode_put(dpinode); + return -EBUSY; + } + } + } + + /* Gulp... Here comes the real work... */ + if(dent) { + /* We are overwriting something. Remove the object that we're + overwriting from its parent. */ + if((irv = ext2_dir_rm_entry(fs->fs, dpinode, ent, &tmp))) { + free(cp); + ext2_inode_put(dpinode); + ext2_inode_put(dinode); + return -EIO; + } + + ext2_inode_put(dinode); + + /* Decrement the old object's reference count, deallocating it if + necessary. */ + if(ext2_inode_deref(fs->fs, tmp, isdir)) { + free(cp); + ext2_inode_put(dpinode); + return -EIO; + } + + /* If it was a directory that we just removed, then decrement the parent + directory's reference count. */ + if(isdir) { + --dpinode->i_links_count; + ext2_inode_mark_dirty(dpinode); + } + } + + /* Add the new entry to the directory. */ + if(ext2_dir_add_entry(fs->fs, dpinode, ent, finode_num, finode, NULL)) { + free(cp); + ext2_inode_put(dpinode); + return -EIO; + } + + /* Unlink the item we're moving from its parent directory now that it is + safely in its new home. */ + if((irv = ext2_dir_rm_entry(fs->fs, pinode, fn1, &tmp))) { + free(cp); + ext2_inode_put(dpinode); + return -EIO; + } + + /* If the thing we moved was a directory, we need to fix its '..' entry and + update the reference counts of the inodes involved. */ + if(!isfile) { + if((ext2_dir_redir_entry(fs->fs, finode, "..", dpinode_num, NULL))) + return -EIO; + + --pinode->i_links_count; + ++dpinode->i_links_count; + ext2_inode_mark_dirty(dpinode); + ext2_inode_mark_dirty(pinode); + } + + free(cp); + ext2_inode_put(dpinode); + return 0; +} + +static int fs_ext2_rename(vfs_handler_t *vfs, const char *fn1, + const char *fn2) { + fs_ext2_fs_t *fs = (fs_ext2_fs_t *)vfs->privdata; + int irv; + ext2_inode_t *pinode, *inode; + uint32_t inode_num; + ext2_dirent_t *dent; + char *cp, *ent; + + /* Make sure we get valid filenames. */ + if(!fn1 || !fn2) { + errno = ENOENT; + return -1; + } + + /* No, you cannot move the root directory. */ + if(!*fn1) { + errno = EINVAL; + return -1; + } + + /* Make sure the fs is writable */ + if(!(fs->mount_flags & FS_EXT2_MOUNT_READWRITE)) { + errno = EROFS; + return -1; + } + + /* Make a writable copy of the source filename. */ + if(!(cp = strdup(fn1))) { + errno = ENOMEM; + return -1; + } + + /* Separate our copy into the parent and the file we want to move. */ + if(!(ent = strrchr(cp, '/'))) { + free(cp); + errno = EINVAL; + return -1; + } + + /* Split the string. */ + *ent++ = 0; + + mutex_lock(&ext2_mutex); + + /* Find the parent directory of the original object.*/ + if((irv = ext2_inode_by_path(fs->fs, cp, &pinode, &inode_num, 1, NULL))) { + mutex_unlock(&ext2_mutex); + free(cp); + errno = -irv; + 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; + } + + /* Grab the directory entry for the old filename. */ + if(!(dent = ext2_dir_entry(fs->fs, pinode, ent))) { + ext2_inode_put(pinode); + mutex_unlock(&ext2_mutex); + free(cp); + errno = ENOENT; + return -1; + } + + /* Find the inode of the entry we want to move. */ + if(!(inode = ext2_inode_get(fs->fs, dent->inode, &irv))) { + mutex_unlock(&ext2_mutex); + errno = EIO; + return -1; + } + + /* Is it a directory? */ + if((inode->i_mode & 0xF000) == EXT2_S_IFDIR) { + if((irv = int_rename(fs, ent, fn2, pinode, inode, dent->inode, + 0)) < 0) { + errno = -irv; + irv = -1; + } + } + else { + if((irv = int_rename(fs, ent, fn2, pinode, inode, dent->inode, + 1)) < 0) { + errno = -irv; + irv = -1; + } + } + + free(cp); + ext2_inode_put(pinode); + ext2_inode_put(inode); + mutex_lock(&ext2_mutex); + return irv; +} + static int fs_ext2_unlink(vfs_handler_t *vfs, const char *fn) { fs_ext2_fs_t *fs = (fs_ext2_fs_t *)vfs->privdata; int irv; @@ -862,7 +1112,7 @@ static vfs_handler_t vh = { fs_ext2_total, /* total */ fs_ext2_readdir, /* readdir */ NULL, /* ioctl */ - NULL, /* rename */ + fs_ext2_rename, /* rename */ fs_ext2_unlink, /* unlink */ NULL, /* mmap */ NULL, /* complete */ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-04-17 01:23: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 6b25a44cd0919820e6b0495bcf455da9d1d5d155 (commit) via e62d2015d26b889e6444639cc5b5b6204528621f (commit) from c0e3f814f7c596346d776910b013dfa7a547aba5 (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 6b25a44cd0919820e6b0495bcf455da9d1d5d155 Merge: e62d201 c0e3f81 Author: Lawrence Sebald <ljs...@us...> Date: Tue Apr 16 21:23:25 2013 -0400 Merge branch 'master' of ssh://git.code.sf.net/p/cadcdev/kallistios commit e62d2015d26b889e6444639cc5b5b6204528621f Author: Lawrence Sebald <ljs...@us...> Date: Tue Apr 16 21:11:04 2013 -0400 Furthering write support in libkosext2fs a bit... 1. Add a function to allocate blocks to an inode. 2. Add mkdir to fs_ext2. ----------------------------------------------------------------------- Summary of changes: hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-04-17 01:12: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 c0e3f814f7c596346d776910b013dfa7a547aba5 (commit) from cc47aaa0c998d521607127c252d2fa95745ab2fb (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 c0e3f814f7c596346d776910b013dfa7a547aba5 Author: Lawrence Sebald <blu...@ne...> Date: Tue Apr 16 21:11:04 2013 -0400 Furthering write support in libkosext2fs a bit... 1. Add a function to allocate blocks to an inode. 2. Add mkdir to fs_ext2. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/directory.c | 180 ++++++++++++++++++++++- addons/libkosext2fs/directory.h | 14 ++- addons/libkosext2fs/ext2fs.c | 98 ++++++++++++- addons/libkosext2fs/ext2fs.h | 4 +- addons/libkosext2fs/fs_ext2.c | 128 +++++++++++++++- addons/libkosext2fs/inode.c | 304 ++++++++++++++++++++++++++++++++++----- addons/libkosext2fs/inode.h | 11 ++- addons/libkosext2fs/symlink.c | 3 +- 8 files changed, 681 insertions(+), 61 deletions(-) diff --git a/addons/libkosext2fs/directory.c b/addons/libkosext2fs/directory.c index 41abf5b..fe7d6dc 100644 --- a/addons/libkosext2fs/directory.c +++ b/addons/libkosext2fs/directory.c @@ -12,16 +12,24 @@ #include "directory.h" #include "inode.h" +/* Calculate the minimum size of a directory entry based on the length of the + filename. This takes care of making sure that everything aligns nicely on a + 4-byte boundary as well. */ +#define DENT_SZ(n) (((n) + sizeof(ext2_dirent_t) + 4) & 0x01FC) + int ext2_dir_is_empty(ext2_fs_t *fs, const struct ext2_inode *dir) { uint32_t off, i, blocks; ext2_dirent_t *dent; uint8_t *buf; + int err; blocks = dir->i_blocks / (2 << fs->sb.s_log_block_size); for(i = 0; i < blocks; ++i) { off = 0; - buf = ext2_inode_read_block(fs, dir, i, NULL); + + if(!(buf = ext2_inode_read_block(fs, dir, i, NULL, &err))) + return -err; while(off < fs->block_size) { dent = (ext2_dirent_t *)(buf + off); @@ -54,12 +62,15 @@ ext2_dirent_t *ext2_dir_entry(ext2_fs_t *fs, const struct ext2_inode *dir, ext2_dirent_t *dent; uint8_t *buf; size_t len = strlen(fn); + int err; blocks = dir->i_blocks / (2 << fs->sb.s_log_block_size); for(i = 0; i < blocks; ++i) { off = 0; - buf = ext2_inode_read_block(fs, dir, i, NULL); + + if(!(buf = ext2_inode_read_block(fs, dir, i, NULL, &err))) + return NULL; while(off < fs->block_size) { dent = (ext2_dirent_t *)(buf + off); @@ -82,12 +93,13 @@ ext2_dirent_t *ext2_dir_entry(ext2_fs_t *fs, const struct ext2_inode *dir, return NULL; } -int ext2_dir_rm_entry(ext2_fs_t *fs, const struct ext2_inode *dir, - const char *fn, uint32_t *inode) { +int ext2_dir_rm_entry(ext2_fs_t *fs, struct ext2_inode *dir, const char *fn, + uint32_t *inode) { uint32_t off, i, blocks, bn; ext2_dirent_t *dent, *prev; uint8_t *buf; size_t len = strlen(fn); + int err; /* Don't even bother if we're mounted read-only. */ if(!(fs->mnt_flags & EXT2FS_MNT_FLAG_RW)) @@ -99,7 +111,9 @@ int ext2_dir_rm_entry(ext2_fs_t *fs, const struct ext2_inode *dir, off = 0; prev = NULL; dent = NULL; - buf = ext2_inode_read_block(fs, dir, i, &bn); + + if(!(buf = ext2_inode_read_block(fs, dir, i, &bn, &err))) + return -err; while(off < fs->block_size) { prev = dent; @@ -132,6 +146,12 @@ int ext2_dir_rm_entry(ext2_fs_t *fs, const struct ext2_inode *dir, /* Mark the block as dirty so that it gets rewritten to the block device. */ ext2_block_mark_dirty(fs, bn); + + /* Since we may well have trashed the tree if we're using a + btree directory structure, make sure that we note that + by setting that the directory is no longer indexed. */ + dir->i_flags &= ~EXT2_BTREE_FL; + ext2_inode_mark_dirty(dir); return 0; } } @@ -143,3 +163,153 @@ int ext2_dir_rm_entry(ext2_fs_t *fs, const struct ext2_inode *dir, /* Didn't find it, oh well. */ return -ENOENT; } + +static const uint8_t inodetype_to_dirtype[16] = { + EXT2_FT_UNKNOWN, EXT2_FT_FIFO, EXT2_FT_CHRDEV, EXT2_FT_UNKNOWN, + EXT2_FT_DIR, EXT2_FT_UNKNOWN, EXT2_FT_BLKDEV, EXT2_FT_UNKNOWN, + EXT2_FT_REG_FILE, EXT2_FT_UNKNOWN, EXT2_FT_SYMLINK, EXT2_FT_UNKNOWN, + EXT2_FT_SOCK, EXT2_FT_UNKNOWN, EXT2_FT_UNKNOWN, EXT2_FT_UNKNOWN +}; + +int ext2_dir_add_entry(ext2_fs_t *fs, struct ext2_inode *dir, const char *fn, + uint32_t inode_num, const struct ext2_inode *ent, + ext2_dirent_t **rv) { + uint32_t off, i, blocks, bn; + ext2_dirent_t *dent; + uint8_t *buf; + size_t nlen = strlen(fn); + uint16_t rlen = DENT_SZ(nlen), tmp; + int err; + + /* Don't even bother if we're mounted read-only. */ + if(!(fs->mnt_flags & EXT2FS_MNT_FLAG_RW)) + return -EROFS; + + blocks = dir->i_blocks / (2 << fs->sb.s_log_block_size); + + for(i = 0; i < blocks; ++i) { + off = 0; + dent = NULL; + + if(!(buf = ext2_inode_read_block(fs, dir, i, &bn, &err))) + return -err; + + while(off < fs->block_size) { + dent = (ext2_dirent_t *)(buf + off); + + /* Make sure we don't trip and fall on a malformed entry. */ + if(!dent->rec_len) + return -EIO; + + /* If the entry is filled in, check to make sure it doesn't match + the name of the entry we're trying to add. */ + if(dent->inode) { + if(dent->name_len == nlen && !memcmp(dent->name, fn, nlen)) { + return -EEXIST; + } + else if(dent->rec_len >= rlen + DENT_SZ(dent->name_len)) { + /* We have space at the end of this entry... Cut off the + empty space*/ + rlen = dent->rec_len; + tmp = dent->rec_len = DENT_SZ(dent->name_len); + dent = (ext2_dirent_t *)(buf + off + tmp); + dent->rec_len = rlen - tmp; + goto fill_it_in; + } + } + /* If it isn't filled in, is there enough space to stick our new + entry here? */ + else if(dent->rec_len >= rlen) { + goto fill_it_in; + } + + off += dent->rec_len; + } + } + + /* 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))) + return -err; + + dent = (ext2_dirent_t *)buf; + dent->rec_len = fs->block_size; + + /* Update the directory's size in the inode. */ + dir->i_size += fs->block_size; + + /* Fall through... */ +fill_it_in: + dent->inode = inode_num; + dent->name_len = (uint8_t)nlen; + memcpy(dent->name, fn, nlen); + + /* Fill in the file type if applicable to this fs. */ + if(fs->sb.s_rev_level >= EXT2_DYNAMIC_REV && + (fs->sb.s_feature_incompat & EXT2_FEATURE_INCOMPAT_FILETYPE)) + dent->file_type = inodetype_to_dirtype[ent->i_mode >> 12]; + + if(rv) + *rv = dent; + + /* Mark the directory's block as dirty. */ + ext2_block_mark_dirty(fs, bn); + + /* Since we may well have trashed the tree if we're using a btree directory + structure, make sure that we note that by setting that the directory is + no longer indexed. */ + dir->i_flags &= ~EXT2_BTREE_FL; + ext2_inode_mark_dirty(dir); + + return 0; +} + +int ext2_dir_create_empty(ext2_fs_t *fs, struct ext2_inode *dir, + uint32_t inode_num, uint32_t parent_inode) { + uint8_t *dir_buf; + ext2_dirent_t *ent; + int err; + uint32_t bg; + + /* Allocate a block for the directory structure. */ + if(!(dir_buf = ext2_inode_alloc_block(fs, dir, &err))) + return -err; + + /* Fill in "." */ + ent = (ext2_dirent_t *)dir_buf; + ent->inode = inode_num; + ent->rec_len = 12; + ent->name_len = 1; + ent->file_type = 0; + ent->name[0] = '.'; + ent->name[1] = ent->name[2] = ent->name[3] = '\0'; + + if(fs->sb.s_rev_level >= EXT2_DYNAMIC_REV && + (fs->sb.s_feature_incompat & EXT2_FEATURE_INCOMPAT_FILETYPE)) + ent->file_type = EXT2_FT_DIR; + + /* Fill in ".." */ + ent = (ext2_dirent_t *)(dir_buf + 12); + ent->inode = parent_inode; + ent->rec_len = fs->block_size - 12; + ent->name_len = 2; + ent->file_type = 0; + ent->name[0] = ent->name[1] = '.'; + ent->name[2] = ent->name[3] = '\0'; + + if(fs->sb.s_rev_level >= EXT2_DYNAMIC_REV && + (fs->sb.s_feature_incompat & EXT2_FEATURE_INCOMPAT_FILETYPE)) + ent->file_type = EXT2_FT_DIR; + + /* Fix up some stuff in the inode. */ + dir->i_size = fs->block_size; + dir->i_links_count = 2; + + /* And update the block group's directory counter. */ + bg = (inode_num - 1) / fs->sb.s_inodes_per_group; + ++fs->bg[bg].bg_used_dirs_count; + fs->flags |= EXT2_FS_FLAG_SB_DIRTY; + + /* And, we're done. */ + return 0; +} diff --git a/addons/libkosext2fs/directory.h b/addons/libkosext2fs/directory.h index a05d858..5a917a2 100644 --- a/addons/libkosext2fs/directory.h +++ b/addons/libkosext2fs/directory.h @@ -43,8 +43,18 @@ ext2_dirent_t *ext2_dir_entry(ext2_fs_t *fs, const struct ext2_inode *dir, /* Delete an entry from a directory. Note that this does nothing about cleaning up the inode, but it does tell you which inode you're going to need to clean up (or lower the reference count on). */ -int ext2_dir_rm_entry(ext2_fs_t *fs, const struct ext2_inode *dir, - const char *fn, uint32_t *inode); +int ext2_dir_rm_entry(ext2_fs_t *fs, struct ext2_inode *dir, const char *fn, + uint32_t *inode); + +/* Add an entry to a directory. */ +int ext2_dir_add_entry(ext2_fs_t *fs, struct ext2_inode *dir, const char *fn, + uint32_t inode_num, const struct ext2_inode *ent, + ext2_dirent_t **rv); + +/* Create the structure of an empty directory. The inode for the directory + must already be allocated. */ +int ext2_dir_create_empty(ext2_fs_t *fs, struct ext2_inode *dir, + uint32_t inode_num, uint32_t parent_inode); __END_DECLS #endif /* !__EXT2_DIRECTORY_H */ diff --git a/addons/libkosext2fs/ext2fs.c b/addons/libkosext2fs/ext2fs.c index 1cded4f..ff1b5fe 100644 --- a/addons/libkosext2fs/ext2fs.c +++ b/addons/libkosext2fs/ext2fs.c @@ -41,7 +41,7 @@ static void make_mru(ext2_fs_t *fs, ext2_cache_t **cache, int block) { } /* XXXX: This needs locking! */ -uint8_t *ext2_block_read(ext2_fs_t *fs, uint32_t bl) { +uint8_t *ext2_block_read(ext2_fs_t *fs, uint32_t bl, int *err) { int i; uint8_t *rv; ext2_cache_t **cache = fs->bcache; @@ -65,7 +65,7 @@ uint8_t *ext2_block_read(ext2_fs_t *fs, uint32_t bl) { if(cache[0]->flags & EXT2_CACHE_FLAG_DIRTY) { if(ext2_block_write_nc(fs, cache[0]->block, cache[0]->data)) { /* XXXX: Uh oh... */ - errno = EIO; + *err = EIO; return NULL; } } @@ -73,7 +73,7 @@ uint8_t *ext2_block_read(ext2_fs_t *fs, uint32_t bl) { /* Try to read the block in question. */ if(ext2_block_read_nc(fs, bl, cache[i]->data)) { - errno = EIO; + *err = EIO; cache[i]->flags = 0; /* Mark it as invalid... */ return NULL; } @@ -160,6 +160,98 @@ int ext2_block_cache_wb(ext2_fs_t *fs) { return 0; } +uint8_t *ext2_block_alloc(ext2_fs_t *fs, uint32_t bg, uint32_t *bn, int *err) { + uint8_t *buf, *blk; + uint32_t index; + + /* Don't even bother if we're mounted read-only. */ + if(!(fs->mnt_flags & EXT2FS_MNT_FLAG_RW)) { + *err = EROFS; + return NULL; + } + + /* See if we have any free blocks at all... */ + if(!fs->sb.s_free_blocks_count) { + *err = ENOSPC; + return NULL; + } + + /* See if we have any free blocks in the block group requested. */ + if(fs->bg[bg].bg_free_blocks_count) { + if(!(buf = ext2_block_read(fs, fs->bg[bg].bg_block_bitmap, err))) + return NULL; + + index = ext2_bit_find_zero((uint32_t *)buf, 0, + fs->sb.s_blocks_per_group - 1); + if(index < fs->sb.s_blocks_per_group) { + *bn = index + bg * fs->sb.s_blocks_per_group + + fs->sb.s_first_data_block; + + if(!(blk = ext2_block_read(fs, *bn, err))) + return NULL; + + ext2_bit_set((uint32_t *)buf, index); + ext2_block_mark_dirty(fs, fs->bg[bg].bg_block_bitmap); + --fs->bg[bg].bg_free_blocks_count; + --fs->sb.s_free_blocks_count; + fs->flags |= EXT2_FS_FLAG_SB_DIRTY; + + memset(blk, 0, fs->block_size); + ext2_block_mark_dirty(fs, *bn); + return blk; + } + + /* We shouldn't get here... But, just in case, fall through. We should + probably log an error and tell the user to fsck though. */ + dbglog(DBG_WARNING, "ext2_block_alloc: Block group %" PRIu32 " " + "indicates that it has free blocks, but doesn't appear to. " + "Please run fsck on this volume!\n", bg); + } + + /* Couldn't find a free block in the requested block group... Loop through + all the block groups looking for a free block. */ + for(bg = 0; bg < fs->bg_count; ++bg) { + if(fs->bg[bg].bg_free_blocks_count) { + if(!(buf = ext2_block_read(fs, fs->bg[bg].bg_block_bitmap, err))) + return NULL; + + index = ext2_bit_find_zero((uint32_t *)buf, 0, + fs->sb.s_blocks_per_group - 1); + if(index < fs->sb.s_blocks_per_group) { + *bn = index + bg * fs->sb.s_blocks_per_group + + fs->sb.s_first_data_block; + + if(!(blk = ext2_block_read(fs, *bn, err))) + return NULL; + + ext2_bit_set((uint32_t *)buf, index); + ext2_block_mark_dirty(fs, fs->bg[bg].bg_block_bitmap); + --fs->bg[bg].bg_free_blocks_count; + --fs->sb.s_free_blocks_count; + fs->flags |= EXT2_FS_FLAG_SB_DIRTY; + + memset(blk, 0, fs->block_size); + ext2_block_mark_dirty(fs, *bn); + return blk; + } + + /* We shouldn't get here... But, just in case, fall through. We + should probably log an error and tell the user to fsck though. */ + dbglog(DBG_WARNING, "ext2_block_alloc: Block group %" PRIu32 " " + "indicates that it has free blocks, but doesn't appear to. " + "Please run fsck on this volume!\n", bg); + } + } + + /* Uh oh... We went through everything and didn't find any. That means the + data in the superblock is wrong. */ + dbglog(DBG_WARNING, "ext2_block_alloc: Filesystem indicates that it has " + "free blocks, but doesn't appear to. Please run fsck on this " + "volume!\n"); + *err = ENOSPC; + return NULL; +} + uint32_t ext2_block_size(const ext2_fs_t *fs) { return fs->block_size; } diff --git a/addons/libkosext2fs/ext2fs.h b/addons/libkosext2fs/ext2fs.h index 36a366c..2a21f47 100644 --- a/addons/libkosext2fs/ext2fs.h +++ b/addons/libkosext2fs/ext2fs.h @@ -97,7 +97,7 @@ int ext2_fs_sync(ext2_fs_t *fs); void ext2_fs_shutdown(ext2_fs_t *fs); int ext2_block_read_nc(ext2_fs_t *fs, uint32_t block_num, uint8_t *rv); -uint8_t *ext2_block_read(ext2_fs_t *fs, uint32_t block_num); +uint8_t *ext2_block_read(ext2_fs_t *fs, uint32_t block_num, int *err); int ext2_block_write_nc(ext2_fs_t *fs, uint32_t block_num, const uint8_t *blk); @@ -107,6 +107,8 @@ int ext2_block_mark_dirty(ext2_fs_t *fs, uint32_t block_num); call the corresponding inode function before this one. */ int ext2_block_cache_wb(ext2_fs_t *fs); +uint8_t *ext2_block_alloc(ext2_fs_t *fs, uint32_t bg, uint32_t *bn, int *err); + __END_DECLS #endif /* !__EXT2_EXT2FS_H */ diff --git a/addons/libkosext2fs/fs_ext2.c b/addons/libkosext2fs/fs_ext2.c index a3ac19b..24315bb 100644 --- a/addons/libkosext2fs/fs_ext2.c +++ b/addons/libkosext2fs/fs_ext2.c @@ -4,6 +4,7 @@ Copyright (C) 2012, 2013 Lawrence Sebald */ +#include <time.h> #include <errno.h> #include <stdint.h> #include <stdlib.h> @@ -168,9 +169,8 @@ static ssize_t fs_ext2_read(void *h, void *buf, size_t cnt) { /* Handle the first block specially if we are offset within it. */ if(bo) { if(!(block = ext2_inode_read_block(fs, fh[fd].inode, fh[fd].ptr >> lbs, - NULL))) { + NULL, &errno))) { mutex_unlock(&ext2_mutex); - errno = EBADF; return -1; } @@ -190,9 +190,8 @@ static ssize_t fs_ext2_read(void *h, void *buf, size_t cnt) { /* While we still have more to read, do it. */ while(cnt) { if(!(block = ext2_inode_read_block(fs, fh[fd].inode, fh[fd].ptr >> lbs, - NULL))) { + NULL, &errno))) { mutex_unlock(&ext2_mutex); - errno = EBADF; return -1; } @@ -318,9 +317,8 @@ retry: } if(!(block = ext2_inode_read_block(fs, fh[fd].inode, fh[fd].ptr >> lbs, - NULL))) { + NULL, &errno))) { mutex_unlock(&ext2_mutex); - errno = EBADF; return NULL; } @@ -478,6 +476,9 @@ static int fs_ext2_unlink(vfs_handler_t *vfs, const char *fn) { return -1; } + /* Update the times in the parent's inode */ + pinode->i_ctime = pinode->i_mtime = time(NULL); + /* We're done with these now, so clean them up. */ ext2_inode_put(pinode); ext2_inode_put(inode); @@ -560,6 +561,115 @@ static int fs_ext2_stat(vfs_handler_t *vfs, const char *fn, stat_t *rv) { return 0; } +static int fs_ext2_mkdir(vfs_handler_t *vfs, const char *fn) { + fs_ext2_fs_t *fs = (fs_ext2_fs_t *)vfs->privdata; + int irv; + ext2_inode_t *inode, *ninode; + uint32_t inode_num, ninode_num; + char *cp, *nd; + + /* Make sure there is a filename given */ + if(!fn) { + errno = ENOENT; + return -1; + } + + /* Make sure the fs is writable */ + if(!(fs->mount_flags & FS_EXT2_MOUNT_READWRITE)) { + errno = EROFS; + return -1; + } + + /* The root directory has to exist... */ + if(!*fn) { + errno = EEXIST; + return -1; + } + ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-04-10 02:18:28
|
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 "The collection of ports that can be used in KallistiOS programs.". The branch, master has been updated via 714b9654ce3b3d2dffdc5f9cf53f5f65243ca31a (commit) via 5da55526fe2efbf8315fe118c10ce23d38a520ae (commit) from 543ec0d3e5f2e48b9e92d7e0ad4f7775b746b36c (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 714b9654ce3b3d2dffdc5f9cf53f5f65243ca31a Author: Lawrence Sebald <blu...@ne...> Date: Tue Apr 9 22:16:36 2013 -0400 Fix SDL link. commit 5da55526fe2efbf8315fe118c10ce23d38a520ae Author: Lawrence Sebald <blu...@ne...> Date: Tue Apr 9 22:14:58 2013 -0400 Fix the submodules for the new repo location. ----------------------------------------------------------------------- Summary of changes: .gitmodules | 44 ++++++++++++++++++++++---------------------- 1 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.gitmodules b/.gitmodules index f92efaa..a0ec562 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,66 +1,66 @@ [submodule "SDL"] path = SDL - url = git://cadcdev.git.sourceforge.net/gitroot/cadcdev/SDL + url = git://git.code.sf.net/p/cadcdev/sdl [submodule "libbz2"] path = libbz2 - url = git://cadcdev.git.sourceforge.net/gitroot/cadcdev/libbz2 + url = git://git.code.sf.net/p/cadcdev/libbz2 [submodule "libconio"] path = libconio - url = git://cadcdev.git.sourceforge.net/gitroot/cadcdev/libconio + url = git://git.code.sf.net/p/cadcdev/libconio [submodule "libdcplib"] path = libdcplib - url = git://cadcdev.git.sourceforge.net/gitroot/cadcdev/libdcplib + url = git://git.code.sf.net/p/cadcdev/libdcplib [submodule "libgl"] path = libgl - url = git://cadcdev.git.sourceforge.net/gitroot/cadcdev/libgl + url = git://git.code.sf.net/p/cadcdev/libgl [submodule "libimageload"] path = libimageload - url = git://cadcdev.git.sourceforge.net/gitroot/cadcdev/libimageload + url = git://git.code.sf.net/p/cadcdev/libimageload [submodule "libjpeg"] path = libjpeg - url = git://cadcdev.git.sourceforge.net/gitroot/cadcdev/libjpeg + url = git://git.code.sf.net/p/cadcdev/libjpeg [submodule "libkmg"] path = libkmg - url = git://cadcdev.git.sourceforge.net/gitroot/cadcdev/libkmg + url = git://git.code.sf.net/p/cadcdev/libkmg [submodule "libkosh"] path = libkosh - url = git://cadcdev.git.sourceforge.net/gitroot/cadcdev/libkosh + url = git://git.code.sf.net/p/cadcdev/libkosh [submodule "libmodplug"] path = libmodplug - url = git://cadcdev.git.sourceforge.net/gitroot/cadcdev/libmodplug + url = git://git.code.sf.net/p/cadcdev/libmodplug [submodule "libmp3"] path = libmp3 - url = git://cadcdev.git.sourceforge.net/gitroot/cadcdev/libmp3 + url = git://git.code.sf.net/p/cadcdev/libmp3 [submodule "liboggvorbis"] path = liboggvorbis - url = git://cadcdev.git.sourceforge.net/gitroot/cadcdev/liboggvorbis + url = git://git.code.sf.net/p/cadcdev/liboggvorbis [submodule "libparallax"] path = libparallax - url = git://cadcdev.git.sourceforge.net/gitroot/cadcdev/libparallax + url = git://git.code.sf.net/p/cadcdev/libparallax [submodule "libpcx"] path = libpcx - url = git://cadcdev.git.sourceforge.net/gitroot/cadcdev/libpcx + url = git://git.code.sf.net/p/cadcdev/libpcx [submodule "libpng"] path = libpng - url = git://cadcdev.git.sourceforge.net/gitroot/cadcdev/libpng + url = git://git.code.sf.net/p/cadcdev/libpng [submodule "libs3m"] path = libs3m - url = git://cadcdev.git.sourceforge.net/gitroot/cadcdev/libs3m + url = git://git.code.sf.net/p/cadcdev/libs3m [submodule "libtga"] path = libtga - url = git://cadcdev.git.sourceforge.net/gitroot/cadcdev/libtga + url = git://git.code.sf.net/p/cadcdev/libtga [submodule "libtremor"] path = libtremor - url = git://cadcdev.git.sourceforge.net/gitroot/cadcdev/libtremor + url = git://git.code.sf.net/p/cadcdev/libtremor [submodule "libtsunami"] path = libtsunami - url = git://cadcdev.git.sourceforge.net/gitroot/cadcdev/libtsunami + url = git://git.code.sf.net/p/cadcdev/libtsunami [submodule "lua"] path = lua - url = git://cadcdev.git.sourceforge.net/gitroot/cadcdev/lua + url = git://git.code.sf.net/p/cadcdev/lua [submodule "lwip"] path = lwip - url = git://cadcdev.git.sourceforge.net/gitroot/cadcdev/lwip + url = git://git.code.sf.net/p/cadcdev/lwip [submodule "zlib"] path = zlib - url = git://cadcdev.git.sourceforge.net/gitroot/cadcdev/zlib + url = git://git.code.sf.net/p/cadcdev/zlib hooks/post-receive -- The collection of ports that can be used in KallistiOS programs. |
From: Lawrence S. <ljs...@us...> - 2013-04-10 01:50: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 cc47aaa0c998d521607127c252d2fa95745ab2fb (commit) from a9dfe43213f47264982d426f5364b09381dde05c (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 cc47aaa0c998d521607127c252d2fa95745ab2fb Author: Lawrence Sebald <ljs...@us...> Date: Tue Apr 9 21:49:45 2013 -0400 Get rid of a debugging printf I left in by mistake... ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/inode.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/addons/libkosext2fs/inode.c b/addons/libkosext2fs/inode.c index 975d25b..57a8b4a 100644 --- a/addons/libkosext2fs/inode.c +++ b/addons/libkosext2fs/inode.c @@ -562,7 +562,6 @@ static int ext2_inode_free_all(ext2_fs_t *fs, ext2_inode_t *inode, dbglog(DBG_WARNING, "ext2_inode_free_all: xattr with bad magic!\n"); } else if(!--xattr->h_refcount) { - printf("Freeing xattr at block %d\n", (int)inode->i_file_acl); if((rv = mark_block_free(fs, inode->i_file_acl))) return rv; } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-04-10 00:48:18
|
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 a9dfe43213f47264982d426f5364b09381dde05c (commit) from de3fe342ba44fe1353cf2315bceaa53d3b0a56e1 (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 a9dfe43213f47264982d426f5364b09381dde05c Author: Lawrence Sebald <ljs...@us...> Date: Tue Apr 9 20:48:02 2013 -0400 Fix a small mistake in the last commit. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/inode.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/addons/libkosext2fs/inode.c b/addons/libkosext2fs/inode.c index 96292ac..975d25b 100644 --- a/addons/libkosext2fs/inode.c +++ b/addons/libkosext2fs/inode.c @@ -563,7 +563,7 @@ static int ext2_inode_free_all(ext2_fs_t *fs, ext2_inode_t *inode, } else if(!--xattr->h_refcount) { printf("Freeing xattr at block %d\n", (int)inode->i_file_acl); - if((rv = mark_block_free(fs, blk))) + if((rv = mark_block_free(fs, inode->i_file_acl))) return rv; } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-04-10 00:45:44
|
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 de3fe342ba44fe1353cf2315bceaa53d3b0a56e1 (commit) from 186e9f53b0f6c951c69252a228f816255eaa2074 (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 de3fe342ba44fe1353cf2315bceaa53d3b0a56e1 Author: Lawrence Sebald <ljs...@us...> Date: Tue Apr 9 20:44:18 2013 -0400 Add support for unlink and rmdir to fs_ext2. ----------------------------------------------------------------------- Summary of changes: addons/include/ext2/fs_ext2.h | 2 + addons/libkosext2fs/block.c | 4 + addons/libkosext2fs/directory.c | 67 ++++++++- addons/libkosext2fs/directory.h | 9 + addons/libkosext2fs/ext2fs.c | 22 ++- addons/libkosext2fs/ext2fs.h | 11 +- addons/libkosext2fs/ext2internal.h | 1 + addons/libkosext2fs/fs_ext2.c | 284 +++++++++++++++++++++++++++++++- addons/libkosext2fs/inode.c | 317 ++++++++++++++++++++++++++++++++++-- addons/libkosext2fs/inode.h | 20 ++- addons/libkosext2fs/superblock.c | 4 + addons/libkosext2fs/symlink.c | 2 +- 12 files changed, 713 insertions(+), 30 deletions(-) diff --git a/addons/include/ext2/fs_ext2.h b/addons/include/ext2/fs_ext2.h index 3bc16ca..2722af5 100644 --- a/addons/include/ext2/fs_ext2.h +++ b/addons/include/ext2/fs_ext2.h @@ -83,6 +83,8 @@ int fs_ext2_shutdown(void); the block device does not support writing, then the filesystem will not be mounted as read-write (for obvious reasons). + These should stay synchronized with the ones in ext2fs.h. + @{ */ #define FS_EXT2_MOUNT_READONLY 0x00000000 /**< \brief Mount read-only */ diff --git a/addons/libkosext2fs/block.c b/addons/libkosext2fs/block.c index 399481e..0395cb7 100644 --- a/addons/libkosext2fs/block.c +++ b/addons/libkosext2fs/block.c @@ -55,6 +55,10 @@ int ext2_write_blockgroups(ext2_fs_t *fs, uint32_t bg) { uint32_t start_block = bg * fs->sb.s_blocks_per_group + fs->sb.s_first_data_block + 1; + /* Don't even bother if we're mounted read-only. */ + if(!(fs->mnt_flags & EXT2FS_MNT_FLAG_RW)) + return 0; + if(!(buf = (uint8_t *)malloc(fs->block_size))) return -ENOMEM; diff --git a/addons/libkosext2fs/directory.c b/addons/libkosext2fs/directory.c index 5a82bec..41abf5b 100644 --- a/addons/libkosext2fs/directory.c +++ b/addons/libkosext2fs/directory.c @@ -5,6 +5,7 @@ */ #include <string.h> +#include <errno.h> #include "ext2fs.h" #include "ext2internal.h" @@ -20,7 +21,7 @@ int ext2_dir_is_empty(ext2_fs_t *fs, const struct ext2_inode *dir) { for(i = 0; i < blocks; ++i) { off = 0; - buf = ext2_inode_read_block(fs, dir, (uint32_t)i); + buf = ext2_inode_read_block(fs, dir, i, NULL); while(off < fs->block_size) { dent = (ext2_dirent_t *)(buf + off); @@ -58,7 +59,7 @@ ext2_dirent_t *ext2_dir_entry(ext2_fs_t *fs, const struct ext2_inode *dir, for(i = 0; i < blocks; ++i) { off = 0; - buf = ext2_inode_read_block(fs, dir, (uint32_t)i); + buf = ext2_inode_read_block(fs, dir, i, NULL); while(off < fs->block_size) { dent = (ext2_dirent_t *)(buf + off); @@ -80,3 +81,65 @@ ext2_dirent_t *ext2_dir_entry(ext2_fs_t *fs, const struct ext2_inode *dir, /* Didn't find it, oh well. */ return NULL; } + +int ext2_dir_rm_entry(ext2_fs_t *fs, const struct ext2_inode *dir, + const char *fn, uint32_t *inode) { + uint32_t off, i, blocks, bn; + ext2_dirent_t *dent, *prev; + uint8_t *buf; + size_t len = strlen(fn); + + /* Don't even bother if we're mounted read-only. */ + if(!(fs->mnt_flags & EXT2FS_MNT_FLAG_RW)) + return -EROFS; + + blocks = dir->i_blocks / (2 << fs->sb.s_log_block_size); + + for(i = 0; i < blocks; ++i) { + off = 0; + prev = NULL; + dent = NULL; + buf = ext2_inode_read_block(fs, dir, i, &bn); + + while(off < fs->block_size) { + prev = dent; + dent = (ext2_dirent_t *)(buf + off); + + /* Make sure we don't trip and fall on a malformed entry. */ + if(!dent->rec_len) + return -EIO; + + if(dent->inode) { + /* Check if this what we're looking for. */ + if(dent->name_len == len && !memcmp(dent->name, fn, len)) { + /* Return the inode number to the calling function. */ + *inode = dent->inode; + + if(prev) { + /* Remove it from the chain and clear the entry. */ + prev->rec_len += dent->rec_len; + memset(dent, 0, dent->rec_len); + } + else { + /* This is the first entry in a block, so simply mark + the entry as invalid, and clear the filename and such + from it. */ + dent->inode = 0; + memset(dent->name, 0, dent->name_len); + dent->name_len = dent->file_type = 0; + } + + /* Mark the block as dirty so that it gets rewritten to the + block device. */ + ext2_block_mark_dirty(fs, bn); + return 0; + } + } + + off += dent->rec_len; + } + } + + /* Didn't find it, oh well. */ + return -ENOENT; +} diff --git a/addons/libkosext2fs/directory.h b/addons/libkosext2fs/directory.h index 78d40f4..a05d858 100644 --- a/addons/libkosext2fs/directory.h +++ b/addons/libkosext2fs/directory.h @@ -33,9 +33,18 @@ typedef struct ext2_dirent { /* Forward declaration... */ struct ext2_inode; +/* Check if a directory is empty. */ int ext2_dir_is_empty(ext2_fs_t *fs, const struct ext2_inode *dir); + +/* Find an entry in a directory. */ ext2_dirent_t *ext2_dir_entry(ext2_fs_t *fs, const struct ext2_inode *dir, const char *fn); +/* Delete an entry from a directory. Note that this does nothing about cleaning + up the inode, but it does tell you which inode you're going to need to clean + up (or lower the reference count on). */ +int ext2_dir_rm_entry(ext2_fs_t *fs, const struct ext2_inode *dir, + const char *fn, uint32_t *inode); + __END_DECLS #endif /* !__EXT2_DIRECTORY_H */ diff --git a/addons/libkosext2fs/ext2fs.c b/addons/libkosext2fs/ext2fs.c index b5b3331..1cded4f 100644 --- a/addons/libkosext2fs/ext2fs.c +++ b/addons/libkosext2fs/ext2fs.c @@ -144,6 +144,10 @@ int ext2_block_cache_wb(ext2_fs_t *fs) { int i, err; ext2_cache_t **cache = fs->bcache; + /* Don't even bother if we're mounted read-only. */ + if(!(fs->mnt_flags & EXT2FS_MNT_FLAG_RW)) + return 0; + for(i = fs->cache_size - 1; i >= 0; --i) { if(cache[i]->flags & EXT2_CACHE_FLAG_DIRTY) { if((err = ext2_block_write_nc(fs, cache[i]->block, cache[i]->data))) @@ -171,11 +175,11 @@ int ext2_init(void) { return 0; } -ext2_fs_t *ext2_fs_init(kos_blockdev_t *bd) { - return ext2_fs_init_ex(bd, EXT2_CACHE_BLOCKS); +ext2_fs_t *ext2_fs_init(kos_blockdev_t *bd, uint32_t flags) { + return ext2_fs_init_ex(bd, flags, EXT2_CACHE_BLOCKS); } -ext2_fs_t *ext2_fs_init_ex(kos_blockdev_t *bd, int cache_sz) { +ext2_fs_t *ext2_fs_init_ex(kos_blockdev_t *bd, uint32_t flags, int cache_sz) { ext2_fs_t *rv; uint32_t bc; int j; @@ -201,6 +205,14 @@ ext2_fs_t *ext2_fs_init_ex(kos_blockdev_t *bd, int cache_sz) { } rv->dev = bd; + rv->mnt_flags = flags & EXT2FS_MNT_VALID_FLAGS_MASK; + + if(rv->mnt_flags != flags) { + dbglog(DBG_WARNING, "ext2_fs_init: unknown mount flags: %08" PRIx32 + "\n", flags); + dbglog(DBG_WARNING, " mounting read-only\n"); + rv->mnt_flags = 0; + } /* Read in the all-important superblock. */ if(ext2_read_superblock(&rv->sb, bd)) { @@ -350,6 +362,10 @@ out_cache: int ext2_fs_sync(ext2_fs_t *fs) { int rv, frv = 0; + /* Don't even bother if we're mounted read-only. */ + if(!(fs->mnt_flags & EXT2FS_MNT_FLAG_RW)) + return 0; + /* Do a write-back on the inode cache first, pushing the changes out to the block cache. */ if((rv = ext2_inode_cache_wb(fs))) { diff --git a/addons/libkosext2fs/ext2fs.h b/addons/libkosext2fs/ext2fs.h index 0b20af3..36a366c 100644 --- a/addons/libkosext2fs/ext2fs.h +++ b/addons/libkosext2fs/ext2fs.h @@ -76,6 +76,13 @@ typedef struct kos_blockdev { struct ext2fs_struct; typedef struct ext2fs_struct ext2_fs_t; +/* Filesystem mount flags */ +#define EXT2FS_MNT_FLAG_RO 0x00000000 +#define EXT2FS_MNT_FLAG_RW 0x00000001 + +/* Valid flags mask */ +#define EXT2FS_MNT_VALID_FLAGS_MASK 0x00000001 + uint32_t ext2_block_size(const ext2_fs_t *fs); uint32_t ext2_log_block_size(const ext2_fs_t *fs); @@ -84,8 +91,8 @@ uint32_t ext2_log_block_size(const ext2_fs_t *fs); mounting the first filesystem. */ int ext2_init(void); -ext2_fs_t *ext2_fs_init(kos_blockdev_t *bd); -ext2_fs_t *ext2_fs_init_ex(kos_blockdev_t *bd, int cache_sz); +ext2_fs_t *ext2_fs_init(kos_blockdev_t *bd, uint32_t flags); +ext2_fs_t *ext2_fs_init_ex(kos_blockdev_t *bd, uint32_t flags, int cache_sz); int ext2_fs_sync(ext2_fs_t *fs); void ext2_fs_shutdown(ext2_fs_t *fs); diff --git a/addons/libkosext2fs/ext2internal.h b/addons/libkosext2fs/ext2internal.h index 8624a38..20808cd 100644 --- a/addons/libkosext2fs/ext2internal.h +++ b/addons/libkosext2fs/ext2internal.h @@ -37,6 +37,7 @@ struct ext2fs_struct { int cache_size; uint32_t flags; + uint32_t mnt_flags; }; /* The superblock and/or block descriptors need to be written to the block diff --git a/addons/libkosext2fs/fs_ext2.c b/addons/libkosext2fs/fs_ext2.c index fcb3f74..a3ac19b 100644 --- a/addons/libkosext2fs/fs_ext2.c +++ b/addons/libkosext2fs/fs_ext2.c @@ -20,6 +20,9 @@ #include "inode.h" #include "directory.h" +/* For some reason, Newlib doesn't seem to define this function in stdlib.h. */ +extern char *realpath(const char *, const char *); + #define MAX_EXT2_FILES 16 typedef struct fs_ext2_fs { @@ -164,8 +167,8 @@ static ssize_t fs_ext2_read(void *h, void *buf, size_t cnt) { /* Handle the first block specially if we are offset within it. */ if(bo) { - if(!(block = ext2_inode_read_block(fs, fh[fd].inode, - fh[fd].ptr >> lbs))) { + if(!(block = ext2_inode_read_block(fs, fh[fd].inode, fh[fd].ptr >> lbs, + NULL))) { mutex_unlock(&ext2_mutex); errno = EBADF; return -1; @@ -186,8 +189,8 @@ static ssize_t fs_ext2_read(void *h, void *buf, size_t cnt) { /* While we still have more to read, do it. */ while(cnt) { - if(!(block = ext2_inode_read_block(fs, fh[fd].inode, - fh[fd].ptr >> lbs))) { + if(!(block = ext2_inode_read_block(fs, fh[fd].inode, fh[fd].ptr >> lbs, + NULL))) { mutex_unlock(&ext2_mutex); errno = EBADF; return -1; @@ -314,7 +317,8 @@ retry: return NULL; } - if(!(block = ext2_inode_read_block(fs, fh[fd].inode, fh[fd].ptr >> lbs))) { + if(!(block = ext2_inode_read_block(fs, fh[fd].inode, fh[fd].ptr >> lbs, + NULL))) { mutex_unlock(&ext2_mutex); errno = EBADF; return NULL; @@ -361,6 +365,136 @@ retry: return &fh[fd].dent; } +static int fs_ext2_unlink(vfs_handler_t *vfs, const char *fn) { + fs_ext2_fs_t *fs = (fs_ext2_fs_t *)vfs->privdata; + int irv; + ext2_inode_t *pinode, *inode; + uint32_t inode_num; + ext2_dirent_t *dent; + char *cp, *ent; + uint32_t in_num; + + /* Make sure there is a filename given */ + if(!fn) { + errno = ENOENT; + return -1; + } + + /* Make sure we're not trying to remove the root of the filesystem. */ + if(!*fn) { + errno = EPERM; + return -1; + } + + /* Make sure the fs is writable */ + if(!(fs->mount_flags & FS_EXT2_MOUNT_READWRITE)) { + errno = EROFS; + return -1; + } + + /* Make a writable copy of the filename. */ + if(!(cp = strdup(fn))) { + errno = ENOMEM; + return -1; + } + + /* Separate our copy into the parent and the file we want to remove. */ + if(!(ent = strrchr(cp, '/'))) { + free(cp); + errno = EPERM; + return -1; + } + + /* Split the string. */ + *ent++ = 0; + + mutex_lock(&ext2_mutex); + + /* Find the parent directory of the object in question.*/ + if((irv = ext2_inode_by_path(fs->fs, cp, &pinode, &inode_num, 1, NULL))) { + mutex_unlock(&ext2_mutex); + free(cp); + errno = -irv; + 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; + } + + /* Try to find the directory entry of the item we want to remove. */ + if(!(dent = ext2_dir_entry(fs->fs, pinode, ent))) { + ext2_inode_put(pinode); + mutex_unlock(&ext2_mutex); + free(cp); + errno = ENOENT; + return -1; + } + + /* Find the inode of the entry we want to remove. */ + if(!(inode = ext2_inode_get(fs->fs, dent->inode, &irv))) { + ext2_inode_put(pinode); + mutex_unlock(&ext2_mutex); + free(cp); + errno = EIO; + return -1; + } + + /* Make sure we don't try to remove a directory with unlink. That is what + rmdir is for. */ + if((inode->i_mode & 0xF000) == EXT2_S_IFDIR) { + ext2_inode_put(pinode); + ext2_inode_put(inode); + mutex_unlock(&ext2_mutex); + free(cp); + errno = EPERM; + 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; + } + } + + /* Remove the entry from the parent's directory. */ + if((irv = ext2_dir_rm_entry(fs->fs, pinode, ent, &in_num))) { + ext2_inode_put(pinode); + ext2_inode_put(inode); + mutex_unlock(&ext2_mutex); + free(cp); + errno = -irv; + return -1; + } + + /* We're done with these now, so clean them up. */ + ext2_inode_put(pinode); + ext2_inode_put(inode); + free(cp); + + /* Free up the inode and all the data blocks. */ + if((irv = ext2_inode_deref(fs->fs, in_num, 0))) { + mutex_unlock(&ext2_mutex); + errno = -irv; + return -1; + } + + /* And, we're done. Unlock the mutex. */ + mutex_unlock(&ext2_mutex); + return 0; +} + static int fs_ext2_stat(vfs_handler_t *vfs, const char *fn, stat_t *rv) { fs_ext2_fs_t *fs = (fs_ext2_fs_t *)vfs->privdata; int irv; @@ -426,6 +560,140 @@ static int fs_ext2_stat(vfs_handler_t *vfs, const char *fn, stat_t *rv) { return 0; } +static int fs_ext2_rmdir(vfs_handler_t *vfs, const char *fn) { + fs_ext2_fs_t *fs = (fs_ext2_fs_t *)vfs->privdata; + int irv; + ext2_inode_t *pinode, *inode; + uint32_t inode_num; + ext2_dirent_t *dent; + char *cp, *ent; + uint32_t in_num; + + /* Make sure there is a filename given */ + if(!fn) { + errno = ENOENT; + return -1; + } + + /* Make sure we're not trying to remove the root of the filesystem. */ + if(!*fn || (fn[0] == '/' && !fn[1])) { + errno = EPERM; + return -1; + } + + /* Make sure the fs is writable */ + if(!(fs->mount_flags & FS_EXT2_MOUNT_READWRITE)) { + errno = EROFS; + return -1; + } + + /* Make a writable copy of the filename. */ + if(!(cp = strdup(fn))) { + errno = ENOMEM; + return -1; + } + + /* Separate our copy into the parent and the file we want to remove. */ + if(!(ent = strrchr(cp, '/'))) { + free(cp); + errno = EPERM; + return -1; + } + + /* Split the string. */ + *ent++ = 0; + + mutex_lock(&ext2_mutex); + + /* Find the parent directory of the object in question.*/ + if((irv = ext2_inode_by_path(fs->fs, cp, &pinode, &inode_num, 1, NULL))) { + mutex_unlock(&ext2_mutex); + free(cp); + errno = -irv; + 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; + } + + /* Try to find the directory entry of the item we want to remove. */ + if(!(dent = ext2_dir_entry(fs->fs, pinode, ent))) { + ext2_inode_put(pinode); + mutex_unlock(&ext2_mutex); + free(cp); ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-04-07 02:01:55
|
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 186e9f53b0f6c951c69252a228f816255eaa2074 (commit) from e29e15ea9864b2a6fff2df5d8f75d4ac6c590468 (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 186e9f53b0f6c951c69252a228f816255eaa2074 Author: Lawrence Sebald <ljs...@us...> Date: Sat Apr 6 22:00:39 2013 -0400 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. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/block.c | 36 +++++++ addons/libkosext2fs/block.h | 1 + addons/libkosext2fs/ext2fs.c | 95 +++++++++++++++++-- addons/libkosext2fs/ext2fs.h | 9 ++- addons/libkosext2fs/ext2internal.h | 13 +++- addons/libkosext2fs/inode.c | 185 ++++++++++++++++++++++++++++++++++- addons/libkosext2fs/inode.h | 10 ++ addons/libkosext2fs/superblock.c | 63 ++++++++++++- addons/libkosext2fs/superblock.h | 21 ++++ addons/libkosext2fs/utils.h | 18 +++- 10 files changed, 429 insertions(+), 22 deletions(-) diff --git a/addons/libkosext2fs/block.c b/addons/libkosext2fs/block.c index 03c7262..399481e 100644 --- a/addons/libkosext2fs/block.c +++ b/addons/libkosext2fs/block.c @@ -46,3 +46,39 @@ int ext2_read_blockgroups(ext2_fs_t *fs, uint32_t start_block) { free(buf); return 0; } + +int ext2_write_blockgroups(ext2_fs_t *fs, uint32_t bg) { + uint8_t *buf; + ext2_bg_desc_t *ptr = fs->bg; + uint32_t bg_per_block; + uint32_t count = fs->bg_count; + uint32_t start_block = bg * fs->sb.s_blocks_per_group + + fs->sb.s_first_data_block + 1; + + if(!(buf = (uint8_t *)malloc(fs->block_size))) + return -ENOMEM; + + bg_per_block = fs->block_size / sizeof(ext2_bg_desc_t); + + while(count) { + if(count < bg_per_block) { + memcpy(buf, ptr, count * sizeof(ext2_bg_desc_t)); + memset(buf + count * sizeof(ext2_bg_desc_t), 0, + (bg_per_block - count) * sizeof(ext2_bg_desc_t)); + count = 0; + } + else { + memcpy(buf, ptr, count * sizeof(ext2_bg_desc_t)); + count -= bg_per_block; + ptr += bg_per_block; + } + + if(ext2_block_write_nc(fs, start_block++, buf)) { + free(buf); + return -EIO; + } + } + + free(buf); + return 0; +} diff --git a/addons/libkosext2fs/block.h b/addons/libkosext2fs/block.h index 36a2634..76f081a 100644 --- a/addons/libkosext2fs/block.h +++ b/addons/libkosext2fs/block.h @@ -47,6 +47,7 @@ typedef struct ext2_bg_desc { } ext2_bg_desc_t; int ext2_read_blockgroups(ext2_fs_t *fs, uint32_t start_block); +int ext2_write_blockgroups(ext2_fs_t *fs, uint32_t bg); __END_DECLS diff --git a/addons/libkosext2fs/ext2fs.c b/addons/libkosext2fs/ext2fs.c index 4c4aaf6..b5b3331 100644 --- a/addons/libkosext2fs/ext2fs.c +++ b/addons/libkosext2fs/ext2fs.c @@ -48,8 +48,8 @@ uint8_t *ext2_block_read(ext2_fs_t *fs, uint32_t bl) { /* Look through the cache from the most recently used to the least recently used entry. */ - for(i = fs->cache_size - 1; i >= 0 && cache[i]->flags; --i) { - if(cache[i]->block == bl) { + for(i = fs->cache_size - 1; i >= 0; --i) { + if(cache[i]->block == bl && cache[i]->flags) { rv = cache[i]->data; make_mru(fs, cache, i); goto out; @@ -74,6 +74,7 @@ uint8_t *ext2_block_read(ext2_fs_t *fs, uint32_t bl) { /* Try to read the block in question. */ if(ext2_block_read_nc(fs, bl, cache[i]->data)) { errno = EIO; + cache[i]->flags = 0; /* Mark it as invalid... */ return NULL; } @@ -104,24 +105,57 @@ int ext2_block_read_nc(ext2_fs_t *fs, uint32_t block_num, uint8_t *rv) { return 0; } -int ext2_block_write_nc(ext2_fs_t *fs, uint32_t block_num, uint8_t *rv) { +int ext2_block_write_nc(ext2_fs_t *fs, uint32_t block_num, const uint8_t *blk) { int fs_per_block = fs->sb.s_log_block_size - fs->dev->l_block_size + 10; 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. */ + /* 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(fs->sb.s_blocks_count <= block_num) return -EINVAL; if(fs->dev->write_blocks(fs->dev, block_num << fs_per_block, - 1 << fs_per_block, rv)) + 1 << fs_per_block, blk)) return -EIO; return 0; } +int ext2_block_mark_dirty(ext2_fs_t *fs, uint32_t block_num) { + int i; + ext2_cache_t **cache = fs->bcache; + + /* Look through the cache from the most recently used to the least recently + used entry. */ + for(i = fs->cache_size - 1; i >= 0; --i) { + if(cache[i]->block == block_num && cache[i]->flags) { + cache[i]->flags |= EXT2_CACHE_FLAG_DIRTY; + make_mru(fs, cache, i); + return 0; + } + } + + return -EINVAL; +} + +int ext2_block_cache_wb(ext2_fs_t *fs) { + int i, err; + ext2_cache_t **cache = fs->bcache; + + for(i = fs->cache_size - 1; i >= 0; --i) { + if(cache[i]->flags & EXT2_CACHE_FLAG_DIRTY) { + if((err = ext2_block_write_nc(fs, cache[i]->block, cache[i]->data))) + return err; + + cache[i]->flags &= ~EXT2_CACHE_FLAG_DIRTY; + } + } + + return 0; +} + uint32_t ext2_block_size(const ext2_fs_t *fs) { return fs->block_size; } @@ -195,7 +229,8 @@ ext2_fs_t *ext2_fs_init_ex(kos_blockdev_t *bd, int cache_sz) { dbglog(DBG_KDEBUG, "Superblocks are stored on the following blocks:\n"); tmp = rv->sb.s_first_data_block; - if(rv->sb.s_rev_level == EXT2_GOOD_OLD_REV) { + if(rv->sb.s_rev_level < EXT2_DYNAMIC_REV || + !(rv->sb.s_feature_ro_compat & EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER)) { while(tmp < bc) { dbglog(DBG_KDEBUG, "%" PRIu32 "\n", tmp); tmp += rv->sb.s_blocks_per_group; @@ -312,9 +347,55 @@ out_cache: return NULL; } +int ext2_fs_sync(ext2_fs_t *fs) { + int rv, frv = 0; + + /* Do a write-back on the inode cache first, pushing the changes out to the + block cache. */ + if((rv = ext2_inode_cache_wb(fs))) { + dbglog(DBG_ERROR, "ext2_fs_sync: Error writing back the inode cache: " + "%s.\n", strerror(-rv)); + errno = -rv; + frv = -1; + } + + /* Do a write-back on the block cache next, which should take care of all + the writes other than superblock(s) and block group descriptors. */ + if((rv = ext2_block_cache_wb(fs))) { + dbglog(DBG_ERROR, "ext2_fs_sync: Error writing back the block cache: " + "%s.\n", strerror(-rv)); + errno = -rv; + frv = -1; + } + + if((fs->flags & EXT2_FS_FLAG_SB_DIRTY)) { + /* Write the main superblock and the block group descriptors. */ + if((rv = ext2_write_superblock(fs, 0))) { + dbglog(DBG_ERROR, "ext2_fs_sync: Error writing back the main " + "superblock: %s.\n", strerror(-rv)); + dbglog(DBG_ERROR, " Your filesystem is possibly toast " + "at this point... Run e2fsck ASAP.\n"); + errno = -rv; + frv = -1; + } + + if((rv = ext2_write_blockgroups(fs, 0))) { + dbglog(DBG_ERROR, "ext2_fs_sync: Error writing back the main " + "block group descriptors: %s.\n", strerror(-rv)); + errno = -rv; + frv = -1; + } + } + + return frv; +} + void ext2_fs_shutdown(ext2_fs_t *fs) { int i; + /* Sync the filesystem back to the block device, if needed. */ + ext2_fs_sync(fs); + for(i = 0; i < fs->cache_size; ++i) { free(fs->bcache[i]->data); free(fs->bcache[i]); diff --git a/addons/libkosext2fs/ext2fs.h b/addons/libkosext2fs/ext2fs.h index 215680a..0b20af3 100644 --- a/addons/libkosext2fs/ext2fs.h +++ b/addons/libkosext2fs/ext2fs.h @@ -86,12 +86,19 @@ int ext2_init(void); ext2_fs_t *ext2_fs_init(kos_blockdev_t *bd); ext2_fs_t *ext2_fs_init_ex(kos_blockdev_t *bd, int cache_sz); +int ext2_fs_sync(ext2_fs_t *fs); void ext2_fs_shutdown(ext2_fs_t *fs); int ext2_block_read_nc(ext2_fs_t *fs, uint32_t block_num, uint8_t *rv); uint8_t *ext2_block_read(ext2_fs_t *fs, uint32_t block_num); -int ext2_block_write_nc(ext2_fs_t *fs, uint32_t block_num, uint8_t *rv); +int ext2_block_write_nc(ext2_fs_t *fs, uint32_t block_num, const uint8_t *blk); + +int ext2_block_mark_dirty(ext2_fs_t *fs, uint32_t block_num); + +/* Write-back all dirty blocks from the filesystem's cache. You probably want to + call the corresponding inode function before this one. */ +int ext2_block_cache_wb(ext2_fs_t *fs); __END_DECLS diff --git a/addons/libkosext2fs/ext2internal.h b/addons/libkosext2fs/ext2internal.h index afe25a7..8624a38 100644 --- a/addons/libkosext2fs/ext2internal.h +++ b/addons/libkosext2fs/ext2internal.h @@ -35,11 +35,22 @@ struct ext2fs_struct { ext2_cache_t **bcache; int cache_size; + + uint32_t flags; }; +/* The superblock and/or block descriptors need to be written to the block + device. */ +#define EXT2_FS_FLAG_SB_DIRTY 1 + #ifdef EXT2_NOT_IN_KOS #include <stdio.h> -#define dbglog(x, ...) printf(__VA_ARGS__) +#define DBG_DEBUG 0 +#define DBG_KDEBUG 0 +#define DBG_WARNING 0 +#define DBG_ERROR 0 + +#define dbglog(lvl, ...) printf(__VA_ARGS__) #endif #endif /* !__EXT2_EXT2INTERNAL_H */ diff --git a/addons/libkosext2fs/inode.c b/addons/libkosext2fs/inode.c index 48a15db..c8ad29c 100644 --- a/addons/libkosext2fs/inode.c +++ b/addons/libkosext2fs/inode.c @@ -24,9 +24,12 @@ #define MAX_INODES (1 << EXT2_LOG_MAX_INODES) #define INODE_HASH_SZ (1 << EXT2_LOG_INODE_HASH) +#define INODE_FLAG_DIRTY 0x00000001 + /* Internal inode storage structure. This is used for cacheing used inodes. */ static struct int_inode { - /* Start with the on-disk inode itself to make the put() function easier. */ + /* Start with the on-disk inode itself to make the put() function easier. + DO NOT MOVE THIS FROM THE BEGINNING OF THE STRUCTURE. */ ext2_inode_t inode; /* Hash table entry -- used at all points after the first time an inode is @@ -66,6 +69,7 @@ static struct inode_list inode_hash[INODE_HASH_SZ]; /* Forward declaration... */ static ext2_inode_t *ext2_inode_read(ext2_fs_t *fs, uint32_t inode_num); +static int ext2_inode_wb(struct int_inode *inode); void ext2_inode_init(void) { int i; @@ -158,11 +162,14 @@ void ext2_inode_put(ext2_inode_t *inode) { /* Decrement the reference counter, and see if we've got the last one. */ if(!--iinode->refcnt) { - /* Yep, we've gone and consumed the last reference, so put it on the - free list at the end (in case we want to bring it back from the dead - later on). - XXXX: We should write it back out to the disk if it is dirty, but - that is for another day. */ + /* Write it back out to the block cache if it was dirty. */ + if(iinode->flags & INODE_FLAG_DIRTY) + /* XXXX: Should probably make sure this succeeds... */ + ext2_inode_wb(iinode); + + /* We've gone and consumed the last reference, so put it on the free + list at the end, in case we want to bring it back from the dead later + on. */ TAILQ_INSERT_TAIL(&free_inodes, iinode, qentry); } @@ -174,6 +181,15 @@ void ext2_inode_put(ext2_inode_t *inode) { #endif } +void ext2_inode_mark_dirty(ext2_inode_t *inode) { + struct int_inode *iinode = (struct int_inode *)inode; + + /* Make sure we're not trying anything really mean. */ + assert(iinode->refcnt != 0); + + iinode->flags |= INODE_FLAG_DIRTY; +} + static ext2_inode_t *ext2_inode_read(ext2_fs_t *fs, uint32_t inode_num) { uint32_t bg, index; uint8_t *buf; @@ -208,6 +224,163 @@ static ext2_inode_t *ext2_inode_read(ext2_fs_t *fs, uint32_t inode_num) { return (ext2_inode_t *)(buf + (index * fs->sb.s_inode_size)); } +static int ext2_inode_wb(struct int_inode *inode) { + uint32_t bg, index; + uint8_t *buf; + int in_per_block, rv; + uint32_t inode_block; + ext2_fs_t *fs = inode->fs; + + in_per_block = (fs->block_size) / fs->sb.s_inode_size; + + /* Figure out what block group and index within that group the inode in + question is. */ + bg = (inode->inode_num - 1) / fs->sb.s_inodes_per_group; + index = (inode->inode_num - 1) % fs->sb.s_inodes_per_group; + + if(inode->inode_num > fs->sb.s_inodes_count) + return -EINVAL; + + /* Read the block containing the inode in so that we can write the part that + we need to it. */ + inode_block = fs->bg[bg].bg_inode_table + (index / in_per_block); + index %= in_per_block; + + if(!(buf = ext2_block_read(fs, inode_block))) + return -errno; + + /* Write to the block and mark it as dirty so that it'll get flushed. */ + memcpy(buf + (index * fs->sb.s_inode_size), inode, sizeof(ext2_inode_t)); + rv = ext2_block_mark_dirty(fs, inode_block); + + /* Clear the dirty flag, if we wrote it out successfully. */ + if(!rv) + inode->flags &= ~INODE_FLAG_DIRTY; + + return rv; +} + +int ext2_inode_cache_wb(ext2_fs_t *fs) { + int i, rv = 0; + + for(i = 0; i < MAX_INODES && !rv; ++i) { + if(inodes[i].fs == fs && (inodes[i].flags & INODE_FLAG_DIRTY)) { + rv = ext2_inode_wb(inodes + i); + } + } + + return rv; +} + +ext2_inode_t *ext2_inode_alloc(ext2_fs_t *fs, uint32_t bg, int *err) { + uint8_t *buf; + uint32_t index; + struct int_inode *i; + + /* See if we have any free inodes at all... */ + if(!fs->sb.s_free_inodes_count) { + *err = ENOSPC; + return NULL; + } + + /* See if we have any free inodes in the block group requested. */ + if(fs->bg[bg].bg_free_inodes_count) { + if(!(buf = ext2_block_read(fs, fs->bg[bg].bg_inode_bitmap))) { + *err = errno; + return NULL; + } + + index = ext2_bit_find_nonzero((uint32_t *)buf, 0, + fs->sb.s_inodes_per_group - 1); + if(index < fs->sb.s_inodes_per_group) { + ext2_bit_set((uint32_t *)buf, index); + ext2_block_mark_dirty(fs, fs->bg[bg].bg_inode_bitmap); + --fs->bg[bg].bg_free_inodes_count; + --fs->sb.s_free_inodes_count; + fs->flags |= EXT2_FS_FLAG_SB_DIRTY; + i = (struct int_inode *)ext2_inode_get(fs, index + bg * + fs->sb.s_inodes_per_group + + 1, err); + memset(i, 0, sizeof(ext2_inode_t)); + i->flags |= INODE_FLAG_DIRTY; + return (ext2_inode_t *)i; + } + + /* We shouldn't get here... But, just in case, fall through. We should + probably log an error and tell the user to fsck though. */ + dbglog(DBG_WARNING, "ext2_inode_alloc: Block group %" PRIu32 " " + "indicates that it has free inodes, but doesn't appear to. " + "Please run fsck on this volume!\n", bg); + } + + /* Couldn't find a free inode in the requested block group... Loop through + all the block groups looking for a free inode. */ + for(bg = 0; bg < fs->bg_count; ++bg) { + if(fs->bg[bg].bg_free_inodes_count) { + if(!(buf = ext2_block_read(fs, fs->bg[bg].bg_inode_bitmap))) { + *err = errno; + return NULL; + } + + index = ext2_bit_find_nonzero((uint32_t *)buf, 0, + fs->sb.s_inodes_per_group - 1); + if(index < fs->sb.s_inodes_per_group) { + ext2_bit_set((uint32_t *)buf, index); + ext2_block_mark_dirty(fs, fs->bg[bg].bg_inode_bitmap); + --fs->bg[bg].bg_free_inodes_count; + --fs->sb.s_free_inodes_count; + fs->flags |= EXT2_FS_FLAG_SB_DIRTY; + i = (struct int_inode *)ext2_inode_get(fs, index + bg * + fs->sb.s_inodes_per_group + + 1, err); + memset(i, 0, sizeof(ext2_inode_t)); + i->flags |= INODE_FLAG_DIRTY; + return (ext2_inode_t *)i; + } + + /* We shouldn't get here... But, just in case, fall through. We + should probably log an error and tell the user to fsck though. */ + dbglog(DBG_WARNING, "ext2_inode_alloc: Block group %" PRIu32 " " + "indicates that it has free inodes, but doesn't appear to. " + "Please run fsck on this volume!\n", bg); + } + } + + *err = ENOSPC; + return NULL; +} + +int ext2_inode_free(ext2_fs_t *fs, uint32_t inode_num) { + uint32_t bg, index; + uint8_t *buf; + + if(inode_num > fs->sb.s_inodes_count) + return -EINVAL; + + /* Figure out what block group and index within that group the inode in + question is. */ + bg = (inode_num - 1) / fs->sb.s_inodes_per_group; + index = (inode_num - 1) % fs->sb.s_inodes_per_group; + + if(!(buf = ext2_block_read(fs, fs->bg[bg].bg_inode_bitmap))) + return -EIO; + + /* Make sure it is actually allocated. */ + if(!ext2_bit_is_set((uint32_t *)buf, index)) + return -EINVAL; + + /* Mark the inode as free in the bitmap and increase the counters. */ + ext2_bit_clear((uint32_t *)buf, index); + ext2_block_mark_dirty(fs, fs->bg[bg].bg_inode_bitmap); + + ++fs->bg[bg].bg_free_inodes_count; + ++fs->sb.s_free_inodes_count; + fs->flags |= EXT2_FS_FLAG_SB_DIRTY; + + /* TODO: Perhaps we should zero the inode? */ + return 0; +} + static ext2_dirent_t *search_dir(uint8_t *buf, int block_size, const char *token, int *err) { int block_offset = 0; diff --git a/addons/libkosext2fs/inode.h b/addons/libkosext2fs/inode.h index 79712f0..9b2eefc 100644 --- a/addons/libkosext2fs/inode.h +++ b/addons/libkosext2fs/inode.h @@ -104,6 +104,16 @@ int ext2_inode_by_path(ext2_fs_t *fs, const char *path, ext2_inode_t **rv, void ext2_inode_put(ext2_inode_t *inode); +/* Write-back all of the inodes marked as dirty from the specified filesystem to + its block cache. */ +int ext2_inode_cache_wb(ext2_fs_t *fs); + +/* Allocate an unused inode on the specified filesystem. */ +ext2_inode_t *ext2_inode_alloc(ext2_fs_t *fs, uint32_t bg, int *err); ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-04-02 14:57:24
|
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 e29e15ea9864b2a6fff2df5d8f75d4ac6c590468 (commit) from aab9c278b89b0500d29644ab45a9c530cb0ee698 (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 e29e15ea9864b2a6fff2df5d8f75d4ac6c590468 Author: Lawrence Sebald <ljs...@us...> Date: Tue Apr 2 10:56:44 2013 -0400 Use the git commit hash in the make_banner.sh script. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/kernel/make_banner.sh | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/arch/dreamcast/kernel/make_banner.sh b/kernel/arch/dreamcast/kernel/make_banner.sh index 5cdedbf..0098d90 100755 --- a/kernel/arch/dreamcast/kernel/make_banner.sh +++ b/kernel/arch/dreamcast/kernel/make_banner.sh @@ -5,9 +5,9 @@ echo 'char banner[] = ' > banner.c echo -n '"KallistiOS ' >> banner.c -if [ -d ".svn" ]; then - echo -n 'SVN r' >> banner.c - echo -n `svnversion` >> banner.c +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 else echo -n '##version##: ' >> banner.c hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Christian G. <sa...@us...> - 2013-03-28 01:25:50
|
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 "An ethernet program loader for the Dreamcast.". The branch, master has been updated via d44ffb5ea72f4c171ed2f8ad18f3f3c6cfee998d (commit) from 7b095e34ecffb5ac2732fa76410cdbad39e83bf5 (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 d44ffb5ea72f4c171ed2f8ad18f3f3c6cfee998d Author: Christian Groessler <ch...@gr...> Date: Thu Mar 28 02:25:35 2013 +0100 comment fix ----------------------------------------------------------------------- Summary of changes: Makefile.cfg | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Makefile.cfg b/Makefile.cfg index 3fe3b64..174ae52 100644 --- a/Makefile.cfg +++ b/Makefile.cfg @@ -23,7 +23,7 @@ BFDINCLUDE = -I/opt/dc/sh-elf/include #BFDINCLUDE = -I/usr/local/include # When using libelf instead of BFD, these must point to your -# libelf installation (leave empty if libelf is part of the system) +# libelf installation (leave empty or undefined if libelf is part of the system) #ELFLIB = -L/opt/misc.ppc/lib #ELFINCLUDE = -I/opt/misc.ppc/include hooks/post-receive -- An ethernet program loader for the Dreamcast. |
From: Christian G. <sa...@us...> - 2013-03-28 00:43:40
|
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 "An ethernet program loader for the Dreamcast.". The branch, master has been updated via 7b095e34ecffb5ac2732fa76410cdbad39e83bf5 (commit) via e4c018c095e3ad92b1f94e58dae9903f1677db74 (commit) via 770753bb2265ab242ecfaaeb27f019c9d1aa6024 (commit) via 9c3a8df083a9b301c48640c6e8befd7ca6a82ef2 (commit) from c32cdb3fbf9d099b52d8e98f46e781b61f21df78 (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 7b095e34ecffb5ac2732fa76410cdbad39e83bf5 Author: Christian Groessler <ch...@gr...> Date: Thu Mar 28 01:42:14 2013 +0100 set MAKE variable only if it isn't set already commit e4c018c095e3ad92b1f94e58dae9903f1677db74 Author: Christian Groessler <ch...@gr...> Date: Thu Mar 28 01:41:11 2013 +0100 make libelf installation directory configurable commit 770753bb2265ab242ecfaaeb27f019c9d1aa6024 Author: Christian Groessler <ch...@gr...> Date: Thu Mar 28 01:31:13 2013 +0100 add support for some BSDs commit 9c3a8df083a9b301c48640c6e8befd7ca6a82ef2 Author: Christian Groessler <ch...@gr...> Date: Thu Mar 28 01:24:07 2013 +0100 fix setting of TARGETCCVER if gcc version only has 2 parts ----------------------------------------------------------------------- Summary of changes: Makefile | 2 +- Makefile.cfg | 13 +++++++++---- host-src/Makefile | 2 +- host-src/tool/Makefile | 5 +++-- host-src/tool/syscalls.c | 2 +- target-src/Makefile | 2 +- 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 9466fd7..aa7edd6 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ include Makefile.cfg SUBDIRS = host-src target-src example-src -MAKE = make +MAKE ?= make all: subdirs diff --git a/Makefile.cfg b/Makefile.cfg index 6a37ea0..3fe3b64 100644 --- a/Makefile.cfg +++ b/Makefile.cfg @@ -10,17 +10,22 @@ HOSTLDFLAGS = # these must point to your sh-elf bfd, not the system one BFDLIB = -L/opt/dc/sh-elf/lib -lbfd -liberty -lintl -BFDINCLUDE = /opt/dc/sh-elf/include +BFDINCLUDE = -I/opt/dc/sh-elf/include # cygwin # these must point to your sh-elf bfd, not the system one #BFDLIB = -L/usr/local/lib -lbfd -liberty -lintl -#BFDINCLUDE = /usr/local/include +#BFDINCLUDE = -I/usr/local/include # MinGW # these must point to your sh-elf bfd, not the system one #BFDLIB = -L/usr/local/lib -lbfd -liberty -lws2_32 -lwsock32 -#BFDINCLUDE = /usr/local/include +#BFDINCLUDE = -I/usr/local/include + +# When using libelf instead of BFD, these must point to your +# libelf installation (leave empty if libelf is part of the system) +#ELFLIB = -L/opt/misc.ppc/lib +#ELFINCLUDE = -I/opt/misc.ppc/include # sh-elf-stuff # if you have the SH compiler in your path you can leave SHTOOLS empty, @@ -34,7 +39,7 @@ TARGETOBJCOPY = $(SHTOOLS)sh-elf-objcopy TARGETLD = $(SHTOOLS)sh-elf-ld # set TARGETCCVER to 3 or 4, depending on your SH compiler version (gcc 3.x or gcc 4.x) # this line tries to detect the version automatically -TARGETCCVER = $(shell $(TARGETCC) --version | head -1 | sed "s/.* \([[:digit:]][[:digit:]]*\)\.[[:digit:]][[:digit:]]*\.[[:digit:]][[:digit:]]*.*/\1/") +TARGETCCVER = $(shell $(TARGETCC) --version | head -1 | sed "s/.* \([[:digit:]][[:digit:]]*\)\.[[:digit:]][[:digit:]]*.*/\1/") # you generally shouldn't change this unless you are making forked # versions (or test versions) diff --git a/host-src/Makefile b/host-src/Makefile index 0bf2e1e..fe9505c 100644 --- a/host-src/Makefile +++ b/host-src/Makefile @@ -1,5 +1,5 @@ SUBDIRS = tool -MAKE = make +MAKE ?= make .PHONY : subdirs $(SUBDIRS) diff --git a/host-src/tool/Makefile b/host-src/tool/Makefile index 6b7a3ad..eb2b128 100644 --- a/host-src/tool/Makefile +++ b/host-src/tool/Makefile @@ -2,13 +2,14 @@ include ../../Makefile.cfg CC = $(HOSTCC) CFLAGS = $(HOSTCFLAGS) -DDREAMCAST_IP=\"$(DREAMCAST_IP)\" -DHAVE_GETOPT -INCLUDE = -I$(BFDINCLUDE) ifdef WITH_BFD CFLAGS += -DWITH_BFD LDFLAGS = $(HOSTLDFLAGS) $(BFDLIB) + INCLUDE = $(BFDINCLUDE) else - LDFLAGS = $(HOSTLDFLAGS) -lelf + LDFLAGS = $(HOSTLDFLAGS) $(ELFLIB) -lelf + INCLUDE = $(ELFINCLUDE) endif DCTOOL = dc-tool$(EXECUTABLEEXTENSION) diff --git a/host-src/tool/syscalls.c b/host-src/tool/syscalls.c index d80f47a..ab451fc 100644 --- a/host-src/tool/syscalls.c +++ b/host-src/tool/syscalls.c @@ -391,7 +391,7 @@ int dc_readdir(unsigned char * buffer) somedirent = NULL; if (somedirent) { -#ifdef __APPLE__ +#if defined (__APPLE__) || defined (__NetBSD__) || defined (__FreeBSD__) || defined (__OpenBSD__) dcdirent.d_ino = dc_order(somedirent->d_fileno); dcdirent.d_off = dc_order(0); dcdirent.d_reclen = dc_order(somedirent->d_reclen); diff --git a/target-src/Makefile b/target-src/Makefile index 2d18d22..5d2e8a2 100644 --- a/target-src/Makefile +++ b/target-src/Makefile @@ -1,5 +1,5 @@ SUBDIRS = 1st_read dcload -MAKE = make +MAKE ?= make .PHONY : subdirs $(SUBDIRS) hooks/post-receive -- An ethernet program loader for the Dreamcast. |
From: Christian G. <sa...@us...> - 2013-03-27 23:11:19
|
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 "An ethernet program loader for the Dreamcast.". The branch, master has been updated via c32cdb3fbf9d099b52d8e98f46e781b61f21df78 (commit) from 9007aa015d0ef84b25ff693848866396f904dae8 (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 c32cdb3fbf9d099b52d8e98f46e781b61f21df78 Author: Christian Groessler <ch...@gr...> Date: Thu Mar 28 00:07:47 2013 +0100 set TARGETCCVER (needed for example-src/); introduce SHTOOLS (SH compiler installation directory) ----------------------------------------------------------------------- Summary of changes: Makefile.cfg | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Makefile.cfg b/Makefile.cfg index 26e8fc8..6a37ea0 100644 --- a/Makefile.cfg +++ b/Makefile.cfg @@ -23,10 +23,18 @@ BFDINCLUDE = /opt/dc/sh-elf/include #BFDINCLUDE = /usr/local/include # sh-elf-stuff -TARGETCC = sh-elf-gcc +# if you have the SH compiler in your path you can leave SHTOOLS empty, +# otherwise set it to the bin directory of your SH compiler installation +# (include trailing slash) +#SHTOOLS = /opt/dcgcc-4.7.0/sh-elf/bin/ +SHTOOLS = +TARGETCC = $(SHTOOLS)sh-elf-gcc TARGETCFLAGS = -O2 -ml -m4-single-only -TARGETOBJCOPY = sh-elf-objcopy -TARGETLD = sh-elf-ld +TARGETOBJCOPY = $(SHTOOLS)sh-elf-objcopy +TARGETLD = $(SHTOOLS)sh-elf-ld +# set TARGETCCVER to 3 or 4, depending on your SH compiler version (gcc 3.x or gcc 4.x) +# this line tries to detect the version automatically +TARGETCCVER = $(shell $(TARGETCC) --version | head -1 | sed "s/.* \([[:digit:]][[:digit:]]*\)\.[[:digit:]][[:digit:]]*\.[[:digit:]][[:digit:]]*.*/\1/") # you generally shouldn't change this unless you are making forked # versions (or test versions) hooks/post-receive -- An ethernet program loader for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-03-27 20:06:58
|
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 aab9c278b89b0500d29644ab45a9c530cb0ee698 (commit) from 62369bab2ddeee094bade538f2e88e10c2ebfa67 (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 aab9c278b89b0500d29644ab45a9c530cb0ee698 Author: Lawrence Sebald <ljs...@us...> Date: Wed Mar 27 16:06:42 2013 -0400 Remove a stray printf... ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/ext2fs.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/addons/libkosext2fs/ext2fs.c b/addons/libkosext2fs/ext2fs.c index 5a27a98..4c4aaf6 100644 --- a/addons/libkosext2fs/ext2fs.c +++ b/addons/libkosext2fs/ext2fs.c @@ -69,9 +69,6 @@ uint8_t *ext2_block_read(ext2_fs_t *fs, uint32_t bl) { return NULL; } } - - printf("Throwing out block %" PRIu32 " flags: %08" PRIx32 "\n", - cache[0]->block, cache[0]->flags); } /* Try to read the block in question. */ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-03-27 20:04:23
|
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 62369bab2ddeee094bade538f2e88e10c2ebfa67 (commit) from 85d151011bf46a9d06faa3a6d24abea603b792c2 (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 62369bab2ddeee094bade538f2e88e10c2ebfa67 Author: Lawrence Sebald <ljs...@us...> Date: Wed Mar 27 16:02:46 2013 -0400 A few changes in libkosext2fs: 1. Clean up the caches. There is now only one block cache, rather than separate directory block, inode block, and data block caches. 2. Clean up compilation outside of KOS and add a Makefile to facilitate that. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/Makefile.nonkos | 14 ++++ addons/libkosext2fs/ext2fs.c | 125 +++++++++++++---------------------- addons/libkosext2fs/ext2fs.h | 47 ++++++++++++- addons/libkosext2fs/ext2internal.h | 25 +++++-- addons/libkosext2fs/inode.c | 68 ++++++++----------- addons/libkosext2fs/superblock.c | 1 + addons/libkosext2fs/superblock.h | 4 + 7 files changed, 154 insertions(+), 130 deletions(-) create mode 100644 addons/libkosext2fs/Makefile.nonkos diff --git a/addons/libkosext2fs/Makefile.nonkos b/addons/libkosext2fs/Makefile.nonkos new file mode 100644 index 0000000..e415374 --- /dev/null +++ b/addons/libkosext2fs/Makefile.nonkos @@ -0,0 +1,14 @@ +# libkosext2fs Makefile +# This one is for building everything except the VFS glue outside of KOS. + +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 + +libkosext2fs.a: $(OBJS) + $(AR) rcs $@ $^ + +clean: + -rm -f $(OBJS) + -rm -f libkosext2fs.a diff --git a/addons/libkosext2fs/ext2fs.c b/addons/libkosext2fs/ext2fs.c index fc5a255..5a27a98 100644 --- a/addons/libkosext2fs/ext2fs.c +++ b/addons/libkosext2fs/ext2fs.c @@ -41,13 +41,14 @@ static void make_mru(ext2_fs_t *fs, ext2_cache_t **cache, int block) { } /* XXXX: This needs locking! */ -static uint8_t *read_cache(ext2_fs_t *fs, ext2_cache_t **cache, uint32_t bl) { +uint8_t *ext2_block_read(ext2_fs_t *fs, uint32_t bl) { int i; uint8_t *rv; + ext2_cache_t **cache = fs->bcache; /* Look through the cache from the most recently used to the least recently used entry. */ - for(i = fs->cache_size - 1; i >= 0 && cache[i]->valid; --i) { + for(i = fs->cache_size - 1; i >= 0 && cache[i]->flags; --i) { if(cache[i]->block == bl) { rv = cache[i]->data; make_mru(fs, cache, i); @@ -57,15 +58,30 @@ static uint8_t *read_cache(ext2_fs_t *fs, ext2_cache_t **cache, uint32_t bl) { /* If we didn't get anything, did we end up with an invalid entry or do we need to boot someone out? */ - if(i < 0) + if(i < 0) { i = 0; + /* Make sure that if the block is dirty, we write it back out. */ + if(cache[0]->flags & EXT2_CACHE_FLAG_DIRTY) { + if(ext2_block_write_nc(fs, cache[0]->block, cache[0]->data)) { + /* XXXX: Uh oh... */ + errno = EIO; + return NULL; + } + } + + printf("Throwing out block %" PRIu32 " flags: %08" PRIx32 "\n", + cache[0]->block, cache[0]->flags); + } + /* Try to read the block in question. */ - if(ext2_block_read_nc(fs, bl, cache[i]->data)) + if(ext2_block_read_nc(fs, bl, cache[i]->data)) { + errno = EIO; return NULL; + } cache[i]->block = bl; - cache[i]->valid = 1; + cache[i]->flags = EXT2_CACHE_FLAG_VALID; rv = cache[i]->data; make_mru(fs, cache, i); @@ -91,36 +107,22 @@ int ext2_block_read_nc(ext2_fs_t *fs, uint32_t block_num, uint8_t *rv) { return 0; } -uint8_t *ext2_block_read(ext2_fs_t *fs, uint32_t block_num, int cache) { - uint8_t *rv; - ext2_cache_t **cb; - - /* Figure out what cache we're looking at */ - switch(cache) { - case EXT2_CACHE_INODE: - cb = fs->icache; - break; - - case EXT2_CACHE_DIR: - cb = fs->dcache; - break; +int ext2_block_write_nc(ext2_fs_t *fs, uint32_t block_num, uint8_t *rv) { + int fs_per_block = fs->sb.s_log_block_size - fs->dev->l_block_size + 10; - case EXT2_CACHE_DATA: - cb = fs->bcache; - break; + 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; - default: - errno = EINVAL; - return NULL; - } + if(fs->sb.s_blocks_count <= block_num) + return -EINVAL; - /* Try to read from it. */ - if(!(rv = read_cache(fs, cb, block_num))) { - errno = EIO; - return NULL; - } + if(fs->dev->write_blocks(fs->dev, block_num << fs_per_block, + 1 << fs_per_block, rv)) + return -EIO; - return rv; + return 0; } uint32_t ext2_block_size(const ext2_fs_t *fs) { @@ -139,6 +141,10 @@ int ext2_init(void) { } ext2_fs_t *ext2_fs_init(kos_blockdev_t *bd) { + return ext2_fs_init_ex(bd, EXT2_CACHE_BLOCKS); +} + +ext2_fs_t *ext2_fs_init_ex(kos_blockdev_t *bd, int cache_sz) { ext2_fs_t *rv; uint32_t bc; int j; @@ -266,77 +272,43 @@ ext2_fs_t *ext2_fs_init(kos_blockdev_t *bd) { } #endif /* EXT2FS_DEBUG */ - /* Make space for the caches. */ - if(!(rv->icache = (ext2_cache_t **)malloc(sizeof(ext2_cache_t *) * 16))) { - free(rv->bg); - free(rv); - bd->shutdown(bd); - return NULL; - } - - if(!(rv->dcache = (ext2_cache_t **)malloc(sizeof(ext2_cache_t *) * 16))) { - free(rv->icache); - free(rv->bg); - free(rv); - bd->shutdown(bd); - return NULL; - } - - if(!(rv->bcache = (ext2_cache_t **)malloc(sizeof(ext2_cache_t *) * 16))) { - free(rv->dcache); - free(rv->icache); + /* Make space for the block cache. */ + if(!(rv->bcache = (ext2_cache_t **)malloc(sizeof(ext2_cache_t *) * + cache_sz))) { free(rv->bg); free(rv); bd->shutdown(bd); return NULL; } - - for(j = 0; j < 16; ++j) { - if(!(rv->icache[j] = (ext2_cache_t *)malloc(sizeof(ext2_cache_t)))) - goto out_cache; - - if(!(rv->dcache[j] = (ext2_cache_t *)malloc(sizeof(ext2_cache_t)))) - goto out_cache; + for(j = 0; j < cache_sz; ++j) { if(!(rv->bcache[j] = (ext2_cache_t *)malloc(sizeof(ext2_cache_t)))) goto out_cache; } - for(j = 0; j < 16; ++j) { - if(!(rv->icache[j]->data = (uint8_t *)malloc(block_size))) - goto out_bcache; - - if(!(rv->dcache[j]->data = (uint8_t *)malloc(block_size))) - goto out_bcache; - + for(j = 0; j < cache_sz; ++j) { if(!(rv->bcache[j]->data = (uint8_t *)malloc(block_size))) goto out_bcache; - rv->icache[j]->valid = rv->dcache[j]->valid = rv->bcache[j]->valid = 0; + rv->bcache[j]->flags = 0; } - rv->cache_size = 16; + rv->cache_size = cache_sz; return rv; out_bcache: for(; j >= 0; --j) { free(rv->bcache[j]->data); - free(rv->dcache[j]->data); - free(rv->icache[j]->data); } - j = 15; + j = cache_sz - 1; out_cache: for(; j >= 0; --j) { free(rv->bcache[j]); - free(rv->dcache[j]); - free(rv->icache[j]); } free(rv->bcache); - free(rv->dcache); - free(rv->icache); free(rv->bg); free(rv); bd->shutdown(bd); @@ -347,18 +319,11 @@ void ext2_fs_shutdown(ext2_fs_t *fs) { int i; for(i = 0; i < fs->cache_size; ++i) { - free(fs->icache[i]->data); - free(fs->icache[i]); - free(fs->dcache[i]->data); - free(fs->dcache[i]); free(fs->bcache[i]->data); free(fs->bcache[i]); } free(fs->bcache); - free(fs->dcache); - free(fs->icache); - fs->dev->shutdown(fs->dev); free(fs->bg); free(fs); diff --git a/addons/libkosext2fs/ext2fs.h b/addons/libkosext2fs/ext2fs.h index 8a906f8..215680a 100644 --- a/addons/libkosext2fs/ext2fs.h +++ b/addons/libkosext2fs/ext2fs.h @@ -10,7 +10,11 @@ #include <sys/cdefs.h> __BEGIN_DECLS +#include <stdint.h> + +#ifndef EXT2_NOT_IN_KOS #include <kos/blockdev.h> +#endif /* Tunable filesystem parameters. These must be set at compile time. */ @@ -30,8 +34,44 @@ __BEGIN_DECLS constant. */ #define EXT2_LOG_INODE_HASH (EXT2_LOG_MAX_INODES - 2) +/* Size of the block cache, in filesystem blocks. When reading from the + filesystem, all data is read in block-sized units. The size of a block can + generally range from 1024 bytes to 4096 bytes, and is dependent on the + parameters the filesystem was formatted with. Increasing this value should + ensure that more accesses can be handled by the cache, but also increases the + latency at which data is written back to the block device itself. Setting + this to 32 should work well enough, but if you have more memory to spare, + feel free to set it larger. + + Note that this is a default value for filesystems initialized/mounted with + ext2_fs_init(). If you wish to specify your own value that differs from this + one, you can do so with the ext2_fs_init_ex() function. +*/ +#define EXT2_CACHE_BLOCKS 32 + /* End tunable filesystem parameters. */ +/* Convenience stuff, for in case you want to use this outside of KOS. */ +#ifdef EXT2_NOT_IN_KOS + +typedef struct kos_blockdev { + void *dev_data; + uint32_t l_block_size; + int (*init)(struct kos_blockdev *d); + int (*shutdown)(struct kos_blockdev *d); + int (*read_blocks)(struct kos_blockdev *d, uint32_t block, size_t count, + void *buf); + int (*write_blocks)(struct kos_blockdev *d, uint32_t block, size_t count, + const void *buf); + uint32_t (*count_blocks)(struct kos_blockdev *d); +} kos_blockdev_t; + +#ifndef SYMLOOP_MAX +#define SYMLOOP_MAX 16 +#endif + +#endif /* EXT2_NOT_IN_KOS */ + /* Opaque ext2 filesystem type */ struct ext2fs_struct; typedef struct ext2fs_struct ext2_fs_t; @@ -45,14 +85,13 @@ uint32_t ext2_log_block_size(const ext2_fs_t *fs); int ext2_init(void); ext2_fs_t *ext2_fs_init(kos_blockdev_t *bd); +ext2_fs_t *ext2_fs_init_ex(kos_blockdev_t *bd, int cache_sz); void ext2_fs_shutdown(ext2_fs_t *fs); int ext2_block_read_nc(ext2_fs_t *fs, uint32_t block_num, uint8_t *rv); -uint8_t *ext2_block_read(ext2_fs_t *fs, uint32_t block_num, int cache); +uint8_t *ext2_block_read(ext2_fs_t *fs, uint32_t block_num); -#define EXT2_CACHE_INODE 0 -#define EXT2_CACHE_DIR 1 -#define EXT2_CACHE_DATA 2 +int ext2_block_write_nc(ext2_fs_t *fs, uint32_t block_num, uint8_t *rv); __END_DECLS diff --git a/addons/libkosext2fs/ext2internal.h b/addons/libkosext2fs/ext2internal.h index ff69130..afe25a7 100644 --- a/addons/libkosext2fs/ext2internal.h +++ b/addons/libkosext2fs/ext2internal.h @@ -1,34 +1,45 @@ /* KallistiOS ##version## ext2internal.h - Copyright (C) 2012 Lawrence Sebald + Copyright (C) 2012, 2013 Lawrence Sebald */ #include "block.h" #include "superblock.h" + +#ifndef EXT2_NOT_IN_KOS #include <kos/blockdev.h> +#else +#include "ext2fs.h" +#endif #ifndef __EXT2_EXT2INTERNAL_H #define __EXT2_EXT2INTERNAL_H +#define EXT2_CACHE_FLAG_VALID 1 +#define EXT2_CACHE_FLAG_DIRTY 2 + typedef struct ext2_cache { - int valid; - uint8_t *data; + uint32_t flags; uint32_t block; + uint8_t *data; } ext2_cache_t; struct ext2fs_struct { kos_blockdev_t *dev; ext2_superblock_t sb; uint32_t block_size; - + uint32_t bg_count; ext2_bg_desc_t *bg; - - ext2_cache_t **icache; - ext2_cache_t **dcache; + ext2_cache_t **bcache; int cache_size; }; +#ifdef EXT2_NOT_IN_KOS +#include <stdio.h> +#define dbglog(x, ...) printf(__VA_ARGS__) +#endif + #endif /* !__EXT2_EXT2INTERNAL_H */ diff --git a/addons/libkosext2fs/inode.c b/addons/libkosext2fs/inode.c index 9303d82..48a15db 100644 --- a/addons/libkosext2fs/inode.c +++ b/addons/libkosext2fs/inode.c @@ -87,12 +87,12 @@ void ext2_inode_init(void) { } ext2_inode_t *ext2_inode_get(ext2_fs_t *fs, uint32_t inode_num, int *err) { - int entry = inode_num & (INODE_HASH_SZ - 1); + int ent = inode_num & (INODE_HASH_SZ - 1); struct int_inode *i; ext2_inode_t *rinode; /* Figure out if this inode is already in the hash table. */ - LIST_FOREACH(i, &inode_hash[entry], entry) { + LIST_FOREACH(i, &inode_hash[ent], entry) { if(i->fs == fs && i->inode_num == inode_num) { /* Increase the reference count, and see if it was free before. */ if(!i->refcnt++) { @@ -117,6 +117,11 @@ ext2_inode_t *ext2_inode_get(ext2_fs_t *fs, uint32_t inode_num, int *err) { /* Ok, at this point, we have a free inode, remove it from the free pool. */ TAILQ_REMOVE(&free_inodes, i, qentry); + + /* Remove it from any old hash table lists it was in */ + if(i->inode_num) + LIST_REMOVE(i, entry); + i->refcnt = 1; i->inode_num = inode_num; i->fs = fs; @@ -127,13 +132,14 @@ ext2_inode_t *ext2_inode_get(ext2_fs_t *fs, uint32_t inode_num, int *err) { i->refcnt = 0; i->inode_num = 0; i->fs = NULL; + TAILQ_INSERT_HEAD(&free_inodes, i, qentry); *err = -EIO; return NULL; } /* Add it to the hash table. */ i->inode = *rinode; - LIST_INSERT_HEAD(&inode_hash[entry], i, entry); + LIST_INSERT_HEAD(&inode_hash[ent], i, entry); #ifdef EXT2FS_DEBUG dbglog(DBG_KDEBUG, "ext2_inode_get: %" PRIu32 " (%" PRIu32 " refs)\n", @@ -184,8 +190,7 @@ static ext2_inode_t *ext2_inode_read(ext2_fs_t *fs, uint32_t inode_num) { if(inode_num > fs->sb.s_inodes_count) return NULL; - if(!(buf = ext2_block_read(fs, fs->bg[bg].bg_inode_bitmap, - EXT2_CACHE_INODE))) + if(!(buf = ext2_block_read(fs, fs->bg[bg].bg_inode_bitmap))) return NULL; if(!ext2_bit_is_set((uint32_t *)buf, index)) @@ -196,7 +201,7 @@ static ext2_inode_t *ext2_inode_read(ext2_fs_t *fs, uint32_t inode_num) { inode_block = fs->bg[bg].bg_inode_table + (index / in_per_block); index %= in_per_block; - if(!(buf = ext2_block_read(fs, inode_block, EXT2_CACHE_INODE))) + if(!(buf = ext2_block_read(fs, inode_block))) return NULL; /* Return the inode in question */ @@ -331,7 +336,7 @@ int ext2_inode_by_path(ext2_fs_t *fs, const char *path, ext2_inode_t **rv, char *ipath, *cxt, *token; int blocks, i, block_size; uint8_t *buf; - uint32_t *iblock; + uint32_t *ib; ext2_dirent_t *dent; int err = 0; size_t tmp_sz; @@ -383,8 +388,7 @@ int ext2_inode_by_path(ext2_fs_t *fs, const char *path, ext2_inode_t **rv, /* Run through any direct blocks in the inode. */ for(i = 0; i < blocks && inode->i_block[i] && i < 12; ++i) { /* Grab the block, looking in the directory cache. */ - if(!(buf = ext2_block_read(fs, inode->i_block[i], - EXT2_CACHE_DIR))) { + if(!(buf = ext2_block_read(fs, inode->i_block[i]))) { free(ipath); ext2_inode_put(inode); return -EIO; @@ -406,14 +410,13 @@ int ext2_inode_by_path(ext2_fs_t *fs, const char *path, ext2_inode_t **rv, goto out; /* Next, look through the indirect block. */ - if(!(iblock = (uint32_t *)ext2_block_read(fs, inode->i_block[12], - EXT2_CACHE_DIR))) { + if(!(ib = (uint32_t *)ext2_block_read(fs, inode->i_block[12]))) { free(ipath); ext2_inode_put(inode); return -EIO; } - if((dent = search_indir(fs, iblock, block_size, token, &err))) { + if((dent = search_indir(fs, ib, block_size, token, &err))) { goto next_token; } else if(err) { @@ -425,15 +428,13 @@ int ext2_inode_by_path(ext2_fs_t *fs, const char *path, ext2_inode_t **rv, /* Next, look through the doubly-indirect block. */ if(inode->i_block[13]) { /* Grab the block, looking in the directory cache. */ - if(!(iblock = (uint32_t *)ext2_block_read(fs, inode->i_block[13], - EXT2_CACHE_DIR))) { + if(!(ib = (uint32_t *)ext2_block_read(fs, inode->i_block[13]))) { free(ipath); ext2_inode_put(inode); return -EIO; } - if((dent = search_indir_23(fs, iblock, block_size, token, &err, - 0))) { + if((dent = search_indir_23(fs, ib, block_size, token, &err, 0))) { goto next_token; } else if(err) { @@ -447,15 +448,13 @@ int ext2_inode_by_path(ext2_fs_t *fs, const char *path, ext2_inode_t **rv, have to look all the way through one of these... */ if(inode->i_block[14]) { /* Grab the block, looking in the directory cache. */ - if(!(iblock = (uint32_t *)ext2_block_read(fs, inode->i_block[14], - EXT2_CACHE_DIR))) { ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-03-25 00:23:59
|
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 85d151011bf46a9d06faa3a6d24abea603b792c2 (commit) from c7c191ff6c8e884d17f6a536be53ed68a4553a0e (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 85d151011bf46a9d06faa3a6d24abea603b792c2 Author: Lawrence Sebald <ljs...@us...> Date: Sun Mar 24 20:23:23 2013 -0400 Change how threads are swapped a little bit. ----------------------------------------------------------------------- Summary of changes: kernel/thread/thread.c | 31 +++++++++++++++++++++++-------- 1 files changed, 23 insertions(+), 8 deletions(-) diff --git a/kernel/thread/thread.c b/kernel/thread/thread.c index a808e43..4c10b7d 100644 --- a/kernel/thread/thread.c +++ b/kernel/thread/thread.c @@ -66,6 +66,9 @@ static semaphore_t thd_reap_sem; /* Number of threads active in the system. */ static uint32 thd_count = 0; +/* The idle task */ +static kthread_t *thd_idle_thd = NULL; + /*****************************************************************************/ /* Debug */ @@ -485,9 +488,9 @@ void thd_schedule(int front_of_line, uint64 now) { arch_exit(); } - /* Re-queue the last "current" thread onto the run queue if - it didn't die */ - if(!dontenq && thd_current->state == STATE_RUNNING) { + /* If the current thread is supposed to be in the front of the line, and it + did not die, re-enqueue it to the front of the line now. */ + if(front_of_line && !dontenq && thd_current->state == STATE_RUNNING) { thd_current->state = STATE_READY; thd_add_to_runnable(thd_current, front_of_line); } @@ -504,6 +507,18 @@ void thd_schedule(int front_of_line, uint64 now) { break; } + /* If we didn't already re-enqueue the thread and we are supposed to do so, + do it now. */ + if(!front_of_line && !dontenq && thd_current->state == STATE_RUNNING) { + thd_current->state = STATE_READY; + thd_add_to_runnable(thd_current, front_of_line); + + /* Make sure we have a thread, just in case we couldn't find anything + above. */ + if(thd == NULL || thd == thd_idle_thd) + thd = thd_current; + } + /* Didn't find one? Big problem here... */ if(thd == NULL) { thd_pslist(printf); @@ -812,7 +827,7 @@ int kthread_key_delete(kthread_key_t key) { /* Init */ int thd_init(int mode) { - kthread_t *idle, *kern, *reaper; + kthread_t *kern, *reaper; /* Make sure we're not already running */ if(thd_mode != THD_MODE_NONE) @@ -849,10 +864,10 @@ int thd_init(int mode) { /* Setup an idle task that is always ready to run, in case everyone else is blocked on something. */ - idle = thd_create(0, thd_idle_task, NULL); - strcpy(idle->label, "[idle]"); - thd_set_prio(idle, PRIO_MAX); - idle->state = STATE_READY; + thd_idle_thd = thd_create(0, thd_idle_task, NULL); + strcpy(thd_idle_thd->label, "[idle]"); + thd_set_prio(thd_idle_thd, PRIO_MAX); + thd_idle_thd->state = STATE_READY; /* Set up a thread to reap old zombies */ sem_init(&thd_reap_sem, 0); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-02-27 17:10: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 c7c191ff6c8e884d17f6a536be53ed68a4553a0e (commit) from 21deaf55920776d590cc8fd404355a45fcd711d6 (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 c7c191ff6c8e884d17f6a536be53ed68a4553a0e Author: Lawrence Sebald <ljs...@us...> Date: Wed Feb 27 12:09:35 2013 -0500 Add authors list and update the license section in the README.KOS file. ----------------------------------------------------------------------- Summary of changes: AUTHORS | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ doc/README.KOS | 7 +-- 2 files changed, 118 insertions(+), 4 deletions(-) create mode 100644 AUTHORS diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..7b63560 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,115 @@ +KallistiOS Authors List +----------------------- +The following is a list of all of the attributed authors for KallistiOS, as well +as the year(s) of their contributions. As KallistiOS is copyrighted computer +software, any use of any parts of KallistiOS must give attribution to the +authors who produced it. The names here are listed in no particular order. It is +the responsibility of any contributors to KallistiOS to add themselves to this +file in order to document their contributions. Note that this list covers only +KallistiOS itself, and not any utilities that are bundled with it nor any +external libraries that it may use on any given platform (such as Newlib or +libgcc). Please consult a legal professional if you intend to use KallistiOS for +any commercial purposes to clarify the licensing restrictions that may be placed +on your software due to its use of KallistiOS or other libraries. + +Also, keep in mind that libraries included in kos-ports are also not covered by +this list, and may have differing license restrictions than KallistiOS itself. +Once again, if in doubt, contact a legal professional. + +For more information about the license that KallistiOS is distributed under, +please see the README.KOS file in the doc directory. + +Contributors list (under the normal KOS license): +------------------------------------------------- +Dan Potter: 1997, 2000, 2001, 2002, 2003, 2004 +Lawrence Sebald: 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 +Sam Steele: 2004 +Gil Megidish: 2002 +Florian Schulze: 2002 +Walter van Niftrik: 2005 +Donald Haase: 2008 +Andrew Kieschnick: 2000, 2001, 2002, 2003 +Jordan DeLong: 2000, 2001, 2002 +Bero: 2002 +Kazuaki Matsumoto: 2002 +Anders Clerwall (scav): 2001 +Nick Kochakian: 2002, 2004 +Vincent Penne: 2004 +Roger Cattermole: 2002 +Paul Boese: 2002 +Brian Paul: 1999, 2000, 2001 + +Files with Specific licenses: +----------------------------- +include/pthread.h: +/* pthread.h + * + * Written by Joel Sherrill <jo...@OA...>. + * + * COPYRIGHT (c) 1989-2000. + * On-Line Applications Research Corporation (OAR). + * + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software. + * + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION + * OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS + * SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + * + */ + +kernel/libc/koslib/realpath.c: +/* + * Copyright (c) 2003 Constantin S. Svintsoff <ko...@ic...> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The names of the authors may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +kernel/arch/dreamcast/kernel/gdb_stub.c: +/* This is originally based on an m68k software stub written by Glenn + Engel at HP, but has changed quite a bit. + + Modifications for the SH by Ben Lee and Steve Chamberlain + + Modifications for KOS by Dan Potter (earlier) and Richard Moats (more + recently). +*/ + +/**************************************************************************** + + THIS SOFTWARE IS NOT COPYRIGHTED + + HP offers the following for use in the public domain. HP makes no + warranty with regard to the software or it's performance and the + user accepts the software "AS IS" with all faults. + + HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD + TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +****************************************************************************/ diff --git a/doc/README.KOS b/doc/README.KOS index ebb8f91..ab4e99d 100644 --- a/doc/README.KOS +++ b/doc/README.KOS @@ -25,13 +25,12 @@ says is that you have to give credit where credit is due (both in derived source files and binary compilations; a credit in the documentation is ok) and there is no warranty. - Dan Potter + Dan Potter All of the documentation and software included in the KallistiOS Releases -is copyrighted (c)2000-2002 by Dan Potter and others (as noted in each file). +is copyrighted (C) 2000-2013 by Dan Potter and others (as noted in each file). -Copyright 2000, 2001, 2002 - Dan Potter and others (as noted in each file). All rights reserved. +Copyright (C) 1997-2013 KallistiOS Contributors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-02-27 15:27: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 21deaf55920776d590cc8fd404355a45fcd711d6 (commit) from 8708f6205731cbbe1fd06848eeec1cdd5f15a4cf (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 21deaf55920776d590cc8fd404355a45fcd711d6 Author: Lawrence Sebald <ljs...@us...> Date: Wed Feb 27 10:25:29 2013 -0500 Fix a two rather stupid bugs with fs_ext2. 1. If the file pointer was offset within a block, reading wouldn't work properly. 2. If you tried to read more than one filesystem block's worth of data, the read would continuously write to the beginning of the buffer instead of moving within it as it should have. Basically, fs_ext2 was pretty much completely broken for files of more than 1024 bytes (since newlib seems to like splitting fread calls into read calls of 1024 bytes each). ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/fs_ext2.c | 26 +++++++++++++++++++++++++- 1 files changed, 25 insertions(+), 1 deletions(-) diff --git a/addons/libkosext2fs/fs_ext2.c b/addons/libkosext2fs/fs_ext2.c index af138e2..fcb3f74 100644 --- a/addons/libkosext2fs/fs_ext2.c +++ b/addons/libkosext2fs/fs_ext2.c @@ -138,7 +138,7 @@ static void fs_ext2_close(void * h) { static ssize_t fs_ext2_read(void *h, void *buf, size_t cnt) { file_t fd = ((file_t)h) - 1; ext2_fs_t *fs; - uint32_t bs, lbs; + uint32_t bs, lbs, bo; uint8_t *block; uint8_t *bbuf = (uint8_t *)buf; ssize_t rv; @@ -160,6 +160,29 @@ static ssize_t fs_ext2_read(void *h, 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); + + /* Handle the first block specially if we are offset within it. */ + if(bo) { + if(!(block = ext2_inode_read_block(fs, fh[fd].inode, + fh[fd].ptr >> lbs))) { + mutex_unlock(&ext2_mutex); + errno = EBADF; + return -1; + } + + if(cnt > bs - bo) { + memcpy(bbuf, block + bo, bs - bo); + fh[fd].ptr += bs - bo; + cnt -= bs - bo; + bbuf += bs - bo; + } + else { + memcpy(bbuf, block + bo, cnt); + fh[fd].ptr += cnt; + cnt = 0; + } + } /* While we still have more to read, do it. */ while(cnt) { @@ -174,6 +197,7 @@ static ssize_t fs_ext2_read(void *h, void *buf, size_t cnt) { memcpy(bbuf, block, bs); fh[fd].ptr += bs; cnt -= bs; + bbuf += bs; } else { memcpy(bbuf, block, cnt); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-02-10 21:06: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 "An ethernet program loader for the Dreamcast.". The branch, master has been updated via 9007aa015d0ef84b25ff693848866396f904dae8 (commit) from 03f30ac98fdf5922dc340bda093edace58c03535 (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 9007aa015d0ef84b25ff693848866396f904dae8 Author: Lawrence Sebald <blu...@ne...> Date: Sun Feb 10 16:05:28 2013 -0500 Add in a new 1st_read for dcload-ip (completely in assembly) and bump the version number to 1.0.5. ----------------------------------------------------------------------- Summary of changes: Makefile.cfg | 4 +- target-src/1st_read/1st_read.c | 41 ------- target-src/1st_read/Makefile | 54 +++------- target-src/1st_read/asm.h | 22 ---- target-src/1st_read/crt0.S | 99 ----------------- target-src/1st_read/dc3.x | 228 ---------------------------------------- target-src/1st_read/dc4.x | 228 ---------------------------------------- target-src/1st_read/loader.s | 98 +++++++++++++++++ target-src/1st_read/memcpy.S | 221 -------------------------------------- 9 files changed, 113 insertions(+), 882 deletions(-) delete mode 100644 target-src/1st_read/1st_read.c delete mode 100644 target-src/1st_read/asm.h delete mode 100644 target-src/1st_read/crt0.S delete mode 100644 target-src/1st_read/dc3.x delete mode 100644 target-src/1st_read/dc4.x create mode 100644 target-src/1st_read/loader.s delete mode 100644 target-src/1st_read/memcpy.S diff --git a/Makefile.cfg b/Makefile.cfg index d5e5bcd..26e8fc8 100644 --- a/Makefile.cfg +++ b/Makefile.cfg @@ -23,8 +23,6 @@ BFDINCLUDE = /opt/dc/sh-elf/include #BFDINCLUDE = /usr/local/include # sh-elf-stuff - # Replace with 3 if you're using gcc < 4.x -TARGETCCVER = 4 TARGETCC = sh-elf-gcc TARGETCFLAGS = -O2 -ml -m4-single-only TARGETOBJCOPY = sh-elf-objcopy @@ -32,7 +30,7 @@ TARGETLD = sh-elf-ld # you generally shouldn't change this unless you are making forked # versions (or test versions) -VERFLAGS = -DDCLOAD_VERSION=\"1.0.4\" +VERFLAGS = -DDCLOAD_VERSION=\"1.0.5\" TARGETCFLAGS += $(VERFLAGS) HOSTCFLAGS += $(VERFLAGS) diff --git a/target-src/1st_read/1st_read.c b/target-src/1st_read/1st_read.c deleted file mode 100644 index 7b14ea1..0000000 --- a/target-src/1st_read/1st_read.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * This file is part of the dcload Dreamcast ethernet loader - * - * Copyright (C) 2001 Andrew Kieschnick <an...@au...> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include <string.h> - -#define TARGET1 (unsigned int *)0x8c004000 -#define TARGET2 (unsigned int *)0x8c00f400 - -extern void disable_cache(void); - -extern unsigned int binary_dcload_bin_start; -extern unsigned int binary_dcload_bin_size; -extern unsigned int binary_exception_bin_start; -extern unsigned int binary_exception_bin_size; - -int main(void) -{ - memcpy(TARGET1, &binary_dcload_bin_start, binary_dcload_bin_size); - memcpy(TARGET2, &binary_exception_bin_start, binary_exception_bin_size); - - disable_cache(); - (*(void (*)()) 0x8c004000) (); -} diff --git a/target-src/1st_read/Makefile b/target-src/1st_read/Makefile index fa37e1b..bffede7 100644 --- a/target-src/1st_read/Makefile +++ b/target-src/1st_read/Makefile @@ -1,49 +1,23 @@ include ../../Makefile.cfg -CC = $(TARGETCC) -CFLAGS = $(TARGETCFLAGS) -INCLUDE = -I../../target-inc -OBJCOPY = $(TARGETOBJCOPY) -LD = $(TARGETLD) +TARGET = 1st_read.bin -OBJECTS = crt0.o 1st_read.o disable.o memcpy.o dcload.o exception.o - -.c.o: - $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< - -.S.o: - $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< - -.s.o: - $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $< - -all: 1st_read.bin 1st_read.srec - -dcload.bin: ../dcload/dcload.bin - cp $< $@ - -exception.bin: ../dcload/exception.bin - cp $< $@ - -dcload.o: dcload.bin - $(LD) -A sh -b binary --oformat elf32-shl $< -o $@ -r -EL --no-warn-mismatch - -exception.o: exception.bin - $(LD) -A sh -b binary --oformat elf32-shl $< -o $@ -r -EL --no-warn-mismatch - -1st_read.bin: 1st_read - $(OBJCOPY) -O binary $< $@ - -1st_read.srec: 1st_read - $(OBJCOPY) -O srec $< $@ - -1st_read: $(OBJECTS) - $(CC) $(CFLAGS) -Wl,-Tdc$(TARGETCCVER).x -nostartfiles -nostdlib $^ -o $@ -lgcc +all: rm-elf $(TARGET) .PHONY : clean clean: - rm -f $(OBJECTS) 1st_read dcload.bin exception.bin + -rm -f $(TARGET) 1st_read.bin loader.elf .PHONY : distclean distclean: clean - rm -f 1st_read.bin 1st_read.srec + +.PHONY : rm-elf +rm-elf: + -rm -f $(TARGET) loader.elf + +loader.elf: loader.s disable.s ../dcload/dcload.bin ../dcload/exception.bin + $(TARGETCC) $(TARGETCFLAGS) -o $@ loader.s disable.s -nostartfiles \ + -nostdlib -Ttext=0x8c010000 -Wa,-I../dcload + +1st_read.bin: loader.elf + $(TARGETOBJCOPY) -R .stack -O binary $^ $@ diff --git a/target-src/1st_read/asm.h b/target-src/1st_read/asm.h deleted file mode 100644 index ed27fdb..0000000 --- a/target-src/1st_read/asm.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifdef __STDC__ -# define _C_LABEL(x) _ ## x -#else -# define _C_LABEL(x) _/**/x -#endif -#define _ASM_LABEL(x) x - -#define _ENTRY(name) \ - .text; .align 2; .globl name; name: - -#define ENTRY(name) \ - _ENTRY(_C_LABEL(name)) - -#if (defined (__sh2__) || defined (__sh3__) || defined (__SH3E__) \ - || defined (__SH4_SINGLE__) || defined (__SH4__)) || defined(__SH4_SINGLE_ONLY__) -#define DELAYED_BRANCHES -#define SL(branch, dest, in_slot, in_slot_arg2) \ - branch##.s dest; in_slot, in_slot_arg2 -#else -#define SL(branch, dest, in_slot, in_slot_arg2) \ - in_slot, in_slot_arg2; branch dest -#endif diff --git a/target-src/1st_read/crt0.S b/target-src/1st_read/crt0.S deleted file mode 100644 index 32b0db0..0000000 --- a/target-src/1st_read/crt0.S +++ /dev/null @@ -1,99 +0,0 @@ - .section .text - .global start - .global _atexit -start: - mov.l setup_cache_k,r0 - mov.l p2_mask,r1 - or r1,r0 - jmp @r0 - nop -setup_cache: - mov.l ccr_addr,r0 - mov.w ccr_data,r1 - mov.l r1,@r0 - mov.l start_2_k,r0 - nop - nop - nop - nop - nop - nop - nop - jmp @r0 - nop -start_2: - mov.l old_stack_k,r14 - mov.l r15,@r14 - mov.l old_pr_k,r14 - sts pr,r15 - mov.l r15,@r14 - mov.l stack_k,r15 - - ! zero out bss - mov.l edata_k,r0 - mov.l end_k,r1 - mov #0,r2 -start_l: - mov.l r2,@r0 - add #4,r0 - cmp/ge r0,r1 - bt start_l - - mov.l set_fpscr_k, r1 - jsr @r1 - mov #0,r4 - lds r3,fpscr - - ! call the mainline - mov.l main_k,r0 - jsr @r0 - nop - - mov.l old_pr_k,r14 - mov.l @r14,r15 - lds r15,pr - mov.l old_stack_k,r14 - mov.l @r14,r15 - -_atexit: - rts - nop - - .align 4 -set_fpscr_k: - .long ___set_fpscr -stack_k: - .long _stack -edata_k: - .long _edata -end_k: - .long _end -main_k: - .long _main -old_stack_k: - .long _old_stack -old_pr_k: - .long _old_pr -_old_stack: - .long 0 -_old_pr: - .long 0 -setup_cache_k: - .long setup_cache -start_2_k: - .long start_2 -p2_mask: - .long 0xa0000000 -ccr_addr: - .long 0xff00001c -ccr_data: - .word 0x090b - - .align 4 - -#ifdef __ELF__ - .section .stack,"aw" -#else - .section .stack -#endif - diff --git a/target-src/1st_read/dc3.x b/target-src/1st_read/dc3.x deleted file mode 100644 index 5ea23dc..0000000 --- a/target-src/1st_read/dc3.x +++ /dev/null @@ -1,228 +0,0 @@ -/* Sega Dreamcast linker script */ - -OUTPUT_FORMAT("elf32-shl", "elf32-shl", - "elf32-shl") -OUTPUT_ARCH(sh) -ENTRY(start) - SEARCH_DIR(/usr/local/dcdev/sh-elf/lib); -/* Do we need any of these for elf? - __DYNAMIC = 0; */ - -MEMORY -{ - ram (rwx) : ORIGIN = 0x8c010000, LENGTH = 0xfe0000 -} - -SECTIONS -{ - /* Read-only sections, merged into text segment: */ -/* . = 0x1000;*/ - .interp : { *(.interp) } - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .gnu.version : { *(.gnu.version) } - .gnu.version_d : { *(.gnu.version_d) } - .gnu.version_r : { *(.gnu.version_r) } - .rel.init : { *(.rel.init) } - .rela.init : { *(.rela.init) } - .rel.text : - { - *(.rel.text) - *(.rel.text.*) - *(.rel.gnu.linkonce.t*) - } - .rela.text : - { - *(.rela.text) - *(.rela.text.*) - *(.rela.gnu.linkonce.t*) - } - .rel.fini : { *(.rel.fini) } - .rela.fini : { *(.rela.fini) } - .rel.rodata : - { - *(.rel.rodata) - *(.rel.rodata.*) - *(.rel.gnu.linkonce.r*) - } - .rela.rodata : - { - *(.rela.rodata) - *(.rela.rodata.*) - *(.rela.gnu.linkonce.r*) - } - .rel.data : - { - *(.rel.data) - *(.rel.data.*) - *(.rel.gnu.linkonce.d*) - } - .rela.data : - { - *(.rela.data) - *(.rela.data.*) - *(.rela.gnu.linkonce.d*) - } - .rel.ctors : { *(.rel.ctors) } - .rela.ctors : { *(.rela.ctors) } - .rel.dtors : { *(.rel.dtors) } - .rela.dtors : { *(.rela.dtors) } - .rel.got : { *(.rel.got) } - .rela.got : { *(.rela.got) } - .rel.sdata : - { - *(.rel.sdata) - *(.rel.sdata.*) - *(.rel.gnu.linkonce.s*) - } - .rela.sdata : - { - *(.rela.sdata) - *(.rela.sdata.*) - *(.rela.gnu.linkonce.s*) - } - .rel.sbss : { *(.rel.sbss) } - .rela.sbss : { *(.rela.sbss) } - .rel.bss : { *(.rel.bss) } - .rela.bss : { *(.rela.bss) } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .init : - { - KEEP (*(.init)) - } =0 - .plt : { *(.plt) } - .text : - { - *(.text) - *(.text.*) - *(.stub) - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - *(.gnu.linkonce.t*) - } =0 - _etext = .; - PROVIDE (etext = .); - .fini : - { - KEEP (*(.fini)) - } =0 - .rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) } - .rodata1 : { *(.rodata1) } - /* Adjust the address for the data segment. We want to adjust up to - the same address within the page on the next page up. */ - . = ALIGN(128) + (. & (128 - 1)); - .data : - { - *(.data) - *(.data.*) - *(.gnu.linkonce.d*) - SORT(CONSTRUCTORS) - } - .data1 : { *(.data1) } - .eh_frame : { *(.eh_frame) } - .gcc_except_table : { *(.gcc_except_table) } - .ctors ALIGN(4): - { - ___ctors = .; - /* gcc uses crtbegin.o to find the start of - the constructors, so we make sure it is - first. Because this is a wildcard, it - doesn't matter if the user does not - actually link against crtbegin.o; the - linker won't look for a file to match a - wildcard. The wildcard also means that it - doesn't matter which directory crtbegin.o - is in. */ - KEEP (*crtbegin.o(.ctors)) - /* We don't want to include the .ctor section from - from the crtend.o file until after the sorted ctors. - The .ctor section from the crtend file contains the - end of ctors marker and it must be last */ - KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) - KEEP (*(SORT(.ctors.*))) - KEEP (*(.ctors)) - ___ctors_end = .; - } - .dtors : - { - ___dtors = .; - KEEP (*crtbegin.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) - KEEP (*(SORT(.dtors.*))) - KEEP (*(.dtors)) - ___dtors_end = .; - } - .got : { *(.got.plt) *(.got) } - .dynamic : { *(.dynamic) } - /* We want the small data sections together, so single-instruction offsets - can access them all, and initialized data all before uninitialized, so - we can shorten the on-disk segment size. */ - .sdata : - { - *(.sdata) - *(.sdata.*) - *(.gnu.linkonce.s.*) - } - _edata = .; - PROVIDE (edata = .); - __bss_start = .; - .sbss : - { - *(.dynsbss) - *(.sbss) - *(.sbss.*) - *(.scommon) - } - .bss : - { - *(.dynbss) - *(.bss) - *(.bss.*) - *(COMMON) - /* Align here to ensure that the .bss section occupies space up to - _end. Align after .bss to ensure correct alignment even if the - .bss section disappears because there are no input sections. */ - . = ALIGN(32 / 8); - } - . = ALIGN(32 / 8); - _end = .; - PROVIDE (end = .); - /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } - /* DWARF debug sections. - Symbols in the DWARF debugging sections are relative to the beginning - of the section so we begin them at 0. */ - /* DWARF 1 */ - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - /* GNU DWARF 1 extensions */ - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - /* DWARF 1.1 and DWARF 2 */ - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - /* DWARF 2 */ - .debug_info 0 : { *(.debug_info) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } ...<truncated>... hooks/post-receive -- An ethernet program loader for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2013-02-10 20: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 "An ethernet program loader for the Dreamcast.". The branch, master has been updated via 03f30ac98fdf5922dc340bda093edace58c03535 (commit) from 1e9acf22c28525c6a0fe8f6cf423eace5978b0e9 (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 03f30ac98fdf5922dc340bda093edace58c03535 Author: Lawrence Sebald <blu...@ne...> Date: Sun Feb 10 15:47:44 2013 -0500 A few small changes to dcload-ip on the way to fixing it with gcc 4.x. ----------------------------------------------------------------------- Summary of changes: target-src/dcload/Makefile | 2 +- target-src/dcload/dcload.c | 6 +- target-src/dcload/{dcload3.x => dcload.x} | 0 target-src/dcload/dcload4.x | 228 ----------------------------- target-src/dcload/go.s | 2 +- 5 files changed, 5 insertions(+), 233 deletions(-) rename target-src/dcload/{dcload3.x => dcload.x} (100%) delete mode 100644 target-src/dcload/dcload4.x diff --git a/target-src/dcload/Makefile b/target-src/dcload/Makefile index 6f58a0b..a315b18 100644 --- a/target-src/dcload/Makefile +++ b/target-src/dcload/Makefile @@ -21,7 +21,7 @@ EXCOBJECTS = exception.o all: dcload.bin exception.bin dcload: $(DCLOBJECTS) - $(CC) $(CFLAGS) -Wl,-Tdcload$(TARGETCCVER).x -nostartfiles -nostdlib $^ -o $@ -lgcc + $(CC) $(CFLAGS) -Wl,-Tdcload.x -nostartfiles -nostdlib $^ -o $@ -lgcc exception: $(EXCOBJECTS) $(CC) $(CFLAGS) -Wl,-Ttext=0x8c00f400 -nostartfiles -nostdlib $^ -o $@ diff --git a/target-src/dcload/dcload.c b/target-src/dcload/dcload.c index 4e70041..e14f863 100644 --- a/target-src/dcload/dcload.c +++ b/target-src/dcload/dcload.c @@ -127,7 +127,7 @@ void draw_progress(unsigned int current, unsigned int total) uint_to_string(total, total_string); uint_to_string(current, current_string); - clear_lines(120, 24, 0x0100); + clear_lines(120, 24, 0x0010); draw_string(30, 174, "(", 0xffff); draw_string(42, 174, current_string, 0xffff); draw_string(138, 174, "/", 0xffff); @@ -157,7 +157,7 @@ void disp_info(void) int c; unsigned char *ip = (unsigned char *)&our_ip; - setup_video(0,0x0100); + setup_video(0,0x0010); draw_string(30, 54, NAME, 0xffff); draw_string(30, 78, bb->name, 0xffff); draw_string(30, 102, mac_string, 0xffff); @@ -168,7 +168,7 @@ void disp_info(void) } void disp_status(const char * status) { - clear_lines(150, 24, 0x0100); + clear_lines(150, 24, 0x0010); draw_string(30, 150, status, 0xffff); } diff --git a/target-src/dcload/dcload3.x b/target-src/dcload/dcload.x similarity index 100% rename from target-src/dcload/dcload3.x rename to target-src/dcload/dcload.x diff --git a/target-src/dcload/dcload4.x b/target-src/dcload/dcload4.x deleted file mode 100644 index bb6be04..0000000 --- a/target-src/dcload/dcload4.x +++ /dev/null @@ -1,228 +0,0 @@ -/* Script for -z combreloc: combine and sort reloc sections */ -OUTPUT_FORMAT("elf32-shl", "elf32-shl", - "elf32-shl") -OUTPUT_ARCH(sh) -ENTRY(start) -SEARCH_DIR("/usr/local/dc-new/sh-elf/sh-elf/lib"); -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - PROVIDE (__executable_start = 0x8c004000); . = 0x8c004000; - .text : - { - *(.text .stub .text.* .gnu.linkonce.t.*) - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - } =0 - .init : - { - KEEP (*(.init)) - } =0 - .fini : - { - KEEP (*(.fini)) - } =0 - .interp : { *(.interp) } - .note.gnu.build-id : { *(.note.gnu.build-id) } - .hash : { *(.hash) } - .gnu.hash : { *(.gnu.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .gnu.version : { *(.gnu.version) } - .gnu.version_d : { *(.gnu.version_d) } - .gnu.version_r : { *(.gnu.version_r) } - .rel.dyn : - { - *(.rel.init) - *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) - *(.rel.fini) - *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) - *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) - *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) - *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) - *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) - *(.rel.ctors) - *(.rel.dtors) - *(.rel.got) - *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) - *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) - *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) - *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) - *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) - } - .rela.dyn : - { - *(.rela.init) - *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) - *(.rela.fini) - *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) - *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) - *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) - *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) - *(.rela.ctors) - *(.rela.dtors) - *(.rela.got) - *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) - *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) - *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) - *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) - *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) - } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .plt : { *(.plt) } - PROVIDE (__etext = .); - PROVIDE (_etext = .); - PROVIDE (etext = .); - .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } - .rodata1 : { *(.rodata1) } - .sdata2 : - { - *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) - } - .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } - .eh_frame_hdr : { *(.eh_frame_hdr) } - .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } - .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) } - /* Adjust the address for the data segment. We want to adjust up to - the same address within the page on the next page up. */ - . = ALIGN(128) + (. & (128 - 1)); - /* Exception handling */ - .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } - .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } - /* Thread Local Storage sections */ - .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } - .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } - .preinit_array : - { - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP (*(.preinit_array)) - PROVIDE_HIDDEN (__preinit_array_end = .); - } - .init_array : - { - PROVIDE_HIDDEN (__init_array_start = .); - KEEP (*(SORT(.init_array.*))) - KEEP (*(.init_array)) - PROVIDE_HIDDEN (__init_array_end = .); - } - .fini_array : - { - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP (*(.fini_array)) - KEEP (*(SORT(.fini_array.*))) - PROVIDE_HIDDEN (__fini_array_end = .); - } - .ctors : - { - ___ctors = .; - /* gcc uses crtbegin.o to find the start of - the constructors, so we make sure it is - first. Because this is a wildcard, it - doesn't matter if the user does not - actually link against crtbegin.o; the - linker won't look for a file to match a - wildcard. The wildcard also means that it - doesn't matter which directory crtbegin.o - is in. */ - KEEP (*crtbegin.o(.ctors)) - KEEP (*crtbegin?.o(.ctors)) - /* We don't want to include the .ctor section from - the crtend.o file until after the sorted ctors. - The .ctor section from the crtend file contains the - end of ctors marker and it must be last */ - KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) - KEEP (*(SORT(.ctors.*))) - KEEP (*(.ctors)) - ___ctors_end = .; - } - .dtors : - { - ___dtors = .; - KEEP (*crtbegin.o(.dtors)) - KEEP (*crtbegin?.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) - KEEP (*(SORT(.dtors.*))) - KEEP (*(.dtors)) - ___dtors_end = .; - } - .jcr : { KEEP (*(.jcr)) } - .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) } - .dynamic : { *(.dynamic) } - .data : - { - *(.data .data.* .gnu.linkonce.d.*) - SORT(CONSTRUCTORS) - } - .data1 : { *(.data1) } - .got : { *(.got.plt) *(.got) } - /* We want the small data sections together, so single-instruction offsets - can access them all, and initialized data all before uninitialized, so - we can shorten the on-disk segment size. */ - .sdata : - { - *(.sdata .sdata.* .gnu.linkonce.s.*) - } - _edata = .; PROVIDE (edata = .); - __bss_start = .; - .sbss : - { - *(.dynsbss) - *(.sbss .sbss.* .gnu.linkonce.sb.*) - *(.scommon) - } - .bss : - { - *(.dynbss) - *(.bss .bss.* .gnu.linkonce.b.*) - *(COMMON) - /* Align here to ensure that the .bss section occupies space up to - _end. Align after .bss to ensure correct alignment even if the - .bss section disappears because there are no input sections. - FIXME: Why do we need it? When there is no .bss section, we don't - pad the .data section. */ - . = ALIGN(. != 0 ? 32 / 8 : 1); - } - . = ALIGN(32 / 8); - . = ALIGN(32 / 8); - _end = .; PROVIDE (end = .); - /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } - /* DWARF debug sections. - Symbols in the DWARF debugging sections are relative to the beginning - of the section so we begin them at 0. */ - /* DWARF 1 */ - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - /* GNU DWARF 1 extensions */ - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - /* DWARF 1.1 and DWARF 2 */ - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - /* DWARF 2 */ - .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - /* SGI/MIPS DWARF 2 extensions */ - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } - /* DWARF 3 */ - .debug_pubtypes 0 : { *(.debug_pubtypes) } - .debug_ranges 0 : { *(.debug_ranges) } - .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } - /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) } -_stack = 0x8c00f400; -} diff --git a/target-src/dcload/go.s b/target-src/dcload/go.s index c291073..e997f5d 100644 --- a/target-src/dcload/go.s +++ b/target-src/dcload/go.s @@ -45,7 +45,7 @@ entry_addr: sr_data_k: .long sr_data sr_data: - .long 0x600000f0 + .long 0x500000f0 vbr_data_k: .long vbr_data vbr_data: hooks/post-receive -- An ethernet program loader for the Dreamcast. |