|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH 2/5] lib/vfscore: prefix defines conflicting with Newlib
Signed-off-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx>
---
lib/ramfs/ramfs_vnops.c | 2 +-
lib/vfscore/include/vfscore/fs.h | 12 +++++++-----
lib/vfscore/main.c | 12 +++++-------
lib/vfscore/stdio.c | 2 +-
lib/vfscore/syscalls.c | 13 ++++++-------
5 files changed, 20 insertions(+), 21 deletions(-)
diff --git a/lib/ramfs/ramfs_vnops.c b/lib/ramfs/ramfs_vnops.c
index 3c55dbe0..58f78c00 100644
--- a/lib/ramfs/ramfs_vnops.c
+++ b/lib/ramfs/ramfs_vnops.c
@@ -241,7 +241,7 @@ ramfs_lookup(struct vnode *dvp, char *name, struct vnode
**vpp)
return ENOMEM;
}
vp->v_data = np;
- vp->v_mode = ALLPERMS;
+ vp->v_mode = UK_ALLPERMS;
vp->v_type = np->rn_type;
vp->v_size = np->rn_size;
diff --git a/lib/vfscore/include/vfscore/fs.h b/lib/vfscore/include/vfscore/fs.h
index e3bda95b..620be0fe 100644
--- a/lib/vfscore/include/vfscore/fs.h
+++ b/lib/vfscore/include/vfscore/fs.h
@@ -6,22 +6,24 @@
* Kernel encoding of open mode; separate read and write bits that are
* independently testable: 1 greater than the above.
*/
-#define FREAD 0x00000001
-#define FWRITE 0x00000002
+#define UK_FREAD 0x00000001
+#define UK_FWRITE 0x00000002
-#define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)
+#define UK_ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)
static inline int vfscore_fflags(int oflags)
{
int rw = oflags & O_ACCMODE;
+
oflags &= ~O_ACCMODE;
return (rw + 1) | oflags;
}
static inline int vfscore_oflags(int fflags)
{
- int rw = fflags & (FREAD|FWRITE);
- fflags &= ~(FREAD|FWRITE);
+ int rw = fflags & (UK_FREAD|UK_FWRITE);
+
+ fflags &= ~(UK_FREAD|UK_FWRITE);
return (rw - 1) | fflags;
}
diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
index 285ddaf2..47471339 100644
--- a/lib/vfscore/main.c
+++ b/lib/vfscore/main.c
@@ -1887,7 +1887,7 @@ int chmod(const char *pathname, mode_t mode)
goto out_errno;
if ((error = task_conv(t, pathname, VWRITE, path)) != 0)
goto out_errno;
- error = sys_chmod(path, mode & ALLPERMS);
+ error = sys_chmod(path, mode & UK_ALLPERMS);
if (error)
goto out_errno;
trace_vfs_chmod_ret();
@@ -1904,7 +1904,7 @@ TRACEPOINT(trace_vfs_fchmod_ret, "");
int fchmod(int fd, mode_t mode)
{
trace_vfs_fchmod(fd, mode);
- int error = sys_fchmod(fd, mode & ALLPERMS);
+ int error = sys_fchmod(fd, mode & UK_ALLPERMS);
trace_vfs_fchmod_ret();
if (error) {
errno = error;
@@ -1957,17 +1957,15 @@ ssize_t sendfile(int out_fd, int in_fd, off_t *_offset,
size_t count)
return libc_error(EBADF);
}
- if (!(in_fp->f_flags & FREAD)) {
+ if (!(in_fp->f_flags & UK_FREAD))
return libc_error(EBADF);
- }
if (out_fp->f_type & DTYPE_VNODE) {
- if (!out_fp->f_dentry) {
+ if (!out_fp->f_dentry)
return libc_error(EBADF);
- } else if (!(out_fp->f_flags & FWRITE)) {
+ else if (!(out_fp->f_flags & UK_FWRITE))
return libc_error(EBADF);
}
- }
off_t offset ;
diff --git a/lib/vfscore/stdio.c b/lib/vfscore/stdio.c
index 5f15ef2a..ee8a5b1d 100644
--- a/lib/vfscore/stdio.c
+++ b/lib/vfscore/stdio.c
@@ -104,7 +104,7 @@ static struct dentry stdio_dentry = {
static struct vfscore_file stdio_file = {
.fd = 1,
- .f_flags = FWRITE | FREAD,
+ .f_flags = UK_FWRITE | UK_FREAD,
.f_dentry = &stdio_dentry,
/* reference count is 2 because close(0) is a valid
* operation. However it is not properly handled in the
diff --git a/lib/vfscore/syscalls.c b/lib/vfscore/syscalls.c
index 7931d34b..a2584ab1 100644
--- a/lib/vfscore/syscalls.c
+++ b/lib/vfscore/syscalls.c
@@ -168,7 +168,7 @@ sys_open(char *path, int flags, mode_t mode, struct
vfscore_file **fpp)
vp = dp->d_vnode;
- if (flags & FWRITE || flags & O_TRUNC) {
+ if (flags & UK_FWRITE || flags & O_TRUNC) {
error = vn_access(vp, VWRITE);
if (error)
goto out_drele;
@@ -189,7 +189,7 @@ sys_open(char *path, int flags, mode_t mode, struct
vfscore_file **fpp)
/* Process truncate request */
if (flags & O_TRUNC) {
error = EINVAL;
- if (!(flags & FWRITE) || vp->v_type == VDIR)
+ if (!(flags & UK_FWRITE) || vp->v_type == VDIR)
goto out_vn_unlock;
error = VOP_TRUNCATE(vp, 0);
@@ -245,7 +245,7 @@ sys_read(struct vfscore_file *fp, const struct iovec *iov,
size_t niov,
{
int error = 0;
struct iovec *copy_iov;
- if ((fp->f_flags & FREAD) == 0)
+ if ((fp->f_flags & UK_FREAD) == 0)
return EBADF;
size_t bytes = 0;
@@ -295,7 +295,7 @@ sys_write(struct vfscore_file *fp, const struct iovec *iov,
size_t niov,
{
struct iovec *copy_iov;
int error = 0;
- if ((fp->f_flags & FWRITE) == 0)
+ if ((fp->f_flags & UK_FWRITE) == 0)
return EBADF;
size_t bytes = 0;
@@ -381,7 +381,7 @@ sys_ioctl(struct vfscore_file *fp, unsigned long request,
void *buf)
DPRINTF(VFSDB_SYSCALL, ("sys_ioctl: fp=%p request=%lux\n", fp,
request));
- if ((fp->f_flags & (FREAD | FWRITE)) == 0)
+ if ((fp->f_flags & (UK_FREAD | UK_FWRITE)) == 0)
return EBADF;
error = vfs_ioctl(fp, request, buf);
@@ -1437,9 +1437,8 @@ sys_fallocate(struct vfscore_file *fp, int mode, off_t
offset, off_t len)
DPRINTF(VFSDB_SYSCALL, ("sys_fallocate: fp=%p", fp));
- if (!fp->f_dentry || !(fp->f_flags & FWRITE)) {
+ if (!fp->f_dentry || !(fp->f_flags & UK_FWRITE))
return EBADF;
- }
if (offset < 0 || len <= 0) {
return EINVAL;
--
2.19.2
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |