Skip to content

Commit

Permalink
Add support for name_to_handle_at and open_by_handle.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulrich Drepper committed Apr 1, 2011
1 parent 46998f7 commit 158648c
Show file tree
Hide file tree
Showing 10 changed files with 297 additions and 38 deletions.
13 changes: 13 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
2011-04-01 Ulrich Drepper <drepper@gmail.com>

* sysdeps/unix/sysv/linux/Versions [GLIBC_2.14] (name_to_handle_at,
open_by_handle): Add.
* sysdeps/unix/sysv/linux/i386/bits/fcntl.h: Define struct file_handle
and MAX_HANDLE_SZ. Declare name_to_handle_at and open_by_handle.
Augment a few comments.
* sysdeps/unix/sysv/linux/ia64/bits/fcntl.h: Likewise.
* sysdeps/unix/sysv/linux/s390/bits/fcntl.h: Likewise.
* sysdeps/unix/sysv/linux/sh/bits/fcntl.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/fcntl.h: Likewise.
* sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h: Likewise.
* sysdeps/unix/sysv/linux/syscalls.list: Add name_to_handle_at and
open_by_handle.

* io/fcntl.h (AT_EMPTY_PATH): Define.

2011-03-30 Ulrich Drepper <drepper@gmail.com>
Expand Down
4 changes: 2 additions & 2 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GNU C Library NEWS -- history of user-visible changes. 2011-3-30
GNU C Library NEWS -- history of user-visible changes. 2011-4-1
Copyright (C) 1992-2009, 2010, 2011 Free Software Foundation, Inc.
See the end for copying conditions.

Expand All @@ -7,7 +7,7 @@ using `glibc' in the "product" field.

Version 2.14

* New Linux interfaces: clock_adjtime
* New Linux interfaces: clock_adjtime, name_to_handle_at, open_by_handle

* The following bugs are resolved with this release:

Expand Down
2 changes: 2 additions & 0 deletions sysdeps/unix/sysv/linux/Versions
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ libc {
}
GLIBC_2.14 {
clock_adjtime;

name_to_handle_at; open_by_handle;
}
GLIBC_PRIVATE {
# functions used in other libraries
Expand Down
48 changes: 43 additions & 5 deletions sysdeps/unix/sysv/linux/i386/bits/fcntl.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux.
Copyright (C) 1995, 1996, 1997, 1998, 2000, 2004, 2006, 2007, 2009, 2010
Copyright (C) 1995-1998, 2000, 2004, 2006, 2007, 2009, 2010, 2011
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Expand Down Expand Up @@ -232,6 +232,19 @@ struct f_owner_ex
we splice from/to). */
# define SPLICE_F_MORE 4 /* Expect more data. */
# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */


/* File handle structure. */
struct file_handle
{
unsigned int handle_bytes;
int handle_type;
/* File identifier. */
unsigned char f_handle[0];
};

/* Maximum handle size (for now). */
# define MAX_HANDLE_SZ 128
#endif

__BEGIN_DECLS
Expand All @@ -248,20 +261,32 @@ extern int sync_file_range (int __fd, __off64_t __offset, __off64_t __count,
unsigned int __flags);


/* Splice address range into a pipe. */
/* Splice address range into a pipe.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
size_t __count, unsigned int __flags);

/* Splice two files together. */
/* Splice two files together.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
__off64_t *__offout, size_t __len,
unsigned int __flags);

/* In-kernel implementation of tee for pipe buffers. */
/* In-kernel implementation of tee for pipe buffers.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern ssize_t tee (int __fdin, int __fdout, size_t __len,
unsigned int __flags);

/* Reserve storage for the data of the file associated with FD. */
/* Reserve storage for the data of the file associated with FD.
This function is a possible cancellation point and therefore not
marked with __THROW. */
# ifndef __USE_FILE_OFFSET64
extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len);
# else
Expand All @@ -278,6 +303,19 @@ extern int fallocate64 (int __fd, int __mode, __off64_t __offset,
__off64_t __len);
# endif


/* Map file name to file handle. */
extern int name_to_handle_at (int __dfd, const char *__name,
struct file_handle *__handle, int *__mnt_id,
int __flags) __THROW;

/* Open file using the file handle.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int open_by_handle (int __mountdirfd, struct file_handle *__handle,
int __flags);

#endif

__END_DECLS
53 changes: 47 additions & 6 deletions sysdeps/unix/sysv/linux/ia64/bits/fcntl.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux/IA64.
Copyright (C) 1999, 2000, 2004, 2006, 2007, 2009, 2010
Copyright (C) 1999, 2000, 2004, 2006, 2007, 2009, 2010, 2011
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Expand Down Expand Up @@ -227,6 +227,19 @@ struct f_owner_ex
we splice from/to). */
# define SPLICE_F_MORE 4 /* Expect more data. */
# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */


/* File handle structure. */
struct file_handle
{
unsigned int handle_bytes;
int handle_type;
/* File identifier. */
unsigned char f_handle[0];
};

/* Maximum handle size (for now). */
# define MAX_HANDLE_SZ 128
#endif

__BEGIN_DECLS
Expand All @@ -238,25 +251,40 @@ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
__THROW;


/* Selective file content synch'ing. */
/* Selective file content synch'ing.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int sync_file_range (int __fd, __off64_t __offset, __off64_t __count,
unsigned int __flags);


/* Splice address range into a pipe. */
/* Splice address range into a pipe.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
size_t __count, unsigned int __flags);

/* Splice two files together. */
/* Splice two files together.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
__off64_t *__offout, size_t __len,
unsigned int __flags);

/* In-kernel implementation of tee for pipe buffers. */
/* In-kernel implementation of tee for pipe buffers.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern ssize_t tee (int __fdin, int __fdout, size_t __len,
unsigned int __flags);

/* Reserve storage for the data of the file associated with FD. */
/* Reserve storage for the data of the file associated with FD.
This function is a possible cancellation point and therefore not
marked with __THROW. */
# ifndef __USE_FILE_OFFSET64
extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len);
# else
Expand All @@ -273,6 +301,19 @@ extern int fallocate64 (int __fd, int __mode, __off64_t __offset,
__off64_t __len);
# endif


/* Map file name to file handle. */
extern int name_to_handle_at (int __dfd, const char *__name,
struct file_handle *__handle, int *__mnt_id,
int __flags) __THROW;

/* Open file using the file handle.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int open_by_handle (int __mountdirfd, struct file_handle *__handle,
int __flags);

#endif

__END_DECLS
53 changes: 47 additions & 6 deletions sysdeps/unix/sysv/linux/s390/bits/fcntl.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux.
Copyright (C) 2000-2002,2004,2006,2007,2009,2010
Copyright (C) 2000-2002,2004,2006,2007,2009,2010,2011
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Expand Down Expand Up @@ -253,6 +253,19 @@ struct f_owner_ex
we splice from/to). */
# define SPLICE_F_MORE 4 /* Expect more data. */
# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */


/* File handle structure. */
struct file_handle
{
unsigned int handle_bytes;
int handle_type;
/* File identifier. */
unsigned char f_handle[0];
};

/* Maximum handle size (for now). */
# define MAX_HANDLE_SZ 128
#endif

__BEGIN_DECLS
Expand All @@ -264,25 +277,40 @@ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
__THROW;


/* Selective file content synch'ing. */
/* Selective file content synch'ing.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int sync_file_range (int __fd, __off64_t __offset, __off64_t __count,
unsigned int __flags);


/* Splice address range into a pipe. */
/* Splice address range into a pipe.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
size_t __count, unsigned int __flags);

/* Splice two files together. */
/* Splice two files together.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
__off64_t *__offout, size_t __len,
unsigned int __flags);

/* In-kernel implementation of tee for pipe buffers. */
/* In-kernel implementation of tee for pipe buffers.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern ssize_t tee (int __fdin, int __fdout, size_t __len,
unsigned int __flags);

/* Reserve storage for the data of the file associated with FD. */
/* Reserve storage for the data of the file associated with FD.
This function is a possible cancellation point and therefore not
marked with __THROW. */
# ifndef __USE_FILE_OFFSET64
extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len);
# else
Expand All @@ -299,6 +327,19 @@ extern int fallocate64 (int __fd, int __mode, __off64_t __offset,
__off64_t __len);
# endif


/* Map file name to file handle. */
extern int name_to_handle_at (int __dfd, const char *__name,
struct file_handle *__handle, int *__mnt_id,
int __flags) __THROW;

/* Open file using the file handle.
This function is a possible cancellation point and therefore not
marked with __THROW. */
extern int open_by_handle (int __mountdirfd, struct file_handle *__handle,
int __flags);

#endif

__END_DECLS
Loading

0 comments on commit 158648c

Please sign in to comment.