After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 123414 - Need gnome_vfs_async_seek ()
Need gnome_vfs_async_seek ()
Status: RESOLVED FIXED
Product: gnome-vfs
Classification: Deprecated
Component: File operations
cvs (head)
Other Linux
: Normal normal
: 2.6
Assigned To: gnome-vfs maintainers
gnome-vfs maintainers
Depends on:
Blocks: 40870
 
 
Reported: 2003-09-28 13:56 UTC by Manuel Clos
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch agains HEAD that implements gnome_vfs_async_seek () (7.66 KB, patch)
2003-10-05 20:56 UTC, Manuel Clos
none Details | Review
Updated patch (7.90 KB, patch)
2003-10-14 22:00 UTC, Manuel Clos
none Details | Review
updated patch (8.03 KB, patch)
2003-10-18 17:29 UTC, Manuel Clos
none Details | Review

Description Manuel Clos 2003-09-28 13:56:49 UTC
You can currently async_open and async_read an uri, but you can't
async_seek it.
Comment 1 Manuel Clos 2003-10-05 18:26:12 UTC
Working on this now.
Comment 2 Manuel Clos 2003-10-05 20:56:09 UTC
Created attachment 20483 [details] [review]
Patch agains HEAD that implements gnome_vfs_async_seek ()
Comment 3 Manuel Clos 2003-10-05 20:57:55 UTC
Adding PATCH keyword.

It resulted to be pretty easy to do, because gnome_vfs code is clean
and well structured.

Can anyone review this please?
Comment 4 Manuel Clos 2003-10-14 22:00:15 UTC
Created attachment 20707 [details] [review]
Updated patch
Comment 5 Manuel Clos 2003-10-14 22:01:42 UTC
The previous patch was not working because it was missing a case in
_get_job_completed().

This version has been tested in downman with both ftp and http and
works well.

Please, review.
Comment 6 Christophe Fergeau 2003-10-15 12:08:12 UTC
I started to look at that patch, but need to spend more time on it. A
few first glance comments:
* you forgot to add "seek" in job_debug_types[], this probably breaks
the JOB_DEBUG_TYPE macro since you modified the corresponding enum
* you should handle GNOME_VFS_OP_SEEK in gnome_vfs_op_destroy and
_gnome_vfs_job_destroy_notify_result since all the other operation
types are there
Will look at it more in details at a later point :)
Comment 7 Manuel Clos 2003-10-15 20:49:47 UTC
> * you forgot to add "seek" in job_debug_types[], this probably breaks
> the JOB_DEBUG_TYPE macro since you modified the corresponding enum

Yes, I that didn't got in the patch, I forgot, sorry.

> * you should handle GNOME_VFS_OP_SEEK in gnome_vfs_op_destroy
> and _gnome_vfs_job_destroy_notify_result since all the other operation
> types are there

They are both being handled, just that the SEEK operation does not
need to do anything special there. I have revised it and I don't see
nothing that needs to be destroyed/unref/freed.

> Will look at it more in details at a later point :)
Great
Comment 8 Christophe Fergeau 2003-10-15 21:16:37 UTC
>They are both being handled, just that the SEEK operation does not
>need to do anything special there. I have revised it and I don't see
>nothing that needs to be destroyed/unref/freed.

I'm not implying you should be doing something, just that it should be
there for consistency, for example there currently is:

	case GNOME_VFS_OP_XFER:
		/* the XFER result is allocated on the stack */
		break;
or
	case GNOME_VFS_OP_READ:
	case GNOME_VFS_OP_WRITE:
	case GNOME_VFS_OP_CLOSE:
	case GNOME_VFS_OP_READ_WRITE_DONE:
		break;

I agree, this is totally unimportant ;)
Comment 9 Manuel Clos 2003-10-15 22:12:31 UTC
The "case GNOME_VFS_OP_SEEK" is there, look at the patch attachment in
bugzilla. Perhaps it didn't applied cleanly?
Comment 10 Christophe Fergeau 2003-10-15 22:32:23 UTC
Hmm yeah, I looked at the patch without applying it during lunch break
and managed to miss those two chunks, sorry about that
Comment 11 Christophe Fergeau 2003-10-18 00:39:25 UTC
I looked at it some more, and the 
 	case GNOME_VFS_OP_CREATE_AS_CHANNEL:
 	case GNOME_VFS_OP_CREATE_SYMBOLIC_LINK:
+	case GNOME_VFS_OP_SEEK:
 		/* if job got cancelled, no close expected */
 		return job->cancelled || job->failed;
and
+	if (result != GNOME_VFS_OK) {
+		/* if the seek failed, just drop the job */
+		job->failed = TRUE;
+	}

part doesn't feel right. I don't think you want to remove the job from
the job map when a seek fails, otherwise things like subsequent seeks
with the same handle will also fail. I'm quite new to this async code,
so forgive me if I'm wrong once again ;)
Comment 12 Manuel Clos 2003-10-18 15:15:26 UTC
+	case GNOME_VFS_OP_SEEK:
 		/* if job got cancelled, no close expected */
 		return job->cancelled || job->failed;

Yes, you are right. This was only change in the second patch.
Obviously it was working for me because this usually returns FALSE.

I have modified the code to always return FALSE, but I still have one
doubt:

        case GNOME_VFS_OP_READ:
        case GNOME_VFS_OP_WRITE:
                g_assert_not_reached();
                return FALSE;

it looks that job_complete will not be called for read and write,
what's the reason? does this reason apply to seek?

and
+	if (result != GNOME_VFS_OK) {
+		/* if the seek failed, just drop the job */
+		job->failed = TRUE;
+	}

Yes, you are right again. I based the the code on "open". So this must
just be removed from the patch.

I will send an updated patch when you finish finding bugs :)
Comment 13 Christophe Fergeau 2003-10-18 16:06:02 UTC
When the job is completing, op->type contains
GNOME_VFS_OP_READ_WRITE_DONE, it can no longer contain GNOME_VFS_OP_READ
or GNOME_VFS_OP_WRITE (see the end of execute_read and execute_write)
Comment 14 Christophe Fergeau 2003-10-18 16:06:39 UTC
Btw, you can attach an updated patch, I have stopped looking at this
one for now and am reviewing the ftp seek one
Comment 15 Manuel Clos 2003-10-18 17:29:37 UTC
Created attachment 20778 [details] [review]
updated patch
Comment 16 Manuel Clos 2003-10-18 17:30:51 UTC
Changes in the last patch:

- added "seek" bug string
- always return FALSE on job_complete
- if seek does not succeed, don't mark the job failed, as the handle
must continue to be valid
Comment 17 Christophe Fergeau 2003-10-20 11:57:06 UTC
Committed (I removed two unused fields from GnomeVFSSeekOpResult
(whence and offset). Thanks for the hard work :)
Comment 18 Manuel Clos 2003-10-20 12:39:27 UTC
Umh, thanks for the excellent reviews :)