@@ -21,7 +21,7 @@ alloc_pptr_buf(
pi = calloc(bufsize, 1);
if (!pi)
return NULL;
- pi->gp_ptrs_size = bufsize;
+ pi->gp_bufsize = bufsize;
return pi;
}
@@ -752,8 +752,6 @@ struct xfs_scrub_metadata {
XFS_SCRUB_OFLAG_NO_REPAIR_NEEDED)
#define XFS_SCRUB_FLAGS_ALL (XFS_SCRUB_FLAGS_IN | XFS_SCRUB_FLAGS_OUT)
-#define XFS_GETPARENTS_MAXNAMELEN 256
-
/* return parents of the handle, not the open fd */
#define XFS_GETPARENTS_IFLAG_HANDLE (1U << 0)
@@ -769,11 +767,11 @@ struct xfs_scrub_metadata {
/* Get an inode parent pointer through ioctl */
struct xfs_getparents_rec {
- __u64 gpr_ino; /* Inode */
- __u32 gpr_gen; /* Inode generation */
- __u32 gpr_diroffset; /* Directory offset */
- __u64 gpr_rsvd; /* Reserved */
- __u8 gpr_name[]; /* File name */
+ __u64 gpr_ino; /* Inode number */
+ __u32 gpr_gen; /* Inode generation */
+ __u32 gpr_diroffset; /* Directory offset */
+ __u64 gpr_rsvd; /* Reserved */
+ __u8 gpr_name[]; /* File name and null terminator */
};
/* Iterate through an inodes parent pointers */
@@ -794,8 +792,8 @@ struct xfs_getparents {
/* Must be set to zero */
__u32 gp_reserved;
- /* size of the trailing buffer in bytes */
- __u32 gp_ptrs_size;
+ /* Size of the buffer in bytes, including this header */
+ __u32 gp_bufsize;
/* # of entries filled in (output) */
__u32 gp_count;
@@ -807,19 +805,13 @@ struct xfs_getparents {
__u32 gp_offsets[];
};
-static inline size_t
-xfs_getparents_sizeof(int nr_ptrs)
-{
- return sizeof(struct xfs_getparents) +
- (nr_ptrs * sizeof(struct xfs_getparents_rec));
-}
-
static inline struct xfs_getparents_rec*
xfs_getparents_rec(
struct xfs_getparents *info,
- int idx)
+ unsigned int idx)
{
- return (struct xfs_getparents_rec *)((char *)info + info->gp_offsets[idx]);
+ return (struct xfs_getparents_rec *)((char *)info +
+ info->gp_offsets[idx]);
}
/*
@@ -867,7 +859,7 @@ xfs_getparents_rec(
/* XFS_IOC_GETFSMAP ------ hoisted 59 */
#define XFS_IOC_SCRUB_METADATA _IOWR('X', 60, struct xfs_scrub_metadata)
#define XFS_IOC_AG_GEOMETRY _IOWR('X', 61, struct xfs_ag_geometry)
-#define XFS_IOC_GETPARENTS _IOWR('X', 62, struct xfs_getparents_rec)
+#define XFS_IOC_GETPARENTS _IOWR('X', 62, struct xfs_getparents)
/*
* ioctl commands that replace IRIX syssgi()'s