2 * Copyright (c) 2013, Cisco Systems, Inc. All rights reserved.
4 * This program is free software; you may redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
11 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
12 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
13 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
14 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 #include <linux/debugfs.h>
20 #include <linux/module.h>
23 #include "usnic_log.h"
24 #include "usnic_debugfs.h"
26 static struct dentry
*debugfs_root
;
28 static ssize_t
usnic_debugfs_buildinfo_read(struct file
*f
, char __user
*data
,
29 size_t count
, loff_t
*ppos
)
37 res
= scnprintf(buf
, sizeof(buf
),
40 DRV_VERSION
, DRV_RELDATE
);
42 return simple_read_from_buffer(data
, count
, ppos
, buf
, res
);
45 static const struct file_operations usnic_debugfs_buildinfo_ops
= {
48 .read
= usnic_debugfs_buildinfo_read
51 void usnic_debugfs_init(void)
53 debugfs_root
= debugfs_create_dir(DRV_NAME
, NULL
);
54 if (IS_ERR(debugfs_root
)) {
55 usnic_err("Failed to create debugfs root dir, check if debugfs is enabled in kernel configuration\n");
60 debugfs_create_file("build-info", S_IRUGO
, debugfs_root
,
61 NULL
, &usnic_debugfs_buildinfo_ops
);
64 void usnic_debugfs_exit(void)
69 debugfs_remove_recursive(debugfs_root
);