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; 35+ 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] 35+ messages in thread

end of thread, other threads:[~2010-03-01 21:25 UTC | newest]

Thread overview: 35+ 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

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).