patch: reget working again [Re: Reget: bug or feature?]
Alexander Savelyev
i at fano.com.ua
Sun Jan 25 13:44:40 UTC 2004
Pavel Roskin wrote:
> 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.
fixed
> 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's necessary because FTP protocol supposes use seek (command REST)
only before open (command RETR).
We from ftpfs_open_data_connection have no access to (FileOpContext)ctx
(ctx->reget) and we should transfer it by a call mc_open from
copy_file_file for vfs_s_open where is called linear_start.
copy_file_file -> mc_open -> vfs_s_open -> linear_start
(ftpfs_linear_start) -> ftpfs_open_data_connection (ftp command "REST
offset")
> 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:
I read it.
> /* 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.
c) is wrong
> *
> * 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.
>
adjusted.
patch below.
--
~.
Alexander
>>> mailto:i at fano.com.ua
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diff.mc
URL: <http://lists.midnight-commander.org/pipermail/mc-devel/attachments/20040125/fa148018/attachment.ksh>
More information about the mc-devel
mailing list