Skip to content

Commit

Permalink
libnfs.c: add support for nfs_umask
Browse files Browse the repository at this point in the history
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
  • Loading branch information
sahlberg committed Dec 9, 2014
1 parent b53cd4d commit 0c1a5c4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion include/nfsc/libnfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
9 changes: 8 additions & 1 deletion lib/libnfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -412,7 +413,7 @@ struct nfs_context *nfs_init_context(void)
}

nfs->cwd = strdup("/");

nfs->mask = 022;
return nfs;
}

Expand Down Expand Up @@ -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;
}

0 comments on commit 0c1a5c4

Please sign in to comment.