diff options
Diffstat (limited to 'api')
-rw-r--r-- | api/examples/glfsxmp.c | 36 | ||||
-rw-r--r-- | api/src/glfs.c | 1 |
2 files changed, 32 insertions, 5 deletions
diff --git a/api/examples/glfsxmp.c b/api/examples/glfsxmp.c index 1883b54bc92..9497128af91 100644 --- a/api/examples/glfsxmp.c +++ b/api/examples/glfsxmp.c @@ -8,22 +8,23 @@ int main (int argc, char *argv[]) { glfs_t *fs = NULL; + glfs_t *fs2 = NULL; int ret = 0; glfs_fd_t *fd = NULL; + glfs_fd_t *fd2 = NULL; struct stat sb = {0, }; char readbuf[32]; char writebuf[32]; - char *volname = "iops"; char *filename = "/filename2"; - fs = glfs_new (volname); + fs = glfs_new ("iops"); if (!fs) { fprintf (stderr, "glfs_new: returned NULL\n"); return 1; } -// ret = glfs_set_volfile (fs, "/tmp/filename.vol"); +// ret = glfs_set_volfile (fs, "/tmp/posix.vol"); ret = glfs_set_volfile_server (fs, "socket", "localhost", 24007); @@ -35,6 +36,24 @@ main (int argc, char *argv[]) fprintf (stderr, "glfs_init: returned %d\n", ret); + sleep (2); + + fs2 = glfs_new ("iops"); + if (!fs2) { + fprintf (stderr, "glfs_new: returned NULL\n"); + return 1; + } + + +// ret = glfs_set_volfile (fs2, "/tmp/posix.vol"); + + ret = glfs_set_volfile_server (fs2, "socket", "localhost", 24007); + + ret = glfs_set_logging (fs2, "/dev/stderr", 7); + + ret = glfs_init (fs2); + + fprintf (stderr, "glfs_init: returned %d\n", ret); ret = glfs_lstat (fs, filename, &sb); fprintf (stderr, "%s: (%d) %s\n", filename, ret, strerror (errno)); @@ -42,16 +61,23 @@ main (int argc, char *argv[]) fd = glfs_creat (fs, filename, O_RDWR, 0644); fprintf (stderr, "%s: (%p) %s\n", filename, fd, strerror (errno)); + fd2 = glfs_open (fs2, filename, O_RDWR); + fprintf (stderr, "%s: (%p) %s\n", filename, fd, strerror (errno)); + sprintf (writebuf, "hi there\n"); ret = glfs_write (fd, writebuf, 32, 0); - glfs_lseek (fd, 0, SEEK_SET); + glfs_lseek (fd2, 0, SEEK_SET); - ret = glfs_read (fd, readbuf, 32, 0); + ret = glfs_read (fd2, readbuf, 32, 0); printf ("read %d, %s", ret, readbuf); glfs_close (fd); + glfs_close (fd2); + + glfs_fini (fs); + glfs_fini (fs2); return ret; } diff --git a/api/src/glfs.c b/api/src/glfs.c index 017a55b1be8..01b3bc83674 100644 --- a/api/src/glfs.c +++ b/api/src/glfs.c @@ -25,6 +25,7 @@ - implement glfs_fini() - modify syncop_fsync() to accept 'dataonly' flag - 0-copy for readv/writev + - reconcile the open/creat mess */ #include <unistd.h> |