summaryrefslogtreecommitdiffstats
path: root/libglusterfsclient/src
Commit message (Collapse)AuthorAgeFilesLines
...
* libglusterfsclient: Add seekdir APIShehjar Tikoo2009-05-182-0/+32
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add rewinddir APIShehjar Tikoo2009-05-182-1/+33
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Revert and re-do readdir conformanceShehjar Tikoo2009-05-182-61/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit basically reverts the previous readdir conformance patch I sent a few days back. That commit had a completely retarded and broken way of maintaining per-directory dirent. It was broken for two reasons: 1. Creating a wrapper structure around the directory's fd_t only for storing a struct dirent is not clean enough. This commit takes a better approach by storing the dirent in fd_t context. This dirent is valid only if the fd_t refers to a directory. 2. That commit was made and tested under the assumption (..stupidity is a better word..) that only opendir call is used for opening a directory. That is not correct. Directories are also opened using the open syscall. The point is, glusterfs_open returns an fd_t and so did glusterfs_opendir. The previous patch actually changed opendir to return a new wrapper structure. That is fine, if we go by the POSIX definition of open and opendir because, they're both supposed to return different types, an int and a DIR*. However, in libglusterfsclient, all other code assumes that directory handles corresponding to DIR* and file descriptors corresponding to int types are the same type, resulting in use of the same locking and fd context addition/extraction code. So a directory opened using opendir returned a wrapper structure which went down into the libglusterfsclient stack where some function called a lock on the handle assuming it was an fd_t, since it is not and dereferencing of the supposed fd->inode->lock results in a seg fault. Obviously, this didnt show up till unfs3 used open() to open a directory and not opendir. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* workaround for not including sys/cdefs.h -- including sys/cdefs.h breaks ↵Anand V. Avati2009-05-181-1/+16
| | | | build on solaris and other platforms
* libglusterfsclient: Improve readdir conformance on re-entrancyShehjar Tikoo2009-05-062-23/+63
| | | | | | | | | | | readdir is supposed to be non-re-entrant only with respect to the given dir stream, not the whole process. What that means is the static struct dirent that we maintain in libglusterfsclient should be per-directory handle and not process-wide. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Fix large directory reading bugShehjar Tikoo2009-05-061-3/+16
| | | | | | | | | | | | | | As of now, we use 1024 bytes as the buffer for reading directory entries. If a directory as many files, then its possible that it does not fit into this buffer, thereby requiring more than one call to readdir. Now suppose the last bunch of directories fit more or less exactly int the 1024 byte buffer. If this happens, the offset extracted by the current logic(in libgf_client_readdir) never gets updated beyond the first entry in this last block, because the last block's first entry always remains same. This explanation is convoluted, I know, but I too found out the hard way. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add 0-byte size/count guardsShehjar Tikoo2009-05-051-0/+144
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: A Fix deadlock in ftruncateShehjar Tikoo2009-05-051-1/+1
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Conform'ify glusterfs_readdirShehjar Tikoo2009-05-052-22/+31
| | | | | | | | | | | This commit does two things: 1. Changes glusterfs_readdir prototype to conform to the POSIX readdir(). 2. Uses a 1024-byte value instead of sizeof(struct dirent) for the @size for libgf_client_readdir. This allows even larger names to fit into a single readdir request to the server. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add VMP-based lchownShehjar Tikoo2009-05-052-3/+96
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add remove APIShehjar Tikoo2009-05-052-0/+86
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add lightweight path resolutionShehjar Tikoo2009-05-051-85/+300
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add lgetxattr APIShehjar Tikoo2009-05-052-17/+71
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add setxattr,lsetxattr APIShehjar Tikoo2009-05-052-23/+81
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Make stat resolve all symlinksShehjar Tikoo2009-05-051-11/+10
| | | | | | | | We want to resolve even nested symlinks when calling stat, therefore, we need to depend on realpath-like functionality and not just a readlink. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Fix realpath operationShehjar Tikoo2009-05-051-23/+25
| | | | | | | | | | | | | | | This commit does two things: 1. Ensures we go on to traverse nested symlinks by calling realpath recursively on the symlink. 2. Makes glusterfs_realpath, a VMP-based operation, return a resolved /real path that actually has the VMP pre-fixed to the resolved path. If this is not done, we'll be returning a path that is valid only within the glusterfs context, i.e. the path will point to a real file/dir only if a glusterfs handle identifies which glusterfs context the file is in. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Dont lookup oldpath on symlinkShehjar Tikoo2009-05-051-13/+1
| | | | | | | The target of the symlink does not have to be interpreted in any way. It should be sent across as it is. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Improve path matching heuristicShehjar Tikoo2009-05-051-7/+73
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Guard against un-inited VMP searchesShehjar Tikoo2009-05-051-0/+6
| | | | | | | | | | | On my system, an selinux module gets inited before booster even though the FS calls from the selinux module get routed through our LD_PRELOAD'ed wrappers. In this scenario, the VMP list is un-inited, resulting in a seg-fault if it is dereferenced. The list_empty check does not help because the pointers in the list have non-NULL values. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add comments to APIShehjar Tikoo2009-05-051-30/+773
| | | | | | | | | | | Some of the functions have also been moved within the header to reflect the order in which users will read through and try to understand how to use the lib. For eg. the init, mount and umount functions have been moved to the beginning to clarify how to start by init and de-initing. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Expose a few remaining APIsShehjar Tikoo2009-05-051-0/+14
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add VMP-based renameShehjar Tikoo2009-05-052-2/+47
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: implement glusterfs_umountRaghavendra G2009-04-232-0/+41
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add VMP-based realpathShehjar Tikoo2009-04-212-3/+27
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add VMP-based readlinkShehjar Tikoo2009-04-212-4/+34
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add VMP-based symlinkShehjar Tikoo2009-04-212-2/+32
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add VMP-based unlinkShehjar Tikoo2009-04-212-1/+28
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add VMP-based mkfifoShehjar Tikoo2009-04-212-1/+29
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add VMP-based mknodShehjar Tikoo2009-04-212-4/+28
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add VMP-based utimeShehjar Tikoo2009-04-212-2/+33
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add VMP-based utimesShehjar Tikoo2009-04-212-2/+30
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add VMP-based statvfsShehjar Tikoo2009-04-212-2/+33
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add VMP-based statfsShehjar Tikoo2009-04-212-1/+31
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add VMP-based linkShehjar Tikoo2009-04-212-1/+44
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add VMP-based opendirShehjar Tikoo2009-04-212-1/+29
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add VMP-based chownShehjar Tikoo2009-04-212-2/+30
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add VMP-based chmodShehjar Tikoo2009-04-212-1/+27
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add VMP-based rmdirShehjar Tikoo2009-04-212-6/+25
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add VMP-based mkdirShehjar Tikoo2009-04-212-7/+26
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add VMP-based lstatShehjar Tikoo2009-04-212-1/+30
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add VMP-based statShehjar Tikoo2009-04-212-6/+33
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Fix stat cache bugShehjar Tikoo2009-04-211-5/+12
| | | | | | | | | | | | | The way stat cache gets updated was not consistent across all syscalls. Consequently, I was running into a bug that returned a 0 st_ino. The fix actually resides in the hunk that changes the lines in libgf_client_lookup but similar changes were also required in other users of stat cache. This commit fixes the bug and also cleans up the way stat cache is updated. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add VMP-based setxattrShehjar Tikoo2009-04-212-9/+35
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add VMP-based creatShehjar Tikoo2009-04-212-4/+26
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add VMP-based openShehjar Tikoo2009-04-212-7/+41
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add VMP-based getxattrShehjar Tikoo2009-04-212-8/+35
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add VMP-based getShehjar Tikoo2009-04-212-6/+30
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add virtual mount point supportShehjar Tikoo2009-04-213-0/+178
| | | | | | | | | | | | | | | | | | | | | One part of the glusterfsclient library requires users to use a handle to address a particular glusterfs context. This can become cumbersome for applications that need to use multiple such context. For such applications, we make it easy by letting them define virtual mount points(VMPs), which are just paths that identify a particular glusterfs context. This is done through a new glusterfs_mount(..) interface. Subsequenly, any path based operations, that pre-pend a VMP before the files and directories inside the glusterfsd export, get internally routed to the correct glusterfs context. This helps users do away with the need to maintain their own path-to-glusterfs_handle_t mapping. The old handle-based interface still exists for whoever wishes to use it. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Must return size from readvShehjar Tikoo2009-04-211-1/+0
| | | | | | | | The line being removed made libgf_client_readv return a 0 on successfull return when the return should really be the size of data read. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Expose glusterfs_realpathShehjar Tikoo2009-04-211-0/+3
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>