cregit-Linux how code gets into the kernel

Release 4.14 arch/s390/hypfs/hypfs_dbfs.c

Directory: arch/s390/hypfs
// SPDX-License-Identifier: GPL-2.0
/*
 * Hypervisor filesystem for Linux on s390 - debugfs interface
 *
 * Copyright IBM Corp. 2010
 * Author(s): Michael Holzheu <holzheu@linux.vnet.ibm.com>
 */

#include <linux/slab.h>
#include "hypfs.h"


static struct dentry *dbfs_dir;


static struct hypfs_dbfs_data *hypfs_dbfs_data_alloc(struct hypfs_dbfs_file *f) { struct hypfs_dbfs_data *data; data = kmalloc(sizeof(*data), GFP_KERNEL); if (!data) return NULL; data->dbfs_file = f; return data; }

Contributors

PersonTokensPropCommitsCommitProp
Michael Holzheu48100.00%1100.00%
Total48100.00%1100.00%


static void hypfs_dbfs_data_free(struct hypfs_dbfs_data *data) { data->dbfs_file->data_free(data->buf_free_ptr); kfree(data); }

Contributors

PersonTokensPropCommitsCommitProp
Michael Holzheu27100.00%2100.00%
Total27100.00%2100.00%


static ssize_t dbfs_read(struct file *file, char __user *buf, size_t size, loff_t *ppos) { struct hypfs_dbfs_data *data; struct hypfs_dbfs_file *df; ssize_t rc; if (*ppos != 0) return 0; df = file_inode(file)->i_private; mutex_lock(&df->lock); data = hypfs_dbfs_data_alloc(df); if (!data) { mutex_unlock(&df->lock); return -ENOMEM; } rc = df->data_create(&data->buf, &data->buf_free_ptr, &data->size); if (rc) { mutex_unlock(&df->lock); kfree(data); return rc; } mutex_unlock(&df->lock); rc = simple_read_from_buffer(buf, size, ppos, data->buf, data->size); hypfs_dbfs_data_free(data); return rc; }

Contributors

PersonTokensPropCommitsCommitProp
Michael Holzheu16598.21%266.67%
Al Viro31.79%133.33%
Total168100.00%3100.00%


static long dbfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { struct hypfs_dbfs_file *df = file_inode(file)->i_private; long rc; mutex_lock(&df->lock); if (df->unlocked_ioctl) rc = df->unlocked_ioctl(file, cmd, arg); else rc = -ENOTTY; mutex_unlock(&df->lock); return rc; }

Contributors

PersonTokensPropCommitsCommitProp
Martin Schwidefsky7191.03%150.00%
Al Viro78.97%150.00%
Total78100.00%2100.00%

static const struct file_operations dbfs_ops = { .read = dbfs_read, .llseek = no_llseek, .unlocked_ioctl = dbfs_ioctl, };
int hypfs_dbfs_create_file(struct hypfs_dbfs_file *df) { df->dentry = debugfs_create_file(df->name, 0400, dbfs_dir, df, &dbfs_ops); if (IS_ERR(df->dentry)) return PTR_ERR(df->dentry); mutex_init(&df->lock); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Michael Holzheu58100.00%1100.00%
Total58100.00%1100.00%


void hypfs_dbfs_remove_file(struct hypfs_dbfs_file *df) { debugfs_remove(df->dentry); }

Contributors

PersonTokensPropCommitsCommitProp
Michael Holzheu17100.00%1100.00%
Total17100.00%1100.00%


int hypfs_dbfs_init(void) { dbfs_dir = debugfs_create_dir("s390_hypfs", NULL); return PTR_ERR_OR_ZERO(dbfs_dir); }

Contributors

PersonTokensPropCommitsCommitProp
Michael Holzheu2195.45%150.00%
Rusty Russell14.55%150.00%
Total22100.00%2100.00%


void hypfs_dbfs_exit(void) { debugfs_remove(dbfs_dir); }

Contributors

PersonTokensPropCommitsCommitProp
Michael Holzheu12100.00%1100.00%
Total12100.00%1100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
Michael Holzheu37880.94%225.00%
Martin Schwidefsky7616.27%112.50%
Al Viro102.14%225.00%
Heiko Carstens10.21%112.50%
Rusty Russell10.21%112.50%
Greg Kroah-Hartman10.21%112.50%
Total467100.00%8100.00%
Directory: arch/s390/hypfs
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.