diff options
author | Fritz Elfert <felfert@to.com> | 2000-01-17 23:10:22 +0000 |
---|---|---|
committer | Fritz Elfert <felfert@to.com> | 2000-01-17 23:10:22 +0000 |
commit | 645d422982f78267bd19bb75ecef9bccb130ddbc (patch) | |
tree | fbd969d041e76f3d19ce37a19bf046c594fc0a2d /plpnfsd | |
parent | e8fe1c4a207e99f3dee27724c776fffbcd4c6d90 (diff) | |
download | plptools-645d422982f78267bd19bb75ecef9bccb130ddbc.tar.gz plptools-645d422982f78267bd19bb75ecef9bccb130ddbc.tar.bz2 plptools-645d422982f78267bd19bb75ecef9bccb130ddbc.zip |
Maintenance release 0.6
Several fixes in plpnfsd: NFS-mounted device has not been writable.
Diffstat (limited to 'plpnfsd')
-rw-r--r-- | plpnfsd/main.cc | 59 | ||||
-rw-r--r-- | plpnfsd/rfsv_api.h | 1 |
2 files changed, 31 insertions, 29 deletions
diff --git a/plpnfsd/main.cc b/plpnfsd/main.cc index 206d902..e322685 100644 --- a/plpnfsd/main.cc +++ b/plpnfsd/main.cc @@ -23,18 +23,17 @@ extern "C" { static rfsv *a; static rfsvfactory *rf; -static char *a_filename; +static char *a_filename = 0; static long a_handle; static long a_offset; static long a_openmode; long rfsv_isalive() { if (!a) { - a = rf->create(true); - if (a != NULL) - return (a->getStatus() == 0); + if (!(a = rf->create(true))) + return 0; } - return 0; + return (a->getStatus() == 0); } long rfsv_dir(const char *file, dentry **e) { @@ -79,27 +78,33 @@ long rfsv_mkdir(const char *file) { return a->mkdir(file); } -long rfsv_remove(const char *file) { +static long rfsv_closecached() { if (!a) return -1; - return a->remove(file); + if (!a_filename) + return 0; + a->fclose(a_handle); + free(a_filename); + a_filename = 0; + return 0; } -long rfsv_fclose(long handle) { +long rfsv_remove(const char *file) { if (!a) return -1; - return a->fclose(handle); + if (a_filename && !strcmp(a_filename, file)) + rfsv_closecached(); + return a->remove(file); } -long rfsv_fopen(long attr, const char *file, long *handle) { - long ph; - long ret; - +long rfsv_fclose(long handle) { if (!a) return -1; - ret = a->fopen(a->opMode(attr), file, ph); - *handle = ph; - return ret; + if (a_filename && (handle == a_handle)) { + free(a_filename); + a_filename = 0; + } + return a->fclose(handle); } long rfsv_fcreate(long attr, const char *file, long *handle) { @@ -108,6 +113,8 @@ long rfsv_fcreate(long attr, const char *file, long *handle) { if (!a) return -1; + if (a_filename && !strcmp(a_filename, file)) + rfsv_closecached(); ret = a->fcreatefile(attr, file, ph); *handle = ph; return ret; @@ -130,17 +137,6 @@ static long rfsv_opencached(const char *name, long mode) { return ret; } -static long rfsv_closecached() { - if (!a) - return -1; - if (!a_filename) - return 0; - a->fclose(a_handle); - free(a_filename); - a_filename = 0; - return 0; -} - long rfsv_read(char *buf, long offset, long len, char *name) { // FIXME: this might break on RFSV16? long ret = 0; @@ -192,6 +188,8 @@ long rfsv_write(char *buf, long offset, long len, char *name) { long rfsv_setmtime(const char *name, long time) { if (!a) return -1; + if (a_filename && !strcmp(a_filename, name)) + rfsv_closecached(); return a->fsetmtime(name, time); } @@ -202,6 +200,8 @@ long rfsv_setsize(const char *name, long size) { if (!a) return -1; + if (a_filename && !strcmp(name, a_filename)) + return a->fsetsize(a_handle, size); ret = a->fopen(a->opMode(rfsv::PSI_O_RDWR), name, ph); if (!ret) { ret = a->fsetsize(ph, size); @@ -213,7 +213,10 @@ long rfsv_setsize(const char *name, long size) { long rfsv_setattr(const char *name, long sattr, long dattr) { if (!a) return -1; - return a->fsetattr(name, dattr, sattr); + if (a_filename && !strcmp(name, a_filename)) + rfsv_closecached(); + long ret = a->fsetattr(name, dattr, sattr); + return ret; } long rfsv_getattr(const char *name, long *attr, long *size, long *time) { diff --git a/plpnfsd/rfsv_api.h b/plpnfsd/rfsv_api.h index b63911d..d4a996b 100644 --- a/plpnfsd/rfsv_api.h +++ b/plpnfsd/rfsv_api.h @@ -16,7 +16,6 @@ extern long rfsv_rmdir(const char *name); extern long rfsv_remove(const char *name); extern long rfsv_rename(const char *oldname, const char *newname); extern long rfsv_fclose(long handle); -extern long rfsv_fopen(long attr, const char *name, long *handle); extern long rfsv_fcreate(long attr, const char *name, long *handle); extern long rfsv_read(char *buf, long offset, long len, char *name); extern long rfsv_write(char *buf, long offset, long len, char *name); |