Hi Eric,

2007/9/19 Eric Auer <[email protected]>:
> I tried to fix bug 1908: Our kernel used to need a fresh
> dir entry for renaming, as it renamed by "create new dir
> entry for file, then mark old entry as deleted". My patch
> tries to limit this to cases where you rename files or
> directories across directories. If both old and new name
> are in the same directory, the new version should only
> change the old dir entry "in place". So that should even
> work if you rename files on a disk with full root dir...

I got a zero-sized file when I tried to save the attachment of
archived bug 1908,
www.freedos.org/bugzilla/cgi-bin/show_bug.cgi?id=1908
www.freedos.org/bugzilla/cgi-bin/attachment.cgi?id=43
but I've changed dos_rename in SVN r1417 to change the directory entry
in-place instead of creating a new one and then deleting the old one
-- if the directory is the same for both paths.

> Caveats:
>
> - it is possible that renaming directories on a disk with
>  full root directory still does consume an extra dir entry,
>  as I am not sure whether my "does the rename take place in
>  the same directory" test captures that case as well.

I don't think that's a problem: then we have
fnp1->f_dirstart == fnp2->f_dirstart == 0

> - if you rename a directory across directories, then the
>  ".." entry for the directory itself is not updated. Note
>  that neither FreeCOM command.com nor MOVE use the int21
>  rename interface for such activities at the moment (?).

I think MSDOS specifically disallows this:
http://groups.google.com/group/comp.os.msdos.programmer/msg/259ca094fe4d0c9a
so we need to add another check.

> -  if ((ret = remove_lfn_entries(fnp1)) < 0)
> -    return ret;
> +  if ((ret = remove_lfn_entries(fnp1)) < 0) {
> +    dir_close(fnp2);
> +    return ret; /* remove_... already closes fnp1 on error */
> +  }

With my recent fnode changes (I'll send another email) we no longer
need to close fnodes: there are only two at fixed locations and
usually only the first is used. The only exception being
"dos_rename()" which uses the two fnodes. So it saves some trouble
with leaks.

Bart

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Freedos-kernel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel

Reply via email to