Re: Patch: cromwell/fs/cdrom
David Pye <[email protected]>
| Newsgroups | gmane.linux.ports.xbox.devel |
|---|---|
| Message-ID | <[email protected]> |
Sorry to not reply directly ;)
This patch looks sane to me.
Ed (Gimli), you're the owner of the isofs code in cromwell - do you want me to
apply it, or do you want to do it in your own time?
Cheers,
David
On Friday 05 November 2004 20:07, Ge van Geldorp wrote:
> Hello,
>
> I'm new to the Xbox part of the woods, so if I do something stupid please
> let me know :-). Maybe a short introduction: I'm one of the developers of
> ReactOS (http://www.reactos.com). After meeting Michael on LinuxWorldExpo
> in Frankfurt, we decided porting ReactOS to the Xbox would be a nice
> project.
> While working on loading our startup code from CD, I noticed some things in
> the Cromwell ISO9600 fs code that don't seem correct. Hence the following
> patch.
>
> Changelog:
> - Don't overwrite the byte following the directory entry with NUL, that
> byte might actually be the length byte of the next directory entry
> - When the length byte of a directory entry is 0, skip to the next sector
> - Don't recurse into a directory unless we need to
>
> Index: fs/cdrom/iso9660.c
> ===================================================================
> RCS file: /cvsroot/xbox-linux/cromwell/fs/cdrom/iso9660.c,v
> retrieving revision 1.5
> diff -u -r1.5 iso9660.c
> --- fs/cdrom/iso9660.c 20 Aug 2004 09:53:59 -0000 1.5
> +++ fs/cdrom/iso9660.c 5 Nov 2004 20:06:00 -0000
> @@ -29,8 +29,7 @@
> }
> }
>
> -int iso9660_name_translate(char *old) {
> - int len = strlen(old);
> +int iso9660_name_translate(char *translated, char *old, unsigned len) {
> int i;
>
> for (i = 0; i < len; i++) {
> @@ -53,9 +52,9 @@
> if (c == ';')
> c = '.';
>
> - old[i] = c;
> + translated[i] = c;
> }
> - old[i] = '\0';
> + translated[i] = '\0';
> return i;
> }
>
> @@ -89,13 +88,14 @@
> dir = (struct iso_directory_record *)&buffer[offset];
> dir_length = *((unsigned char *)(dir->length));
> if(!dir_length) {
> - offset++;
> + /* Skip to next sector */
> + offset = (offset + ISOFS_BLOCK_SIZE) & ~ (ISOFS_BLOCK_SIZE - 1);
> continue;
> }
> if(dir->name[0] != 0 && dir->name[0] != 1) {
> - dir->name[(unsigned char)dir->name_len[0]] = 0;
> - iso9660_name_translate(dir->name);
> - sprintf(newfilename,"%s/%s",filename, dir->name);
> + sprintf(newfilename, "%s/", filename);
> + iso9660_name_translate(newfilename + strlen(newfilename),
> + dir->name, (unsigned char) dir->name_len[0]);
> // printk("Read : Sector %d Filename %s %d\n",
> // *((unsigned long *)(dir->extent)), newfilename,
> // (unsigned char)dir->ext_attr_length[0]);
> @@ -114,15 +114,13 @@
> }
> }
> if((*((char *)(dir->flags)) & IS_DIR) && (*((unsigned char
> *)(dir->name_len)) > 1)) { - if((strlen(newfilename) + strlen(dir->name))
> > 1024) {
> - free(newfilename);
> - free(buffer);
> - return 0;
> - }
> - sprintf(newfilename,"%s/%s",filename, dir->name);
> // printk("Directory %s Filename %s\n", newfilename, search);
> - sect = read_dir(driveId, dir, search, newfilename, dir_found);
> - if(sect != 0) return sect;
> + if (strlen(newfilename) < strlen(search) &&
> + 0 == memcmp(search, newfilename, strlen(newfilename)) &&
> + '/' == search[strlen(newfilename)]) {
> + sect = read_dir(driveId, dir, search, newfilename, dir_found);
> + return sect;
> + }
> }
> offset+=dir_length;
> sect = 0;
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Sybase ASE Linux Express Edition - download now for FREE
> LinuxWorld Reader's Choice Award Winner for best database on Linux.
> http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
> _______________________________________________
> Xbox-linux-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/xbox-linux-devel
--
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS d- s-: a-- C++ UL++++ P L+++ E--- W++ N+ o+ K- w---
O M V- PS+ PE+ Y+ PGP t 5- X+ R- tv+ b+ DI++ D+
G+ e++ h--- r++ y++
------END GEEK CODE BLOCK------
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click