1 /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
5 * wrapper around bootid read. Using KALLSYMS to get its address when
6 * available, else we need to have a kernel that exports this function to GPL
9 * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 #include <linux/errno.h>
14 /* boot_id depends on sysctl */
15 #if defined(CONFIG_SYSCTL)
18 #include <linux/file.h>
19 #include <linux/sched.h>
20 #include <linux/uaccess.h>
21 #include <wrapper/random.h>
24 * Returns string boot id.
26 int wrapper_get_bootid(char *bootid
)
33 file
= filp_open("/proc/sys/kernel/random/boot_id", O_RDONLY
, 0);
40 if (!file
->f_op
|| !file
->f_op
->read
) {
45 len
= file
->f_op
->read(file
, bootid
, BOOT_ID_LEN
- 1, &file
->f_pos
);
46 if (len
!= BOOT_ID_LEN
- 1) {
51 bootid
[BOOT_ID_LEN
- 1] = '\0';
55 filp_close(file
, current
->files
);
58 EXPORT_SYMBOL_GPL(wrapper_get_bootid
);
62 int wrapper_get_bootid(char *bootid
)
66 EXPORT_SYMBOL_GPL(wrapper_get_bootid
);
This page took 0.031174 seconds and 5 git commands to generate.