hal/libhal-storage libhal-storage.c,1.8.2.2,1.8.2.3
David Zeuthen
david at freedesktop.org
Mon Jan 24 18:30:49 PST 2005
Update of /cvs/hal/hal/libhal-storage
In directory gabe:/tmp/cvs-serv31733/libhal-storage
Modified Files:
Tag: hal-0_4-stable-branch
libhal-storage.c
Log Message:
2005-01-24 David Zeuthen <davidz at redhat.com>
* libhal-storage/libhal-storage.c (mopts_collect): Also remove
mount options if something is set to FALSE (based on patch from
Sebastian Dransfeld <sebastid at stud.ntnu.no>; also fix a pretty bad
bug where the computation of is_imply_opt were totally wrong.
(hal_volume_policy_get_mount_options),
(hal_drive_policy_get_mount_options): Collect imply options in the
correct order now that mopts_collect is fixed : -do-
2005-01-24 David Zeuthen <davidz at redhat.com>
* tools/device-manager/Const.py.in: hdm throws a nice exception
when info.bus == "ieee1394", can be easily solved by adding it to
BUS_NAMES. Done in attached patch. From Sjoerd Simons
<sjoerd at luon.net>.
Index: libhal-storage.c
===================================================================
RCS file: /cvs/hal/hal/libhal-storage/libhal-storage.c,v
retrieving revision 1.8.2.2
retrieving revision 1.8.2.3
diff -u -d -r1.8.2.2 -r1.8.2.3
--- libhal-storage.c 1 Dec 2004 04:28:58 -0000 1.8.2.2
+++ libhal-storage.c 25 Jan 2005 02:30:46 -0000 1.8.2.3
@@ -1472,7 +1472,7 @@
type = hal_psi_get_type (&it);
key = hal_psi_get_key (&it);
- if (hal_psi_get_type (&it) == DBUS_TYPE_BOOLEAN && hal_psi_get_bool (&it) &&
+ if (hal_psi_get_type (&it) == DBUS_TYPE_BOOLEAN &&
strncmp (key, namespace, namespace_len - 1) == 0) {
const char *option = key + namespace_len - 1;
char *location;
@@ -1482,9 +1482,12 @@
if (strcmp (option, "user") == 0 ||
strcmp (option, "users") == 0 ||
strcmp (option, "defaults") == 0 ||
- strcmp (option, "pamconsole"))
+ strcmp (option, "pamconsole") == 0)
is_imply_opt = TRUE;
+ fprintf (stderr, "************************************\n");
+ fprintf (stderr, "option=%s is_imply=%d only_collect_imply=%d\n", option, is_imply_opt, only_collect_imply_opts);
+
if (only_collect_imply_opts) {
if (!is_imply_opt)
continue;
@@ -1493,12 +1496,30 @@
continue;
}
- /* see if option is already there */
- location = strstr (options_string, option);
- if (location == NULL) {
- if (strlen (options_string) > 0)
- strcat_len (options_string, ",", options_max_len);
- strcat_len (options_string, option, options_max_len);
+ if (hal_psi_get_bool (&it)) {
+ fprintf (stderr, "before_mount_options = %s - ", options_string);
+ /* see if option is already there */
+ location = strstr (options_string, option);
+ if (location == NULL) {
+ if (strlen (options_string) > 0)
+ strcat_len (options_string, ",", options_max_len);
+ strcat_len (options_string, option, options_max_len);
+ }
+ fprintf (stderr, "after_mount_options = %s\n", options_string);
+ } else {
+ /* remove option if already there */
+ location = strstr (options_string, option);
+ if (location != NULL) {
+ char *end;
+
+ end = strchr (location, ',');
+ if (end == NULL) {
+ location[0] = '\0';
+ } else {
+ strcpy (location, end + 1); /* skip the extra comma */
+ }
+ }
+
}
}
}
@@ -1518,15 +1539,15 @@
drive->mount_options[0] = '\0';
/* collect options != ('pamconsole', 'user', 'users', 'defaults' options that imply other options) */
- mopts_collect (drive->hal_ctx, stor_mount_option_begin, sizeof (stor_mount_option_begin),
- drive->udi, drive->mount_options, MOUNT_OPTIONS_SIZE, FALSE);
mopts_collect (drive->hal_ctx, stor_mount_option_default_begin, sizeof (stor_mount_option_default_begin),
- "/org/freedesktop/Hal/devices/computer", drive->mount_options, MOUNT_OPTIONS_SIZE, FALSE);
- /* ensure ('pamconsole', 'user', 'users', 'defaults' options that imply other options), are first */
+ "/org/freedesktop/Hal/devices/computer", drive->mount_options, MOUNT_OPTIONS_SIZE, TRUE);
mopts_collect (drive->hal_ctx, stor_mount_option_begin, sizeof (stor_mount_option_begin),
drive->udi, drive->mount_options, MOUNT_OPTIONS_SIZE, TRUE);
+ /* ensure ('pamconsole', 'user', 'users', 'defaults' options that imply other options), are first */
mopts_collect (drive->hal_ctx, stor_mount_option_default_begin, sizeof (stor_mount_option_default_begin),
- "/org/freedesktop/Hal/devices/computer", drive->mount_options, MOUNT_OPTIONS_SIZE, TRUE);
+ "/org/freedesktop/Hal/devices/computer", drive->mount_options, MOUNT_OPTIONS_SIZE, FALSE);
+ mopts_collect (drive->hal_ctx, stor_mount_option_begin, sizeof (stor_mount_option_begin),
+ drive->udi, drive->mount_options, MOUNT_OPTIONS_SIZE, FALSE);
result = drive->mount_options;
@@ -1560,16 +1581,16 @@
result = NULL;
volume->mount_options[0] = '\0';
- /* collect options != ('pamconsole', 'user', 'users', 'defaults' options that imply other options) */
- mopts_collect (drive->hal_ctx, vol_mount_option_begin, sizeof (vol_mount_option_begin),
- volume->udi, volume->mount_options, MOUNT_OPTIONS_SIZE, FALSE);
- mopts_collect (drive->hal_ctx, stor_mount_option_default_begin, sizeof (stor_mount_option_default_begin),
- "/org/freedesktop/Hal/devices/computer", volume->mount_options, MOUNT_OPTIONS_SIZE, FALSE);
/* ensure ('pamconsole', 'user', 'users', 'defaults' options that imply other options), are first */
+ mopts_collect (drive->hal_ctx, stor_mount_option_default_begin, sizeof (stor_mount_option_default_begin),
+ "/org/freedesktop/Hal/devices/computer", volume->mount_options, MOUNT_OPTIONS_SIZE, TRUE);
mopts_collect (drive->hal_ctx, vol_mount_option_begin, sizeof (vol_mount_option_begin),
volume->udi, volume->mount_options, MOUNT_OPTIONS_SIZE, TRUE);
+ /* collect options != ('pamconsole', 'user', 'users', 'defaults' options that imply other options) */
mopts_collect (drive->hal_ctx, stor_mount_option_default_begin, sizeof (stor_mount_option_default_begin),
- "/org/freedesktop/Hal/devices/computer", volume->mount_options, MOUNT_OPTIONS_SIZE, TRUE);
+ "/org/freedesktop/Hal/devices/computer", volume->mount_options, MOUNT_OPTIONS_SIZE, FALSE);
+ mopts_collect (drive->hal_ctx, vol_mount_option_begin, sizeof (vol_mount_option_begin),
+ volume->udi, volume->mount_options, MOUNT_OPTIONS_SIZE, FALSE);
result = volume->mount_options;
More information about the hal-commit
mailing list