linux/fs/configfs/file.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * file.c - operations for regular (text) files.
 *
 * Based on sysfs:
 * 	sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel
 *
 * configfs Copyright (C) 2005 Oracle.  All rights reserved.
 */

#include <linux/fs.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/mutex.h>
#include <linux/vmalloc.h>
#include <linux/uaccess.h>
#include <linux/uio.h>
#include <linux/configfs.h>
#include "configfs_internal.h"

/*
 * A simple attribute can only be 4096 characters.  Why 4k?  Because the
 * original code limited it to PAGE_SIZE.  That's a bad idea, though,
 * because an attribute of 16k on ia64 won't work on x86.  So we limit to
 * 4k, our minimum common page size.
 */
#define SIMPLE_ATTR_SIZE

struct configfs_buffer {};

static inline struct configfs_fragment *to_frag(struct file *file)
{}

static int fill_read_buffer(struct file *file, struct configfs_buffer *buffer)
{}

static ssize_t configfs_read_iter(struct kiocb *iocb, struct iov_iter *to)
{}

static ssize_t configfs_bin_read_iter(struct kiocb *iocb, struct iov_iter *to)
{}

/* Fill @buffer with data coming from @from. */
static int fill_write_buffer(struct configfs_buffer *buffer,
			     struct iov_iter *from)
{}

static int
flush_write_buffer(struct file *file, struct configfs_buffer *buffer, size_t count)
{}


/*
 * There is no easy way for us to know if userspace is only doing a partial
 * write, so we don't support them. We expect the entire buffer to come on the
 * first write.
 * Hint: if you're writing a value, first read the file, modify only the value
 * you're changing, then write entire buffer back.
 */
static ssize_t configfs_write_iter(struct kiocb *iocb, struct iov_iter *from)
{}

static ssize_t configfs_bin_write_iter(struct kiocb *iocb,
				       struct iov_iter *from)
{}

static int __configfs_open_file(struct inode *inode, struct file *file, int type)
{}

static int configfs_release(struct inode *inode, struct file *filp)
{}

static int configfs_open_file(struct inode *inode, struct file *filp)
{}

static int configfs_open_bin_file(struct inode *inode, struct file *filp)
{}

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


const struct file_operations configfs_file_operations =;

const struct file_operations configfs_bin_file_operations =;

/**
 *	configfs_create_file - create an attribute file for an item.
 *	@item:	item we're creating for.
 *	@attr:	atrribute descriptor.
 */

int configfs_create_file(struct config_item * item, const struct configfs_attribute * attr)
{}

/**
 *	configfs_create_bin_file - create a binary attribute file for an item.
 *	@item:	item we're creating for.
 *	@bin_attr: atrribute descriptor.
 */

int configfs_create_bin_file(struct config_item *item,
		const struct configfs_bin_attribute *bin_attr)
{}