Hi Eric,

There has been a recent request for ntfs-3g to return
the st_size for symlinks as the size of the target
path (as described in the stat manual), so the target
is now useful....

Regards

Jean-Pierre

Eric Biggers wrote:
> Now that the size of the reparse point attribute is no longer used by
> the FUSE drivers to populate st_size for symlinks and junctions, it no
> longer needs to be returned by ntfs_make_symlink().
>
> Signed-off-by: Eric Biggers <ebigge...@gmail.com>
> ---
>   include/ntfs-3g/reparse.h |  4 ++--
>   libntfs-3g/reparse.c      |  4 +---
>   src/lowntfs-3g.c          | 14 ++++----------
>   src/ntfs-3g.c             | 12 ++++--------
>   4 files changed, 11 insertions(+), 23 deletions(-)
>
> diff --git a/include/ntfs-3g/reparse.h b/include/ntfs-3g/reparse.h
> index 27e9050..76af915 100644
> --- a/include/ntfs-3g/reparse.h
> +++ b/include/ntfs-3g/reparse.h
> @@ -24,8 +24,8 @@
>   #ifndef REPARSE_H
>   #define REPARSE_H
>
> -char *ntfs_make_symlink(ntfs_inode *ni, const char *mnt_point,
> -                     int *pattr_size);
> +char *ntfs_make_symlink(ntfs_inode *ni, const char *mnt_point);
> +
>   BOOL ntfs_possible_symlink(ntfs_inode *ni);
>
>   int ntfs_get_ntfs_reparse_data(ntfs_inode *ni, char *value, size_t size);
> diff --git a/libntfs-3g/reparse.c b/libntfs-3g/reparse.c
> index b0f96ae..2e92fbb 100644
> --- a/libntfs-3g/reparse.c
> +++ b/libntfs-3g/reparse.c
> @@ -724,8 +724,7 @@ static char *ntfs_get_rellink(ntfs_inode *ni, ntfschar 
> *junction, int count)
>    *                  symbolic link or directory junction
>    */
>
> -char *ntfs_make_symlink(ntfs_inode *ni, const char *mnt_point,
> -                     int *pattr_size)
> +char *ntfs_make_symlink(ntfs_inode *ni, const char *mnt_point)
>   {
>       s64 attr_size = 0;
>       char *target;
> @@ -820,7 +819,6 @@ char *ntfs_make_symlink(ntfs_inode *ni, const char 
> *mnt_point,
>               }
>               free(reparse_attr);
>       }
> -     *pattr_size = attr_size;
>       if (bad)
>               errno = EOPNOTSUPP;
>       return (target);
> diff --git a/src/lowntfs-3g.c b/src/lowntfs-3g.c
> index bc9770a..b05492e 100644
> --- a/src/lowntfs-3g.c
> +++ b/src/lowntfs-3g.c
> @@ -634,11 +634,10 @@ static int junction_getstat(ntfs_inode *ni,
>                       struct stat *stbuf)
>   {
>       char *target;
> -     int attr_size;
>       int res;
>
>       errno = 0;
> -     target = ntfs_make_symlink(ni, ctx->abs_mnt_point, &attr_size);
> +     target = ntfs_make_symlink(ni, ctx->abs_mnt_point);
>               /*
>                * If the reparse point is not a valid
>                * directory junction, and there is no error
> @@ -713,11 +712,9 @@ static int ntfs_fuse_getstat(struct SECURITY_CONTEXT 
> *scx,
>                       goto ok;
>   #else /* PLUGINS_DISABLED */
>                       char *target;
> -                     int attr_size;
>
>                       errno = 0;
> -                     target = ntfs_make_symlink(ni, ctx->abs_mnt_point,
> -                                     &attr_size);
> +                     target = ntfs_make_symlink(ni, ctx->abs_mnt_point);
>                               /*
>                                * If the reparse point is not a valid
>                                * directory junction, and there is no error
> @@ -1020,12 +1017,11 @@ static int junction_readlink(ntfs_inode *ni,
>                       const REPARSE_POINT *reparse __attribute__((unused)),
>                       char **pbuf)
>   {
> -     int attr_size;
>       int res;
>
>       errno = 0;
>       res = 0;
> -     *pbuf = ntfs_make_symlink(ni, ctx->abs_mnt_point, &attr_size);
> +     *pbuf = ntfs_make_symlink(ni, ctx->abs_mnt_point);
>       if (!*pbuf) {
>               if (errno == EOPNOTSUPP) {
>                       *pbuf = strdup(ntfs_bad_reparse);
> @@ -1068,11 +1064,9 @@ static void ntfs_fuse_readlink(fuse_req_t req, 
> fuse_ino_t ino)
>                               res = -errno;
>               }
>   #else /* PLUGINS_DISABLED */
> -             int attr_size;
> -
>               errno = 0;
>               res = 0;
> -             buf = ntfs_make_symlink(ni, ctx->abs_mnt_point, &attr_size);
> +             buf = ntfs_make_symlink(ni, ctx->abs_mnt_point);
>               if (!buf) {
>                       if (errno == EOPNOTSUPP)
>                               buf = strdup(ntfs_bad_reparse);
> diff --git a/src/ntfs-3g.c b/src/ntfs-3g.c
> index f4af89b..3633ac3 100644
> --- a/src/ntfs-3g.c
> +++ b/src/ntfs-3g.c
> @@ -698,11 +698,10 @@ static int junction_getattr(ntfs_inode *ni,
>               struct stat *stbuf)
>   {
>       char *target;
> -     int attr_size;
>       int res;
>
>       errno = 0;
> -     target = ntfs_make_symlink(ni, ctx->abs_mnt_point, &attr_size);
> +     target = ntfs_make_symlink(ni, ctx->abs_mnt_point);
>               /*
>                * If the reparse point is not a valid
>                * directory junction, and there is no error
> @@ -805,10 +804,9 @@ static int ntfs_fuse_getattr(const char *org_path, 
> struct stat *stbuf)
>                       goto exit;
>   #else /* PLUGINS_DISABLED */
>                       char *target;
> -                     int attr_size;
>
>                       errno = 0;
> -                     target = ntfs_make_symlink(ni, ctx->abs_mnt_point, 
> &attr_size);
> +                     target = ntfs_make_symlink(ni, ctx->abs_mnt_point);
>                               /*
>                                * If the reparse point is not a valid
>                                * directory junction, and there is no error
> @@ -1038,12 +1036,11 @@ static int junction_readlink(ntfs_inode *ni,
>                       const REPARSE_POINT *reparse __attribute__((unused)),
>                       char **pbuf)
>   {
> -     int attr_size;
>       int res;
>
>       errno = 0;
>       res = 0;
> -     *pbuf = ntfs_make_symlink(ni, ctx->abs_mnt_point, &attr_size);
> +     *pbuf = ntfs_make_symlink(ni, ctx->abs_mnt_point);
>       if (!*pbuf) {
>               if (errno == EOPNOTSUPP) {
>                       *pbuf = strdup(ntfs_bad_reparse);
> @@ -1099,11 +1096,10 @@ static int ntfs_fuse_readlink(const char *org_path, 
> char *buf, size_t buf_size)
>               }
>   #else /* PLUGINS_DISABLED */
>               char *target;
> -             int attr_size;
>
>               errno = 0;
>               res = 0;
> -             target = ntfs_make_symlink(ni, ctx->abs_mnt_point, &attr_size);
> +             target = ntfs_make_symlink(ni, ctx->abs_mnt_point);
>               if (target) {
>                       strncpy(buf,target,buf_size);
>                       free(target);
>


------------------------------------------------------------------------------
_______________________________________________
ntfs-3g-devel mailing list
ntfs-3g-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel

Reply via email to