Lines 164-196
Link Here
|
164 |
udi = argv[1]; |
164 |
udi = argv[1]; |
165 |
|
165 |
|
166 |
/* initialize hal connection */ |
166 |
/* initialize hal connection */ |
167 |
hal_ctx = hal_initialize( NULL, FALSE ); |
167 |
hal_ctx = libhal_ctx_new (); |
168 |
if( !hal_ctx ) { |
168 |
if( !hal_ctx ) { |
169 |
fprintf( stderr, _("Error: could not connect to hal\n") ); |
169 |
fprintf( stderr, _("Error: could not connect to hal\n") ); |
170 |
return 1; |
170 |
return 1; |
171 |
} |
171 |
} |
172 |
|
172 |
|
173 |
/* get all interesting properties */ |
173 |
/* get all interesting properties */ |
174 |
if( !hal_device_exists( hal_ctx, udi ) ) { |
174 |
if( !libhal_device_exists( hal_ctx, udi, NULL ) ) { |
175 |
fprintf( stderr, _("Error: given UDI does not exist\n") ); |
175 |
fprintf( stderr, _("Error: given UDI does not exist\n") ); |
|
|
176 |
libhal_ctx_free ( hal_ctx ); |
176 |
return 1; |
177 |
return 1; |
177 |
} |
178 |
} |
178 |
|
179 |
|
179 |
if( hal_device_property_exists( hal_ctx, udi, "block.device" ) ) |
180 |
if( libhal_device_property_exists( hal_ctx, udi, "block.device", NULL ) ) |
180 |
device = hal_device_get_property_string( hal_ctx, udi, "block.device" ); |
181 |
device = libhal_device_get_property_string( hal_ctx, udi, "block.device", NULL ); |
181 |
if( !device ) { |
182 |
if( !device ) { |
182 |
fprintf( stderr, _("Error: given UDI is not a mountable volume\n") ); |
183 |
fprintf( stderr, _("Error: given UDI is not a mountable volume\n") ); |
|
|
184 |
libhal_ctx_free ( hal_ctx ); |
183 |
return 1; |
185 |
return 1; |
184 |
} |
186 |
} |
185 |
|
187 |
|
186 |
if( hal_device_property_exists( hal_ctx, udi, "volume.policy.desired_mount_point" ) ) |
188 |
if( libhal_device_property_exists( hal_ctx, udi, "volume.policy.desired_mount_point", NULL ) ) |
187 |
label = hal_device_get_property_string( hal_ctx, udi, "volume.policy.desired_mount_point" ); |
189 |
label = libhal_device_get_property_string( hal_ctx, udi, "volume.policy.desired_mount_point", NULL ); |
188 |
if( hal_device_property_exists( hal_ctx, udi, "volume.fstype" ) ) |
190 |
if( libhal_device_property_exists( hal_ctx, udi, "volume.fstype", NULL ) ) |
189 |
fstype = hal_device_get_property_string( hal_ctx, udi, "volume.fstype" ); |
191 |
fstype = libhal_device_get_property_string( hal_ctx, udi, "volume.fstype", NULL ); |
190 |
if( hal_device_property_exists( hal_ctx, udi, "volume.policy.mount_option.sync" ) ) |
192 |
if( libhal_device_property_exists( hal_ctx, udi, "volume.policy.mount_option.sync", NULL ) ) |
191 |
sync = hal_device_get_property_bool( hal_ctx, udi, "volume.policy.mount_option.sync" ); |
193 |
sync = libhal_device_get_property_bool( hal_ctx, udi, "volume.policy.mount_option.sync", NULL ); |
192 |
if( hal_device_property_exists( hal_ctx, udi, "volume.policy.mount_option.noatime" ) ) |
194 |
if( libhal_device_property_exists( hal_ctx, udi, "volume.policy.mount_option.noatime", NULL ) ) |
193 |
noatime = hal_device_get_property_bool( hal_ctx, udi, "volume.policy.mount_option.noatime" ); |
195 |
noatime = libhal_device_get_property_bool( hal_ctx, udi, "volume.policy.mount_option.noatime", NULL ); |
|
|
196 |
libhal_ctx_free ( hal_ctx ); |
194 |
|
197 |
|
195 |
exec_pmount( device, fstype, label, sync, noatime, argc-2, argv+2 ); |
198 |
exec_pmount( device, fstype, label, sync, noatime, argc-2, argv+2 ); |
196 |
|
199 |
|