Page MenuHomeFreeBSD

D37090.id112104.diff
No OneTemporary

D37090.id112104.diff

diff --git a/sys/compat/lindebugfs/lindebugfs.c b/sys/compat/lindebugfs/lindebugfs.c
--- a/sys/compat/lindebugfs/lindebugfs.c
+++ b/sys/compat/lindebugfs/lindebugfs.c
@@ -367,6 +367,36 @@
&fops_bool_ro, &fops_bool_wo);
}
+
+static int
+debugfs_u8_get(void *data, uint64_t *value)
+{
+ uint8_t *u8data = data;
+ *value = *u8data;
+ return (0);
+}
+
+static int
+debugfs_u8_set(void *data, uint64_t value)
+{
+ uint8_t *u8data = data;
+ *u8data = (uint8_t)value;
+ return (0);
+}
+
+DEFINE_DEBUGFS_ATTRIBUTE(fops_u8, debugfs_u8_get, debugfs_u8_set, "%u\n");
+DEFINE_DEBUGFS_ATTRIBUTE(fops_u8_ro, debugfs_u8_get, NULL, "%u\n");
+DEFINE_DEBUGFS_ATTRIBUTE(fops_u8_wo, NULL, debugfs_u8_set, "%u\n");
+
+void
+debugfs_create_u8(const char *name, umode_t mode, struct dentry *parent, uint8_t *value)
+{
+ debugfs_create_mode_unsafe(name, mode, parent, value, &fops_u8,
+ &fops_u8_ro, &fops_u8_wo);
+}
+
+
+
static int
debugfs_ulong_get(void *data, uint64_t *value)
{
@@ -394,6 +424,45 @@
&fops_ulong_ro, &fops_ulong_wo);
}
+
+
+
+static int
+debugfs_blob_get(void *data, uint64_t *value)
+{
+ *value =
+ ('X' << 7) |
+ ('X' << 6) |
+ ('X' << 5) |
+ ('B' << 4) |
+ ('L' << 3) |
+ ('O' << 2) |
+ ('B' << 1) |
+ '0';
+ return (0);
+}
+
+static int
+debugfs_blob_set(void *data, uint64_t value)
+{
+ char *bdata = data;
+ memcpy(bdata, "BLOBXXX\0", 8);
+ return (0);
+}
+
+DEFINE_DEBUGFS_ATTRIBUTE(fops_blob, debugfs_blob_get, debugfs_blob_set, "%s\n");
+DEFINE_DEBUGFS_ATTRIBUTE(fops_blob_ro, debugfs_blob_get, NULL, "%s\n");
+DEFINE_DEBUGFS_ATTRIBUTE(fops_blob_wo, NULL, debugfs_blob_set, "%s\n");
+
+struct dentry *
+debugfs_create_blob(const char *name, umode_t mode, struct dentry *parent,
+ struct debugfs_blob_wrapper *value)
+{
+ return (debugfs_create_mode_unsafe(name, mode, parent, value, &fops_blob,
+ &fops_blob_ro, &fops_blob_wo));
+}
+
+
static int
lindebugfs_init(PFS_INIT_ARGS)
{
diff --git a/sys/compat/linuxkpi/common/include/linux/debugfs.h b/sys/compat/linuxkpi/common/include/linux/debugfs.h
--- a/sys/compat/linuxkpi/common/include/linux/debugfs.h
+++ b/sys/compat/linuxkpi/common/include/linux/debugfs.h
@@ -47,6 +47,11 @@
int nregs;
};
+struct debugfs_blob_wrapper {
+ void *data;
+ size_t size;
+};
+
struct dentry *debugfs_create_file(const char *name, umode_t mode,
struct dentry *parent, void *data,
const struct file_operations *fops);
@@ -75,8 +80,12 @@
void debugfs_create_bool(const char *name, umode_t mode, struct dentry *parent,
bool *value);
-
+void debugfs_create_u8(const char *name, umode_t mode, struct dentry *parent,
+ uint8_t *value);
void debugfs_create_ulong(const char *name, umode_t mode, struct dentry *parent,
unsigned long *value);
+struct dentry *debugfs_create_blob(const char *name, umode_t mode,
+ struct dentry *parent, struct debugfs_blob_wrapper *value);
+
#endif /* _LINUXKPI_LINUX_DEBUGFS_H_ */

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 24, 4:43 PM (19 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16092641
Default Alt Text
D37090.id112104.diff (2 KB)

Event Timeline