linux/fs/ocfs2/dlmfs/dlmfs.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * dlmfs.c
 *
 * Code which implements the kernel side of a minimal userspace
 * interface to our DLM. This file handles the virtual file system
 * used for communication with userspace. Credit should go to ramfs,
 * which was a template for the fs side of this module.
 *
 * Copyright (C) 2003, 2004 Oracle.  All rights reserved.
 */

/* Simple VFS hooks based on: */
/*
 * Resizable simple ram filesystem for Linux.
 *
 * Copyright (C) 2000 Linus Torvalds.
 *               2000 Transmeta Corp.
 */

#include <linux/module.h>
#include <linux/fs.h>
#include <linux/pagemap.h>
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/highmem.h>
#include <linux/init.h>
#include <linux/string.h>
#include <linux/backing-dev.h>
#include <linux/poll.h>

#include <linux/uaccess.h>

#include "../stackglue.h"
#include "userdlm.h"

#define MLOG_MASK_PREFIX
#include "../cluster/masklog.h"


static const struct super_operations dlmfs_ops;
static const struct file_operations dlmfs_file_operations;
static const struct inode_operations dlmfs_dir_inode_operations;
static const struct inode_operations dlmfs_root_inode_operations;
static const struct inode_operations dlmfs_file_inode_operations;
static struct kmem_cache *dlmfs_inode_cache;

struct workqueue_struct *user_dlm_worker;



/*
 * These are the ABI capabilities of dlmfs.
 *
 * Over time, dlmfs has added some features that were not part of the
 * initial ABI.  Unfortunately, some of these features are not detectable
 * via standard usage.  For example, Linux's default poll always returns
 * EPOLLIN, so there is no way for a caller of poll(2) to know when dlmfs
 * added poll support.  Instead, we provide this list of new capabilities.
 *
 * Capabilities is a read-only attribute.  We do it as a module parameter
 * so we can discover it whether dlmfs is built in, loaded, or even not
 * loaded.
 *
 * The ABI features are local to this machine's dlmfs mount.  This is
 * distinct from the locking protocol, which is concerned with inter-node
 * interaction.
 *
 * Capabilities:
 * - bast	: EPOLLIN against the file descriptor of a held lock
 *		  signifies a bast fired on the lock.
 */
#define DLMFS_CAPABILITIES
static int param_set_dlmfs_capabilities(const char *val,
					const struct kernel_param *kp)
{}
static int param_get_dlmfs_capabilities(char *buffer,
					const struct kernel_param *kp)
{}
module_param_call();
MODULE_PARM_DESC(capabilities, DLMFS_CAPABILITIES);


/*
 * decodes a set of open flags into a valid lock level and a set of flags.
 * returns < 0 if we have invalid flags
 * flags which mean something to us:
 * O_RDONLY -> PRMODE level
 * O_WRONLY -> EXMODE level
 *
 * O_NONBLOCK -> NOQUEUE
 */
static int dlmfs_decode_open_flags(int open_flags,
				   int *level,
				   int *flags)
{}

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

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

/*
 * We do ->setattr() just to override size changes.  Our size is the size
 * of the LVB and nothing else.
 */
static int dlmfs_file_setattr(struct mnt_idmap *idmap,
			      struct dentry *dentry, struct iattr *attr)
{}

static __poll_t dlmfs_file_poll(struct file *file, poll_table *wait)
{}

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

static ssize_t dlmfs_file_write(struct file *filp,
				const char __user *buf,
				size_t count,
				loff_t *ppos)
{}

static void dlmfs_init_once(void *foo)
{}

static struct inode *dlmfs_alloc_inode(struct super_block *sb)
{}

static void dlmfs_free_inode(struct inode *inode)
{}

static void dlmfs_evict_inode(struct inode *inode)
{}

static struct inode *dlmfs_get_root_inode(struct super_block *sb)
{}

static struct inode *dlmfs_get_inode(struct inode *parent,
				     struct dentry *dentry,
				     umode_t mode)
{}

/*
 * File creation. Allocate an inode, and we're done..
 */
/* SMP-safe */
static int dlmfs_mkdir(struct mnt_idmap * idmap,
		       struct inode * dir,
		       struct dentry * dentry,
		       umode_t mode)
{}

static int dlmfs_create(struct mnt_idmap *idmap,
			struct inode *dir,
			struct dentry *dentry,
			umode_t mode,
			bool excl)
{}

static int dlmfs_unlink(struct inode *dir,
			struct dentry *dentry)
{}

static int dlmfs_fill_super(struct super_block * sb,
			    void * data,
			    int silent)
{}

static const struct file_operations dlmfs_file_operations =;

static const struct inode_operations dlmfs_dir_inode_operations =;

/* this way we can restrict mkdir to only the toplevel of the fs. */
static const struct inode_operations dlmfs_root_inode_operations =;

static const struct super_operations dlmfs_ops =;

static const struct inode_operations dlmfs_file_inode_operations =;

static struct dentry *dlmfs_mount(struct file_system_type *fs_type,
	int flags, const char *dev_name, void *data)
{}

static struct file_system_type dlmfs_fs_type =;
MODULE_ALIAS_FS();

static int __init init_dlmfs_fs(void)
{}

static void __exit exit_dlmfs_fs(void)
{}

MODULE_AUTHOR();
MODULE_LICENSE();
MODULE_DESCRIPTION();

module_init()
module_exit()