title: How to access a dynamic character device from userspace?
body: <p>The <code>register_chrdev()</code> function in kernel registers a character device:</p>
  
  <pre><code>int register_chrdev(unsigned  int  major,  const  char*name,
   struct file_operations*ops));
  </code></pre>
  
  <p>If <code>major</code> is <code>0</code> the kernel dynamically allocates a major number and the register function returns it.</p>
  
  <p>Now, let's assume a module <code>foo.ko</code> wants to use <code>/dev/foo</code> with a dynamic major number. How does the userspace learn what major number to pass to  <code>mknod</code> to create <code>/dev/foo</code> ?</p>