--- uae/src/filesys.c 2018/04/24 17:10:57 1.1.1.18 +++ uae/src/filesys.c 2018/04/24 17:14:30 1.1.1.20 @@ -119,7 +119,7 @@ typedef struct { char *rootdir; /* root unix directory */ int readonly; /* disallow write access? */ int devno; - + struct hardfiledata hf; /* Threading stuff */ @@ -183,7 +183,7 @@ char *get_filesys_unit (struct uaedev_mo if (nr >= mountinfo->num_units) return "No slot allocated for this unit"; - + *volname = uip->volname ? my_strdup (uip->volname) : 0; *rootdir = uip->rootdir ? my_strdup (uip->rootdir) : 0; *readonly = uip->readonly; @@ -601,7 +601,7 @@ find_unit (uaecptr port) return u; } - + static void prepare_for_open (char *name) { #if 0 @@ -663,7 +663,7 @@ static void recycle_aino (Unit *unit, a_ a_inode **aip; aip = &parent->child; - if (! parent->locked_children) + if (! parent->locked_children) { for (;;) { a_inode *aino = *aip; if (aino == 0) @@ -672,9 +672,9 @@ static void recycle_aino (Unit *unit, a_ /* Not recyclable if next == 0 (i.e., not chained into recyclable list), or if parent directory is being ExNext()ed. */ - if (aino->next == 0) + if (aino->next == 0) { aip = &aino->sibling; - else { + } else { if (aino->shlock > 0 || aino->elock) write_log ("panic: freeing locked a_inode!\n"); @@ -683,6 +683,7 @@ static void recycle_aino (Unit *unit, a_ i++; } } + } /* In the previous loop, we went through all children of one parent. Re-arrange the recycled list so that we'll find a different parent the next time around. */ @@ -719,7 +720,7 @@ static void update_child_names (Unit *un char *name_start; char *new_name; char dirsep[2] = { FSDB_DIR_SEPARATOR, '\0' }; - + a->parent = parent; name_start = strrchr (a->nname, FSDB_DIR_SEPARATOR); if (name_start == 0) { @@ -748,7 +749,6 @@ static void move_aino_children (Unit *un static void delete_aino (Unit *unit, a_inode *aino) { a_inode **aip; - int hash; TRACE(("deleting aino %x\n", aino->uniq)); @@ -863,7 +863,7 @@ static char *get_nname (Unit *unit, a_in char *p = 0; *modified_rel = 0; - + /* If we have a mapping of some other aname to "rel", we must pretend * it does not exist. * This can happen for example if an Amiga program creates a @@ -896,7 +896,7 @@ static char *create_nname (Unit *unit, a char *p; /* We are trying to create a file called REL. */ - + /* If the name is used otherwise in the directory (or globally), we * need a new unique nname. */ if (fsdb_name_invalid (rel) || fsdb_used_as_nname (base, rel)) { @@ -1267,7 +1267,7 @@ static void do_info (Unit *unit, dpacket packet, uaecptr info) { struct fs_usage fsu; - + if (get_fs_usage (unit->ui.rootdir, 0, &fsu) != 0) { PUT_PCK_RES1 (packet, DOS_FALSE); PUT_PCK_RES2 (packet, dos_errno ()); @@ -1778,8 +1778,6 @@ static void populate_directory (Unit *un static void do_examine (Unit *unit, dpacket packet, ExamineKey *ek, uaecptr info) { - a_inode *aino; - if (ek->curr_file == 0) goto no_more_entries; @@ -2192,7 +2190,7 @@ action_seek (Unit *unit, dpacket packet) TRACE(("ACTION_SEEK(%s,%d,%d)\n", k->aino->nname, pos, mode)); old = lseek (k->fd, 0, SEEK_CUR); - { + { uae_s32 temppos; long filesize = lseek (k->fd, 0, SEEK_END); lseek (k->fd, old, SEEK_SET); @@ -2317,7 +2315,7 @@ action_change_mode (Unit *unit, dpacket /* will be CHANGE_FH or CHANGE_LOCK value */ long type = GET_PCK_ARG1 (packet); /* either a file-handle or lock */ - uaecptr object = GET_PCK_ARG2 (packet) << 2; + uaecptr object = GET_PCK_ARG2 (packet) << 2; /* will be EXCLUSIVE_LOCK/SHARED_LOCK if CHANGE_LOCK, * or MODE_OLDFILE/MODE_NEWFILE/MODE_READWRITE if CHANGE_FH */ long mode = GET_PCK_ARG3 (packet); @@ -3054,6 +3052,14 @@ static int get_new_device (char **devnam return result; } +static void init_filesys_diagentry (void) +{ + do_put_mem_long ((uae_u32 *)(filesysory + 0x2100), EXPANSION_explibname); + do_put_mem_long ((uae_u32 *)(filesysory + 0x2104), filesys_configdev); + do_put_mem_long ((uae_u32 *)(filesysory + 0x2108), EXPANSION_doslibname); + do_put_mem_long ((uae_u32 *)(filesysory + 0x210c), current_mountinfo->num_units); +} + void filesys_start_threads (void) { UnitInfo *uip; @@ -3062,7 +3068,7 @@ void filesys_start_threads (void) current_mountinfo = dup_mountinfo (currprefs.mountinfo); reset_uaedevices (); - + uip = current_mountinfo->ui; for (i = 0; i < current_mountinfo->num_units; i++) { uip[i].unit_pipe = 0; @@ -3102,11 +3108,10 @@ void filesys_reset (void) static void free_all_ainos (Unit *u, a_inode *parent) { - a_inode *a; - while (a = parent->child) - { - free_all_ainos (u, a); - dispose_aino (u, &parent->child, a); + a_inode *a; + while (a = parent->child) { + free_all_ainos (u, a); + dispose_aino (u, &parent->child, a); } } @@ -3149,10 +3154,7 @@ static uae_u32 filesys_diagentry (void) filesys_configdev = m68k_areg (regs, 3); - do_put_mem_long ((uae_u32 *)(filesysory + 0x2100), EXPANSION_explibname); - do_put_mem_long ((uae_u32 *)(filesysory + 0x2104), filesys_configdev); - do_put_mem_long ((uae_u32 *)(filesysory + 0x2108), EXPANSION_doslibname); - do_put_mem_long ((uae_u32 *)(filesysory + 0x210c), current_mountinfo->num_units); + init_filesys_diagentry (); uae_sem_init (&singlethread_int_sem, 0, 1); if (ROM_hardfile_resid != 0) { @@ -3169,7 +3171,7 @@ static uae_u32 filesys_diagentry (void) } resaddr += 0x1A; tmp = resaddr; - + /* The good thing about this function is that it always gets called * when we boot. So we could put all sorts of stuff that wants to be done * here.