Changeset 1159

Show
Ignore:
Timestamp:
11/18/06 12:38:24 (6 years ago)
Author:
wbx
Message:

cleanup, use gcc builtin defines to recognize host os

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/freewrt/tools/afdisk/Makefile

    r1157 r1159  
    44# material, please see the LICENCE file in the top-level directory 
    55# or at http://www.freewrt.org/licence for details. 
     6 
     7PKG_NAME:=              afdisk 
     8PKG_VERSION:=           0.0.1 
     9PKG_RELEASE:=           1 
    610 
    711include $(TOPDIR)/rules.mk 
  • trunk/freewrt/tools/afdisk/detect.c

    r1146 r1159  
    2929extern struct hdlist *detect(int *count) { 
    3030        /* Possible devices. Currently tests for 8 ide and 4 scsi disks */ 
    31 #ifdef LINUX 
     31#if defined(__linux__) 
    3232        char *pdevs[2][2] = { {"hd","abcdefgh"},{"sd","abcd"} }; 
    3333#endif 
    34 #ifdef FREEBSD 
     34#if defined(__FreeBSD__) 
    3535        char *pdevs[2][2] = { {"ad","01234567"},{"da","0123"} }; 
     36#endif 
     37#if defined(__OpenBSD__) 
     38        char *pdevs[2][2] = { {"wd","01234567"},{"sd","0123"} }; 
    3639#endif 
    3740        char *device; 
  • trunk/freewrt/tools/afdisk/partx86.c

    r1146 r1159  
    2828 
    2929/* Linux only */ 
    30 #ifdef LINUX 
     30#if defined(__linux__) 
    3131#include <linux/unistd.h> 
    3232#include <linux/fs.h> 
     
    3434#endif 
    3535 
    36 /*FreeBSD only*/ 
    37 #ifdef FREEBSD 
     36/*FreeBSD/OpenBSD only*/ 
     37#if defined(__FreeBSD__) || defined(__OpenBSD__) 
    3838#include <sys/disklabel.h> 
    3939#endif 
     
    6868 
    6969/* Linux-specific, because lseek uses long as argument which is not sufficient for modern hds */ 
    70 #ifdef LINUX 
     70#if defined(__linux__)  
    7171static 
    7272_syscall5(int,  _llseek,  uint,  fd, ulong, hi, ulong, lo, 
     
    8181#endif 
    8282 
    83 #ifdef FREEBSD 
     83#if defined(__FreeBSD__) || defined(__OpenBSD__)  
    8484static int longseek(int fd, long long seek) { 
    8585        return lseek(fd, seek, SEEK_SET); 
     
    8888 
    8989/* Functions using Linux-specific ioctls */ 
    90 #ifdef LINUX 
     90#if defined(__linux__) 
    9191static long get_size(fd) { 
    9292        long s; 
     
    111111 
    112112/* The same functions with FreeBSD's ioctls */ 
    113 #ifdef FREEBSD 
     113#if defined(__FreeBSD__) || defined(__OpenBSD__)  
    114114static long get_size(fd) { 
    115115        struct disklabel l;