Re: [PATCH] man: Fix XFS_IOC_GETPARENTS ioctl example

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Aug 16, 2025 at 01:28:42AM +0100, linux@xxxxxxxxxxx wrote:
> From: "Dr. David Alan Gilbert" <linux@xxxxxxxxxxx>
> 
> Fix various typos that stopped the example building.
> Add perror calls everywhere so it doesn't fail silently
> and mysteriously.
> 
> Now builds cleanly with -Wpedantic.
> 
> Fixes: a24294c2 ("man: document the XFS_IOC_GETPARENTS ioctl")
> Signed-off-by: Dr. David Alan Gilbert <linux@xxxxxxxxxxx>
> ---
>  man/man2/ioctl_xfs_getparents.2 | 18 +++++++++++-------
>  1 file changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/man/man2/ioctl_xfs_getparents.2 b/man/man2/ioctl_xfs_getparents.2
> index 5bb9b96a..63926016 100644
> --- a/man/man2/ioctl_xfs_getparents.2
> +++ b/man/man2/ioctl_xfs_getparents.2
> @@ -119,7 +119,7 @@ If the name is a zero-length string, the file queried has no parents.
>  Calling programs should allocate a large memory buffer, initialize the head
>  structure to zeroes, set gp_bufsize to the size of the buffer, and call the
>  ioctl.
> -The XFS_GETPARENTS_OFLAG_DONE flag will be set in gp_flags when there are no
> +The XFS_GETPARENTS_OFLAG_DONE flag will be set in gp_oflags when there are no
>  more parent pointers to be read.
>  The below code is an example of XFS_IOC_GETPARENTS usage:
>  
> @@ -142,16 +142,20 @@ int main() {
>  		perror("malloc");
>  		return 1;
>  	}
> -	gp->gp_bufsize = 65536;
> +	gp.gp_bufsize = 65536;
>  
> -	fd = open("/mnt/test/foo.txt", O_RDONLY | O_CREAT);
> -	if (fd  == -1)
> +	fd = open("/mnt/test/foo.txt", O_RDONLY | O_CREAT, 0666);
> +	if (fd  == -1) {
> +    perror("open");
>  		return errno;
> +  }

Formatting looks really weird here, probably because of a mix of
tabs and space an different tabstop settings for the original version
of the code and your edits.

The technical changes look good to me.




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux