summaryrefslogtreecommitdiff
path: root/gio/gfile.c
AgeCommit message (Collapse)AuthorFilesLines
2013-04-19Add async version of g_file_make_directory()Sébastien Wilmet1-0/+111
https://bugzilla.gnome.org/show_bug.cgi?id=548353
2013-04-19GFile: fix the *_async_thread()Sébastien Wilmet1-57/+8
In the *_async_thread() functions, call the corresponding synchronous function instead of calling the interface vfunc, which can be NULL. In some cases the check for the vfunc == NULL was done, but to be consistent it is better to always call the synchronous version (and the code is simpler). https://bugzilla.gnome.org/show_bug.cgi?id=548353
2013-04-10Add async version of g_file_trash()Sébastien Wilmet1-0/+111
https://bugzilla.gnome.org/show_bug.cgi?id=548353
2013-04-10Add missing details in GFile documentationSébastien Wilmet1-0/+2
https://bugzilla.gnome.org/show_bug.cgi?id=548353
2013-03-25g_file_copy(): Ensure G_FILE_COPY_OVERWRITE preserves permissionsColin Walters1-7/+8
We need to close the stream *before* applying the file modes, because g_file_replace() allocates a temporary file. At the moment we're applying the modes to the extant file, then immediately rename()ing over it with the default perms. This regressed with commit 166766a89fcd173dcd6ffda11f902029928f7f28. The real fix here is to have g_file_create_with_info() so that we can atomically create a file with the permissions we want. https://bugzilla.gnome.org/show_bug.cgi?id=696014
2013-02-10Fix the build on SolarisMatthias Clasen1-3/+3
Make the btrfs support explicitly linux-only, as that is what it is. With this, there's no need anymore to check for sys/ioctl.h either. https://bugzilla.gnome.org/show_bug.cgi?id=692829
2013-01-29Add g_close(), use itColin Walters1-3/+12
There are two benefits to this: 1) We can centralize any operating system specific knowledge of close-vs-EINTR handling. For example, while on Linux we should never retry, if someone cared enough later about HP-UX, they could come by and change this one spot. 2) For places that do care about the return value and want to provide the caller with a GError, this function makes it convenient to do so. Note that gspawn.c had an incorrect EINTR loop-retry around close(). https://bugzilla.gnome.org/show_bug.cgi?id=682819
2013-01-27GFile: Clean up file_copy_fallback to fix SEGV with btrfsColin Walters1-64/+76
Ok, this function was just an awful mess before. Now the problem domain is not trivial, and I won't claim this new code is *beautiful*, but it should fix the bug at hand, and be somewhat less prone to failure for the next person who tries to modify it. There's only one unref call for each object now. https://bugzilla.gnome.org/show_bug.cgi?id=692408
2013-01-25gfile: Ensure we create internal pipe with FD_CLOEXECColin Walters1-6/+5
That way the descriptors aren't leaked to child processes. https://bugzilla.gnome.org/show_bug.cgi?id=692544
2013-01-21gfile: don't report completion twice on g_file_load_contents errorCosimo Cecchi1-4/+5
When an error occurs while reading the file input stream in g_file_load_contents (e.g. because the operation was cancelled), the code is correctly calling g_task_return_error(), but in the callback from the close operation, g_task_return_boolean() will be called again. Code that cleans up its state in the async callback will then be called twice, leading to invalid memory access. https://bugzilla.gnome.org/show_bug.cgi?id=692202
2013-01-05GFile: Add Btrfs clone ioctl supportNirbheek Chauhan1-9/+95
The attached patch adds support for the btrfs "clone" ioctl which makes Copy-on-Write reflinks, resulting in cheap O(1) copies when source/destination are on the same filesystem. The ioctl itself is quite straightforward, and GNU coreutils has had support since 7.5 (--reflink=auto --sparse=auto). The ioctl only operates on regular files and symlinks, and always follows symlinks; checks have been added accordingly. This patch would be very useful for everyone who uses btrfs filesystems (Meego folks for instance). On systems that don't have btrfs, or if the the source is not on a btrfs filesystem, the ioctl returns EINVAL, and the fallback code is triggered. Hence this will cause no problems for non-btrfs users. https://bugzilla.gnome.org/show_bug.cgi?id=626497
2012-12-19gio + inotify support for hard linksRyan Lortie1-1/+18
Add a new GFileMonitorFlag: G_FILE_MONITOR_WATCH_HARD_LINKS. When set, changes made to the file via another hard link will be detected. Implement the new flag for the inotify backend. https://bugzilla.gnome.org/show_bug.cgi?id=532815
2012-12-18gio: port file/vfs-related classes from GSimpleAsyncResult to GTaskDan Winship1-589/+344
https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-12-14docs: Fix return value of g_file_set_attributes_from_info()Tomas Bzatek1-1/+1
GIO API usually returns FALSE and sets GError when something went wrong and it was also the case of this method, just being badly documented.
2012-11-30g_file_enumerate_children: Fix reference to wrong error codeMatthias Clasen1-1/+1
This function does in fact return G_IO_ERROR_NOT_DIRETORY, and not G_FILE_ERROR_NOTDIR.
2012-11-27gio: New API for GFile from remote commandline argRyan Lortie1-16/+60
Add a pair of new APIs: one to GFile to create a new file from a commandline arg relative to a given cwd and one to GApplicationCommandLine to create a GFile from an arg, relative to the cwd of the invoking commandline. https://bugzilla.gnome.org/show_bug.cgi?id=689037
2012-10-10gio: deprecate gioscheduler, soft deprecate GSimpleAsyncResultDan Winship1-39/+28
Reimplement gioscheduler in terms of GTask, and deprecate the original gioscheduler methods. Update docs to point people to GTask rather than gioscheduler and GSimpleAsyncResult, but don't actually formally deprecate GSimpleAsyncResult yet. https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-09-23Fix gio docsMatthias Clasen1-1/+1
2012-09-03g_file_copy: plug a leakDan Winship1-0/+1
The fallback copy code was leaking the GFileInfo if it didn't have G_FILE_ATTRIBUTE_STANDARD_TYPE. https://bugzilla.gnome.org/show_bug.cgi?id=682560
2012-08-28GFile: Cosmetic doc changesMatthias Clasen1-2442/+2589
2012-08-16g_file_make_directory_with_parents: clean up logicOwen W. Taylor1-12/+10
Simplify logic by only looking at whether we have a GError and not also using return codes. https://bugzilla.gnome.org/show_bug.cgi?id=680823
2012-08-16g_file_make_directory_with_parents(): fix a corner caseOwen W. Taylor1-2/+3
If g_file_get_parent() unexpectedly failed, we could return FALSE but with no error. https://bugzilla.gnome.org/show_bug.cgi?id=680823
2012-08-16g_file_make_directory_with_parents: refix error propagationOwen W. Taylor1-4/+1
The patch from b0bce4ad triggered segfaults - see: http://redmine.yorba.org/issues/5656 We were clearing the error before dereferencing it in the next go-around of the while loop - this wasn't necessary. https://bugzilla.gnome.org/show_bug.cgi?id=680823
2012-07-30g_file_make_directory_with_parents: Fix error propagationOwen W. Taylor1-2/+4
When creating a directory fails for some reason other than the parent not existing, don't clear the error before we try to propagate it. To reproduce, run 'ostadmin init' on /ostree or otherwise try to run the function on a directory with a parent directory where the current user is not allowed to write. https://bugzilla.gnome.org/show_bug.cgi?id=680823
2012-07-30GFile: Note semantics of g_file_delete()Colin Walters1-2/+3
Particularly for someone programming on Unix, this helps them understand that we will unlink symbolic links, and not follow them.
2012-07-30GFile: Add g_file_delete_async()Colin Walters1-0/+118
This looks like it was stubbed out but not implemented; the vtable entry dates to commit 3781343738de4abddf56982325a77bd70a98cd26 which is just alex's initial merge of gio into glib. I was working on some code that wants an asynchronous rm -rf equivalent, and so yeah, this is desirable. https://bugzilla.gnome.org/show_bug.cgi?id=680760
2012-07-10gio: Add g_async_result_legacy_propagate_error()Dan Winship1-139/+50
Finish deprecating the "handle GSimpleAsyncResult errors in the wrapper function" idiom (and protect against future GSimpleAsyncResult deprecation warnings) by adding a "legacy" GAsyncResult method to do it in those classes/methods where it had been traditionally done. (This applies only to wrapper methods; in cases where an _async vmethod explicitly uses GSimpleAsyncResult, its corresponding _finish vmethod still uses g_simple_async_result_propagate_error.) https://bugzilla.gnome.org/show_bug.cgi?id=667375 https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-07-10gio: handle GSimpleAsyncResult errors in _finish vmethodsDan Winship1-1/+41
Originally, the standard idiom with GSimpleAsyncResult was to handle all errors in the _finish wrapper function, so that vmethods only had to deal with successful results. But this means that chaining up to a parent _finish vmethod won't work correctly. Fix this by also checking for errors in all the relevant vmethods. (We have to redundantly check in both the vmethod and the wrapper to preserve compatibility.) https://bugzilla.gnome.org/show_bug.cgi?id=667375 https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-07-10GFile: remove some unnecessary codeDan Winship1-15/+0
The "mainloop_barrier" in copy_async_thread() is unnecessary, since the g_simple_async_result_complete_in_idle() will be queued after all of the g_io_scheduler_job_send_to_mainloop_async()s, and sources with the same priority will run in the order in which they were queued. https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-05-21gio: The tmpl parameter to g_file_new_tmp can be NULLDebarshi Ray1-1/+0
Fixes: https://bugzilla.gnome.org/676208
2012-05-15gfile: add g_return_if_fail to g_file_make_directory_with_parents()Paolo Borelli1-0/+2
2012-05-15gfile: Plug memory leak in g_file_make_directory_with_parents()Colin Walters1-7/+16
The logic here is pretty twisted, but basically we were leaking a ref for each non-existent parent. The clearest way to fix this was to move to more explicit refcounting logic; when a variable is pointing to an object, it holds a ref. https://bugzilla.gnome.org/show_bug.cgi?id=675446
2012-04-05Fix malformed GTK-Doc comment blocks: add missing colons.Dieter Verfaillie1-1/+1
Found these thanks to improved gobject-introspection GTK-Doc comment block/annotation parser from: https://bugzilla.gnome.org/show_bug.cgi?id=672254 https://bugzilla.gnome.org/show_bug.cgi?id=673385
2012-03-31Add missing allow-none annotations for function parameters.Robert Ancell1-12/+12
Found using: find . -name '*.c' | xargs grep 'or %NULL' | grep ' \* @' | grep -v '@error' | grep -v allow-none
2012-02-26docs: g_file_new_tmp: template was renamed to tmplThomas Hindoe Paaboel Andersen1-1/+1
2012-01-11GIO: add lots of annotations for Vala bindingsEvan Nemerson1-9/+9
https://bugzilla.gnome.org/show_bug.cgi?id=667447
2011-12-10Add a since tagMatthias Clasen1-1/+3
2011-12-09gfile: Don't use C++ keyword "template" as variable nameColin Walters1-4/+4
This breaks autotestkeyword.cc from gtk+.
2011-12-09GFile: add g_file_new_tempThomas Hindoe Paaboel Andersen1-1/+53
A convenience function that creates a temporary file and returns a GFile and GFileIOStream for it. The file is created using g_file_open_tmp. https://bugzilla.gnome.org/show_bug.cgi?id=657085
2011-11-29Add missing annotation to g_file_set_attribute()Michael Vogt1-2/+2
g_file_set_attribute() also permits a NULL value for value_p, and requires it to be NULL to unset it. Also fix the wrong variable name in the documentation. Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
2011-11-20GFile: Add some introspection annotationsMatthias Clasen1-14/+16
progress_callback in g_file_copy and g_file_copy_async may be NULL. Annotations should reflect that. Pointed out by Carlo Teubner. https://bugzilla.gnome.org/show_bug.cgi?id=664415
2011-10-15Add two annotations to gioTorsten Schönfeld1-1/+1
https://bugzilla.gnome.org/show_bug.cgi?id=656679
2011-10-04[gio] Improve doc for g_file_make_directory_with_parents()Bastien Nocera1-1/+3
g_file_make_directory_with_parents() will fail for already existing directories, unlike g_mkdir_with_parents(), so mention this clearly in the docs. https://bugzilla.gnome.org/show_bug.cgi?id=660791
2011-09-29gfile: Be clear about freeing GFile objectsJavier Jardón1-3/+6
2011-08-29Spelling fixesMatthias Clasen1-2/+2
Spelling fixes in comments and docs, provided by Kjartan Maraas in bug 657336.
2011-07-26Docs: Correct the namespace for g_file_query_filesystem_info()Tomas Bzatek1-2/+2
2011-07-19Document how to unset attributesHolger Berndt1-0/+3
Unsetting won't work on all attributes. Currently, only metadata attributes are supported. https://bugzilla.gnome.org/show_bug.cgi?id=620423
2011-05-03Fix usage of _GNU_SOURCEDan Winship1-1/+0
_GNU_SOURCE must be defined before including any other (system) header, so defining it in glib-unix.h (and hoping no one has included anything else before that) is wrong. And the "#define _USE_GNU" workaround for this problem in gnetworkingprivate.h is even wronger (and still prone to failure anyway due to single-include guards). Fix this by defining _GNU_SOURCE in config.h when building against glibc. In theory this is bad because new releases of glibc may include symbols that conflict with glib symbols, which could then cause compile failures. However, most people only see new releases of glibc when they upgrade their distro, at which point they also generally get new releases of gcc, which have new warnings/errors to clean up anyway. https://bugzilla.gnome.org/show_bug.cgi?id=649201
2011-03-29introspection: add annotations for g_file_load_contents and friendsJonathan Matthew1-5/+5
https://bugzilla.gnome.org/show_bug.cgi?id=645789
2010-12-17[gi] Add annotations for GFile, G[File]{Input|Output|IO}Stream.Pavel Holejsovsky1-91/+92
Also make parameter names in virtual function declarations consistent to silent g-ir-scanner.