libnfs.c: add support for nfs_umask

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
libnfs-4.0.0-vitalif
Ronnie Sahlberg 2014-12-09 14:00:15 -08:00
parent b53cd4d76c
commit 0c1a5c464c
2 changed files with 16 additions and 2 deletions

View File

@ -386,7 +386,14 @@ EXTERN int nfs_fstat64_async(struct nfs_context *nfs, struct nfsfh *nfsfh, nfs_c
*/
EXTERN int nfs_fstat64(struct nfs_context *nfs, struct nfsfh *nfsfh, struct nfs_stat_64 *st);
/*
* UMASK() never blocks, so no special aync/async versions are available
*/
/*
* Sync umask(<mask>)
* Function returns the old mask.
*/
EXTERN uint16_t nfs_umask(struct nfs_context *nfs, uint16_t mask);
/*
* OPEN()

View File

@ -125,6 +125,7 @@ struct nfs_context {
uint64_t writemax;
char *cwd;
struct nfsdir *dircache;
uint16_t mask;
};
void nfs_free_nfsdir(struct nfsdir *nfsdir)
@ -412,7 +413,7 @@ struct nfs_context *nfs_init_context(void)
}
nfs->cwd = strdup("/");
nfs->mask = 022;
return nfs;
}
@ -5095,3 +5096,9 @@ const struct nfs_fh3 *nfs_get_rootfh(struct nfs_context *nfs) {
struct nfs_fh3 *nfs_get_fh(struct nfsfh *nfsfh) {
return &nfsfh->fh;
}
uint16_t nfs_umask(struct nfs_context *nfs, uint16_t mask) {
uint16_t tmp = nfs->mask;
nfs->mask = mask;
return tmp;
}