smbfs seek support
Andrew V. Samoilov
sav at bcs.zp.ua
Wed Feb 19 12:59:55 UTC 2003
Andrew V. Samoilov wrote:
> Hello Pavel and Olecom!
>
> Pavel Roskin wrote:
>
>> Hello!
>>
>>
>>> May I present me as little coding animal.
>>
>>
>>
>> :-)
>>
>>
>>> It's very useful patch for smbfs users. It's very little - but
>>> powerful against windoze smb-kik programs.
>
>
> Olecom, can you test backported version of this function?
> ------------------------------------------------------------------------
>
> ChangeLog:
>
> * smbfs.c (smbfs_lseek): Backport from Samba 2.2 Suite.
>
> diff -u mc/vfs/smbfs.c~ mc/vfs/smbfs.c~
> --- mc/vfs/smbfs.c~ Fri Sep 13 07:29:35 2002
> +++ mc/vfs/smbfs.c Tue Sep 24 11:26:55 2002
> @@ -1550,9 +1567,34 @@ smbfs_stat (vfs *me, char *path, struct
> static int
> smbfs_lseek (void *data, off_t offset, int whence)
> {
> - DEBUG(3, ("smbfs_lseek()\n"));
> - my_errno = EOPNOTSUPP;
> - return -1;
> + smbfs_handle *info = (smbfs_handle *) data;
> + size_t size;
> +
> + DEBUG (3,
> + ("smbfs_lseek(info->nread => %d, offset => %d, whence => %d) \n",
> + (int) info->nread, (int) offset, whence));
> +
> + switch (whence) {
> + case SEEK_SET:
> + info->nread = offset;
> + break;
> + case SEEK_CUR:
> + info->nread += offset;
> + break;
> + case SEEK_END:
> + if (!cli_qfileinfo (info->cli, info->fnum,
> + NULL, &size, NULL, NULL, NULL,
> + NULL, NULL) &&
> + !cli_getattrE (info->cli, info->fnum,
> + NULL, &size, NULL, NULL, NULL)) {
> + errno = EINVAL;
> + return -1;
> + }
> + info->nread = size + offset;
> + break;
> + }
> +
> + return info->nread;
> }
>
> static int
Commited to CVS as far as 3 AIX warning fixes.
--
Regards,
Andrew V. Samoilov
More information about the mc-devel
mailing list