LinuxKPI: seq_file add "private" versions.
Add __seq_open_private() and seq_release_private() needed by iwlwifi debugfs support. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D37089
This commit is contained in:
parent
eefd863cba
commit
b5a8107590
@ -69,6 +69,9 @@ struct seq_operations {
|
|||||||
ssize_t seq_read(struct linux_file *, char *, size_t, off_t *);
|
ssize_t seq_read(struct linux_file *, char *, size_t, off_t *);
|
||||||
int seq_write(struct seq_file *seq, const void *data, size_t len);
|
int seq_write(struct seq_file *seq, const void *data, size_t len);
|
||||||
|
|
||||||
|
void *__seq_open_private(struct linux_file *, const struct seq_operations *, int);
|
||||||
|
int seq_release_private(struct inode *, struct linux_file *);
|
||||||
|
|
||||||
int seq_open(struct linux_file *f, const struct seq_operations *op);
|
int seq_open(struct linux_file *f, const struct seq_operations *op);
|
||||||
int seq_release(struct inode *inode, struct linux_file *file);
|
int seq_release(struct inode *inode, struct linux_file *file);
|
||||||
|
|
||||||
|
@ -130,6 +130,29 @@ seq_open(struct linux_file *f, const struct seq_operations *op)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *
|
||||||
|
__seq_open_private(struct linux_file *f, const struct seq_operations *op, int size)
|
||||||
|
{
|
||||||
|
struct seq_file *seq_file;
|
||||||
|
void *private;
|
||||||
|
int error;
|
||||||
|
|
||||||
|
private = malloc(size, M_LSEQ, M_NOWAIT|M_ZERO);
|
||||||
|
if (private == NULL)
|
||||||
|
return (NULL);
|
||||||
|
|
||||||
|
error = seq_open(f, op);
|
||||||
|
if (error < 0) {
|
||||||
|
free(private, M_LSEQ);
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
seq_file = (struct seq_file *)f->private_data;
|
||||||
|
seq_file->private = private;
|
||||||
|
|
||||||
|
return (private);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
single_open(struct linux_file *f, int (*show)(struct seq_file *, void *), void *d)
|
single_open(struct linux_file *f, int (*show)(struct seq_file *, void *), void *d)
|
||||||
{
|
{
|
||||||
@ -166,6 +189,16 @@ seq_release(struct inode *inode __unused, struct linux_file *file)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
seq_release_private(struct inode *inode __unused, struct linux_file *f)
|
||||||
|
{
|
||||||
|
struct seq_file *seq;
|
||||||
|
|
||||||
|
seq = (struct seq_file *)f->private_data;
|
||||||
|
free(seq->private, M_LSEQ);
|
||||||
|
return (seq_release(inode, f));
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
single_release(struct vnode *v, struct linux_file *f)
|
single_release(struct vnode *v, struct linux_file *f)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user