summaryrefslogtreecommitdiffstats
path: root/isys
diff options
context:
space:
mode:
Diffstat (limited to 'isys')
-rw-r--r--isys/imount.c102
-rw-r--r--isys/imount.h7
-rw-r--r--isys/isys.c13
3 files changed, 50 insertions, 72 deletions
diff --git a/isys/imount.c b/isys/imount.c
index 4f5725373..e615f70f4 100644
--- a/isys/imount.c
+++ b/isys/imount.c
@@ -14,8 +14,7 @@
static int mkdirIfNone(char * directory);
-int doPwMount(char * dev, char * where, char * fs, int rdonly, int istty,
- char * acct, char * pw, int bindmnt, int remount) {
+int doPwMount(char * dev, char * where, char * fs, int options, void *data) {
char * buf = NULL;
int isnfs = 0;
char * mount_opt = NULL;
@@ -26,81 +25,52 @@ int doPwMount(char * dev, char * where, char * fs, int rdonly, int istty,
/*logMessage("mounting %s on %s as type %s", dev, where, fs);*/
- if (!strcmp(fs, "smb")) {
-#if 0 /* disabled for now */
- mkdirChain(where);
-
- if (!acct) acct = "guest";
- if (!pw) pw = "";
-
- buf = alloca(strlen(dev) + 1);
- strcpy(buf, dev);
- chptr = buf;
- while (*chptr && *chptr != ':') chptr++;
- if (!*chptr) {
- /*logMessage("bad smb mount point %s", where);*/
- return IMOUNT_ERR_OTHER;
- }
-
- *chptr = '\0';
- chptr++;
-
-#ifdef __i386__
- /*logMessage("mounting smb filesystem from %s path %s on %s",
- buf, chptr, where);*/
- return smbmount(buf, chptr, acct, pw, "localhost", where);
-#else
- errorWindow("smbfs only works on Intel machines");
-#endif
-#endif /* disabled */
+ if (mkdirChain(where))
+ return IMOUNT_ERR_ERRNO;
+
+ flag = MS_MGC_VAL;
+ if (options & IMOUNT_RDONLY)
+ flag |= MS_RDONLY;
+ if (options & IMOUNT_BIND)
+ flag |= MS_BIND;
+ if (options & IMOUNT_REMOUNT)
+ flag |= MS_REMOUNT;
+
+ if (!isnfs && (*dev == '/' || !strcmp(dev, "none"))) {
+ buf = dev;
+ } else if (!isnfs) {
+ buf = alloca(200);
+ strcpy(buf, "/tmp/");
+ strcat(buf, dev);
} else {
- if (mkdirChain(where))
- return IMOUNT_ERR_ERRNO;
-
- if (!isnfs && (*dev == '/' || !strcmp(dev, "none"))) {
- buf = dev;
- } else if (!isnfs) {
- buf = alloca(200);
- strcpy(buf, "/tmp/");
- strcat(buf, dev);
- } else {
#ifndef DISABLE_NETWORK
- char * extra_opts = NULL;
- int flags = 0;
+ char * extra_opts = strdup(data);
+ int flags = 0;
- buf = dev;
- /*logMessage("calling nfsmount(%s, %s, &flags, &extra_opts, &mount_opt)",
+ buf = dev;
+ /*logMessage("calling nfsmount(%s, %s, &flags, &extra_opts, &mount_opt)",
buf, where);*/
- if (nfsmount(buf, where, &flags, &extra_opts, &mount_opt, 0)) {
+ if (nfsmount(buf, where, &flags, &extra_opts, &mount_opt, 0)) {
/*logMessage("\tnfsmount returned non-zero");*/
/*fprintf(stderr, "nfs mount failed: %s\n",
nfs_error());*/
return IMOUNT_ERR_OTHER;
- }
+ }
#endif
}
- flag = MS_MGC_VAL;
- if (rdonly)
- flag |= MS_RDONLY;
- if (bindmnt)
- flag |= MS_BIND;
- if (remount)
- flag |= MS_REMOUNT;
-
- if (!strncmp(fs, "vfat", 4))
- mount_opt="check=relaxed";
- #ifdef __sparc__
- if (!strncmp(fs, "ufs", 3))
- mount_opt="ufstype=sun";
- #endif
-
- /*logMessage("calling mount(%s, %s, %s, %ld, %p)", buf, where, fs,
- flag, mount_opt);*/
-
- if (mount(buf, where, fs, flag, mount_opt)) {
- return IMOUNT_ERR_ERRNO;
- }
+ if (!strncmp(fs, "vfat", 4))
+ mount_opt="check=relaxed";
+#ifdef __sparc__
+ if (!strncmp(fs, "ufs", 3))
+ mount_opt="ufstype=sun";
+#endif
+
+ /*logMessage("calling mount(%s, %s, %s, %ld, %p)", buf, where, fs,
+ flag, mount_opt);*/
+
+ if (mount(buf, where, fs, flag, mount_opt)) {
+ return IMOUNT_ERR_ERRNO;
}
return 0;
diff --git a/isys/imount.h b/isys/imount.h
index 0907629b9..32cfafac0 100644
--- a/isys/imount.h
+++ b/isys/imount.h
@@ -6,8 +6,11 @@
#include <sys/mount.h> /* for umount() */
-int doPwMount(char * dev, char * where, char * fs, int rdonly, int istty,
- char * acct, char * pw, int bindmnt, int remount);
+#define IMOUNT_RDONLY 1
+#define IMOUNT_BIND 2
+#define IMOUNT_REMOUNT 4
+
+int doPwMount(char * dev, char * where, char * fs, int options, void * data);
int mkdirChain(char * origChain);
#endif
diff --git a/isys/isys.c b/isys/isys.c
index c1aa8e934..ac16705cf 100644
--- a/isys/isys.c
+++ b/isys/isys.c
@@ -465,14 +465,19 @@ static PyObject * doUMount(PyObject * s, PyObject * args) {
static PyObject * doMount(PyObject * s, PyObject * args) {
char * fs, * device, * mntpoint;
int rc;
- int readOnly;
- int bindMount;
- int reMount;
+ int readOnly = 0;
+ int bindMount = 0;
+ int reMount = 0;
+ int flags = 0;
if (!PyArg_ParseTuple(args, "sssiii", &fs, &device, &mntpoint,
&readOnly, &bindMount, &reMount)) return NULL;
- rc = doPwMount(device, mntpoint, fs, readOnly, 0, NULL, NULL, bindMount, reMount);
+ if (readOnly) flags |= IMOUNT_RDONLY;
+ if (bindMount) flags |= IMOUNT_BIND;
+ if (reMount) flags |= IMOUNT_REMOUNT;
+
+ rc = doPwMount(device, mntpoint, fs, flags, NULL);
if (rc == IMOUNT_ERR_ERRNO)
PyErr_SetFromErrno(PyExc_SystemError);
else if (rc)