X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=libcfs%2Flibcfs%2Fmodule.c;h=76210230baed4b447a51c0dae4e8dc81ee5779b8;hb=refs%2Fchanges%2F06%2F11506%2F6;hp=8eeca56a8f44738ddab9428fa0aebe6c477f8d72;hpb=da677c1c4f37886ff7b8d31396645b12365c0e88;p=fs%2Flustre-release.git diff --git a/libcfs/libcfs/module.c b/libcfs/libcfs/module.c index 8eeca56..7621023 100644 --- a/libcfs/libcfs/module.c +++ b/libcfs/libcfs/module.c @@ -35,16 +35,15 @@ */ #define DEBUG_SUBSYSTEM S_LNET -/* TODO - This will be completed in the subsequent patches. - * For this patch the MAX is hardcoded, in the next patch - * the value will be set to the largest data structure that - * can be sent from user space */ -#define LIBCFS_MAX_IOCTL_BUF_LEN 2048 +#define LNET_MAX_IOCTL_BUF_LEN (sizeof(struct lnet_ioctl_net_config) + \ + sizeof(struct lnet_ioctl_config_data)) #include #include #include +#include #include +#include #include "tracefile.h" void @@ -230,10 +229,11 @@ static int libcfs_ioctl_handle(struct cfs_psdev_file *pfile, unsigned long cmd, int err; ENTRY; - /* TODO: this is going to change in subsequent patches - * to exclude messages which use the new data structures */ - if ((cmd <= IOC_LIBCFS_LNETST) || - (cmd >= IOC_LIBCFS_REGISTER_MYNID)) { + /* 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 != 0) { @@ -325,7 +325,7 @@ static int libcfs_ioctl(struct cfs_psdev_file *pfile, * do a check here to restrict the size of the memory * to allocate to guard against DoS attacks. */ - if (buf_len > LIBCFS_MAX_IOCTL_BUF_LEN) { + if (buf_len > LNET_MAX_IOCTL_BUF_LEN) { CERROR("LNET: user buffer exceeds kernel buffer\n"); RETURN(-EINVAL); }