1 /***************************************************************************
2  * CVSID: $Id: hal-storage-mount.c,v 1.7 2006/06/21 00:44:03 david Exp $
3  *
4  * hal-storage-mount.c : Mount wrapper
5  *
6  * Copyright (C) 2006 David Zeuthen, <david@fubar.dk>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21  *
22  **************************************************************************/
23 
24 #ifndef HAL_STORAGE_SHARED_H
25 #define HAL_STORAGE_SHARED_H
26 
27 #include <libhal.h>
28 #include <libhal-storage.h>
29 #ifdef HAVE_POLKIT
30 #include <libpolkit.h>
31 #endif
32 #ifdef sun
33 #include <bsm/adt.h>
34 #include <bsm/adt_event.h>
35 #include "../utils/adt_data.h"
36 #endif
37 
38 /*#define DEBUG*/
39 #define DEBUG
40 
41 gboolean mtab_open (gpointer *handle);
42 char *mtab_next (gpointer handle, char **mount_point);
43 void mtab_close (gpointer handle);
44 
45 gboolean fstab_open (gpointer *handle);
46 char *fstab_next (gpointer handle, char **mount_point);
47 void fstab_close (gpointer handle);
48 
49 gboolean lock_hal_mtab (void);
50 void unlock_hal_mtab (void);
51 
52 void unknown_error (const char *detail);
53 
54 void handle_unmount (LibHalContext *hal_ctx,
55 #ifdef HAVE_POLKIT
56 		     LibPolKitContext *pol_ctx,
57 #endif
58 		     const char *udi,
59 		     LibHalVolume *volume, LibHalDrive *drive, const char *device,
60 		     const char *invoked_by_uid, const char *invoked_by_syscon_name,
61 		     gboolean option_lazy, gboolean option_force,
62 		     DBusConnection *system_bus);
63 
64 void handle_eject (LibHalContext *hal_ctx,
65 #ifdef HAVE_POLKIT
66 		   LibPolKitContext *pol_ctx,
67 #endif
68 		   const char *udi,
69 		   LibHalDrive *drive, const char *device,
70 		   const char *invoked_by_uid, const char *invoked_by_syscon_name,
71 		   gboolean closetray, DBusConnection *system_bus);
72 
73 #ifdef sun
74 char *auth_from_privilege(const char *privilege);
75 void audit_volume(const adt_export_data_t *imported_state, au_event_t event_id, int result,
76     const char *auth_used, const char *mount_point, const char *device, const char *options);
77 #endif /* sun */
78 
79 #endif /* HAL_STORAGE_SHARED_H */
80 
81