static void tsEvent_raw(void) { if (tsdev.penStatus == PEN_DOWN) { BUF_HEAD.x = x; BUF_HEAD.y = y; BUF_HEAD.pressure = PEN_DOWN; #ifdef HOOK_FOR_DRAG ts_timer.expires = jiffies + TS_TIMER_DELAY; add_timer(&ts_timer); #endif } else { #ifdef HOOK_FOR_DRAG del_timer(&ts_timer); #endif BUF_HEAD.x = 0; BUF_HEAD.y = 0; BUF_HEAD.pressure = PEN_UP; } tsdev.head = INCBUF(tsdev.head, MAX_TS_BUF); wake_up_interruptible(&(tsdev.wq)); #ifdef USE_ASYNC if (tsdev.aq) kill_fasync(&(tsdev.aq), SIGIO, POLL_IN); #endif #ifdef CONFIG_PM pm_access(tsdev.pm_dev); #endif }
static inline void kbdEvent_raw(void) { BUF_HEAD = kbddev.key; kbddev.head = INCBUF(kbddev.head, MAX_KBD_BUF); wake_up_interruptible(&(kbddev.wq)); }
static KBD_RET kbdRead(void) { KBD_RET kbd_ret; spin_lock_irq(&(kbddev.lock)); kbd_ret= BUF_TAIL; kbddev.tail = INCBUF(kbddev.tail, MAX_KBD_BUF); spin_unlock_irq(&(kbddev.lock)); return kbd_ret; }
static int tsRead(TS_RET * ts_ret) { spin_lock_irq(&(tsdev.lock)); ts_ret->x = BUF_TAIL.x; ts_ret->y = BUF_TAIL.y; ts_ret->pressure = BUF_TAIL.pressure; tsdev.tail = INCBUF(tsdev.tail, MAX_TS_BUF); spin_unlock_irq(&(tsdev.lock)); return sizeof(TS_RET); }
void ExtractToken( QString & buffer, const QString & string, int & pos, bool & isNumber ) { buffer.clear(); if ( string.isNull() || pos >= string.length() ) return; isNumber = false; QChar curr = string[ pos ]; if ( curr == '-' || curr == '+' || curr.isDigit() ) { if ( curr == '-' || curr == '+' ) INCBUF(); if ( !curr.isNull() && curr.isDigit() ) { isNumber = true; while ( curr.isDigit() ) INCBUF(); if ( curr == '.' ) { INCBUF(); while ( curr.isDigit() ) INCBUF(); } if ( !curr.isNull() && curr.toLower() == 'e' ) { INCBUF(); if ( curr == '-' || curr == '+' ) INCBUF(); if ( curr.isNull() || !curr.isDigit() ) isNumber = false; else while ( curr.isDigit() ) INCBUF(); } } } if ( !isNumber ) { while ( curr != '-' && curr != '+' && !curr.isDigit() && pos < string.length() ) INCBUF(); } }
unsigned int fattr_size(const struct nfs_fattr_set *attr) { uint64_t bitmap = attr->bitmap; unsigned int total = 0; if (bitmap & (1ULL << FATTR4_SUPPORTED_ATTRS)) { INCMAP(fattr_supported_mask); } if (bitmap & (1ULL << FATTR4_TYPE)) { INC32(attr->type); } if (bitmap & (1ULL << FATTR4_FH_EXPIRE_TYPE)) { INC32(attr->fh_expire_type); } if (bitmap & (1ULL << FATTR4_CHANGE)) { INC64(attr->change); } if (bitmap & (1ULL << FATTR4_SIZE)) { INC64(attr->size); } if (bitmap & (1ULL << FATTR4_LINK_SUPPORT)) { INC32(attr->link_support ? 1 : 0); } if (bitmap & (1ULL << FATTR4_SYMLINK_SUPPORT)) { INC32(attr->symlink_support ? 1 : 0); } if (bitmap & (1ULL << FATTR4_NAMED_ATTR)) { INC32(attr->named_attr ? 1 : 0); } if (bitmap & (1ULL << FATTR4_FSID)) { INC64(attr->fsid.major); INC64(attr->fsid.minor); } if (bitmap & (1ULL << FATTR4_UNIQUE_HANDLES)) { INC32(attr->unique_handles ? 1 : 0); } if (bitmap & (1ULL << FATTR4_LEASE_TIME)) { INC32(attr->lease_time); } if (bitmap & (1ULL << FATTR4_RDATTR_ERROR)) { INC32(attr->rdattr_error); } #if 0 /* FIXME */ if (bitmap & (1ULL << FATTR4_ACL)) { encode_acl(&attr->acl, writes, wr); } #endif if (bitmap & (1ULL << FATTR4_ACLSUPPORT)) { INC32(attr->aclsupport); } if (bitmap & (1ULL << FATTR4_ARCHIVE)) { INC32(attr->archive ? 1 : 0); } if (bitmap & (1ULL << FATTR4_CANSETTIME)) { INC32(attr->cansettime ? 1 : 0); } if (bitmap & (1ULL << FATTR4_CASE_INSENSITIVE)) { INC32(attr->case_insensitive ? 1 : 0); } if (bitmap & (1ULL << FATTR4_CASE_PRESERVING)) { INC32(attr->case_preserving ? 1 : 0); } if (bitmap & (1ULL << FATTR4_CHOWN_RESTRICTED)) { INC32(attr->chown_restricted ? 1 : 0); } if (bitmap & (1ULL << FATTR4_FILEHANDLE)) { INC32(sizeof(struct nfs_fh)); INC64(attr->filehandle); } if (bitmap & (1ULL << FATTR4_FILEID)) { INC64(attr->fileid); } if (bitmap & (1ULL << FATTR4_FILES_AVAIL)) { INC64(attr->files_avail); } if (bitmap & (1ULL << FATTR4_FILES_FREE)) { INC64(attr->files_free); } if (bitmap & (1ULL << FATTR4_FILES_TOTAL)) { INC64(attr->files_total); } if (bitmap & (1ULL << FATTR4_FS_LOCATIONS)) { INC32(1); INCSTR("/"); /* fs_root */ INC32(1); /* location len */ INC32(1); /* location[0].server len */ INCSTR(my_hostname); /* location[0].server[0] */ INC32(1); INCSTR("/"); /* location[0].rootpath */ } if (bitmap & (1ULL << FATTR4_HIDDEN)) { INC32(attr->hidden ? 1 : 0); } if (bitmap & (1ULL << FATTR4_HOMOGENEOUS)) { INC32(attr->homogeneous ? 1 : 0); } if (bitmap & (1ULL << FATTR4_MAXFILESIZE)) { INC64(attr->maxfilesize); } if (bitmap & (1ULL << FATTR4_MAXLINK)) { INC32(attr->maxlink); } if (bitmap & (1ULL << FATTR4_MAXNAME)) { INC32(attr->maxname); } if (bitmap & (1ULL << FATTR4_MAXREAD)) { INC64(attr->maxread); } if (bitmap & (1ULL << FATTR4_MAXWRITE)) { INC64(attr->maxwrite); } if ((bitmap & (1ULL << FATTR4_MIMETYPE)) && (attr->mimetype.len)) { INCBUF(&attr->mimetype); } if (bitmap & (1ULL << FATTR4_MODE)) { INC32(attr->mode); } if (bitmap & (1ULL << FATTR4_NO_TRUNC)) { INC32(attr->no_trunc ? 1 : 0); } if (bitmap & (1ULL << FATTR4_NUMLINKS)) { INC32(attr->numlinks); } if ((bitmap & (1ULL << FATTR4_OWNER)) && (attr->owner.len)) { INCBUF(&attr->owner); } if ((bitmap & (1ULL << FATTR4_OWNER_GROUP)) && (attr->owner_group.len)){ INCBUF(&attr->owner_group); } if (bitmap & (1ULL << FATTR4_QUOTA_AVAIL_HARD)) { INC64(attr->quota_avail_hard); } if (bitmap & (1ULL << FATTR4_QUOTA_AVAIL_SOFT)) { INC64(attr->quota_avail_soft); } if (bitmap & (1ULL << FATTR4_QUOTA_USED)) { INC64(attr->quota_used); } if (bitmap & (1ULL << FATTR4_RAWDEV)) { /* FIXME: correct order of these two dwords? */ INC32(attr->rawdev.specdata1); INC32(attr->rawdev.specdata2); } if (bitmap & (1ULL << FATTR4_SPACE_AVAIL)) { INC64(attr->space_avail); } if (bitmap & (1ULL << FATTR4_SPACE_FREE)) { INC64(attr->space_free); } if (bitmap & (1ULL << FATTR4_SPACE_TOTAL)) { INC64(attr->space_total); } if (bitmap & (1ULL << FATTR4_SPACE_USED)) { INC64(attr->space_used); } if (bitmap & (1ULL << FATTR4_SYSTEM)) { INC32(attr->system ? 1 : 0); } if (bitmap & (1ULL << FATTR4_TIME_ACCESS)) { INC64(attr->time_access.seconds); INC32(attr->time_access.nseconds); } if (bitmap & (1ULL << FATTR4_TIME_BACKUP)) { INC64(attr->time_backup.seconds); INC32(attr->time_backup.nseconds); } if (bitmap & (1ULL << FATTR4_TIME_CREATE)) { INC64(attr->time_create.seconds); INC32(attr->time_create.nseconds); } if (bitmap & (1ULL << FATTR4_TIME_DELTA)) { INC64(attr->time_delta.seconds); INC32(attr->time_delta.nseconds); } if (bitmap & (1ULL << FATTR4_TIME_METADATA)) { INC64(attr->time_metadata.seconds); INC32(attr->time_metadata.nseconds); } if (bitmap & (1ULL << FATTR4_TIME_MODIFY)) { INC64(attr->time_modify.seconds); INC32(attr->time_modify.nseconds); } if (bitmap & (1ULL << FATTR4_MOUNTED_ON_FILEID)) { INC64(attr->mounted_on_fileid); } return total; }