linux/drivers/misc/ibmasm/ibmasmfs.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * IBM ASM Service Processor Device Driver
 *
 * Copyright (C) IBM Corporation, 2004
 *
 * Author: Max Asböck <[email protected]>
 */

/*
 * Parts of this code are based on an article by Jonathan Corbet
 * that appeared in Linux Weekly News.
 */


/*
 * The IBMASM file virtual filesystem. It creates the following hierarchy
 * dynamically when mounted from user space:
 *
 *    /ibmasm
 *    |-- 0
 *    |   |-- command
 *    |   |-- event
 *    |   |-- reverse_heartbeat
 *    |   `-- remote_video
 *    |       |-- depth
 *    |       |-- height
 *    |       `-- width
 *    .
 *    .
 *    .
 *    `-- n
 *        |-- command
 *        |-- event
 *        |-- reverse_heartbeat
 *        `-- remote_video
 *            |-- depth
 *            |-- height
 *            `-- width
 *
 * For each service processor the following files are created:
 *
 * command: execute dot commands
 *	write: execute a dot command on the service processor
 *	read: return the result of a previously executed dot command
 *
 * events: listen for service processor events
 *	read: sleep (interruptible) until an event occurs
 *      write: wakeup sleeping event listener
 *
 * reverse_heartbeat: send a heartbeat to the service processor
 *	read: sleep (interruptible) until the reverse heartbeat fails
 *      write: wakeup sleeping heartbeat listener
 *
 * remote_video/width
 * remote_video/height
 * remote_video/width: control remote display settings
 *	write: set value
 *	read: read value
 */

#include <linux/fs.h>
#include <linux/fs_context.h>
#include <linux/pagemap.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <asm/io.h>
#include "ibmasm.h"
#include "remote.h"
#include "dot_command.h"

#define IBMASMFS_MAGIC

static LIST_HEAD(service_processors);

static struct inode *ibmasmfs_make_inode(struct super_block *sb, int mode);
static void ibmasmfs_create_files (struct super_block *sb);
static int ibmasmfs_fill_super(struct super_block *sb, struct fs_context *fc);

static int ibmasmfs_get_tree(struct fs_context *fc)
{}

static const struct fs_context_operations ibmasmfs_context_ops =;

static int ibmasmfs_init_fs_context(struct fs_context *fc)
{}

static const struct super_operations ibmasmfs_s_ops =;

static const struct file_operations *ibmasmfs_dir_ops =;

static struct file_system_type ibmasmfs_type =;
MODULE_ALIAS_FS();

static int ibmasmfs_fill_super(struct super_block *sb, struct fs_context *fc)
{}

static struct inode *ibmasmfs_make_inode(struct super_block *sb, int mode)
{}

static struct dentry *ibmasmfs_create_file(struct dentry *parent,
			const char *name,
			const struct file_operations *fops,
			void *data,
			int mode)
{}

static struct dentry *ibmasmfs_create_dir(struct dentry *parent,
				const char *name)
{}

int ibmasmfs_register(void)
{}

void ibmasmfs_unregister(void)
{}

void ibmasmfs_add_sp(struct service_processor *sp)
{}

/* struct to save state between command file operations */
struct ibmasmfs_command_data {};

/* struct to save state between event file operations */
struct ibmasmfs_event_data {};

/* struct to save state between reverse heartbeat file operations */
struct ibmasmfs_heartbeat_data {};

static int command_file_open(struct inode *inode, struct file *file)
{}

static int command_file_close(struct inode *inode, struct file *file)
{}

static ssize_t command_file_read(struct file *file, char __user *buf, size_t count, loff_t *offset)
{}

static ssize_t command_file_write(struct file *file, const char __user *ubuff, size_t count, loff_t *offset)
{}

static int event_file_open(struct inode *inode, struct file *file)
{}

static int event_file_close(struct inode *inode, struct file *file)
{}

static ssize_t event_file_read(struct file *file, char __user *buf, size_t count, loff_t *offset)
{}

static ssize_t event_file_write(struct file *file, const char __user *buf, size_t count, loff_t *offset)
{}

static int r_heartbeat_file_open(struct inode *inode, struct file *file)
{}

static int r_heartbeat_file_close(struct inode *inode, struct file *file)
{}

static ssize_t r_heartbeat_file_read(struct file *file, char __user *buf, size_t count, loff_t *offset)
{}

static ssize_t r_heartbeat_file_write(struct file *file, const char __user *buf, size_t count, loff_t *offset)
{}

static int remote_settings_file_close(struct inode *inode, struct file *file)
{}

static ssize_t remote_settings_file_read(struct file *file, char __user *buf, size_t count, loff_t *offset)
{}

static ssize_t remote_settings_file_write(struct file *file, const char __user *ubuff, size_t count, loff_t *offset)
{}

static const struct file_operations command_fops =;

static const struct file_operations event_fops =;

static const struct file_operations r_heartbeat_fops =;

static const struct file_operations remote_settings_fops =;


static void ibmasmfs_create_files (struct super_block *sb)
{}