hal/tools fstab-sync.c,1.21,1.22
David Zeuthen
david at freedesktop.org
Wed Sep 29 07:28:35 PDT 2004
- Previous message: hal/hald/linux block_class_device.c,1.82,1.83
- Next message: hal/po da.po,1.2,1.3 de.po,1.3,1.4 fr.po,1.2,1.3 nl.po,1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/hal/hal/tools
In directory gabe:/tmp/cvs-serv28376/tools
Modified Files:
fstab-sync.c
Log Message:
2004-09-29 David Zeuthen <david at fubar.dk>
* hald/linux/block_class_device.c (detect_disc): Do a CDROM_DRIVE_STATUS
before CDROM_DISC_STATUS
* tools/fstab-sync.c (fs_table_line_is_generated): Use secondary
managed keyword if applicable
(fs_table_add_volume): Use access keyword only if applicable
(volume_new): Also set is_removable
(fs_table_add_volume): Only add removable selinux context for
hotpluggable drives and drives with removable media
* configure.in: Add fstab-sync secondary keyword which is useful for
migration from e.g. kudzu to managed - fstab-sync will only delete
fstab lines with the secondary keyword but never write them. Needs
to be enabled with --enable-mnt-noop-sec.
Also add fstab-sync access keyword which defaults to 'user' but
can be replaced by 'console' - this is useful for specifying the
extra mount option for how to give access. Now the access keyword
needs to be enabled with --enable-mnt-access.
For (my own) reference, this is the parameters used to bootstrap
when building for Red Hat distros
./autogen.sh --enable-mnt-noop --enable-fstab-sync --enable-hotplug-map --with-mnt-noop=managed --enable-mnt-noop-sec --with-mnt-noop-sec=kudzu --enable-mnt-access --with-mnt-access=console --with-init-scripts=redhat --with-pid-file=/var/run/haldaemon.pid --enable-selinux
note: the util-linux package must be patched with the patch in RH bug
133941 in order for --with-mnt-access=console to work; should hit
Rawhide soon.
Index: fstab-sync.c
===================================================================
RCS file: /cvs/hal/hal/tools/fstab-sync.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- fstab-sync.c 27 Sep 2004 16:37:47 -0000 1.21
+++ fstab-sync.c 29 Sep 2004 14:28:33 -0000 1.22
@@ -79,7 +79,15 @@
#endif
#ifndef FSTAB_SYNC_MOUNT_MANAGED_KEYWORD
-# define FSTAB_SYNC_MOUNT_MANAGED_KEYWORD "kudzu"
+# define FSTAB_SYNC_MOUNT_MANAGED_KEYWORD "managed"
+#endif
+
+#ifndef FSTAB_SYNC_MOUNT_MANAGED_KEYWORD_SEC
+# define FSTAB_SYNC_MOUNT_MANAGED_KEYWORD_SEC "kudzu"
+#endif
+
+#ifndef FSTAB_SYNC_MOUNT_ACCESS
+# define FSTAB_SYNC_MOUNT_ACCESS "console"
#endif
#ifndef TRUE
@@ -150,6 +158,7 @@
char *label; /**< Label of media or blank */
char *drive_type; /**< The storage.drive_type value */
boolean is_hotpluggable; /**< TRUE if the volume stems from a hotpluggable drive */
+ boolean is_removable; /**< TRUE if the volume is from a drive with removable media */
dbus_int64_t size; /**< Size in bytes of the volume or -1 if not available */
char *bus; /**< Type of bus the device is connected to */
} Volume;
@@ -360,12 +369,23 @@
static boolean fs_table_line_is_generated (FSTableLine *line)
{
+ boolean has_managed_keyword;
+
+ has_managed_keyword = FALSE;
#ifdef FSTAB_SYNC_USE_NOOP_MOUNT_OPTION
- if (!fs_table_line_has_mount_option (line, FSTAB_SYNC_MOUNT_MANAGED_KEYWORD))
- return FALSE;
+ if (fs_table_line_has_mount_option (line, FSTAB_SYNC_MOUNT_MANAGED_KEYWORD))
+ has_managed_keyword = TRUE;
+#endif
+
+#ifdef FSTAB_SYNC_USE_NOOP_MOUNT_OPTION_SEC
+ if (fs_table_line_has_mount_option (line, FSTAB_SYNC_MOUNT_MANAGED_KEYWORD_SEC))
+ has_managed_keyword = TRUE;
#endif
+ if (!has_managed_keyword)
+ return FALSE;
+
if (strncmp (line->mount_point, FSTAB_SYNC_MOUNT_ROOT "/", sizeof (FSTAB_SYNC_MOUNT_ROOT "/") -1) != 0)
return FALSE;
@@ -1012,6 +1032,7 @@
storudi = hal_device_get_property_string (hal_context, udi, "block.storage_device");
volume->is_hotpluggable = hal_device_get_property_bool (hal_context, storudi, "storage.hotpluggable");
+ volume->is_removable = hal_device_get_property_bool (hal_context, storudi, "storage.removable");
volume->drive_type = hal_device_get_property_string (hal_context, storudi, "storage.drive_type");
volume->bus = hal_device_get_property_string (hal_context, storudi, "storage.bus");
@@ -1264,14 +1285,21 @@
options[0] = '\0';
- strcat_len (options, "noauto,user,exec");
+ strcat_len (options, "noauto");
+
+#ifdef FSTAB_SYNC_USE_ACCESS
+ strcat_len (options, "," FSTAB_SYNC_MOUNT_ACCESS);
+#endif
+
+ strcat_len (options, ",exec");
#ifdef FSTAB_SYNC_USE_NOOP_MOUNT_OPTION
strcat_len (options, "," FSTAB_SYNC_MOUNT_MANAGED_KEYWORD);
#endif
+
#ifdef HAVE_SELINUX
- if (is_selinux_enabled() > 0 ){
+ if (is_selinux_enabled() > 0 && (volume->is_hotpluggable || volume->is_removable) ) {
security_context_t scontext;
fstab_update_debug (_("%d: SELinux is enabled\n"), pid);
- Previous message: hal/hald/linux block_class_device.c,1.82,1.83
- Next message: hal/po da.po,1.2,1.3 de.po,1.3,1.4 fr.po,1.2,1.3 nl.po,1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the hal-commit
mailing list