Coverage Report

Created: 2025-07-01 07:09

/src/glib/gio/gunionvolumemonitor.c
Line
Count
Source (jump to first uncovered line)
1
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2
3
/* GIO - GLib Input, Output and Streaming Library
4
 * 
5
 * Copyright (C) 2006-2007 Red Hat, Inc.
6
 *
7
 * This library is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU Lesser General Public
9
 * License as published by the Free Software Foundation; either
10
 * version 2.1 of the License, or (at your option) any later version.
11
 *
12
 * This library is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 * Lesser General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Lesser General
18
 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
19
 *
20
 * Author: Alexander Larsson <alexl@redhat.com>
21
 *         David Zeuthen <davidz@redhat.com>
22
 */
23
24
#include "config.h"
25
26
#include <string.h>
27
28
#include <glib.h>
29
#include "gunionvolumemonitor.h"
30
#include "gmountprivate.h"
31
#include "giomodule-priv.h"
32
#ifdef G_OS_UNIX
33
#include "gunixvolumemonitor.h"
34
#endif
35
#include "gnativevolumemonitor.h"
36
37
#include "glibintl.h"
38
39
40
struct _GUnionVolumeMonitor {
41
  GVolumeMonitor parent;
42
43
  GList *monitors;
44
};
45
46
static void g_union_volume_monitor_remove_monitor (GUnionVolumeMonitor *union_monitor,
47
               GVolumeMonitor *child_monitor);
48
49
50
#define g_union_volume_monitor_get_type _g_union_volume_monitor_get_type
51
G_DEFINE_TYPE (GUnionVolumeMonitor, g_union_volume_monitor, G_TYPE_VOLUME_MONITOR)
52
53
static GRecMutex the_volume_monitor_mutex;
54
55
static GUnionVolumeMonitor *the_volume_monitor = NULL;
56
57
static void
58
g_union_volume_monitor_finalize (GObject *object)
59
0
{
60
0
  GUnionVolumeMonitor *monitor;
61
0
  GVolumeMonitor *child_monitor;
62
63
0
  monitor = G_UNION_VOLUME_MONITOR (object);
64
65
0
  while (monitor->monitors != NULL)
66
0
    {
67
0
      child_monitor = monitor->monitors->data;
68
0
      g_union_volume_monitor_remove_monitor (monitor, 
69
0
                                             child_monitor);
70
0
      g_object_unref (child_monitor);
71
0
    }
72
73
0
  G_OBJECT_CLASS (g_union_volume_monitor_parent_class)->finalize (object);
74
0
}
75
76
static void
77
g_union_volume_monitor_dispose (GObject *object)
78
0
{
79
0
  GUnionVolumeMonitor *monitor;
80
0
  GVolumeMonitor *child_monitor;
81
0
  GList *l;
82
83
0
  monitor = G_UNION_VOLUME_MONITOR (object);
84
85
0
  g_rec_mutex_lock (&the_volume_monitor_mutex);
86
0
  the_volume_monitor = NULL;
87
88
0
  for (l = monitor->monitors; l != NULL; l = l->next)
89
0
    {
90
0
      child_monitor = l->data;
91
0
      g_object_run_dispose (G_OBJECT (child_monitor));
92
0
    }
93
  
94
0
  g_rec_mutex_unlock (&the_volume_monitor_mutex);
95
96
0
  G_OBJECT_CLASS (g_union_volume_monitor_parent_class)->dispose (object);
97
0
}
98
99
static GList *
100
get_mounts (GVolumeMonitor *volume_monitor)
101
0
{
102
0
  GUnionVolumeMonitor *monitor;
103
0
  GVolumeMonitor *child_monitor;
104
0
  GList *res;
105
0
  GList *l;
106
  
107
0
  monitor = G_UNION_VOLUME_MONITOR (volume_monitor);
108
109
0
  res = NULL;
110
  
111
0
  g_rec_mutex_lock (&the_volume_monitor_mutex);
112
113
0
  for (l = monitor->monitors; l != NULL; l = l->next)
114
0
    {
115
0
      child_monitor = l->data;
116
117
0
      res = g_list_concat (res, g_volume_monitor_get_mounts (child_monitor));
118
0
    }
119
  
120
0
  g_rec_mutex_unlock (&the_volume_monitor_mutex);
121
122
0
  return res;
123
0
}
124
125
static GList *
126
get_volumes (GVolumeMonitor *volume_monitor)
127
0
{
128
0
  GUnionVolumeMonitor *monitor;
129
0
  GVolumeMonitor *child_monitor;
130
0
  GList *res;
131
0
  GList *l;
132
  
133
0
  monitor = G_UNION_VOLUME_MONITOR (volume_monitor);
134
135
0
  res = NULL;
136
  
137
0
  g_rec_mutex_lock (&the_volume_monitor_mutex);
138
139
0
  for (l = monitor->monitors; l != NULL; l = l->next)
140
0
    {
141
0
      child_monitor = l->data;
142
143
0
      res = g_list_concat (res, g_volume_monitor_get_volumes (child_monitor));
144
0
    }
145
  
146
0
  g_rec_mutex_unlock (&the_volume_monitor_mutex);
147
148
0
  return res;
149
0
}
150
151
static GList *
152
get_connected_drives (GVolumeMonitor *volume_monitor)
153
0
{
154
0
  GUnionVolumeMonitor *monitor;
155
0
  GVolumeMonitor *child_monitor;
156
0
  GList *res;
157
0
  GList *l;
158
  
159
0
  monitor = G_UNION_VOLUME_MONITOR (volume_monitor);
160
161
0
  res = NULL;
162
  
163
0
  g_rec_mutex_lock (&the_volume_monitor_mutex);
164
165
0
  for (l = monitor->monitors; l != NULL; l = l->next)
166
0
    {
167
0
      child_monitor = l->data;
168
169
0
      res = g_list_concat (res, g_volume_monitor_get_connected_drives (child_monitor));
170
0
    }
171
  
172
0
  g_rec_mutex_unlock (&the_volume_monitor_mutex);
173
174
0
  return res;
175
0
}
176
177
static GVolume *
178
get_volume_for_uuid (GVolumeMonitor *volume_monitor, const char *uuid)
179
0
{
180
0
  GUnionVolumeMonitor *monitor;
181
0
  GVolumeMonitor *child_monitor;
182
0
  GVolume *volume;
183
0
  GList *l;
184
  
185
0
  monitor = G_UNION_VOLUME_MONITOR (volume_monitor);
186
187
0
  volume = NULL;
188
  
189
0
  g_rec_mutex_lock (&the_volume_monitor_mutex);
190
191
0
  for (l = monitor->monitors; l != NULL; l = l->next)
192
0
    {
193
0
      child_monitor = l->data;
194
195
0
      volume = g_volume_monitor_get_volume_for_uuid (child_monitor, uuid);
196
0
      if (volume != NULL)
197
0
        break;
198
199
0
    }
200
  
201
0
  g_rec_mutex_unlock (&the_volume_monitor_mutex);
202
203
0
  return volume;
204
0
}
205
206
static GMount *
207
get_mount_for_uuid (GVolumeMonitor *volume_monitor, const char *uuid)
208
0
{
209
0
  GUnionVolumeMonitor *monitor;
210
0
  GVolumeMonitor *child_monitor;
211
0
  GMount *mount;
212
0
  GList *l;
213
  
214
0
  monitor = G_UNION_VOLUME_MONITOR (volume_monitor);
215
216
0
  mount = NULL;
217
  
218
0
  g_rec_mutex_lock (&the_volume_monitor_mutex);
219
220
0
  for (l = monitor->monitors; l != NULL; l = l->next)
221
0
    {
222
0
      child_monitor = l->data;
223
224
0
      mount = g_volume_monitor_get_mount_for_uuid (child_monitor, uuid);
225
0
      if (mount != NULL)
226
0
        break;
227
228
0
    }
229
  
230
0
  g_rec_mutex_unlock (&the_volume_monitor_mutex);
231
232
0
  return mount;
233
0
}
234
235
static void
236
g_union_volume_monitor_class_init (GUnionVolumeMonitorClass *klass)
237
0
{
238
0
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
239
0
  GVolumeMonitorClass *monitor_class = G_VOLUME_MONITOR_CLASS (klass);
240
  
241
0
  gobject_class->finalize = g_union_volume_monitor_finalize;
242
0
  gobject_class->dispose = g_union_volume_monitor_dispose;
243
244
0
  monitor_class->get_connected_drives = get_connected_drives;
245
0
  monitor_class->get_volumes = get_volumes;
246
0
  monitor_class->get_mounts = get_mounts;
247
0
  monitor_class->get_volume_for_uuid = get_volume_for_uuid;
248
0
  monitor_class->get_mount_for_uuid = get_mount_for_uuid;
249
0
}
250
251
static void
252
child_volume_added (GVolumeMonitor      *child_monitor,
253
                    GVolume    *child_volume,
254
                    GUnionVolumeMonitor *union_monitor)
255
0
{
256
0
  g_signal_emit_by_name (union_monitor,
257
0
       "volume-added",
258
0
       child_volume);
259
0
}
260
261
static void
262
child_volume_removed (GVolumeMonitor      *child_monitor,
263
                      GVolume    *child_volume,
264
                      GUnionVolumeMonitor *union_monitor)
265
0
{
266
0
  g_signal_emit_by_name (union_monitor,
267
0
       "volume-removed",
268
0
       child_volume);
269
0
}
270
271
static void
272
child_volume_changed (GVolumeMonitor      *child_monitor,
273
                      GVolume    *child_volume,
274
                      GUnionVolumeMonitor *union_monitor)
275
0
{
276
0
  g_signal_emit_by_name (union_monitor,
277
0
       "volume-changed",
278
0
       child_volume);
279
0
}
280
281
static void
282
child_mount_added (GVolumeMonitor      *child_monitor,
283
                   GMount              *child_mount,
284
                   GUnionVolumeMonitor *union_monitor)
285
0
{
286
0
  g_signal_emit_by_name (union_monitor,
287
0
                         "mount-added",
288
0
                         child_mount);
289
0
}
290
291
static void
292
child_mount_removed (GVolumeMonitor      *child_monitor,
293
                     GMount              *child_mount,
294
                     GUnionVolumeMonitor *union_monitor)
295
0
{
296
0
  g_signal_emit_by_name (union_monitor,
297
0
       "mount-removed",
298
0
       child_mount);
299
0
}
300
301
static void
302
child_mount_pre_unmount (GVolumeMonitor       *child_monitor,
303
                          GMount              *child_mount,
304
                          GUnionVolumeMonitor *union_monitor)
305
0
{
306
0
  g_signal_emit_by_name (union_monitor,
307
0
       "mount-pre-unmount",
308
0
       child_mount);
309
0
}
310
311
312
static void
313
child_mount_changed (GVolumeMonitor       *child_monitor,
314
                      GMount              *child_mount,
315
                      GUnionVolumeMonitor *union_monitor)
316
0
{
317
0
  g_signal_emit_by_name (union_monitor,
318
0
       "mount-changed",
319
0
       child_mount);
320
0
}
321
322
static void
323
child_drive_connected (GVolumeMonitor      *child_monitor,
324
                       GDrive              *child_drive,
325
                       GUnionVolumeMonitor *union_monitor)
326
0
{
327
0
  g_signal_emit_by_name (union_monitor,
328
0
       "drive-connected",
329
0
       child_drive);
330
0
}
331
332
static void
333
child_drive_disconnected (GVolumeMonitor      *child_monitor,
334
                          GDrive              *child_drive,
335
                          GUnionVolumeMonitor *union_monitor)
336
0
{
337
0
  g_signal_emit_by_name (union_monitor,
338
0
       "drive-disconnected",
339
0
       child_drive);
340
0
}
341
342
static void
343
child_drive_changed (GVolumeMonitor      *child_monitor,
344
                     GDrive             *child_drive,
345
                     GUnionVolumeMonitor *union_monitor)
346
0
{
347
0
  g_signal_emit_by_name (union_monitor,
348
0
                         "drive-changed",
349
0
                         child_drive);
350
0
}
351
352
static void
353
child_drive_eject_button (GVolumeMonitor      *child_monitor,
354
                          GDrive             *child_drive,
355
                          GUnionVolumeMonitor *union_monitor)
356
0
{
357
0
  g_signal_emit_by_name (union_monitor,
358
0
                         "drive-eject-button",
359
0
                         child_drive);
360
0
}
361
362
static void
363
child_drive_stop_button (GVolumeMonitor      *child_monitor,
364
                         GDrive             *child_drive,
365
                         GUnionVolumeMonitor *union_monitor)
366
0
{
367
0
  g_signal_emit_by_name (union_monitor,
368
0
                         "drive-stop-button",
369
0
                         child_drive);
370
0
}
371
372
static void
373
g_union_volume_monitor_add_monitor (GUnionVolumeMonitor *union_monitor,
374
                                    GVolumeMonitor      *volume_monitor)
375
0
{
376
0
  if (g_list_find (union_monitor->monitors, volume_monitor))
377
0
    return;
378
379
0
  union_monitor->monitors =
380
0
    g_list_prepend (union_monitor->monitors,
381
0
        g_object_ref (volume_monitor));
382
383
0
  g_signal_connect (volume_monitor, "volume-added", (GCallback)child_volume_added, union_monitor);
384
0
  g_signal_connect (volume_monitor, "volume-removed", (GCallback)child_volume_removed, union_monitor);
385
0
  g_signal_connect (volume_monitor, "volume-changed", (GCallback)child_volume_changed, union_monitor);
386
0
  g_signal_connect (volume_monitor, "mount-added", (GCallback)child_mount_added, union_monitor);
387
0
  g_signal_connect (volume_monitor, "mount-removed", (GCallback)child_mount_removed, union_monitor);
388
0
  g_signal_connect (volume_monitor, "mount-pre-unmount", (GCallback)child_mount_pre_unmount, union_monitor);
389
0
  g_signal_connect (volume_monitor, "mount-changed", (GCallback)child_mount_changed, union_monitor);
390
0
  g_signal_connect (volume_monitor, "drive-connected", (GCallback)child_drive_connected, union_monitor);
391
0
  g_signal_connect (volume_monitor, "drive-disconnected", (GCallback)child_drive_disconnected, union_monitor);
392
0
  g_signal_connect (volume_monitor, "drive-changed", (GCallback)child_drive_changed, union_monitor);
393
0
  g_signal_connect (volume_monitor, "drive-eject-button", (GCallback)child_drive_eject_button, union_monitor);
394
0
  g_signal_connect (volume_monitor, "drive-stop-button", (GCallback)child_drive_stop_button, union_monitor);
395
0
}
396
397
static void
398
g_union_volume_monitor_remove_monitor (GUnionVolumeMonitor *union_monitor,
399
                                       GVolumeMonitor      *child_monitor)
400
0
{
401
0
  GList *l;
402
403
0
  l = g_list_find (union_monitor->monitors, child_monitor);
404
0
  if (l == NULL)
405
0
    return;
406
407
0
  union_monitor->monitors = g_list_delete_link (union_monitor->monitors, l);
408
409
0
  g_signal_handlers_disconnect_by_func (child_monitor, child_volume_added, union_monitor);
410
0
  g_signal_handlers_disconnect_by_func (child_monitor, child_volume_removed, union_monitor);
411
0
  g_signal_handlers_disconnect_by_func (child_monitor, child_volume_changed, union_monitor);
412
0
  g_signal_handlers_disconnect_by_func (child_monitor, child_mount_added, union_monitor);
413
0
  g_signal_handlers_disconnect_by_func (child_monitor, child_mount_removed, union_monitor);
414
0
  g_signal_handlers_disconnect_by_func (child_monitor, child_mount_pre_unmount, union_monitor);
415
0
  g_signal_handlers_disconnect_by_func (child_monitor, child_mount_changed, union_monitor);
416
0
  g_signal_handlers_disconnect_by_func (child_monitor, child_drive_connected, union_monitor);
417
0
  g_signal_handlers_disconnect_by_func (child_monitor, child_drive_disconnected, union_monitor);
418
0
  g_signal_handlers_disconnect_by_func (child_monitor, child_drive_changed, union_monitor);
419
0
  g_signal_handlers_disconnect_by_func (child_monitor, child_drive_eject_button, union_monitor);
420
0
  g_signal_handlers_disconnect_by_func (child_monitor, child_drive_stop_button, union_monitor);
421
0
}
422
423
static GType
424
get_default_native_class (gpointer data)
425
0
{
426
0
  return _g_io_module_get_default_type (G_NATIVE_VOLUME_MONITOR_EXTENSION_POINT_NAME,
427
0
                                        "GIO_USE_VOLUME_MONITOR",
428
0
                                        G_STRUCT_OFFSET (GVolumeMonitorClass, is_supported));
429
0
}
430
431
/* We return the class, with a ref taken.
432
 * This way we avoid unloading the class/module
433
 * between selecting the type and creating the
434
 * instance on the first call.
435
 */
436
static GNativeVolumeMonitorClass *
437
get_native_class (void)
438
0
{
439
0
  static GOnce once_init = G_ONCE_INIT;
440
0
  GTypeClass *type_class;
441
442
0
  type_class = NULL;
443
0
  g_once (&once_init, (GThreadFunc)get_default_native_class, &type_class);
444
445
0
  if (type_class == NULL && once_init.retval != GUINT_TO_POINTER(G_TYPE_INVALID))
446
0
    type_class = g_type_class_ref ((GType)once_init.retval);
447
  
448
0
  return (GNativeVolumeMonitorClass *)type_class;
449
0
}
450
451
static void
452
g_union_volume_monitor_init (GUnionVolumeMonitor *union_monitor)
453
0
{
454
0
}
455
456
static void
457
populate_union_monitor (GUnionVolumeMonitor *union_monitor)
458
0
{
459
0
  GVolumeMonitor *monitor;
460
0
  GNativeVolumeMonitorClass *native_class;
461
0
  GVolumeMonitorClass *klass;
462
0
  GIOExtensionPoint *ep;
463
0
  GIOExtension *extension;
464
0
  GList *l;
465
466
0
  native_class = get_native_class ();
467
468
0
  if (native_class != NULL)
469
0
    {
470
0
      monitor = g_object_new (G_TYPE_FROM_CLASS (native_class), NULL);
471
0
      g_union_volume_monitor_add_monitor (union_monitor, monitor);
472
0
      g_object_unref (monitor);
473
0
      g_type_class_unref (native_class);
474
0
    }
475
476
0
  ep = g_io_extension_point_lookup (G_VOLUME_MONITOR_EXTENSION_POINT_NAME);
477
0
  for (l = g_io_extension_point_get_extensions (ep); l != NULL; l = l->next)
478
0
    {
479
0
      extension = l->data;
480
      
481
0
      klass = G_VOLUME_MONITOR_CLASS (g_io_extension_ref_class (extension));
482
0
      if (klass->is_supported == NULL || klass->is_supported())
483
0
  {
484
0
    monitor = g_object_new (g_io_extension_get_type (extension), NULL);
485
0
    g_union_volume_monitor_add_monitor (union_monitor, monitor);
486
0
    g_object_unref (monitor);
487
0
  }
488
0
      g_type_class_unref (klass);
489
0
    }
490
0
}
491
492
static GUnionVolumeMonitor *
493
g_union_volume_monitor_new (void)
494
0
{
495
0
  GUnionVolumeMonitor *monitor;
496
497
0
  monitor = g_object_new (G_TYPE_UNION_VOLUME_MONITOR, NULL);
498
  
499
0
  return monitor;
500
0
}
501
502
/**
503
 * g_volume_monitor_get:
504
 * 
505
 * Gets the volume monitor used by gio.
506
 *
507
 * Returns: (transfer full): a reference to the #GVolumeMonitor used by gio. Call
508
 *    g_object_unref() when done with it.
509
 **/
510
GVolumeMonitor *
511
g_volume_monitor_get (void)
512
0
{
513
0
  GVolumeMonitor *vm;
514
  
515
0
  g_rec_mutex_lock (&the_volume_monitor_mutex);
516
517
0
  if (the_volume_monitor)
518
0
    vm = G_VOLUME_MONITOR (g_object_ref (the_volume_monitor));
519
0
  else
520
0
    {
521
0
      the_volume_monitor = g_union_volume_monitor_new ();
522
0
      populate_union_monitor (the_volume_monitor);
523
0
      vm = G_VOLUME_MONITOR (the_volume_monitor);
524
0
    }
525
  
526
0
  g_rec_mutex_unlock (&the_volume_monitor_mutex);
527
528
0
  return vm;
529
0
}
530
531
GMount *
532
_g_mount_get_for_mount_path (const gchar  *mount_path,
533
           GCancellable *cancellable)
534
0
{
535
0
  GNativeVolumeMonitorClass *klass;
536
0
  GMount *mount;
537
  
538
0
  klass = get_native_class ();
539
0
  if (klass == NULL)
540
0
    return NULL;
541
542
0
  mount = NULL;
543
544
0
  if (klass->get_mount_for_mount_path)
545
0
    mount = klass->get_mount_for_mount_path (mount_path, cancellable);
546
547
  /* TODO: How do we know this succeeded? Keep in mind that the native
548
   *       volume monitor may fail (e.g. not being able to connect to
549
   *       udisks). Is the get_mount_for_mount_path() method allowed to
550
   *       return NULL? Seems like it is ... probably the method needs
551
   *       to take a boolean and write if it succeeds or not.. Messy.
552
   *       Very messy.
553
   */
554
  
555
0
  g_type_class_unref (klass);
556
557
0
  return mount;
558
0
}
559
560
/**
561
 * g_volume_monitor_adopt_orphan_mount:
562
 * @mount: a #GMount object to find a parent for
563
 *
564
 * This function should be called by any #GVolumeMonitor
565
 * implementation when a new #GMount object is created that is not
566
 * associated with a #GVolume object. It must be called just before
567
 * emitting the @mount_added signal.
568
 *
569
 * If the return value is not %NULL, the caller must associate the
570
 * returned #GVolume object with the #GMount. This involves returning
571
 * it in its g_mount_get_volume() implementation. The caller must
572
 * also listen for the "removed" signal on the returned object
573
 * and give up its reference when handling that signal
574
 * 
575
 * Similarly, if implementing g_volume_monitor_adopt_orphan_mount(),
576
 * the implementor must take a reference to @mount and return it in
577
 * its g_volume_get_mount() implemented. Also, the implementor must
578
 * listen for the "unmounted" signal on @mount and give up its
579
 * reference upon handling that signal.
580
 *
581
 * There are two main use cases for this function.
582
 *
583
 * One is when implementing a user space file system driver that reads
584
 * blocks of a block device that is already represented by the native
585
 * volume monitor (for example a CD Audio file system driver). Such
586
 * a driver will generate its own #GMount object that needs to be
587
 * associated with the #GVolume object that represents the volume.
588
 *
589
 * The other is for implementing a #GVolumeMonitor whose sole purpose
590
 * is to return #GVolume objects representing entries in the users
591
 * "favorite servers" list or similar.
592
 *
593
 * Returns: (transfer full): the #GVolume object that is the parent for @mount or %NULL
594
 * if no wants to adopt the #GMount.
595
 *
596
 * Deprecated: 2.20: Instead of using this function, #GVolumeMonitor
597
 * implementations should instead create shadow mounts with the URI of
598
 * the mount they intend to adopt. See the proxy volume monitor in
599
 * gvfs for an example of this. Also see g_mount_is_shadowed(),
600
 * g_mount_shadow() and g_mount_unshadow() functions.
601
 */
602
GVolume *
603
g_volume_monitor_adopt_orphan_mount (GMount *mount)
604
0
{
605
0
  GVolumeMonitor *child_monitor;
606
0
  GVolumeMonitorClass *child_monitor_class;
607
0
  GVolume *volume;
608
0
  GList *l;
609
610
0
  g_return_val_if_fail (mount != NULL, NULL);
611
612
0
  if (the_volume_monitor == NULL)
613
0
    return NULL;
614
615
0
  volume = NULL;
616
  
617
0
  g_rec_mutex_lock (&the_volume_monitor_mutex);
618
619
0
  for (l = the_volume_monitor->monitors; l != NULL; l = l->next)
620
0
    {
621
0
      child_monitor = l->data;
622
0
      child_monitor_class = G_VOLUME_MONITOR_GET_CLASS (child_monitor);
623
624
0
      if (child_monitor_class->adopt_orphan_mount != NULL)
625
0
        {
626
0
          volume = child_monitor_class->adopt_orphan_mount (mount, child_monitor);
627
0
          if (volume != NULL)
628
0
            break;
629
0
        }
630
0
    }
631
  
632
0
  g_rec_mutex_unlock (&the_volume_monitor_mutex);
633
634
0
  return volume;
635
0
}