.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
-.TH OPEN_BY_HANDLE_AT 2 2017-09-15 "Linux" "Linux Programmer's Manual"
+.TH OPEN_BY_HANDLE_AT 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.SH NAME
name_to_handle_at, open_by_handle_at \- obtain handle
for a pathname and open file via a handle
(so that the call returns a handle for the file referred to by the link).
.PP
.BR name_to_handle_at ()
-does not trigger a mount when the final component of the path is an
+does not trigger a mount when the final component of the pathname is an
automount point.
When a filesystem supports both file handles and
automount points, a
with NFS when accessing a directory
which is on a separate filesystem on the server.
In this case, the automount can be triggered by adding a "/" to the end
-of the path.
+of the pathname.
.SS open_by_handle_at()
The
.BR open_by_handle_at ()
.PP
.in +4n
.EX
-$ \fBstat \-\-printf="%i\\n" cecilia.txt\fP # Display inode number
+$ \fBstat \-\-printf="%i\en" cecilia.txt\fP # Display inode number
4072121
$ \fBrm cecilia.txt\fP
$ \fBecho 'Can you please think about it?' > cecilia.txt\fP
-$ \fBstat \-\-printf="%i\\n" cecilia.txt\fP # Check inode number
+$ \fBstat \-\-printf="%i\en" cecilia.txt\fP # Check inode number
4072121
$ \fBsudo ./t_open_by_handle_at < fh\fP
open_by_handle_at: Stale NFS file handle
#include <errno.h>
#include <string.h>
-#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \\
+#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \e
} while (0)
int
char *pathname;
if (argc != 2) {
- fprintf(stderr, "Usage: %s pathname\\n", argv[0]);
+ fprintf(stderr, "Usage: %s pathname\en", argv[0]);
exit(EXIT_FAILURE);
}
fhp\->handle_bytes = 0;
if (name_to_handle_at(dirfd, pathname, fhp,
&mount_id, flags) != \-1 || errno != EOVERFLOW) {
- fprintf(stderr, "Unexpected result from name_to_handle_at()\\n");
+ fprintf(stderr, "Unexpected result from name_to_handle_at()\en");
exit(EXIT_FAILURE);
}
/* Write mount ID, file handle size, and file handle to stdout,
for later reuse by t_open_by_handle_at.c */
- printf("%d\\n", mount_id);
+ printf("%d\en", mount_id);
printf("%d %d ", fhp\->handle_bytes, fhp\->handle_type);
for (j = 0; j < fhp\->handle_bytes; j++)
printf(" %02x", fhp\->f_handle[j]);
- printf("\\n");
+ printf("\en");
exit(EXIT_SUCCESS);
}
#include <unistd.h>
#include <string.h>
-#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \\
+#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \e
} while (0)
/* Scan /proc/self/mountinfo to find the line whose mount ID matches
nread = sscanf(linep, "%d %*d %*s %*s %s",
&mi_mount_id, mount_path);
if (nread != 2) {
- fprintf(stderr, "Bad sscanf()\\n");
+ fprintf(stderr, "Bad sscanf()\en");
exit(EXIT_FAILURE);
}
fclose(fp);
if (!found) {
- fprintf(stderr, "Could not find mount point\\n");
+ fprintf(stderr, "Could not find mount point\en");
exit(EXIT_FAILURE);
}
char *nextp;
if ((argc > 1 && strcmp(argv[1], "\-\-help") == 0) || argc > 2) {
- fprintf(stderr, "Usage: %s [mount\-path]\\n", argv[0]);
+ fprintf(stderr, "Usage: %s [mount\-path]\en", argv[0]);
exit(EXIT_FAILURE);
}
if ((fgets(line1, sizeof(line1), stdin) == NULL) ||
(fgets(line2, sizeof(line2), stdin) == NULL)) {
- fprintf(stderr, "Missing mount_id / file handle\\n");
+ fprintf(stderr, "Missing mount_id / file handle\en");
exit(EXIT_FAILURE);
}
if (nread == \-1)
errExit("read");
- printf("Read %zd bytes\\n", nread);
+ printf("Read %zd bytes\en", nread);
exit(EXIT_SUCCESS);
}