xref: /titanic_52/usr/src/cmd/hal/tools/hal-storage-shared.h (revision c2580b931007758eab8cb5ae8726ebe1588e259b)
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 #endif
36 
37 /*#define DEBUG*/
38 #define DEBUG
39 
40 gboolean mtab_open (gpointer *handle);
41 char *mtab_next (gpointer handle, char **mount_point);
42 void mtab_close (gpointer handle);
43 
44 gboolean fstab_open (gpointer *handle);
45 char *fstab_next (gpointer handle, char **mount_point);
46 void fstab_close (gpointer handle);
47 
48 gboolean lock_hal_mtab (void);
49 void unlock_hal_mtab (void);
50 
51 void unknown_error (const char *detail);
52 
53 void handle_unmount (LibHalContext *hal_ctx,
54 #ifdef HAVE_POLKIT
55 		     LibPolKitContext *pol_ctx,
56 #endif
57 		     const char *udi,
58 		     LibHalVolume *volume, LibHalDrive *drive, const char *device,
59 		     const char *invoked_by_uid, const char *invoked_by_syscon_name,
60 		     gboolean option_lazy, gboolean option_force,
61 		     DBusConnection *system_bus);
62 
63 void handle_eject (LibHalContext *hal_ctx,
64 #ifdef HAVE_POLKIT
65 		   LibPolKitContext *pol_ctx,
66 #endif
67 		   const char *udi,
68 		   LibHalDrive *drive, const char *device,
69 		   const char *invoked_by_uid, const char *invoked_by_syscon_name,
70 		   gboolean closetray, DBusConnection *system_bus);
71 
72 #ifdef sun
73 char *auth_from_privilege(const char *privilege);
74 adt_export_data_t *get_audit_export_data(DBusConnection *bus, const char *invoked_by_syscon_name,
75     size_t *data_size);
76 void audit_volume(const adt_export_data_t *imported_state, au_event_t event_id, int result,
77     const char *auth_used, const char *mount_point, const char *device, const char *options);
78 #endif /* sun */
79 
80 #endif /* HAL_STORAGE_SHARED_H */
81 
82