lindebugfs: Add debugfs_create_file_size()

This is the same as `debugfs_create_file()` but takes the initial size
of the file. In FreeBSD, the given size is ignored and
`debugfs_create_file()` is called.

Reviewed by:	emaste, manu
Approved by:	manu
Differential Revision:	https://reviews.freebsd.org/D37914
This commit is contained in:
Jean-Sébastien Pédron 2022-12-30 10:57:49 +01:00
parent 66cc55a041
commit a04aa80e77
No known key found for this signature in database
GPG Key ID: 39E99761A5FD94CC
2 changed files with 18 additions and 1 deletions

View File

@ -213,6 +213,16 @@ debugfs_create_file(const char *name, umode_t mode,
return (dnode);
}
struct dentry *
debugfs_create_file_size(const char *name, umode_t mode,
struct dentry *parent, void *data,
const struct file_operations *fops,
loff_t file_size __unused)
{
return debugfs_create_file(name, mode, parent, data, fops);
}
/*
* NOTE: Files created with the _unsafe moniker will not be protected from
* debugfs core file removals. It is the responsibility of @fops to protect
@ -228,6 +238,7 @@ debugfs_create_file_unsafe(const char *name, umode_t mode,
struct dentry *parent, void *data,
const struct file_operations *fops)
{
return (debugfs_create_file(name, mode, parent, data, fops));
}

View File

@ -56,8 +56,14 @@ struct dentry *debugfs_create_file(const char *name, umode_t mode,
struct dentry *parent, void *data,
const struct file_operations *fops);
struct dentry *debugfs_create_file_unsafe(const char *name, umode_t mode,
/* TODO: We currently ignore the `file_size` argument. */
struct dentry *debugfs_create_file_size(const char *name, umode_t mode,
struct dentry *parent, void *data,
const struct file_operations *fops,
loff_t file_size);
struct dentry *debugfs_create_file_unsafe(const char *name, umode_t mode,
struct dentry *parent, void *data,
const struct file_operations *fops);
struct dentry *debugfs_create_mode_unsafe(const char *name, umode_t mode,