patch: reget working again [Re: Reget: bug or feature?]

Pavel Roskin proski at gnu.org
Fri Jan 23 21:12:50 UTC 2004


On Tue, 20 Jan 2004, Alexander Savelyev wrote:

> Arpad Biro wrote:
> > Hi,
> >
> > MC 4.6.1-pre1:
> >
> > It seems that when copying files, "reget" means to append the last
> > s-t bytes of the source file to the target file, where s is the source
> > size and t is the target size.
> >
> > However, when performing "move", "reget" works differently:
> > the whole source file is appended to the target.
> >
> > Is this difference a bug or a feature?
>
> It's a bug, below is a patch for this feature. Using global variable the
> same patch only 6 rows length :)

"long long" is not portable.  We need a configure check for format
specification that would work with off_t.  Ideally, conversion to off_t
should be a separate patch.

I still don't understand how O_FTPREGET is supposed to work and why it's
needed.  It should be documented in a comment before O_FTPREGET.  I
remember is was discussed already.  There is a comment in vfs.h that
explains how reget should be implemented:

/* O_LINEAR is strange beast, be careful. If you open file asserting
 * O_RDONLY | O_LINEAR, you promise:
 *
 *      a) to read file linearly from beginning to the end
 *      b) not to open another file before you close this one
 *              (this will likely go away in future)
 *      as a special gift, you may
 *      c) lseek() immediately after open(), giving ftpfs chance to
 *         reget. Be warned that this lseek() can fail, and you _have_
 *         to handle that gratefully.
 *
 * O_LINEAR allows filesystems not to create temporary file in some
 * cases (ftp transfer).                                -- pavel at ucw.cz
 */

If lseek() after open() with O_LINEAR cannot be used, I'd like to see this
comment adjusted.

-- 
Regards,
Pavel Roskin



More information about the mc-devel mailing list