From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boaz Harrosh Subject: Re: [PATCH] proc: get a reference to the owning module when opening file Date: Sun, 22 Feb 2015 17:46:47 +0200 Message-ID: <54E9F9E7.40508@gmail.com> References: <1423623907-6950-1-git-send-email-nicolas.iooss_linux@m4x.org> <20150217201458.GA12422@ZenIV.linux.org.uk> <54E87190.6070209@m4x.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org To: Nicolas Iooss , Al Viro Return-path: In-Reply-To: <54E87190.6070209@m4x.org> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On 02/21/2015 01:52 PM, Nicolas Iooss wrote: <> > > I'm basically developing a project where I created an out-of-tree module > which uses mmap() as a kind of communication channel between a kernel > module and a userspace program (in short, a ring buffer). The virtual > file which is used for mmap() was initially created in debugfs, but as > this filesystem is not always mounted on production systems, I needed > another one and ended up using procfs. I did not consider creating a > character or block device in /dev as I wasn't at ease with grabbing a > major number which could potentially conflict with other out-of-tree > drivers. As using procfs seems not to be fine, I guess I'll anyway use > a block device with a major number in the experimental range (240-254). > > In short, the module I'm writing does not have to be in procfs, and I've > got funnier things to work on than cleaning up vm_operations_struct. > I know that some in-tree drivers do similar things with shmem (tmpfs). shmem even has an in-kernel API for drivers to create and lock pre-allocated files, so when user-mode loads they already find what they need. You should check it out it should have a much better mmap semantics for you, since it is a real FS. > Thank you for your detailed reply. > > Nicolas > <> Good luck Boaz