2 * CORBA/ORBit server side of Vfs object, ran by sandbox_child()
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 "server-Vfs.h" /* self */
23 #include "server-GlibLogFunc.h" /* for impl_Captive_Vfs_registerGlibLogFunc() */
25 #include <glib/gmessages.h>
26 #include "captive/macros.h"
27 #include "server-Directory.h"
28 #include "server-File.h"
32 static void impl_Captive_Vfs_shutdown(impl_POA_Captive_Vfs *servant,CORBA_Environment *ev);
34 static PortableServer_ServantBase__epv impl_Captive_Vfs_base_epv={
35 NULL, /* _private data */
36 NULL, /* finalize routine */
37 NULL, /* default_POA routine */
39 static POA_Captive_Vfs__epv impl_Captive_Vfs_epv={
41 (gpointer)&impl_Captive_Vfs_registerGlibLogFunc,
42 (gpointer)&impl_Captive_Vfs_shutdown,
43 (gpointer)&impl_Captive_Vfs_directory_new_open,
44 (gpointer)&impl_Captive_Vfs_directory_new_make,
45 (gpointer)&impl_Captive_Vfs_file_new_open,
46 (gpointer)&impl_Captive_Vfs_file_new_create,
48 static POA_Captive_Vfs__vepv impl_Captive_Vfs_vepv={
49 &impl_Captive_Vfs_base_epv,
50 &impl_Captive_Vfs_epv,
54 struct captive_options *captive_corba_child_options;
57 Captive_Vfs impl_Captive_Vfs__create(PortableServer_POA poa,CORBA_Environment *ev)
60 impl_POA_Captive_Vfs *newservant;
61 PortableServer_ObjectId *objid;
62 GnomeVFSResult errvfsresult;
64 captive_new0(newservant); /* FIXME: leak */
65 newservant->servant.vepv=&impl_Captive_Vfs_vepv;
67 if (GNOME_VFS_OK!=(errvfsresult=captive_vfs_new(&newservant->captive_vfs_object,captive_corba_child_options))) {
69 CORBA_exception_set(ev,CORBA_USER_EXCEPTION,ex_Captive_GnomeVFSResultException,GINT_TO_POINTER((gint)errvfsresult));
72 POA_Captive_Vfs__init((PortableServer_Servant)newservant,ev);
73 objid=PortableServer_POA_activate_object(poa,newservant,ev);
75 retval=PortableServer_POA_servant_to_reference(poa,newservant,ev);
81 static gboolean impl_Captive_Vfs_shutdown_idle(gpointer data /* unused */)
83 sandbox_child_shutdown();
85 return FALSE; /* remove me */
88 static void impl_Captive_Vfs_shutdown(impl_POA_Captive_Vfs *servant,CORBA_Environment *ev)
90 /* Do not call sandbox_child_shutdown() directly as we would fail
91 * to finish this CORBA method call properly.
94 G_PRIORITY_LOW, /* priority */
95 impl_Captive_Vfs_shutdown_idle, /* function */