Re: [ntfs-3g-devel] [PATCH 2/2] Remove unused argument from ntfs_make_symlink()

2016-09-21 Thread Eric Biggers
On Wed, Sep 21, 2016 at 10:47:57AM +0200, Jean-Pierre André wrote:
> 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
> 

Well, the previous patch does that, which is why 'attr_size' became unused.

Eric

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


[ntfs-3g-devel] [PATCH 2/2] Remove unused argument from ntfs_make_symlink()

2016-09-21 Thread Eric Biggers
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 
---
 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, _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,
-   _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, _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, _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, _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, 
_size);
+   target =