linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] Generic name to handle and open by handle syscalls
@ 2010-02-19  5:42 Aneesh Kumar K.V
  2010-02-19  5:42 ` [RFC PATCH 1/3] vfs: Add name to file handle conversion support Aneesh Kumar K.V
                   ` (4 more replies)
  0 siblings, 5 replies; 36+ messages in thread
From: Aneesh Kumar K.V @ 2010-02-19  5:42 UTC (permalink / raw)
  To: hch, viro; +Cc: linux-fsdevel

The below set of patches implement open by handle support using exportfs
operations. This allows user space application to map a file name to file 
handle and later open the file using handle. This should be usable
for userspace NFS and 9P server. XFS already support this with the ioctls
XFS_IOC_PATH_TO_HANDLE and XFS_IOC_OPEN_BY_HANDLE.

Example program:
-------------
#include <stdio.h>
#include <stdlib.h>

#include <fcntl.h>
#include <unistd.h>
#include <errno.h>

struct file_handle {
	int handle_size;
	int handle_type;
	void *f_handle;
};
int main(int argc, char *argv[])
{
	int ret;
	int fd;
	char buf[100];
	struct file_handle fh;
	fh.handle_type = 0;
	fh.handle = malloc(100);
	fh.handle_size = 100/sizeof(int);
	errno  = 0;
	ret = syscall(338, argv[1], &fh);
	if (ret) {
		perror("Error:");
		exit(1);
	}
	printf("%d\n",fh.handle_size);
	fd = syscall(339, &fh, O_RDONLY);
	if (fd <= 0 ) {
		perror("Error:");
		exit(1);
	}
	printf("fd = %d\n", fd);
	memset(buf, 0 , 100);
	while (read(fd, buf, 100) > 0) {
		printf("%s", buf);
		memset(buf, 0 , 100);
	}
	return 0;
}

-aneesh


^ permalink raw reply	[flat|nested] 36+ messages in thread
* Re: [RFC PATCH] Generic name to handle and open by handle syscalls
@ 2010-03-11 13:14 DENIEL Philippe
  0 siblings, 0 replies; 36+ messages in thread
From: DENIEL Philippe @ 2010-03-11 13:14 UTC (permalink / raw)
  To: linux-fsdevel

Hi,

I just found this message in this mailing list archive. This follows a
search I did after having a look at this thread on LWN.net
(http://lwn.net/Articles/375888/).

> The below set of patches implement open by handle support using 
exportfs > operations. This allows user space application to map a file
name to file > handle and later open the file using handle. This should
be usable > for userspace NFS and 9P server. XFS already support this
with the ioctls > XFS_IOC_PATH_TO_HANDLE and XFS_IOC_OPEN_BY_HANDLE.

After reading the mailing-list archive, it sounds like many people do
not see the benefit in having a way to address files from user space via
their fh and not only through the use of their name. I am leading a
project (see http://nfs-ganesha.sourceforge.net) that implements NFS
functionality from User Space. My server has various backends modules
that make it possible to address different kind of namespaces. When we
did the one dedicated to POSIX, we were strongly limited by the POSIX
functions that reference the files only by their names. We implemented
kind of "name <-> fh" tracking feature via the use of a db, but it is a
bit heavy and not performant. Having a way to translate name to fh, or
open file by fh would be great : it would make it possible to get rid of
all this heavy plumber we did with the db. In fact, half of the work is
already done in my project : we use LUSTRE a lot on our site, and we had
a need for exporting LUSTRE via NFS. There is a user space LUSTRE-API
was provide this "name to fid" and "open by fid" feature. We used it to
build a LUSTRE dedicated backend, and this fit perfectly our needs. So,
if patches are made to perform name-to-handle and open-by-handle
operation, this would be great. Of course, this is my personal point of
view, but personally I have a clear need of this feature.

Regards

Philippe





^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2010-03-11 14:27 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-19  5:42 [RFC PATCH] Generic name to handle and open by handle syscalls Aneesh Kumar K.V
2010-02-19  5:42 ` [RFC PATCH 1/3] vfs: Add name to file handle conversion support Aneesh Kumar K.V
2010-02-20 18:15   ` Andreas Dilger
2010-02-22  5:15     ` Aneesh Kumar K. V
2010-02-19  5:42 ` [RFC PATCH 2/3] vfs: Add open by file handle support Aneesh Kumar K.V
2010-02-20 18:58   ` Andreas Dilger
2010-02-20 20:13     ` Brad Boyer
     [not found]       ` <FB88A140-C2EB-4E62-9769-D2524C874C8C@sun.com>
2010-02-22  2:46         ` Brad Boyer
2010-02-26 19:21         ` J. Bruce Fields
2010-02-28 17:55           ` Andreas Dilger
2010-02-28 19:00             ` J. Bruce Fields
2010-03-01 18:25               ` Oleg Drokin
2010-03-01 21:25                 ` J. Bruce Fields
2010-02-22  6:13     ` Aneesh Kumar K. V
2010-02-22  6:31       ` Dave Chinner
2010-02-26 19:24     ` J. Bruce Fields
2010-02-19  5:42 ` [RFC PATCH 3/3] x86: Add new syscalls for x86_32 Aneesh Kumar K.V
2010-02-19  9:34 ` [RFC PATCH] Generic name to handle and open by handle syscalls Andreas Dilger
2010-02-19  9:49   ` Aneesh Kumar K. V
2010-02-20 19:01     ` Andreas Dilger
2010-02-22  6:27       ` Aneesh Kumar K. V
2010-02-22 23:06 ` Jonathan Corbet
2010-02-23  0:56   ` James Morris
2010-02-23  8:58   ` Aneesh Kumar K. V
2010-02-23 19:46     ` Jonathan Corbet
2010-02-24  0:49     ` Dave Chinner
2010-02-25  4:53     ` Serge E. Hallyn
2010-02-25 14:30       ` Jonathan Corbet
2010-02-25 15:19         ` Serge E. Hallyn
2010-02-25 17:55           ` Aneesh Kumar K. V
2010-02-25 18:11             ` Serge E. Hallyn
2010-02-25 18:20               ` Aneesh Kumar K. V
2010-02-25 19:05                 ` Serge E. Hallyn
2010-02-26  9:12                   ` Andreas Dilger
2010-02-26 19:56                     ` Serge E. Hallyn
  -- strict thread matches above, loose matches on Subject: below --
2010-03-11 13:14 DENIEL Philippe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).