mirror of
https://git.openafs.org/openafs.git
synced 2025-01-22 17:00:15 +00:00
ukernel: add uafs_access
we don't have an access vop. add one. Change-Id: I813fb941608b5e49a0f23730414854602630fdee Reviewed-on: http://gerrit.openafs.org/5589 Reviewed-by: Derrick Brashear <shadow@dementix.org> Tested-by: Derrick Brashear <shadow@dementix.org>
This commit is contained in:
parent
0676dc9e0c
commit
3eb60908a1
@ -3830,6 +3830,45 @@ uafs_statmountpoint_r(char *path)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* uafs_getRights
|
||||||
|
* Get a list of rights for the current user on path.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
uafs_access(char *path, int flags)
|
||||||
|
{
|
||||||
|
int code;
|
||||||
|
struct vnode *vp;
|
||||||
|
int fileMode = 0;
|
||||||
|
|
||||||
|
if (flags & R_OK) {
|
||||||
|
fileMode |= VREAD;
|
||||||
|
}
|
||||||
|
if (flags & W_OK) {
|
||||||
|
fileMode |= VWRITE;
|
||||||
|
}
|
||||||
|
if (flags & X_OK) {
|
||||||
|
fileMode |= VEXEC;
|
||||||
|
}
|
||||||
|
|
||||||
|
AFS_GLOCK();
|
||||||
|
code = uafs_LookupName(path, afs_CurrentDir, &vp, 1, 0);
|
||||||
|
if (code != 0) {
|
||||||
|
errno = code;
|
||||||
|
AFS_GUNLOCK();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
code = afs_access(VTOAFS(vp), fileMode, get_user_struct()->u_cred);
|
||||||
|
VN_RELE(vp);
|
||||||
|
|
||||||
|
if (code != 0)
|
||||||
|
errno = code;
|
||||||
|
|
||||||
|
AFS_GUNLOCK();
|
||||||
|
return code ? -1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* uafs_getRights
|
* uafs_getRights
|
||||||
* Get a list of rights for the current user on path.
|
* Get a list of rights for the current user on path.
|
||||||
|
@ -153,5 +153,6 @@ extern void uafs_Shutdown(void);
|
|||||||
extern void uafs_mount(void);
|
extern void uafs_mount(void);
|
||||||
extern void uafs_setMountDir(const char *dir);
|
extern void uafs_setMountDir(const char *dir);
|
||||||
extern int uafs_fork(int wait, void* (*cbf) (void *), void *rock);
|
extern int uafs_fork(int wait, void* (*cbf) (void *), void *rock);
|
||||||
|
extern int uafs_access(char *path, int amode);
|
||||||
|
|
||||||
#endif /* __AFS_USROPS_H__ */
|
#endif /* __AFS_USROPS_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user