loader: move loader_open_device out of HAVE_LIBUDEV block
[mesa.git] / src / loader / loader.c
1 /*
2 * Copyright (C) 2013 Rob Clark <robclark@freedesktop.org>
3 *
4 * This code is derived from the following files.
5 *
6 * * src/glx/dri3_common.c
7 * Copyright © 2013 Keith Packard
8 *
9 * * src/egl/drivers/dri2/common.c
10 * * src/gbm/backends/dri/driver_name.c
11 * Copyright © 2011 Intel Corporation
12 *
13 * Authors:
14 * Kristian Høgsberg <krh@bitplanet.net>
15 * Benjamin Franzke <benjaminfranzke@googlemail.com>
16 *
17 * * src/gallium/targets/egl-static/egl.c
18 * Copyright (C) 2010-2011 LunarG Inc.
19 *
20 * Authors:
21 * Chia-I Wu <olv@lunarg.com>
22 *
23 * * src/gallium/state_trackers/egl/drm/native_drm.c
24 * Copyright (C) 2010 Chia-I Wu <olv@0xlab.org>
25 *
26 * * src/egl/drivers/dri2/platform_android.c
27 *
28 * Copyright (C) 2010-2011 Chia-I Wu <olvaffe@gmail.com>
29 * Copyright (C) 2010-2011 LunarG Inc.
30 *
31 * Based on platform_x11, which has
32 *
33 * Copyright © 2011 Intel Corporation
34 *
35 * * src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
36 * Copyright 2011 Intel Corporation
37 * Copyright 2012 Francisco Jerez
38 * All Rights Reserved.
39 *
40 * Authors:
41 * Kristian Høgsberg <krh@bitplanet.net>
42 * Benjamin Franzke <benjaminfranzke@googlemail.com>
43 *
44 * Permission is hereby granted, free of charge, to any person obtaining a
45 * copy of this software and associated documentation files (the "Software"),
46 * to deal in the Software without restriction, including without limitation
47 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
48 * and/or sell copies of the Software, and to permit persons to whom the
49 * Software is furnished to do so, subject to the following conditions:
50 *
51 * The above copyright notice and this permission notice (including the next
52 * paragraph) shall be included in all copies or substantial portions of the
53 * Software.
54 *
55 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
56 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
57 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
58 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
59 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
60 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
61 * SOFTWARE.
62 *
63 * Authors:
64 * Rob Clark <robclark@freedesktop.org>
65 */
66
67 #include <errno.h>
68 #include <fcntl.h>
69 #include <sys/stat.h>
70 #include <stdarg.h>
71 #include <stdio.h>
72 #include <string.h>
73 #ifdef HAVE_LIBUDEV
74 #include <assert.h>
75 #include <dlfcn.h>
76 #include <unistd.h>
77 #include <stdlib.h>
78 #ifdef USE_DRICONF
79 #include "xmlconfig.h"
80 #include "xmlpool.h"
81 #endif
82 #endif
83 #ifdef HAVE_SYSFS
84 #include <sys/types.h>
85 #endif
86 #include "loader.h"
87
88 #ifndef __NOT_HAVE_DRM_H
89 #include <xf86drm.h>
90 #endif
91
92 #define __IS_LOADER
93 #include "pci_id_driver_map.h"
94
95 static void default_logger(int level, const char *fmt, ...)
96 {
97 if (level <= _LOADER_WARNING) {
98 va_list args;
99 va_start(args, fmt);
100 vfprintf(stderr, fmt, args);
101 va_end(args);
102 }
103 }
104
105 static void (*log_)(int level, const char *fmt, ...) = default_logger;
106
107 int
108 loader_open_device(const char *device_name)
109 {
110 int fd;
111 #ifdef O_CLOEXEC
112 fd = open(device_name, O_RDWR | O_CLOEXEC);
113 if (fd == -1 && errno == EINVAL)
114 #endif
115 {
116 fd = open(device_name, O_RDWR);
117 if (fd != -1)
118 fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
119 }
120 return fd;
121 }
122
123 #ifdef HAVE_LIBUDEV
124 #include <libudev.h>
125
126 static void *udev_handle = NULL;
127
128 static void *
129 udev_dlopen_handle(void)
130 {
131 if (!udev_handle) {
132 udev_handle = dlopen("libudev.so.1", RTLD_LOCAL | RTLD_LAZY);
133
134 if (!udev_handle) {
135 /* libudev.so.1 changed the return types of the two unref functions
136 * from voids to pointers. We don't use those return values, and the
137 * only ABI I've heard that cares about this kind of change (calling
138 * a function with a void * return that actually only returns void)
139 * might be ia64.
140 */
141 udev_handle = dlopen("libudev.so.0", RTLD_LOCAL | RTLD_LAZY);
142
143 if (!udev_handle) {
144 log_(_LOADER_WARNING, "Couldn't dlopen libudev.so.1 or "
145 "libudev.so.0, driver detection may be broken.\n");
146 }
147 }
148 }
149
150 return udev_handle;
151 }
152
153 static int dlsym_failed = 0;
154
155 static void *
156 checked_dlsym(void *dlopen_handle, const char *name)
157 {
158 void *result = dlsym(dlopen_handle, name);
159 if (!result)
160 dlsym_failed = 1;
161 return result;
162 }
163
164 #define UDEV_SYMBOL(ret, name, args) \
165 ret (*name) args = checked_dlsym(udev_dlopen_handle(), #name);
166
167
168 static inline struct udev_device *
169 udev_device_new_from_fd(struct udev *udev, int fd)
170 {
171 struct udev_device *device;
172 struct stat buf;
173 UDEV_SYMBOL(struct udev_device *, udev_device_new_from_devnum,
174 (struct udev *udev, char type, dev_t devnum));
175
176 if (dlsym_failed)
177 return NULL;
178
179 if (fstat(fd, &buf) < 0) {
180 log_(_LOADER_WARNING, "MESA-LOADER: failed to stat fd %d\n", fd);
181 return NULL;
182 }
183
184 device = udev_device_new_from_devnum(udev, 'c', buf.st_rdev);
185 if (device == NULL) {
186 log_(_LOADER_WARNING,
187 "MESA-LOADER: could not create udev device for fd %d\n", fd);
188 return NULL;
189 }
190
191 return device;
192 }
193
194 static int
195 libudev_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id)
196 {
197 struct udev *udev = NULL;
198 struct udev_device *device = NULL, *parent;
199 const char *pci_id;
200 UDEV_SYMBOL(struct udev *, udev_new, (void));
201 UDEV_SYMBOL(struct udev_device *, udev_device_get_parent,
202 (struct udev_device *));
203 UDEV_SYMBOL(const char *, udev_device_get_property_value,
204 (struct udev_device *, const char *));
205 UDEV_SYMBOL(struct udev_device *, udev_device_unref,
206 (struct udev_device *));
207 UDEV_SYMBOL(struct udev *, udev_unref, (struct udev *));
208
209 *chip_id = -1;
210
211 if (dlsym_failed)
212 return 0;
213
214 udev = udev_new();
215 device = udev_device_new_from_fd(udev, fd);
216 if (!device)
217 goto out;
218
219 parent = udev_device_get_parent(device);
220 if (parent == NULL) {
221 log_(_LOADER_WARNING, "MESA-LOADER: could not get parent device\n");
222 goto out;
223 }
224
225 pci_id = udev_device_get_property_value(parent, "PCI_ID");
226 if (pci_id == NULL) {
227 log_(_LOADER_INFO, "MESA-LOADER: no PCI ID\n");
228 *chip_id = -1;
229 goto out;
230 } else if (sscanf(pci_id, "%x:%x", vendor_id, chip_id) != 2) {
231 log_(_LOADER_WARNING, "MESA-LOADER: malformed PCI ID\n");
232 *chip_id = -1;
233 goto out;
234 }
235
236 out:
237 if (device)
238 udev_device_unref(device);
239 if (udev)
240 udev_unref(udev);
241
242 return (*chip_id >= 0);
243 }
244
245 static char *
246 get_render_node_from_id_path_tag(struct udev *udev,
247 char *id_path_tag,
248 char another_tag)
249 {
250 struct udev_device *device;
251 struct udev_enumerate *e;
252 struct udev_list_entry *entry;
253 const char *path, *id_path_tag_tmp;
254 char *path_res;
255 char found = 0;
256 UDEV_SYMBOL(struct udev_enumerate *, udev_enumerate_new,
257 (struct udev *));
258 UDEV_SYMBOL(int, udev_enumerate_add_match_subsystem,
259 (struct udev_enumerate *, const char *));
260 UDEV_SYMBOL(int, udev_enumerate_add_match_sysname,
261 (struct udev_enumerate *, const char *));
262 UDEV_SYMBOL(int, udev_enumerate_scan_devices,
263 (struct udev_enumerate *));
264 UDEV_SYMBOL(struct udev_list_entry *, udev_enumerate_get_list_entry,
265 (struct udev_enumerate *));
266 UDEV_SYMBOL(struct udev_list_entry *, udev_list_entry_get_next,
267 (struct udev_list_entry *));
268 UDEV_SYMBOL(const char *, udev_list_entry_get_name,
269 (struct udev_list_entry *));
270 UDEV_SYMBOL(struct udev_device *, udev_device_new_from_syspath,
271 (struct udev *, const char *));
272 UDEV_SYMBOL(const char *, udev_device_get_property_value,
273 (struct udev_device *, const char *));
274 UDEV_SYMBOL(const char *, udev_device_get_devnode,
275 (struct udev_device *));
276 UDEV_SYMBOL(struct udev_device *, udev_device_unref,
277 (struct udev_device *));
278
279 e = udev_enumerate_new(udev);
280 udev_enumerate_add_match_subsystem(e, "drm");
281 udev_enumerate_add_match_sysname(e, "render*");
282
283 udev_enumerate_scan_devices(e);
284 udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) {
285 path = udev_list_entry_get_name(entry);
286 device = udev_device_new_from_syspath(udev, path);
287 if (!device)
288 continue;
289 id_path_tag_tmp = udev_device_get_property_value(device, "ID_PATH_TAG");
290 if (id_path_tag_tmp) {
291 if ((!another_tag && !strcmp(id_path_tag, id_path_tag_tmp)) ||
292 (another_tag && strcmp(id_path_tag, id_path_tag_tmp))) {
293 found = 1;
294 break;
295 }
296 }
297 udev_device_unref(device);
298 }
299
300 if (found) {
301 path_res = strdup(udev_device_get_devnode(device));
302 udev_device_unref(device);
303 return path_res;
304 }
305 return NULL;
306 }
307
308 static char *
309 get_id_path_tag_from_fd(struct udev *udev, int fd)
310 {
311 struct udev_device *device;
312 const char *id_path_tag_tmp;
313 char *id_path_tag;
314 UDEV_SYMBOL(const char *, udev_device_get_property_value,
315 (struct udev_device *, const char *));
316 UDEV_SYMBOL(struct udev_device *, udev_device_unref,
317 (struct udev_device *));
318
319 device = udev_device_new_from_fd(udev, fd);
320 if (!device)
321 return NULL;
322
323 id_path_tag_tmp = udev_device_get_property_value(device, "ID_PATH_TAG");
324 if (!id_path_tag_tmp)
325 return NULL;
326
327 id_path_tag = strdup(id_path_tag_tmp);
328
329 udev_device_unref(device);
330 return id_path_tag;
331 }
332
333 #ifdef USE_DRICONF
334 const char __driConfigOptionsLoader[] =
335 DRI_CONF_BEGIN
336 DRI_CONF_SECTION_INITIALIZATION
337 DRI_CONF_DEVICE_ID_PATH_TAG()
338 DRI_CONF_SECTION_END
339 DRI_CONF_END;
340 #endif
341
342 int loader_get_user_preferred_fd(int default_fd, int *different_device)
343 {
344 struct udev *udev;
345 #ifdef USE_DRICONF
346 driOptionCache defaultInitOptions;
347 driOptionCache userInitOptions;
348 #endif
349 const char *dri_prime = getenv("DRI_PRIME");
350 char *prime = NULL;
351 int is_different_device = 0, fd = default_fd;
352 char *default_device_id_path_tag;
353 char *device_name = NULL;
354 char another_tag = 0;
355 UDEV_SYMBOL(struct udev *, udev_new, (void));
356 UDEV_SYMBOL(struct udev *, udev_unref, (struct udev *));
357
358 if (dri_prime)
359 prime = strdup(dri_prime);
360 #ifdef USE_DRICONF
361 else {
362 driParseOptionInfo(&defaultInitOptions, __driConfigOptionsLoader);
363 driParseConfigFiles(&userInitOptions, &defaultInitOptions, 0, "loader");
364 if (driCheckOption(&userInitOptions, "device_id", DRI_STRING))
365 prime = strdup(driQueryOptionstr(&userInitOptions, "device_id"));
366 driDestroyOptionCache(&userInitOptions);
367 driDestroyOptionInfo(&defaultInitOptions);
368 }
369 #endif
370
371 if (prime == NULL) {
372 *different_device = 0;
373 return default_fd;
374 }
375
376 udev = udev_new();
377 if (!udev)
378 goto prime_clean;
379
380 default_device_id_path_tag = get_id_path_tag_from_fd(udev, default_fd);
381 if (!default_device_id_path_tag)
382 goto udev_clean;
383
384 is_different_device = 1;
385 /* two format are supported:
386 * "1": choose any other card than the card used by default.
387 * id_path_tag: (for example "pci-0000_02_00_0") choose the card
388 * with this id_path_tag.
389 */
390 if (!strcmp(prime,"1")) {
391 free(prime);
392 prime = strdup(default_device_id_path_tag);
393 /* request a card with a different card than the default card */
394 another_tag = 1;
395 } else if (!strcmp(default_device_id_path_tag, prime))
396 /* we are to get a new fd (render-node) of the same device */
397 is_different_device = 0;
398
399 device_name = get_render_node_from_id_path_tag(udev,
400 prime,
401 another_tag);
402 if (device_name == NULL) {
403 is_different_device = 0;
404 goto default_device_clean;
405 }
406
407 fd = loader_open_device(device_name);
408 if (fd >= 0) {
409 close(default_fd);
410 } else {
411 fd = default_fd;
412 is_different_device = 0;
413 }
414 free(device_name);
415
416 default_device_clean:
417 free(default_device_id_path_tag);
418 udev_clean:
419 udev_unref(udev);
420 prime_clean:
421 free(prime);
422
423 *different_device = is_different_device;
424 return fd;
425 }
426 #else
427 int loader_get_user_preferred_fd(int default_fd, int *different_device)
428 {
429 *different_device = 0;
430 return default_fd;
431 }
432 #endif
433
434 #if defined(HAVE_SYSFS)
435 static int
436 dev_node_from_fd(int fd, unsigned int *maj, unsigned int *min)
437 {
438 struct stat buf;
439
440 if (fstat(fd, &buf) < 0) {
441 log_(_LOADER_WARNING, "MESA-LOADER: failed to stat fd %d\n", fd);
442 return -1;
443 }
444
445 if (!S_ISCHR(buf.st_mode)) {
446 log_(_LOADER_WARNING, "MESA-LOADER: fd %d not a character device\n", fd);
447 return -1;
448 }
449
450 *maj = major(buf.st_rdev);
451 *min = minor(buf.st_rdev);
452
453 return 0;
454 }
455
456 static int
457 sysfs_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id)
458 {
459 unsigned int maj, min;
460 FILE *f;
461 char buf[0x40];
462
463 if (dev_node_from_fd(fd, &maj, &min) < 0) {
464 *chip_id = -1;
465 return 0;
466 }
467
468 snprintf(buf, sizeof(buf), "/sys/dev/char/%d:%d/device/vendor", maj, min);
469 if (!(f = fopen(buf, "r"))) {
470 *chip_id = -1;
471 return 0;
472 }
473 if (fscanf(f, "%x", vendor_id) != 1) {
474 *chip_id = -1;
475 fclose(f);
476 return 0;
477 }
478 fclose(f);
479 snprintf(buf, sizeof(buf), "/sys/dev/char/%d:%d/device/device", maj, min);
480 if (!(f = fopen(buf, "r"))) {
481 *chip_id = -1;
482 return 0;
483 }
484 if (fscanf(f, "%x", chip_id) != 1) {
485 *chip_id = -1;
486 fclose(f);
487 return 0;
488 }
489 fclose(f);
490 return 1;
491 }
492 #endif
493
494 #if !defined(__NOT_HAVE_DRM_H)
495 /* for i915 */
496 #include <i915_drm.h>
497 /* for radeon */
498 #include <radeon_drm.h>
499
500 static int
501 drm_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id)
502 {
503 drmVersionPtr version;
504
505 *chip_id = -1;
506
507 version = drmGetVersion(fd);
508 if (!version) {
509 log_(_LOADER_WARNING, "MESA-LOADER: invalid drm fd\n");
510 return 0;
511 }
512 if (!version->name) {
513 log_(_LOADER_WARNING, "MESA-LOADER: unable to determine the driver name\n");
514 drmFreeVersion(version);
515 return 0;
516 }
517
518 if (strcmp(version->name, "i915") == 0) {
519 struct drm_i915_getparam gp;
520 int ret;
521
522 *vendor_id = 0x8086;
523
524 memset(&gp, 0, sizeof(gp));
525 gp.param = I915_PARAM_CHIPSET_ID;
526 gp.value = chip_id;
527 ret = drmCommandWriteRead(fd, DRM_I915_GETPARAM, &gp, sizeof(gp));
528 if (ret) {
529 log_(_LOADER_WARNING, "MESA-LOADER: failed to get param for i915\n");
530 *chip_id = -1;
531 }
532 }
533 else if (strcmp(version->name, "radeon") == 0) {
534 struct drm_radeon_info info;
535 int ret;
536
537 *vendor_id = 0x1002;
538
539 memset(&info, 0, sizeof(info));
540 info.request = RADEON_INFO_DEVICE_ID;
541 info.value = (unsigned long) chip_id;
542 ret = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info));
543 if (ret) {
544 log_(_LOADER_WARNING, "MESA-LOADER: failed to get info for radeon\n");
545 *chip_id = -1;
546 }
547 }
548 else if (strcmp(version->name, "nouveau") == 0) {
549 *vendor_id = 0x10de;
550 /* not used */
551 *chip_id = 0;
552 }
553 else if (strcmp(version->name, "vmwgfx") == 0) {
554 *vendor_id = 0x15ad;
555 /* assume SVGA II */
556 *chip_id = 0x0405;
557 }
558
559 drmFreeVersion(version);
560
561 return (*chip_id >= 0);
562 }
563 #endif
564
565
566 int
567 loader_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id)
568 {
569 #if HAVE_LIBUDEV
570 if (libudev_get_pci_id_for_fd(fd, vendor_id, chip_id))
571 return 1;
572 #endif
573 #if HAVE_SYSFS
574 if (sysfs_get_pci_id_for_fd(fd, vendor_id, chip_id))
575 return 1;
576 #endif
577 #if !defined(__NOT_HAVE_DRM_H)
578 if (drm_get_pci_id_for_fd(fd, vendor_id, chip_id))
579 return 1;
580 #endif
581 return 0;
582 }
583
584
585 #ifdef HAVE_LIBUDEV
586 static char *
587 libudev_get_device_name_for_fd(int fd)
588 {
589 char *device_name = NULL;
590 struct udev *udev;
591 struct udev_device *device;
592 const char *const_device_name;
593 UDEV_SYMBOL(struct udev *, udev_new, (void));
594 UDEV_SYMBOL(const char *, udev_device_get_devnode,
595 (struct udev_device *));
596 UDEV_SYMBOL(struct udev_device *, udev_device_unref,
597 (struct udev_device *));
598 UDEV_SYMBOL(struct udev *, udev_unref, (struct udev *));
599
600 if (dlsym_failed)
601 return NULL;
602
603 udev = udev_new();
604 device = udev_device_new_from_fd(udev, fd);
605 if (device == NULL)
606 return NULL;
607
608 const_device_name = udev_device_get_devnode(device);
609 if (!const_device_name)
610 goto out;
611 device_name = strdup(const_device_name);
612
613 out:
614 udev_device_unref(device);
615 udev_unref(udev);
616 return device_name;
617 }
618 #endif
619
620
621 #if HAVE_SYSFS
622 static char *
623 sysfs_get_device_name_for_fd(int fd)
624 {
625 char *device_name = NULL;
626 unsigned int maj, min;
627 FILE *f;
628 char buf[0x40];
629 static const char match[9] = "\0DEVNAME=";
630 int expected = 1;
631
632 if (dev_node_from_fd(fd, &maj, &min) < 0)
633 return NULL;
634
635 snprintf(buf, sizeof(buf), "/sys/dev/char/%d:%d/uevent", maj, min);
636 if (!(f = fopen(buf, "r")))
637 return NULL;
638
639 while (expected < sizeof(match)) {
640 int c = getc(f);
641
642 if (c == EOF) {
643 fclose(f);
644 return NULL;
645 } else if (c == match[expected] )
646 expected++;
647 else
648 expected = 0;
649 }
650
651 strcpy(buf, "/dev/");
652 if (fgets(buf + 5, sizeof(buf) - 5, f))
653 device_name = strdup(buf);
654
655 fclose(f);
656 return device_name;
657 }
658 #endif
659
660
661 char *
662 loader_get_device_name_for_fd(int fd)
663 {
664 char *result = NULL;
665
666 #if HAVE_LIBUDEV
667 if ((result = libudev_get_device_name_for_fd(fd)))
668 return result;
669 #endif
670 #if HAVE_SYSFS
671 if ((result = sysfs_get_device_name_for_fd(fd)))
672 return result;
673 #endif
674 return result;
675 }
676
677 char *
678 loader_get_driver_for_fd(int fd, unsigned driver_types)
679 {
680 int vendor_id, chip_id, i, j;
681 char *driver = NULL;
682
683 if (!driver_types)
684 driver_types = _LOADER_GALLIUM | _LOADER_DRI;
685
686 if (!loader_get_pci_id_for_fd(fd, &vendor_id, &chip_id)) {
687
688 #ifndef __NOT_HAVE_DRM_H
689 /* fallback to drmGetVersion(): */
690 drmVersionPtr version = drmGetVersion(fd);
691
692 if (!version) {
693 log_(_LOADER_WARNING, "failed to get driver name for fd %d\n", fd);
694 return NULL;
695 }
696
697 driver = strndup(version->name, version->name_len);
698 log_(_LOADER_INFO, "using driver %s for %d\n", driver, fd);
699
700 drmFreeVersion(version);
701 #endif
702
703 return driver;
704 }
705
706 for (i = 0; driver_map[i].driver; i++) {
707 if (vendor_id != driver_map[i].vendor_id)
708 continue;
709
710 if (!(driver_types & driver_map[i].driver_types))
711 continue;
712
713 if (driver_map[i].predicate && !driver_map[i].predicate(fd))
714 continue;
715
716 if (driver_map[i].num_chips_ids == -1) {
717 driver = strdup(driver_map[i].driver);
718 goto out;
719 }
720
721 for (j = 0; j < driver_map[i].num_chips_ids; j++)
722 if (driver_map[i].chip_ids[j] == chip_id) {
723 driver = strdup(driver_map[i].driver);
724 goto out;
725 }
726 }
727
728 out:
729 log_(driver ? _LOADER_DEBUG : _LOADER_WARNING,
730 "pci id for fd %d: %04x:%04x, driver %s\n",
731 fd, vendor_id, chip_id, driver);
732 return driver;
733 }
734
735 void
736 loader_set_logger(void (*logger)(int level, const char *fmt, ...))
737 {
738 log_ = logger;
739 }