Linux: Add support for Lustre FID2PATH ioctl (#331829)
This is a modified version of a patch provided by Frank Zago (fzago@cray.com).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14233 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
index 20b6d0e..619a096 100644
--- a/coregrind/m_syswrap/syswrap-linux.c
+++ b/coregrind/m_syswrap/syswrap-linux.c
@@ -7069,6 +7069,12 @@
}
#endif
+ /* To do: figure out which software layer extends the sign of 'request' */
+ case VKI_OBD_IOC_FID2PATH:
+ PRE_MEM_READ("VKI_OBD_IOC_FID2PATH(args)", ARG3,
+ sizeof(struct vki_getinfo_fid2path));
+ break;
+
default:
/* EVIOC* are variable length and return size written on success */
switch (ARG2 & ~(_VKI_IOC_SIZEMASK << _VKI_IOC_SIZESHIFT)) {
@@ -8358,6 +8364,13 @@
break;
#endif
+ /* To do: figure out which software layer extends the sign of 'request' */
+ case VKI_OBD_IOC_FID2PATH: {
+ struct vki_getinfo_fid2path *args = (void *)(ARG3);
+ POST_MEM_WRITE((Addr)args->gf_path, args->gf_pathlen);
+ }
+ break;
+
default:
/* EVIOC* are variable length and return size written on success */
switch (ARG2 & ~(_VKI_IOC_SIZEMASK << _VKI_IOC_SIZESHIFT)) {
diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h
index 6043842..f4e8669 100644
--- a/include/vki/vki-linux.h
+++ b/include/vki/vki-linux.h
@@ -3420,6 +3420,40 @@
#define VKI_ETHTOOL_SCHANNELS 0x0000003d /* Set no of channels */
#define VKI_ETHTOOL_GET_TS_INFO 0x00000041 /* Get time stamping and PHC info */
+//----------------------------------------------------------------------
+// From drivers/staging/lustre/lustre/include/lustre/lustre_user.h
+//----------------------------------------------------------------------
+
+struct vki_lu_fid {
+ __vki_u64 f_seq;
+ __vki_u32 f_oid;
+ __vki_u32 f_ver;
+};
+
+//----------------------------------------------------------------------
+// From drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
+//----------------------------------------------------------------------
+
+struct vki_getinfo_fid2path {
+ struct vki_lu_fid gf_fid;
+ __vki_u64 gf_recno;
+ __vki_u32 gf_linkno;
+ __vki_u32 gf_pathlen;
+ char gf_path[0];
+} __attribute__((packed));
+
+//----------------------------------------------------------------------
+// From drivers/staging/lustre/lustre/include/linux/lustre_lib.h
+//----------------------------------------------------------------------
+
+#define OBD_IOC_DATA_TYPE long
+
+//----------------------------------------------------------------------
+// From drivers/staging/lustre/lustre/include/lustre_lib.h
+//----------------------------------------------------------------------
+
+#define VKI_OBD_IOC_FID2PATH _VKI_IOWR ('f', 150, OBD_IOC_DATA_TYPE)
+
#endif // __VKI_LINUX_H
/*--------------------------------------------------------------------*/