Initial original import from: fuse-2.4.2-2.fc4
[captive.git] / src / libcaptive / io / device.c
1 /* $Id$
2  * reactos devices management of libcaptive
3  * Copyright (C) 2003 Jan Kratochvil <project-captive@jankratochvil.net>
4  * 
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
8  * 
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.
13  * 
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
17  */
18
19
20 #include "config.h"
21
22 #include "reactos/ddk/iofuncs.h"        /* self */
23 #include <glib/gmessages.h>
24
25
26 /* Driver in fs module loaded by captive_w32_init().
27  * Located in: libcaptive/client/init.c
28  */
29 extern DRIVER_OBJECT captive_DriverObject;
30 extern PDRIVER_REINITIALIZE captive_DriverObject_ReinitRoutine;
31 extern PVOID captive_DriverObject_ReinitRoutine_Context;
32
33
34 /**
35  * IoRegisterDriverReinitialization:
36  * @DriverObject: #DRIVER_OBJECT of the driver registering @ReinitRoutine.
37  * Exact unique #captive_DriverObject structure address required by libcaptive.
38  * @ReinitRoutine: Function to be later called back.
39  * %NULL value is forbidden.
40  * @Context: Arbitrary argument of @ReinitRoutine to be passed along.
41  * %NULL value is permitted.
42  *
43  * Register function to be called after the current initialization
44  * route of the filesystem returned.
45  *
46  * Initialization routine may call this function at most once.
47  * The callbacked @ReinitRoutine is allowed to call this function again
48  * ad infinitum.
49  */
50 VOID IoRegisterDriverReinitialization(PDRIVER_OBJECT DriverObject,PDRIVER_REINITIALIZE ReinitRoutine,PVOID Context)
51 {
52         g_return_if_fail(DriverObject!=NULL);
53         g_return_if_fail(ReinitRoutine!=NULL);
54
55         /* libcaptive supports exactly one filesystem driver */
56         g_return_if_fail(DriverObject==&captive_DriverObject);
57
58         /* This function may be called at most once. */
59         g_return_if_fail(captive_DriverObject_ReinitRoutine==NULL);
60
61         captive_DriverObject_ReinitRoutine=ReinitRoutine;
62         captive_DriverObject_ReinitRoutine_Context=Context;
63 }