Example #1
0
int libcfs_ioctl(unsigned long cmd, void __user *uparam)
{
	struct libcfs_ioctl_data *data = NULL;
	struct libcfs_ioctl_hdr *hdr;
	int err;

	/* 'cmd' and permissions get checked in our arch-specific caller */
	err = libcfs_ioctl_getdata(&hdr, uparam);
	if (err) {
		CDEBUG_LIMIT(D_ERROR,
			     "libcfs ioctl: data header error %d\n", err);
		return err;
	}

	if (hdr->ioc_version == LIBCFS_IOCTL_VERSION) {
		/*
		 * The libcfs_ioctl_data_adjust() function performs adjustment
		 * operations on the libcfs_ioctl_data structure to make
		 * it usable by the code.  This doesn't need to be called
		 * for new data structures added.
		 */
		data = container_of(hdr, struct libcfs_ioctl_data, ioc_hdr);
		err = libcfs_ioctl_data_adjust(data);
		if (err)
			goto out;
	}
Example #2
0
static int libcfs_ioctl_handle(struct cfs_psdev_file *pfile, unsigned long cmd,
			       void __user *arg, struct libcfs_ioctl_hdr *hdr)
{
	struct libcfs_ioctl_data *data = NULL;
	int err = -EINVAL;

	/*
	 * The libcfs_ioctl_data_adjust() function performs adjustment
	 * operations on the libcfs_ioctl_data structure to make
	 * it usable by the code.  This doesn't need to be called
	 * for new data structures added.
	 */
	if (hdr->ioc_version == LIBCFS_IOCTL_VERSION) {
		data = container_of(hdr, struct libcfs_ioctl_data, ioc_hdr);
		err = libcfs_ioctl_data_adjust(data);
		if (err)
			return err;
	}