Re: semantics of gnome_vfs_get_file_info_from_handle



On 3 Feb 2003, Colin Walters wrote:

> Is it just me, or does anyone else find the semantics of
> gnome_vfs_get_file_info_from_handle not useful?
> 
> What I want is for it to retrieve information collected during the
> handle creation.  For example, the HTTP method parses the HTTP headers
> like Content-Type, and stores that information in
> handle->file_info->mime_type.  However, the implementation
> do_get_file_info_from_handle makes an entirely new HTTP request!  This
> is not what I want.
> 
> Here is sample code which should illustrate this:
> 
> GnomeVFSHandle *handle;
> GnomeVFSInfo *info;
> gnome_vfs_open_uri (&handle, "http://blaat.com/";, GNOME_VFS_OPEN_READ);
> info = gnome_vfs_file_info_new ();
> gnome_vfs_get_file_info_from_handle (src->handle, info, GNOME_VFS_FILE_INFO_DEFAULT);
> 
> All I really want to do is extract that Content-Type information
> gathered during the HTTP request without wastefully making another.
> 
> The file method seems to do much the same thing.  In its "do_open" call,
> it does actually run fstat, but throws away all the information gained. 
> Its do_get_file_info_from_handle method makes *another* fstat call.
> 
> I think we should change the semantics of
> gnome_vfs_get_file_info_from_handle to make it conceptually a "fast"
> operation; i.e. it will work from whatever information the module handle
> currently has.  Applications which want to do a full "stat" type thing
> can just use the _uri method.
> 
> Alternatively...we could create a new method to do just this.
> 
> What do you think?

I dunno. This is basically a uri based stat and fstat. fstat still does 
the same i/o that stat does. Only it doesn't have to do the pathname 
lookup.

Do you want it to keep reporting the same size as on open always too?

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a superhumanly strong guerilla cyborg from the Mississippi delta. She's 
an artistic red-headed snake charmer from out of town. They fight crime! 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]