All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael Kerrisk (man-pages)" <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Heinrich Schuchardt <xypron.glpk-Mmb7MZpHnFY@public.gmane.org>
Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	OGAWA Hirofumi
	<hirofumi-UIVanBePwB70ZhReMnHkpc8NsWr+9BEh@public.gmane.org>,
	linux-man <linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Andreas Dilger <adilger-m1MBpc4rdrD3fQ9qLvQP4Q@public.gmane.org>
Subject: Re: [PATCH 1/1] ioctl_fat.2: d_ino, d_off, return value explained
Date: Mon, 09 Feb 2015 09:12:38 +0100	[thread overview]
Message-ID: <54D86BF6.30907@gmail.com> (raw)
In-Reply-To: <1423260638-23504-1-git-send-email-xypron.glpk-Mmb7MZpHnFY@public.gmane.org>

On 02/06/2015 11:10 PM, Heinrich Schuchardt wrote:
> The fields d_ino and d_off of structure __fat_dirent are explained.
> 
> The different return values of VFAT_IOCTL_READDIR_BOTH and
> VFAT_IOCTL_READDIR_SHORT are explained.
> 
> The usage of the return value in the example is corrected.

Thanks, Heinrich. Tweaked a little and pushed to the draft_ioctl_fat branch.

Cheers,

Michael


> Signed-off-by: Heinrich Schuchardt <xypron.glpk-Mmb7MZpHnFY@public.gmane.org>
> ---
>  man2/ioctl_fat.2 | 54 ++++++++++++++++++++++++++++++++++++++++++++++--------
>  1 file changed, 46 insertions(+), 8 deletions(-)
> 
> diff --git a/man2/ioctl_fat.2 b/man2/ioctl_fat.2
> index 55417f6..2c28421 100644
> --- a/man2/ioctl_fat.2
> +++ b/man2/ioctl_fat.2
> @@ -157,25 +157,61 @@ struct __fat_dirent {
>  The first entry in the array is for the short filename.
>  The second entry is for the long filename.
>  .PP
> +Fields
> +.I d_ino
> +and
> +.I d_off
> +are only filled for long filenames.
> +Field
> +.I d_ino
> +holds the inode number of the directory.
> +Field
> +.I d_off
> +holds the offset of the file entry in the directory.
> +As these values are not available for short filenames, the user code should
> +simply ignore them.
> +.PP
>  The field
>  .I d_reclen
>  contains the length of the filename in the field
>  .IR d_name .
> -A length of 0 for the short filename signals that the end of the directory
> -has been reached.
> -.\" FIXME Missing here are explanations of the fileds ;d_ino' and 'd_off'
> +To keep backwards compatibility a length of 0 for the short filename signals
> +that the end of the directory has been reached.
> +The user code should rely on the return value to identify the end of the
> +directory.
> +If no long filename exists, field
> +.I d_reclen
> +is set to 0 and
> +.I d_name
> +is a character string of length 0 for the long filename.
>  .SH RETURN VALUE
>  On error, \-1 is returned, and
>  .I errno
>  is set to indicate the error.
> +.PP
> +For
> +.B VFAT_IOCTL_READDIR_BOTH
> +and
> +.B VFAT_IOCTL_READDIR_SHORT
> +a return value of 1 signals that a new directory entry has been read and
> +a return value of 0 signals that the end of the directory has been reached.
>  .SH ERRORS
>  .TP
> -.B ENOTDIR
> +.B ENOENT
>  This error is returned by
> +.B VFAT_IOCTL_READDIR_BOTH
> +and
>  .B VFAT_IOCTL_READDIR_SHORT
> +if the file descriptor
> +.I fd
> +refers to a removed, but still open directory.
> +.TP
> +.B ENOTDIR
> +This error is returned by
> +.B VFAT_IOCTL_READDIR_BOTH
>  and
>  .B VFAT_IOCTL_READDIR_SHORT
> -if
> +if the file descriptor
>  .I fd
>  does not refer to a directory.
>  .TP
> @@ -431,10 +467,12 @@ main(int argc, char *argv[])
>  
>          /*
>           * If an error occurs, the return value is \-1.
> -         * If d_reclen is zero, the end of the directory
> -         * list has been reached.
> +         * If the end of the directory list has been reached,
> +         * the return value is 0.
> +         * For backward compatibility the end of the directory
> +         * list is also signaled by d_reclen == 0.
>           */
> -        if (ret == \-1 || entry[0].d_reclen == 0)
> +        if (ret < 1)
>              break;
>  
>          /*
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-02-09  8:12 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAKgNAkhuGYKtUKkm2+wU+TwQb6iZ+EmnLDdr4qg4fWHJyL9K5A@mail.gmail.com>
     [not found] ` <CAKgNAkhuGYKtUKkm2+wU+TwQb6iZ+EmnLDdr4qg4fWHJyL9K5A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-23 19:54   ` [PATCH v3 1/1] ioctl-fat.2: new manpage for the ioctl fat API Heinrich Schuchardt
2015-01-23 19:54     ` Heinrich Schuchardt
2015-02-03  8:25     ` Michael Kerrisk (man-pages)
2015-02-03  8:51       ` OGAWA Hirofumi
2015-02-03  8:51         ` OGAWA Hirofumi
     [not found]         ` <87k2zze5tg.fsf-UIVanBePwB70ZhReMnHkpc8NsWr+9BEh@public.gmane.org>
2015-02-03  9:24           ` Michael Kerrisk (man-pages)
2015-02-03  9:24             ` Michael Kerrisk (man-pages)
2015-02-03  9:44             ` OGAWA Hirofumi
2015-02-03  9:44               ` OGAWA Hirofumi
     [not found]               ` <87fvane3ch.fsf-UIVanBePwB70ZhReMnHkpc8NsWr+9BEh@public.gmane.org>
2015-02-03  9:54                 ` Michael Kerrisk (man-pages)
2015-02-03  9:54                   ` Michael Kerrisk (man-pages)
2015-02-03 10:05                   ` OGAWA Hirofumi
2015-02-03 10:05                     ` OGAWA Hirofumi
2015-02-06 22:10                 ` [PATCH 1/1] ioctl_fat.2: d_ino, d_off, return value explained Heinrich Schuchardt
     [not found]                   ` <1423260638-23504-1-git-send-email-xypron.glpk-Mmb7MZpHnFY@public.gmane.org>
2015-02-09  8:12                     ` Michael Kerrisk (man-pages) [this message]
2015-02-03  8:49     ` [PATCH v3 1/1] ioctl-fat.2: new manpage for the ioctl fat API Andreas Dilger
     [not found]       ` <5984550D-1518-490C-9A3F-3F9B1FA2EA00-m1MBpc4rdrD3fQ9qLvQP4Q@public.gmane.org>
2015-02-03  9:21         ` Michael Kerrisk (man-pages)
2015-02-03  9:21           ` Michael Kerrisk (man-pages)
     [not found]           ` <CAKgNAki1EnYx+chg1eouwF54youb_tjQ+hW9Ea_M_=cvccu1nA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-02-03  9:48             ` Andreas Dilger
2015-02-03  9:48               ` Andreas Dilger
2015-02-03  9:55               ` Michael Kerrisk (man-pages)
2015-02-03 10:10                 ` OGAWA Hirofumi
2015-02-03 10:10                   ` OGAWA Hirofumi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54D86BF6.30907@gmail.com \
    --to=mtk.manpages-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=adilger-m1MBpc4rdrD3fQ9qLvQP4Q@public.gmane.org \
    --cc=hirofumi-UIVanBePwB70ZhReMnHkpc8NsWr+9BEh@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=xypron.glpk-Mmb7MZpHnFY@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.