4 * wrapper around bootid read. Using KALLSYMS to get its address when
5 * available, else we need to have a kernel that exports this function to GPL
8 * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; only
13 * version 2.1 of the License.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 #include <linux/errno.h>
27 /* boot_id depends on sysctl */
28 #if defined(CONFIG_SYSCTL)
31 #include <linux/file.h>
32 #include <linux/sched.h>
33 #include <linux/uaccess.h>
34 #include <wrapper/random.h>
37 * Returns string boot id.
39 int wrapper_get_bootid(char *bootid
)
46 file
= filp_open("/proc/sys/kernel/random/boot_id", O_RDONLY
, 0);
53 if (!file
->f_op
|| !file
->f_op
->read
) {
58 len
= file
->f_op
->read(file
, bootid
, BOOT_ID_LEN
- 1, &file
->f_pos
);
59 if (len
!= BOOT_ID_LEN
- 1) {
64 bootid
[BOOT_ID_LEN
- 1] = '\0';
68 filp_close(file
, current
->files
);
74 int wrapper_get_bootid(char *bootid
)
This page took 0.030507 seconds and 4 git commands to generate.