1 /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
5 * wrapper around bootid read. Read the boot id through the /proc filesystem.
7 * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 #include <linux/errno.h>
12 /* boot_id depends on sysctl */
13 #if defined(CONFIG_SYSCTL)
16 #include <linux/file.h>
17 #include <linux/sched.h>
18 #include <linux/uaccess.h>
19 #include <wrapper/random.h>
22 * Returns string boot id.
24 int wrapper_get_bootid(char *bootid
)
31 file
= filp_open("/proc/sys/kernel/random/boot_id", O_RDONLY
, 0);
38 if (!file
->f_op
|| !file
->f_op
->read
) {
43 len
= file
->f_op
->read(file
, bootid
, BOOT_ID_LEN
- 1, &file
->f_pos
);
44 if (len
!= BOOT_ID_LEN
- 1) {
49 bootid
[BOOT_ID_LEN
- 1] = '\0';
53 filp_close(file
, current
->files
);
56 EXPORT_SYMBOL_GPL(wrapper_get_bootid
);
60 int wrapper_get_bootid(char *bootid
)
64 EXPORT_SYMBOL_GPL(wrapper_get_bootid
);
This page took 0.031179 seconds and 4 git commands to generate.