diff options
| author | Jiffin Tony Thottan <jthottan@redhat.com> | 2015-08-11 16:00:47 +0530 | 
|---|---|---|
| committer | Kaleb KEITHLEY <kkeithle@redhat.com> | 2015-08-25 05:31:35 -0700 | 
| commit | 130697b8b706432153d9a0fda49b896065289aaa (patch) | |
| tree | 3b63aceeb6644a4c2dd3210126a4a3a9f8835136 /api/src/glfs-handleops.c | |
| parent | edcf4d35397a0a4843b3f6b107c44630c86f3d3c (diff) | |
libgfapi: adding 'follow' flag to glfs_h_lookupat()
This patch is backport of http://review.gluster.org/#/c/11883/
Previously glfs_h_lookupat won't follow the symlink, this patch
introduces new flag `follow` which will resolve the same. Applications
linking against the new library will need to use the new glfs_h_lookupat
API call.
In order to stay compatible with existing binaries that use the previous
glfs_h_lookupat() function, the old symbol needs to stay available.
Verification that there are two versions of glfs_h_lookupat:
  $ objdump -T /usr/lib64/libgfapi.so.0 | grep -w glfs_h_lookupat
  0000000000015070 g    DF .text  000000000000021e  GFAPI_3.7.4 glfs_h_lookupat
  0000000000015290 g    DF .text  0000000000000008 (GFAPI_3.4.2) glfs_h_lookupat
Testing with a binary (based on anonymous_fd_read_write.c from ./tests/)
that was linked against the old library:
  $ objdump -T ./lookupat | grep -w glfs_h_lookupat
  0000000000000000      DF *UND*  0000000000000000  GFAPI_3.4.2 glfs_h_lookupat
Enable debugging for 'ld.so' so that we can check that the GFAPI_3.4.2
version of the symbol gets loaded:
  $ export LD_DEBUG_OUTPUT=lookupat.ld.log LD_DEBUG=all
  $ ./lookupat
  $ grep -w glfs_h_lookupat lookupat.ld.log.2543
  2543:     symbol=glfs_h_lookupat;  lookup in file=./lookupat [0]
  2543:     symbol=glfs_h_lookupat;  lookup in file=/lib64/libgfapi.so.0 [0]
  2543:     binding file ./lookupat [0] to /lib64/libgfapi.so.0 [0]: normal symbol `glfs_h_lookupat' [GFAPI_3.4.2]
This change has been successfully cherry-picked as 1ead86a8bcbfe4045729466e4b98f765f3c13c8d
in master
Upstream reference
>Change-Id: I8bf9b1c19a0585f681bc1a7f84aad1ccd0f75f6a
>BUG: 1252410
>Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
>Signed-off-by: Niels de Vos <ndevos@redhat.com>
>Reviewed-on: http://review.gluster.org/11883
>Reviewed-by: soumya k <skoduri@redhat.com>
>Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
>Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
Change-Id: Idbbf0cd6802f86c53b16377d90d08ff6d99e7b08
BUG: 1256616
Reviewed-on: http://review.gluster.org/12009
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'api/src/glfs-handleops.c')
| -rw-r--r-- | api/src/glfs-handleops.c | 15 | 
1 files changed, 12 insertions, 3 deletions
diff --git a/api/src/glfs-handleops.c b/api/src/glfs-handleops.c index 2e552b763dc..79085ff33a1 100644 --- a/api/src/glfs-handleops.c +++ b/api/src/glfs-handleops.c @@ -63,7 +63,7 @@ glfs_iatt_from_stat (struct stat *stat, int valid, struct iatt *iatt,  struct glfs_object *  pub_glfs_h_lookupat (struct glfs *fs, struct glfs_object *parent, -                     const char *path, struct stat *stat) +                     const char *path, struct stat *stat, int follow)  {          int                      ret = 0;          xlator_t                *subvol = NULL; @@ -100,7 +100,7 @@ pub_glfs_h_lookupat (struct glfs *fs, struct glfs_object *parent,          /* fop/op */          ret = glfs_resolve_at (fs, subvol, inode, path, &loc, &iatt, -                                    0 /*TODO: links? */, 0); +                                    follow, 0);          /* populate out args */          if (!ret) { @@ -124,7 +124,16 @@ invalid_fs:          return object;  } -GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_lookupat, 3.4.2); +GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_lookupat, 3.7.4); + +struct glfs_object * +pub_glfs_h_lookupat34 (struct glfs *fs, struct glfs_object *parent, +                       const char *path, struct stat *stat) +{ +        return pub_glfs_h_lookupat (fs, parent, path, stat, 0); +} + +GFAPI_SYMVER_PUBLIC(glfs_h_lookupat34, glfs_h_lookupat, 3.4.2);  int  pub_glfs_h_statfs (struct glfs *fs, struct glfs_object *object,  | 
