Message ID | 1442271047-4908-12-git-send-email-palmer@dabbelt.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 09/14/2015 03:50 PM, Palmer Dabbelt wrote: > While I don't think this was ever meant to be exposed to userspace, if > anyone is using it then this will at least provide a correct (if > unlikely) definition. > > MAX_RAW_MINORS used to be used in the kernel, where it's been replaced > with CONFIG_MAX_RAW_MINORS. > > Note that there's a checkpatch.pl warning about a split config string > here, but I've left that alone. From a UAPI perspective I would think the right value would be 2^20. -hpa -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, 15 Sep 2015 13:42:47 PDT (-0700), hpa@zytor.com wrote: > On 09/14/2015 03:50 PM, Palmer Dabbelt wrote: >> While I don't think this was ever meant to be exposed to userspace, if >> anyone is using it then this will at least provide a correct (if >> unlikely) definition. >> >> MAX_RAW_MINORS used to be used in the kernel, where it's been replaced >> with CONFIG_MAX_RAW_MINORS. >> >> Note that there's a checkpatch.pl warning about a split config string >> here, but I've left that alone. > > From a UAPI perspective I would think the right value would be 2^20. Wow, I'm super surprised. For some reason I thought major/minor numbers were 16 bits, but according to glibc I just have no idea what I'm doing :). Thanks for catching this! -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/char/raw.c b/drivers/char/raw.c index 60316fbaf295..362d7a6511b9 100644 --- a/drivers/char/raw.c +++ b/drivers/char/raw.c @@ -36,7 +36,7 @@ static struct raw_device_data *raw_devices; static DEFINE_MUTEX(raw_mutex); static const struct file_operations raw_ctl_fops; /* forward declaration */ -static int max_raw_minors = MAX_RAW_MINORS; +static int max_raw_minors = CONFIG_MAX_RAW_MINORS; module_param(max_raw_minors, int, 0); MODULE_PARM_DESC(max_raw_minors, "Maximum number of raw devices (1-65536)"); @@ -317,8 +317,9 @@ static int __init raw_init(void) if (max_raw_minors < 1 || max_raw_minors > 65536) { printk(KERN_WARNING "raw: invalid max_raw_minors (must be" - " between 1 and 65536), using %d\n", MAX_RAW_MINORS); - max_raw_minors = MAX_RAW_MINORS; + " between 1 and 65536), using %d\n", + CONFIG_MAX_RAW_MINORS); + max_raw_minors = CONFIG_MAX_RAW_MINORS; } raw_devices = vzalloc(sizeof(struct raw_device_data) * max_raw_minors); diff --git a/include/uapi/linux/raw.h b/include/uapi/linux/raw.h index 62d543e70603..f0390b3e8530 100644 --- a/include/uapi/linux/raw.h +++ b/include/uapi/linux/raw.h @@ -13,6 +13,6 @@ struct raw_config_request __u64 block_minor; }; -#define MAX_RAW_MINORS CONFIG_MAX_RAW_DEVS +#define MAX_RAW_MINORS 65535 #endif /* __LINUX_RAW_H */