diff --git a/components/dfs/filesystems/devfs/devfs.c b/components/dfs/filesystems/devfs/devfs.c index d615482452..d60f7ddc9b 100644 --- a/components/dfs/filesystems/devfs/devfs.c +++ b/components/dfs/filesystems/devfs/devfs.c @@ -173,7 +173,7 @@ int dfs_device_fs_open(struct dfs_fd *file) if (device == RT_NULL) return -ENODEV; -#ifdef RT_USING_POSIX +#ifdef RT_USING_POSIX_DEVIO if (device->fops) { /* use device fops */ @@ -192,7 +192,7 @@ int dfs_device_fs_open(struct dfs_fd *file) } } else -#endif +#endif /* RT_USING_POSIX_DEVIO */ { result = rt_device_open(device, RT_DEVICE_OFLAG_RDWR); if (result == RT_EOK || result == -RT_ENOSYS) diff --git a/components/drivers/serial/serial.c b/components/drivers/serial/serial.c index 289d523bd2..c17c7aaebb 100644 --- a/components/drivers/serial/serial.c +++ b/components/drivers/serial/serial.c @@ -36,7 +36,7 @@ #define DBG_LVL DBG_INFO #include -#ifdef RT_USING_POSIX +#ifdef RT_USING_POSIX_DEVIO #include #include #include @@ -203,7 +203,7 @@ const static struct dfs_file_ops _serial_fops = RT_NULL, /* getdents */ serial_fops_poll, }; -#endif +#endif /* RT_USING_POSIX_DEVIO */ /* * Serial poll routines @@ -976,8 +976,7 @@ static void _tc_flush(struct rt_serial_device *serial, int queue) } } - -#endif +#endif /* RT_USING_POSIX_TERMIOS */ static rt_err_t rt_serial_control(struct rt_device *dev, int cmd, @@ -1020,7 +1019,7 @@ static rt_err_t rt_serial_control(struct rt_device *dev, } break; -#ifdef RT_USING_POSIX +#ifdef RT_USING_POSIX_DEVIO #ifdef RT_USING_POSIX_TERMIOS case TCGETA: { @@ -1215,7 +1214,7 @@ static rt_err_t rt_serial_control(struct rt_device *dev, *(rt_size_t *)args = recved; } break; -#endif /*RT_USING_POSIX*/ +#endif /* RT_USING_POSIX_DEVIO */ default : /* control device */ ret = serial->ops->control(serial, cmd, args); @@ -1270,7 +1269,7 @@ rt_err_t rt_hw_serial_register(struct rt_serial_device *serial, /* register a character device */ ret = rt_device_register(device, name, flag); -#if defined(RT_USING_POSIX) +#ifdef RT_USING_POSIX_DEVIO /* set fops */ device->fops = &_serial_fops; #endif diff --git a/components/drivers/serial/serial_v2.c b/components/drivers/serial/serial_v2.c index 390dd31748..4a43970126 100644 --- a/components/drivers/serial/serial_v2.c +++ b/components/drivers/serial/serial_v2.c @@ -16,7 +16,7 @@ #define DBG_LVL DBG_INFO #include -#ifdef RT_USING_POSIX +#ifdef RT_USING_POSIX_DEVIO #include #include #include @@ -179,7 +179,7 @@ const static struct dfs_file_ops _serial_fops = RT_NULL, /* getdents */ serial_fops_poll, }; -#endif +#endif /* RT_USING_POSIX_DEVIO */ static rt_size_t rt_serial_get_linear_buffer(struct rt_ringbuffer *rb, rt_uint8_t **ptr) @@ -1135,7 +1135,7 @@ rt_err_t rt_hw_serial_register(struct rt_serial_device *serial, /* register a character device */ ret = rt_device_register(device, name, flag); -#if defined(RT_USING_POSIX) +#ifdef RT_USING_POSIX_DEVIO /* set fops */ device->fops = &_serial_fops; #endif diff --git a/components/drivers/src/pipe.c b/components/drivers/src/pipe.c index bfb07fa950..1d803e9a4c 100644 --- a/components/drivers/src/pipe.c +++ b/components/drivers/src/pipe.c @@ -13,7 +13,7 @@ #include #include -#ifdef RT_USING_POSIX +#ifdef RT_USING_POSIX_DEVIO #include #include #include @@ -320,7 +320,7 @@ static const struct dfs_file_ops pipe_fops = RT_NULL, pipe_fops_poll, }; -#endif /* end of RT_USING_POSIX */ +#endif /* RT_USING_POSIX_DEVIO */ rt_err_t rt_pipe_open(rt_device_t device, rt_uint16_t oflag) { @@ -479,7 +479,7 @@ rt_pipe_t *rt_pipe_create(const char *name, int bufsz) rt_free(pipe); return RT_NULL; } -#ifdef RT_USING_POSIX +#ifdef RT_USING_POSIX_DEVIO dev->fops = (void*)&pipe_fops; #endif @@ -529,7 +529,7 @@ int rt_pipe_delete(const char *name) return result; } -#ifdef RT_USING_POSIX +#ifdef RT_USING_POSIX_DEVIO int pipe(int fildes[2]) { rt_pipe_t *pipe; @@ -575,4 +575,4 @@ int mkfifo(const char *path, mode_t mode) return 0; } -#endif +#endif /* RT_USING_POSIX_DEVIO */ diff --git a/components/libc/compilers/common/sys/ioctl.h b/components/libc/compilers/common/sys/ioctl.h index 04f73837bc..29ed3a8b84 100644 --- a/components/libc/compilers/common/sys/ioctl.h +++ b/components/libc/compilers/common/sys/ioctl.h @@ -11,9 +11,7 @@ #define _SYS_IOCTL_H #include -#ifdef RT_USING_POSIX #include -#endif #ifdef _WIN32 #include diff --git a/components/libc/posix/aio/SConscript b/components/libc/posix/aio/SConscript index 445efaade5..139bc45749 100644 --- a/components/libc/posix/aio/SConscript +++ b/components/libc/posix/aio/SConscript @@ -6,6 +6,6 @@ cwd = GetCurrentDir() src = Glob('*.c') CPPPATH = [cwd] -group = DefineGroup('POSIX', src, depend = ['RT_USING_POSIX', 'RT_USING_POSIX_AIO'], CPPPATH = CPPPATH) +group = DefineGroup('POSIX', src, depend = ['RT_USING_POSIX_AIO'], CPPPATH = CPPPATH) Return('group') diff --git a/components/libc/posix/src/libc.c b/components/libc/posix/src/libc.c index 068719d5d6..c324d84ef8 100644 --- a/components/libc/posix/src/libc.c +++ b/components/libc/posix/src/libc.c @@ -23,7 +23,7 @@ int libc_system_init(void) { -#ifdef RT_USING_POSIX +#ifdef RT_USING_POSIX_DEVIO rt_device_t dev_console; dev_console = rt_console_get_device(); @@ -31,7 +31,7 @@ int libc_system_init(void) { libc_stdio_set_console(dev_console->parent.name, O_RDWR); } -#endif /* RT_USING_POSIX */ +#endif /* RT_USING_POSIX_DEVIO */ #if defined RT_USING_PTHREADS && !defined RT_USING_COMPONENTS_INIT pthread_system_init(); @@ -41,8 +41,7 @@ int libc_system_init(void) } INIT_COMPONENT_EXPORT(libc_system_init); -#ifdef RT_USING_POSIX - +#ifdef RT_USING_POSIX_DEVIO #if defined(RT_USING_LIBC) && defined(RT_USING_NEWLIB) #define STDIO_DEVICE_NAME_MAX 32 static FILE* std_console = NULL; @@ -145,4 +144,4 @@ int libc_stdio_get_console(void) { return std_fd; } #endif /* defined(RT_USING_LIBC) && defined(RT_USING_NEWLIB) */ -#endif /* RT_USING_POSIX */ +#endif /* RT_USING_POSIX_DEVIO */ diff --git a/components/libc/posix/src/libc.h b/components/libc/posix/src/libc.h index f81380bf78..b019267926 100644 --- a/components/libc/posix/src/libc.h +++ b/components/libc/posix/src/libc.h @@ -17,10 +17,10 @@ extern "C" { #endif int libc_system_init(void); -#ifdef RT_USING_POSIX +#ifdef RT_USING_POSIX_DEVIO int libc_stdio_get_console(void); int libc_stdio_set_console(const char* device_name, int mode); -#endif /* RT_USING_POSIX */ +#endif /* RT_USING_POSIX_DEVIO */ #ifdef __cplusplus } diff --git a/components/libc/posix/termios/SConscript b/components/libc/posix/termios/SConscript index bd9a528461..3615926251 100644 --- a/components/libc/posix/termios/SConscript +++ b/components/libc/posix/termios/SConscript @@ -6,8 +6,6 @@ cwd = GetCurrentDir() src = Glob('*.c') + Glob('*.cpp') CPPPATH = [cwd] -group = DefineGroup('POSIX', src, - depend = ['RT_USING_LIBC', 'RT_USING_POSIX', 'RT_USING_POSIX_TERMIOS'], - CPPPATH = CPPPATH) +group = DefineGroup('POSIX', src, depend = ['RT_USING_LIBC', 'RT_USING_POSIX_TERMIOS'], CPPPATH = CPPPATH) Return('group') diff --git a/components/utilities/rt-link/src/rtlink_dev.c b/components/utilities/rt-link/src/rtlink_dev.c index efebf37565..e91736251d 100644 --- a/components/utilities/rt-link/src/rtlink_dev.c +++ b/components/utilities/rt-link/src/rtlink_dev.c @@ -19,7 +19,7 @@ #define RTLINK_SERV(dev) (((struct rt_link_device*)dev)->service) -#ifdef RT_USING_POSIX +#ifdef RT_USING_POSIX_DEVIO #include #include @@ -148,7 +148,7 @@ const static struct dfs_file_ops _rtlink_fops = RT_NULL, /* getdents */ rtlink_fops_poll, }; -#endif /* RT_USING_POSIX */ +#endif /* RT_USING_POSIX_DEVIO */ /* The event type for the service channel number, * which is used to wake up the service thread in blocking receive mode */ @@ -386,7 +386,7 @@ rt_err_t rt_link_dev_register(struct rt_link_device *rtlink, /* register a character device */ ret = rt_device_register(device, name, flag); -#if defined(RT_USING_POSIX) +#ifdef RT_USING_POSIX_DEVIO /* set fops */ device->fops = &_rtlink_fops; #endif diff --git a/examples/libc/termios_test.c b/examples/libc/termios_test.c index 855bc82b96..520fca6380 100644 --- a/examples/libc/termios_test.c +++ b/examples/libc/termios_test.c @@ -14,18 +14,6 @@ #include #include -#if defined (RT_USING_POSIX) - #include - #include - #if defined (RT_USING_POSIX_TERMIOS) - #include - #else - #error "TERMIOS need RT_USING_POSIX_TERMIOS" - #endif -#else - #error "POSIX poll/select need RT_USING_POSIX" -#endif - #define JOINT(x,y) x##y #define B(x) JOINT(B,x) #define Default_baud_rate 115200 diff --git a/examples/rt-link/rtlink_dev_example.c b/examples/rt-link/rtlink_dev_example.c index 523b67ba53..51b6432d9f 100644 --- a/examples/rt-link/rtlink_dev_example.c +++ b/examples/rt-link/rtlink_dev_example.c @@ -45,7 +45,7 @@ static rt_err_t rtlink_dev_tx_done(rt_device_t dev, void *buffer) return RT_EOK; } -#ifdef RT_USING_POSIX +#ifdef RT_USING_POSIX_DEVIO #include #include #include @@ -205,7 +205,7 @@ static void rtlink_fselect() } } MSH_CMD_EXPORT(rtlink_fselect, rtlink posix interface example); -#endif /* RT_USING_POSIX */ +#endif /* RT_USING_POSIX_DEVIO */ static void rtlink_dread(void) { diff --git a/include/rtdef.h b/include/rtdef.h index 9975f8239f..74db37555a 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -1034,7 +1034,7 @@ struct rt_device rt_err_t (*control)(rt_device_t dev, int cmd, void *args); #endif -#if defined(RT_USING_POSIX) +#ifdef RT_USING_POSIX_DEVIO const struct dfs_file_ops *fops; struct rt_wqueue wait_queue; #endif diff --git a/src/device.c b/src/device.c index 6e22c2b692..ebb8f26854 100644 --- a/src/device.c +++ b/src/device.c @@ -16,9 +16,9 @@ */ #include -#ifdef RT_USING_POSIX +#ifdef RT_USING_POSIX_DEVIO #include /* for wqueue_init */ -#endif /* RT_USING_POSIX */ +#endif /* RT_USING_POSIX_DEVIO */ #ifdef RT_USING_DEVICE @@ -64,10 +64,10 @@ rt_err_t rt_device_register(rt_device_t dev, dev->ref_count = 0; dev->open_flag = 0; -#ifdef RT_USING_POSIX +#ifdef RT_USING_POSIX_DEVIO dev->fops = RT_NULL; rt_wqueue_init(&(dev->wait_queue)); -#endif /* RT_USING_POSIX */ +#endif /* RT_USING_POSIX_DEVIO */ return RT_EOK; }