diff options
author | Shehjar Tikoo <shehjart@gluster.com> | 2009-05-20 22:50:10 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-05-20 23:00:12 -0700 |
commit | 4d4cfc6e45a34e53f236cd2dccf66407ddc57796 (patch) | |
tree | 9c4b8c42d03c05d6b14c98ded52319d0bb376651 /booster/src/booster.c | |
parent | 7f001813bc04ede65b05d588f16e0a6c68a94cfe (diff) |
booster: Move fstab parsing into booster from libglusterfstag-release-2.0
This is another attempt at fixing build problems on Solaris.
I am told that booster build is disabled on Solaris and I know
that it is disabled on Mac OS X also. Getting it to work
on both these systems is now on my TODO list, mainly
because on both these systems, we can have a glusterfs client
running without requiring FUSE.
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
Diffstat (limited to 'booster/src/booster.c')
-rw-r--r-- | booster/src/booster.c | 109 |
1 files changed, 1 insertions, 108 deletions
diff --git a/booster/src/booster.c b/booster/src/booster.c index aeb4caa42..264d6772b 100644 --- a/booster/src/booster.c +++ b/booster/src/booster.c @@ -42,7 +42,6 @@ #include <dirent.h> #include <sys/statfs.h> #include <sys/statvfs.h> -#include <glusterfs_fstab.h> #ifndef GF_UNIT_KB #define GF_UNIT_KB 1024 @@ -224,6 +223,7 @@ typedef struct booster_mount_table booster_mount_table_t; static fdtable_t *booster_glfs_fdtable = NULL; static booster_mount_table_t *booster_mount_table = NULL; +extern int booster_configure (char *confpath); /* This is dup'ed every time VMP open/creat wants a new fd. * This is needed so we occupy an entry in the process' file * table. @@ -239,113 +239,6 @@ booster_get_process_fd () #define DEFAULT_BOOSTER_CONF CONFDIR"/booster.conf" #define BOOSTER_CONF_ENV_VAR "GLUSTERFS_BOOSTER_FSTAB" -void -clean_init_params (glusterfs_init_params_t *ipars) -{ - if (!ipars) - return; - - if (ipars->volume_name) - free (ipars->volume_name); - - if (ipars->specfile) - free (ipars->specfile); - - if (ipars->logfile) - free (ipars->logfile); - - if (ipars->loglevel) - free (ipars->loglevel); - - return; -} - -char * -get_option_value (char *opt) -{ - char *val = NULL; - char *saveptr = NULL; - char *copy_opt = NULL; - char *retval = NULL; - - copy_opt = strdup (opt); - - /* Get the = before the value of the option. */ - val = index (copy_opt, '='); - if (val) { - /* Move to start of option */ - ++val; - - /* Now, to create a '\0' delimited string out of the - * options string, first get the position where the - * next option starts, that would be the next ','. - */ - saveptr = index (val, ','); - if (saveptr) - *saveptr = '\0'; - retval = strdup (val); - } - - free (copy_opt); - - return retval; -} - -void -booster_mount (struct glusterfs_mntent *ent) -{ - char *opt = NULL; - glusterfs_init_params_t ipars; - - if (!ent) - return; - - if ((strcmp (ent->mnt_type, "glusterfs") != 0)) - return; - - memset (&ipars, 0, sizeof (glusterfs_init_params_t)); - if (ent->mnt_fsname) - ipars.specfile = strdup (ent->mnt_fsname); - - opt = glusterfs_fstab_hasoption (ent, "subvolume"); - if (opt) - ipars.volume_name = get_option_value (opt); - - opt = glusterfs_fstab_hasoption (ent, "logfile"); - if (opt) - ipars.logfile = get_option_value (opt); - - opt = glusterfs_fstab_hasoption (ent, "loglevel"); - if (opt) - ipars.loglevel = get_option_value (opt); - - glusterfs_mount (ent->mnt_dir, &ipars); - clean_init_params (&ipars); -} - -int -booster_configure (char *confpath) -{ - int ret = -1; - glusterfs_fstab_t *handle = NULL; - struct glusterfs_mntent *ent = NULL; - - if (!confpath) - goto out; - - handle = glusterfs_fstab_init (confpath, "r"); - if (!handle) - goto out; - - while ((ent = glusterfs_fstab_getent (handle)) != NULL) - booster_mount (ent); - - glusterfs_fstab_close (handle); - ret = 0; -out: - return ret; -} - static int32_t booster_put_handle (booster_mount_table_t *table, dev_t st_dev, |