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 /* boot_id depends on sysctl */
26 #if defined(CONFIG_SYSCTL)
29 #include <linux/file.h>
30 #include <linux/sched.h>
31 #include <linux/uaccess.h>
35 * Returns string boot id.
37 int wrapper_get_bootid(char *bootid)
44 file = filp_open("/proc/sys/kernel/random/boot_id", O_RDONLY, 0);
51 if (!file->f_op || !file->f_op->read) {
56 len = file->f_op->read(file, bootid, BOOT_ID_LEN - 1, &file->f_pos);
57 if (len != BOOT_ID_LEN - 1) {
62 bootid[BOOT_ID_LEN - 1] = '\0';
66 filp_close(file, current->files);
72 int wrapper_get_bootid(char *bootid)