2 * CORBA/ORBit client side of File object of sandbox_parent()
3 * Copyright (C) 2003 Jan Kratochvil <project-captive@jankratochvil.net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; exactly version 2 of June 1991 is required
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "parent-File.h" /* self */
23 #include <glib/gmessages.h>
26 #include "../client/file.h"
27 #include "../client/vfs.h"
29 #include "captive/macros.h"
30 #include "reactos/ntos/types.h" /* for ULONG */
33 GnomeVFSResult captive_sandbox_parent_file_new_open(CaptiveFileParentObject *captive_file_parent_object)
35 xmlNode *xml_action=NULL;
36 CaptiveVfsParentObject *captive_vfs_parent_object;
38 Captive_File corba_File_object;
40 g_return_val_if_fail(CAPTIVE_FILE_PARENT_IS_OBJECT(captive_file_parent_object),GNOME_VFS_ERROR_BAD_PARAMETERS);
41 g_return_val_if_fail(captive_file_parent_object->pathname!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
43 captive_vfs_parent_object=CAPTIVE_VFS_PARENT_OBJECT(CAPTIVE_FILE_OBJECT(captive_file_parent_object)->vfs);
45 if (captive_vfs_parent_object->corba_bug_action) {
46 xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"file_new_open",NULL);
47 xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_file_parent_object));
48 xmlNewProp(xml_action,"pathname",captive_file_parent_object->pathname);
49 xmlNewProp(xml_action,"mode",captive_printf_alloca("%u",(unsigned)captive_file_parent_object->mode));
52 corba_File_object=Captive_Vfs_file_new_open(captive_vfs_parent_object->corba_Vfs_object,
53 captive_file_parent_object->pathname,captive_file_parent_object->mode,&captive_corba_ev);
55 xmlNewProp(xml_action,"result",(captive_corba_ev._major==CORBA_NO_EXCEPTION ? "1" : "0"));
56 /* If 'r' means failure 'corba_File_object' may not be 'CORBA_OBJECT_NIL'
57 * although it is not valid 'CORBA_Object' to be passed to CORBA_Object_release().
59 if (GNOME_VFS_OK!=(r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev,captive_vfs_parent_object)))
62 captive_file_parent_object->corba_File_object=corba_File_object;
67 GnomeVFSResult captive_sandbox_parent_file_new_create(CaptiveFileParentObject *captive_file_parent_object,
68 gboolean exclusive,guint perm)
70 xmlNode *xml_action=NULL;
71 CaptiveVfsParentObject *captive_vfs_parent_object;
73 Captive_File corba_File_object;
75 g_return_val_if_fail(CAPTIVE_FILE_PARENT_IS_OBJECT(captive_file_parent_object),GNOME_VFS_ERROR_BAD_PARAMETERS);
76 g_return_val_if_fail(captive_file_parent_object->pathname!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
78 captive_vfs_parent_object=CAPTIVE_VFS_PARENT_OBJECT(CAPTIVE_FILE_OBJECT(captive_file_parent_object)->vfs);
80 if (captive_vfs_parent_object->corba_bug_action) {
81 xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"file_new_create",NULL);
82 xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_file_parent_object));
83 xmlNewProp(xml_action,"pathname",captive_file_parent_object->pathname);
84 xmlNewProp(xml_action,"mode",captive_printf_alloca("%u",(unsigned)captive_file_parent_object->mode));
85 xmlNewProp(xml_action,"exclusive",captive_printf_alloca("%u",(unsigned)exclusive));
86 xmlNewProp(xml_action,"perm",captive_printf_alloca("%u",(unsigned)perm));
89 corba_File_object=Captive_Vfs_file_new_create(captive_vfs_parent_object->corba_Vfs_object,
90 captive_file_parent_object->pathname,captive_file_parent_object->mode,exclusive,perm,&captive_corba_ev);
92 xmlNewProp(xml_action,"result",(captive_corba_ev._major==CORBA_NO_EXCEPTION ? "1" : "0"));
93 /* If 'r' means failure 'corba_File_object' may not be 'CORBA_OBJECT_NIL'
94 * although it is not valid 'CORBA_Object' to be passed to CORBA_Object_release().
96 if (GNOME_VFS_OK!=(r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev,captive_vfs_parent_object)))
99 captive_file_parent_object->corba_File_object=corba_File_object;
104 GnomeVFSResult captive_sandbox_parent_file_close(CaptiveFileParentObject *captive_file_parent_object)
107 xmlNode *xml_action=NULL;
108 CaptiveVfsParentObject *captive_vfs_parent_object;
110 g_return_val_if_fail(CAPTIVE_FILE_PARENT_IS_OBJECT(captive_file_parent_object),GNOME_VFS_ERROR_BAD_PARAMETERS);
112 captive_vfs_parent_object=CAPTIVE_VFS_PARENT_OBJECT(CAPTIVE_FILE_OBJECT(captive_file_parent_object)->vfs);
114 if (captive_vfs_parent_object->corba_bug_action) {
115 xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"file_close",NULL);
116 xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_file_parent_object));
119 Captive_File_shutdown(captive_file_parent_object->corba_File_object,&captive_corba_ev);
120 r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev,captive_vfs_parent_object);
122 xmlNewProp(xml_action,"result",gnome_vfs_result_to_string(r));
124 /* Always clear 'corba_File_object' even if 'r' means failure. */
125 CORBA_Object_release((CORBA_Object)captive_file_parent_object->corba_File_object,&captive_corba_ev);
126 captive_file_parent_object->corba_File_object=CORBA_OBJECT_NIL;
132 static GnomeVFSResult captive_sandbox_parent_file_seek_slave
133 (CaptiveFileParentObject *captive_file_parent_object,GnomeVFSSeekPosition whence,GnomeVFSFileOffset offset);
135 GnomeVFSResult captive_sandbox_parent_file_read(CaptiveFileParentObject *captive_file_parent_object,
136 gpointer buffer_captive,GnomeVFSFileSize num_bytes,GnomeVFSFileSize *bytes_read_return)
139 Captive_Bytes *buffer_corba;
140 xmlNode *xml_action=NULL;
141 CaptiveVfsParentObject *captive_vfs_parent_object;
143 g_return_val_if_fail(CAPTIVE_FILE_PARENT_IS_OBJECT(captive_file_parent_object),GNOME_VFS_ERROR_BAD_PARAMETERS);
144 g_return_val_if_fail(buffer_captive!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
145 g_return_val_if_fail(bytes_read_return!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
146 g_return_val_if_fail(num_bytes==(ULONG)num_bytes,GNOME_VFS_ERROR_BAD_PARAMETERS);
148 captive_vfs_parent_object=CAPTIVE_VFS_PARENT_OBJECT(CAPTIVE_FILE_OBJECT(captive_file_parent_object)->vfs);
150 *bytes_read_return=0;
152 if (captive_vfs_parent_object->corba_bug_action) {
153 xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"file_read",NULL);
154 xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_file_parent_object));
155 xmlNewProp(xml_action,"num_bytes",captive_printf_alloca("%lu",(unsigned long)num_bytes));
158 r=captive_sandbox_parent_file_seek_slave(captive_file_parent_object,
159 GNOME_VFS_SEEK_START,captive_file_parent_object->offset);
160 if (r==GNOME_VFS_OK) {
161 Captive_File_read(captive_file_parent_object->corba_File_object,&buffer_corba,num_bytes,&captive_corba_ev);
162 r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev,captive_vfs_parent_object);
165 xmlNewProp(xml_action,"result",gnome_vfs_result_to_string(r));
169 g_return_val_if_fail(buffer_corba->_length<=num_bytes,GNOME_VFS_ERROR_GENERIC);
170 memcpy(buffer_captive,buffer_corba->_buffer,buffer_corba->_length);
171 *bytes_read_return=buffer_corba->_length;
172 captive_file_parent_object->offset+=buffer_corba->_length;
174 Captive_Bytes__freekids(buffer_corba,NULL/* 'd'; meaning? */);
175 CORBA_free(buffer_corba);
178 xmlNewProp(xml_action,"bytes_read_return",captive_printf_alloca("%lu",(unsigned long)*bytes_read_return));
184 GnomeVFSResult captive_sandbox_parent_file_write(CaptiveFileParentObject *captive_file_parent_object,
185 gconstpointer buffer_captive,GnomeVFSFileSize num_bytes,GnomeVFSFileSize *bytes_written_return)
188 Captive_Bytes buffer_corba_local;
189 Captive_GnomeVFSFileSize bytes_written_corba;
190 xmlNode *xml_action=NULL;
191 CaptiveVfsParentObject *captive_vfs_parent_object;
193 g_return_val_if_fail(CAPTIVE_FILE_PARENT_IS_OBJECT(captive_file_parent_object),GNOME_VFS_ERROR_BAD_PARAMETERS);
194 g_return_val_if_fail(buffer_captive!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
195 g_return_val_if_fail(bytes_written_return!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
196 g_return_val_if_fail(num_bytes==(ULONG)num_bytes,GNOME_VFS_ERROR_BAD_PARAMETERS);
198 captive_vfs_parent_object=CAPTIVE_VFS_PARENT_OBJECT(CAPTIVE_FILE_OBJECT(captive_file_parent_object)->vfs);
200 *bytes_written_return=0;
202 if (captive_vfs_parent_object->corba_bug_action) {
203 xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"file_write",NULL);
204 xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_file_parent_object));
205 xmlNewProp(xml_action,"num_bytes",captive_printf_alloca("%lu",(unsigned long)num_bytes));
208 r=captive_sandbox_parent_file_seek_slave(captive_file_parent_object,
209 GNOME_VFS_SEEK_START,captive_file_parent_object->offset);
210 if (r==GNOME_VFS_OK) {
211 buffer_corba_local._maximum=num_bytes;
212 buffer_corba_local._length=num_bytes;
213 buffer_corba_local._buffer=(/* de-const */gpointer)buffer_captive;
214 buffer_corba_local._release=FALSE;
216 Captive_File_write(captive_file_parent_object->corba_File_object,
217 &buffer_corba_local,&bytes_written_corba,&captive_corba_ev);
218 r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev,captive_vfs_parent_object);
221 xmlNewProp(xml_action,"result",gnome_vfs_result_to_string(r));
225 *bytes_written_return=bytes_written_corba;
226 captive_file_parent_object->offset+=bytes_written_corba;
229 xmlNewProp(xml_action,"bytes_written_return",captive_printf_alloca("%lu",(unsigned long)*bytes_written_return));
235 static GnomeVFSResult captive_sandbox_parent_file_seek_slave
236 (CaptiveFileParentObject *captive_file_parent_object,GnomeVFSSeekPosition whence,GnomeVFSFileOffset offset)
239 xmlNode *xml_action=NULL;
240 CaptiveVfsParentObject *captive_vfs_parent_object;
242 g_return_val_if_fail(CAPTIVE_FILE_PARENT_IS_OBJECT(captive_file_parent_object),GNOME_VFS_ERROR_BAD_PARAMETERS);
244 captive_vfs_parent_object=CAPTIVE_VFS_PARENT_OBJECT(CAPTIVE_FILE_OBJECT(captive_file_parent_object)->vfs);
246 if (captive_vfs_parent_object->corba_bug_action) {
247 xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"file_seek",NULL);
248 xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_file_parent_object));
249 xmlNewProp(xml_action,"whence",
250 (whence==GNOME_VFS_SEEK_START ? "start" :
251 (whence==GNOME_VFS_SEEK_CURRENT ? "current" :
252 (whence==GNOME_VFS_SEEK_END ? "end" : captive_printf_alloca("%lu",(unsigned long)whence)))));
253 xmlNewProp(xml_action,"offset",captive_printf_alloca("%" G_GINT64_FORMAT,(gint64)offset));
256 Captive_File_seek(captive_file_parent_object->corba_File_object,whence,offset,&captive_corba_ev);
257 r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev,captive_vfs_parent_object);
259 xmlNewProp(xml_action,"result",gnome_vfs_result_to_string(r));
267 GnomeVFSResult captive_sandbox_parent_file_seek
268 (CaptiveFileParentObject *captive_file_parent_object,GnomeVFSSeekPosition whence,GnomeVFSFileOffset offset)
271 xmlNode *xml_action=NULL;
272 CaptiveVfsParentObject *captive_vfs_parent_object;
274 g_return_val_if_fail(CAPTIVE_FILE_PARENT_IS_OBJECT(captive_file_parent_object),GNOME_VFS_ERROR_BAD_PARAMETERS);
276 captive_vfs_parent_object=CAPTIVE_VFS_PARENT_OBJECT(CAPTIVE_FILE_OBJECT(captive_file_parent_object)->vfs);
278 if (captive_vfs_parent_object->corba_bug_action) {
279 xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"file_seek",NULL);
280 xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_file_parent_object));
281 xmlNewProp(xml_action,"whence",
282 (whence==GNOME_VFS_SEEK_START ? "start" :
283 (whence==GNOME_VFS_SEEK_CURRENT ? "current" :
284 (whence==GNOME_VFS_SEEK_END ? "end" : captive_printf_alloca("%lu",(unsigned long)whence)))));
285 xmlNewProp(xml_action,"offset",captive_printf_alloca("%" G_GINT64_FORMAT,(gint64)offset));
289 case GNOME_VFS_SEEK_START:
290 captive_file_parent_object->offset=offset;
293 case GNOME_VFS_SEEK_CURRENT:
295 || (offset>0 && (captive_file_parent_object->offset+offset)<captive_file_parent_object->offset)
296 || (offset<0 && (captive_file_parent_object->offset+offset)>captive_file_parent_object->offset))
297 r=GNOME_VFS_ERROR_BAD_PARAMETERS;
299 captive_file_parent_object->offset+=offset;
303 case GNOME_VFS_SEEK_END:
304 g_assert_not_reached(); /* NOT IMPLEMENTED YET */
305 r=GNOME_VFS_ERROR_GENERIC;
308 r=GNOME_VFS_ERROR_BAD_PARAMETERS;
312 xmlNewProp(xml_action,"result",gnome_vfs_result_to_string(r));
321 static GnomeVFSResult captive_sandbox_parent_file_tell_slave
322 (CaptiveFileParentObject *captive_file_parent_object,GnomeVFSFileOffset *offset_return)
324 Captive_GnomeVFSFileOffset offset_corba;
326 xmlNode *xml_action=NULL;
327 CaptiveVfsParentObject *captive_vfs_parent_object;
329 g_return_val_if_fail(CAPTIVE_FILE_PARENT_IS_OBJECT(captive_file_parent_object),GNOME_VFS_ERROR_BAD_PARAMETERS);
330 g_return_val_if_fail(offset_return!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
332 captive_vfs_parent_object=CAPTIVE_VFS_PARENT_OBJECT(CAPTIVE_FILE_OBJECT(captive_file_parent_object)->vfs);
334 if (captive_vfs_parent_object->corba_bug_action) {
335 xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"file_tell",NULL);
336 xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_file_parent_object));
339 Captive_File_tell(captive_file_parent_object->corba_File_object,&offset_corba,&captive_corba_ev);
340 r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev,captive_vfs_parent_object);
342 xmlNewProp(xml_action,"result",gnome_vfs_result_to_string(r));
346 *offset_return=offset_corba;
349 xmlNewProp(xml_action,"offset_return",captive_printf_alloca("%" G_GINT64_FORMAT,(gint64)*offset_return));
356 GnomeVFSResult captive_sandbox_parent_file_tell(CaptiveFileParentObject *captive_file_parent_object,GnomeVFSFileOffset *offset_return)
359 xmlNode *xml_action=NULL;
360 CaptiveVfsParentObject *captive_vfs_parent_object;
362 g_return_val_if_fail(CAPTIVE_FILE_PARENT_IS_OBJECT(captive_file_parent_object),GNOME_VFS_ERROR_BAD_PARAMETERS);
363 g_return_val_if_fail(offset_return!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
365 captive_vfs_parent_object=CAPTIVE_VFS_PARENT_OBJECT(CAPTIVE_FILE_OBJECT(captive_file_parent_object)->vfs);
367 if (captive_vfs_parent_object->corba_bug_action) {
368 xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"file_tell",NULL);
369 xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_file_parent_object));
372 *offset_return=captive_file_parent_object->offset;
375 xmlNewProp(xml_action,"result",gnome_vfs_result_to_string(r));
380 xmlNewProp(xml_action,"offset_return",captive_printf_alloca("%" G_GINT64_FORMAT,(gint64)*offset_return));
386 GnomeVFSResult captive_sandbox_parent_file_remove(CaptiveFileParentObject *captive_file_parent_object)
389 xmlNode *xml_action=NULL;
390 CaptiveVfsParentObject *captive_vfs_parent_object;
392 g_return_val_if_fail(CAPTIVE_FILE_PARENT_IS_OBJECT(captive_file_parent_object),GNOME_VFS_ERROR_BAD_PARAMETERS);
394 captive_vfs_parent_object=CAPTIVE_VFS_PARENT_OBJECT(CAPTIVE_FILE_OBJECT(captive_file_parent_object)->vfs);
396 if (captive_vfs_parent_object->corba_bug_action) {
397 xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"file_remove",NULL);
398 xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_file_parent_object));
401 Captive_File_remove(captive_file_parent_object->corba_File_object,&captive_corba_ev);
402 r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev,captive_vfs_parent_object);
404 xmlNewProp(xml_action,"result",gnome_vfs_result_to_string(r));
412 GnomeVFSResult captive_sandbox_parent_file_file_info_get(CaptiveFileParentObject *captive_file_parent_object,
413 GnomeVFSFileInfo *file_info_captive)
415 Captive_GnomeVFSFileInfo *file_info_corba;
417 xmlNode *xml_action=NULL;
418 CaptiveVfsParentObject *captive_vfs_parent_object;
420 g_return_val_if_fail(CAPTIVE_FILE_PARENT_IS_OBJECT(captive_file_parent_object),GNOME_VFS_ERROR_BAD_PARAMETERS);
421 g_return_val_if_fail(file_info_captive!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
423 captive_vfs_parent_object=CAPTIVE_VFS_PARENT_OBJECT(CAPTIVE_FILE_OBJECT(captive_file_parent_object)->vfs);
425 if (captive_vfs_parent_object->corba_bug_action) {
426 xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"file_file_info_get",NULL);
427 xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_file_parent_object));
430 Captive_File_file_info_get(captive_file_parent_object->corba_File_object,&file_info_corba,&captive_corba_ev);
431 r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev,captive_vfs_parent_object);
433 xmlNewProp(xml_action,"result",gnome_vfs_result_to_string(r));
437 r=captive_sandbox_file_info_corba_to_captive(file_info_captive,file_info_corba);
438 Captive_GnomeVFSFileInfo__freekids(file_info_corba,NULL/* 'd'; meaning? */);
439 CORBA_free(file_info_corba);
441 xmlSetProp(xml_action,"result",gnome_vfs_result_to_string(r));
449 GnomeVFSResult captive_sandbox_parent_file_file_info_set(CaptiveFileParentObject *captive_file_parent_object,
450 const GnomeVFSFileInfo *file_info_captive,GnomeVFSSetFileInfoMask mask)
452 Captive_GnomeVFSFileInfo file_info_corba;
454 xmlNode *xml_action=NULL;
455 CaptiveVfsParentObject *captive_vfs_parent_object;
457 g_return_val_if_fail(CAPTIVE_FILE_PARENT_IS_OBJECT(captive_file_parent_object),GNOME_VFS_ERROR_BAD_PARAMETERS);
458 g_return_val_if_fail(file_info_captive!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
460 captive_vfs_parent_object=CAPTIVE_VFS_PARENT_OBJECT(CAPTIVE_FILE_OBJECT(captive_file_parent_object)->vfs);
462 if (captive_vfs_parent_object->corba_bug_action) {
463 xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"file_file_info_set",NULL);
464 xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_file_parent_object));
465 xmlNewProp(xml_action,"mask",captive_printf_alloca("%u",(unsigned)mask));
468 if (GNOME_VFS_OK!=(r=captive_sandbox_file_info_set_mask_captive_to_corba(&file_info_corba,file_info_captive,mask)))
471 Captive_File_file_info_set(captive_file_parent_object->corba_File_object,&file_info_corba,mask,&captive_corba_ev);
472 r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev,captive_vfs_parent_object);
474 xmlNewProp(xml_action,"result",gnome_vfs_result_to_string(r));
478 Captive_GnomeVFSFileInfo__freekids(&file_info_corba,NULL/* 'd'; meaning? */);
484 GnomeVFSResult captive_sandbox_parent_file_truncate(CaptiveFileParentObject *captive_file_parent_object,GnomeVFSFileSize file_size)
487 xmlNode *xml_action=NULL;
488 CaptiveVfsParentObject *captive_vfs_parent_object;
490 g_return_val_if_fail(CAPTIVE_FILE_PARENT_IS_OBJECT(captive_file_parent_object),GNOME_VFS_ERROR_BAD_PARAMETERS);
492 captive_vfs_parent_object=CAPTIVE_VFS_PARENT_OBJECT(CAPTIVE_FILE_OBJECT(captive_file_parent_object)->vfs);
494 if (captive_vfs_parent_object->corba_bug_action) {
495 xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"file_truncate",NULL);
496 xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_file_parent_object));
497 xmlNewProp(xml_action,"file_size",captive_printf_alloca("%" G_GUINT64_FORMAT,(guint64)file_size));
500 Captive_File_truncate(captive_file_parent_object->corba_File_object,file_size,&captive_corba_ev);
501 r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev,captive_vfs_parent_object);
503 xmlNewProp(xml_action,"result",gnome_vfs_result_to_string(r));
511 GnomeVFSResult captive_sandbox_parent_file_move
512 (CaptiveFileParentObject *captive_file_parent_object_old,const gchar *pathname_new,gboolean force_replace)
515 xmlNode *xml_action=NULL;
516 CaptiveVfsParentObject *captive_vfs_parent_object;
518 g_return_val_if_fail(captive_file_parent_object_old!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
519 g_return_val_if_fail(pathname_new!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
521 captive_vfs_parent_object=CAPTIVE_VFS_PARENT_OBJECT(CAPTIVE_FILE_OBJECT(captive_file_parent_object_old)->vfs);
523 if (captive_vfs_parent_object->corba_bug_action) {
524 xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"file_truncate",NULL);
525 xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_file_parent_object_old));
526 xmlNewProp(xml_action,"pathname_new",pathname_new);
527 xmlNewProp(xml_action,"force_replace",captive_printf_alloca("%u",(unsigned)force_replace));
530 Captive_File_move(captive_file_parent_object_old->corba_File_object,pathname_new,force_replace,&captive_corba_ev);
531 r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev,captive_vfs_parent_object);
533 xmlNewProp(xml_action,"result",gnome_vfs_result_to_string(r));