From: meijia Date: Sat, 24 May 2003 08:54:57 +0000 (+0000) Subject: [liblustre}: X-Git-Tag: v1_7_100~1^91~239 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=11bf5b4b9b2f33945b60d3dc988eef5468759573;p=fs%2Flustre-release.git [liblustre}: - bring back liblustre.c, sharelib.sh again --- diff --git a/lustre/liblustre/liblustre.c b/lustre/liblustre/liblustre.c new file mode 100644 index 0000000..5b827b4 --- /dev/null +++ b/lustre/liblustre/liblustre.c @@ -0,0 +1,83 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#define ENV_LUSTRE_MNTPNT "LUSTRE_MOUNT_POINT" +#define ENV_PORTALS_MYNID "PORTALS_MYNID" + +extern int lllib_init(char *arg); + +static char *root_driver = "native"; +static char *lustre_driver = "llite"; +static char *root_path = "/"; +static char *lustre_path = NULL; +static char *portals_mynid = NULL; +static unsigned mntflgs = 0; + +extern int portal_debug; +extern int portal_subsystem_debug; + +extern int _sysio_native_init(); + +void __liblustre_setup_(void) +{ + int err; + + lustre_path = getenv(ENV_LUSTRE_MNTPNT); + if (!lustre_path) { + printf("lislustre: env %s didn't set!\n", ENV_LUSTRE_MNTPNT); + exit(1); + } + + portals_mynid = getenv("PORTALS_MYNID"); + if (!portals_mynid) { + printf("lislustre: env %s didn't set!\n", ENV_PORTALS_MYNID); + exit(1); + } + + if (_sysio_init() != 0) { + perror("init sysio"); + exit(1); + } + + _sysio_native_init(); + + err = _sysio_mount_root(root_path, root_driver, mntflgs, NULL); + if (err) { + perror(root_driver); + exit(1); + } + +#if 1 + portal_debug = 0; + portal_subsystem_debug = 0; +#endif + err = lllib_init(portals_mynid); + if (err) { + perror("init llite driver"); + exit(1); + } + + err = mount("/", lustre_path, lustre_driver, mntflgs, NULL); + if (err) { + errno = -err; + perror(lustre_driver); + exit(1); + } +} + +void __liblustre_cleanup_(void) +{ + _sysio_shutdown(); +} diff --git a/lustre/liblustre/sharelib.sh b/lustre/liblustre/sharelib.sh new file mode 100755 index 0000000..cd54397 --- /dev/null +++ b/lustre/liblustre/sharelib.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +AR=/usr/bin/ar +LD=/usr/bin/ld + +CWD=`pwd` + +LUS=$CWD/../ +PTL=$LUS/portals +SYSIO=$LUS/../libsysio + +TMP=/tmp/llib_tmp + +LLLIBS="$LUS/liblustre/libllite.a \ + $SYSIO/src/libsysio.a \ + $SYSIO/dev/stdfd/libsysio_stdfd.a \ + $SYSIO/drivers/native/libsysio_native.a \ + $LUS/lov/liblov.a \ + $LUS/osc/libosc.a \ + $LUS/ldlm/libldlm.a \ + $LUS/ptlrpc/libptlrpc.a \ + $LUS/obdclass/liblustreclass.a \ + $LUS/mdc/libmdc.a \ + $PTL/unals/libtcpnal.a \ + $PTL/portals/libportals.a \ + $PTL/utils/libptlctl.a" + +rm -rf $TMP +mkdir -p $TMP + +i=0 +for lib in $LLLIBS; do + mkdir $TMP/$i + cd $TMP/$i + $AR xv $lib + i=$(($i+1)) +done + +cd $TMP + +$LD -shared -o $CWD/liblustre.so -init __liblustre_setup_ -fini __liblustre_cleanup_ \ + `find . -type f` -lpthread -lreadline -lncurses + +cd $CWD