Select Git revision
phy_device.c
os.h 11.28 KiB
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2015 Anton Ivanov (aivanov@{brocade.com,kot-begemot.co.uk})
* Copyright (C) 2015 Thomas Meyer (thomas@m3y3r.de)
* Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
*/
#ifndef __OS_H__
#define __OS_H__
#include <irq_user.h>
#include <longjmp.h>
#include <mm_id.h>
/* This is to get size_t */
#ifndef __UM_HOST__
#include <linux/types.h>
#else
#include <sys/types.h>
#endif
#define CATCH_EINTR(expr) while ((errno = 0, ((expr) < 0)) && (errno == EINTR))
#define OS_TYPE_FILE 1
#define OS_TYPE_DIR 2
#define OS_TYPE_SYMLINK 3
#define OS_TYPE_CHARDEV 4
#define OS_TYPE_BLOCKDEV 5
#define OS_TYPE_FIFO 6
#define OS_TYPE_SOCK 7
/* os_access() flags */
#define OS_ACC_F_OK 0 /* Test for existence. */
#define OS_ACC_X_OK 1 /* Test for execute permission. */
#define OS_ACC_W_OK 2 /* Test for write permission. */
#define OS_ACC_R_OK 4 /* Test for read permission. */
#define OS_ACC_RW_OK (OS_ACC_W_OK | OS_ACC_R_OK) /* Test for RW permission */
#ifdef CONFIG_64BIT
#define OS_LIB_PATH "/usr/lib64/"
#else
#define OS_LIB_PATH "/usr/lib/"
#endif
#define OS_SENDMSG_MAX_FDS 8
/*
* types taken from stat_file() in hostfs_user.c
* (if they are wrong here, they are wrong there...).
*/
struct uml_stat {
int ust_dev; /* device */
unsigned long long ust_ino; /* inode */
int ust_mode; /* protection */
int ust_nlink; /* number of hard links */
int ust_uid; /* user ID of owner */
int ust_gid; /* group ID of owner */
unsigned long long ust_size; /* total size, in bytes */
int ust_blksize; /* blocksize for filesystem I/O */
unsigned long long ust_blocks; /* number of blocks allocated */
unsigned long ust_atime; /* time of last access */
unsigned long ust_mtime; /* time of last modification */
unsigned long ust_ctime; /* time of last change */
};
struct openflags {
unsigned int r : 1;
unsigned int w : 1;
unsigned int s : 1; /* O_SYNC */
unsigned int c : 1; /* O_CREAT */
unsigned int t : 1; /* O_TRUNC */