这篇教程C++ txBegin函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中txBegin函数的典型用法代码示例。如果您正苦于以下问题:C++ txBegin函数的具体用法?C++ txBegin怎么用?C++ txBegin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了txBegin函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: mainint main (){ CreateMyWindow (); // pictures_t pictures; // LoadPictures (pictures); // array_t <dyn, button_t> buttons (0); // SetButtons (buttons, pictures); // int buttonPressed = NothingPressed; // txBegin (); // while (!Exit ()) { DrawBackground (pictures); // DoOperationsWithButtons (buttons, &buttonPressed); // txSleep (1); } txEnd (); DeletePictures (pictures); _txExit = true; return 0;}
开发者ID:olegsmirnov2001,项目名称:Optics-in-MGU,代码行数:30,
示例2: Kotvoid Kot () { HDC Kot = txLoadImage ("Image//Кот.bmp"); double x = random (XWindow / 2 + 300, XWindow / 2 - 300), y = random (YWindow / 2 - 300, YWindow / 2 + 300); double a = random (-300, 300), b = random (-300, 300); while (!GetAsyncKeyState (VK_ESCAPE)) { txBegin (); txSetFillColor (TX_WHITE); txClear (); if (GetAsyncKeyState('A')) x-=2; if (GetAsyncKeyState('D')) x+=2; if (GetAsyncKeyState('W')) y-=2; if (GetAsyncKeyState('S')) y+=2; txTransparentBlt (txDC (), x, y, 92, 41, Kot, 0, 0, TX_WHITE); if (abs (x - x + a) > 35 + 10)txBitBlt (txDC (), x + a, y + b, 38, 20, Kot, 113, 10); if (x < 0) x = XWindow; if (x > XWindow) x = 0; if (y < 0) y = YWindow; if (y > YWindow) y = 0; txEnd (); } txDeleteDC (Kot); }
开发者ID:aleks311001,项目名称:graphic,代码行数:28,
示例3: jfs_acl_chmodint jfs_acl_chmod(struct inode *inode){ struct posix_acl *acl, *clone; int rc; if (S_ISLNK(inode->i_mode)) return -EOPNOTSUPP; acl = jfs_get_acl(inode, ACL_TYPE_ACCESS); if (IS_ERR(acl) || !acl) return PTR_ERR(acl); clone = posix_acl_clone(acl, GFP_KERNEL); posix_acl_release(acl); if (!clone) return -ENOMEM; rc = posix_acl_chmod_masq(clone, inode->i_mode); if (!rc) { tid_t tid = txBegin(inode->i_sb, 0); mutex_lock(&JFS_IP(inode)->commit_mutex); rc = jfs_set_acl(tid, inode, ACL_TYPE_ACCESS, clone); if (!rc) rc = txCommit(tid, 1, &inode, 0); txEnd(tid); mutex_unlock(&JFS_IP(inode)->commit_mutex); } posix_acl_release(clone); return rc;}
开发者ID:A2109devs,项目名称:lenovo_a2109a_kernel,代码行数:31,
示例4: mainint main() { txCreateWindow (sizeX, sizeY); palochka Main[ColVo]; while (!GetAsyncKeyState (VK_ESCAPE)) { txBegin (); txSetFillColor (TX_BLACK); txSetColor (TX_BLACK); txClear (); for (int i = 0; i < ColVo; i++) { all_fizics(&(Main[i])); print_palochka (Main[i]); } txEnd (); } return 0; }
开发者ID:kristevalex,项目名称:palochka_in_sirius,代码行数:25,
示例5: mainint main() { txCreateWindow (MASSSIZE * SIZEB, MASSSIZE * SIZEB); char map [MASSLAYER][MASSSIZE][MASSSIZE] = {}; int lvl = 1; int winlose = 0; int lakomka = 0; while (true) { ReadKarta(map, lvl); int layer = 0; int pos = 1; int x = SIZEB * 4 - SIZEB / 2; int y = SIZEB * 4 - SIZEB / 2; txBegin(); while (true) { int whrgo = MovingOn(map, layer, &pos, x, y, &lakomka); printf ("%d",lakomka); switch (pos) { case 1: x = SIZEB * MASSSIZE / 2; y = SIZEB * MASSSIZE - SIZEB * 1.5; break; case 2: x = 1.5 * SIZEB; y = SIZEB * MASSSIZE / 2; break; case 3: x = SIZEB * MASSSIZE / 2; y = SIZEB + SIZEB * 0.5; break; case 4: x = SIZEB * MASSSIZE - SIZEB * 1.5; y = SIZEB * MASSSIZE / 2; break; } switch (whrgo) { case 2: layer = 0; break; case 3: layer = 1; break; case 4: layer = 2; break; default: layer = 0; } if (whrgo == 0) { winlose = 0; break; } else if (whrgo == 1) { winlose = 1; break; } } txEnd(); if (winlose == 0) { txMessageBox("LOSSE", "LOSSE2"); lakomka = 0; } if (winlose == 1) {txMessageBox("WINNY", "WINNY2"); lvl++;} }}
开发者ID:Timshbnv,项目名称:pelmV,代码行数:55,
示例6: mainint main (){ int n = 0; SortingAlgorithm sortAlgArray[SORT_ALG_ARRAY_SIZE] = { SortingAlgorithm ( bubbleSort, { 12, 205, 90}, n++, Mode (0, 2)), SortingAlgorithm ( selectionSort, {205, 12, 90}, n++, Mode (0, 2)), SortingAlgorithm ( insertionSort, { 12, 90, 205}, n++, Mode (0, 2)), SortingAlgorithm (binaryInsertionSort, {112, 90, 155}, n++, Mode (0, 2)) }; Button buttonArray[BUTTON_ARRAY_SIZE] = { Button (Point ( 0, 0), 0, 0, "BubbleSort" ), Button (Point ( 0, 0), 0, 0, "SelectionSort" ), Button (Point ( 0, 0), 0, 0, "InsertionSort" ), Button (Point ( 0, 0), 0, 0, "BinaryInsertionSort"), Button (Point (130, 405), 140, 30, "Now watching:" ), Button (Point ( 4, 367), 56, 26, "Play/Stop" ) }; distributeButtons (buttonArray, BUTTON_ARRAY_SIZE, 4, Point (654, 140), Point (954, 440)); Mode mode = Mode(COMPS, 3), updateGraphic = Mode( 1, 2); _txWindowStyle &= ~WS_CAPTION; txCreateWindow (WIDTH, HEIGHT); txTextCursor (false); HDC background = txLoadImage ("sortTube.bmp"); assert (background); while (!GetAsyncKeyState (VK_ESCAPE)) { txBegin (); txBitBlt (txDC (), 0, 0, 960, 480, background); txClearConsole (); calculations (sortAlgArray, SORT_ALG_ARRAY_SIZE, buttonArray, BUTTON_ARRAY_SIZE, &mode, &updateGraphic); //rendering (sortAlgArray, SORT_ALG_ARRAY_SIZE, buttonArray, BUTTON_ARRAY_SIZE, mode); txEnd (); txSleep (1000/30); } txDeleteDC (background); return 0;}
开发者ID:Telezombievlad,项目名称:Sorting-Comparison,代码行数:52,
示例7: jfs_set_aclint jfs_set_acl(struct inode *inode, struct posix_acl *acl, int type){ int rc; tid_t tid; tid = txBegin(inode->i_sb, 0); mutex_lock(&JFS_IP(inode)->commit_mutex); rc = __jfs_set_acl(tid, inode, type, acl); if (!rc) rc = txCommit(tid, 1, &inode, 0); txEnd(tid); mutex_unlock(&JFS_IP(inode)->commit_mutex); return rc;}
开发者ID:AshishNamdev,项目名称:linux,代码行数:14,
示例8: Setkavoid Setka (double zoom, double a, double b, double PerX, double PerY) { txBegin (); txSetFillColor (TX_BLACK); txClear (); txSetColor (TX_WHITE, 3); txLine (0, b / 2, XWindow, b / 2); txLine (a / 2, 0, a / 2, YWindow); txLine (XWindow, b / 2, XWindow - 30, b / 2 - 15); txLine (XWindow, b / 2, XWindow - 30, b / 2 + 15); txLine (a / 2, 0, a / 2 + 15, 30); txLine (a / 2, 0, a / 2 - 15, 30); txEnd (); }
开发者ID:aleks311001,项目名称:graphic,代码行数:17,
示例9: mainint main (){ _txWindowStyle &= ~ WS_CAPTION; txCreateWindow (XWindow, YWindow); C_Ball ball [4500] = {}; Mass_Ball (ball, 4500); for (int i = 0;; i++) { txBegin (); if (!GetAsyncKeyState (VK_SPACE)) { txSetFillColor (TX_BLACK); txSetColor (TX_BLACK); txClear (); } Dvig_and_draw (ball, 4500); txSleep (0); txEnd (); }}
开发者ID:aleks311001,项目名称:7-class,代码行数:20,
示例10: Osnovvoid Osnov () { double Zoom = 30; COLORREF color = TX_WHITE; double perX = 0, perY = 0; Setka (Zoom, XWindow, YWindow, 0, 0); int t = 0; while (!GetAsyncKeyState (VK_ESCAPE)) { txBegin (); txClear (); //Mass_Nerav (Kn_Ner, Kn_NerN, color, Zoom, image, perX, perY); Neravenstvo (Zoom, TX_GREEN, Cheburashka, t%2, t%2, t%12, 1, 0, perX, perY); t ++; txEnd (); } }
开发者ID:aleks311001,项目名称:graphic,代码行数:20,
示例11: jfs_commit_inode/* * Workhorse of both fsync & write_inode */int jfs_commit_inode(struct inode *inode, int wait){ int rc = 0; tid_t tid; static int noisy = 5; jfs_info("In jfs_commit_inode, inode = 0x%p", inode); /* * Don't commit if inode has been committed since last being * marked dirty, or if it has been deleted. */ if (inode->i_nlink == 0 || !test_cflag(COMMIT_Dirty, inode)) return 0; if (isReadOnly(inode)) { /* kernel allows writes to devices on read-only * partitions and may think inode is dirty */ if (!special_file(inode->i_mode) && noisy) { jfs_err("jfs_commit_inode(0x%p) called on " "read-only volume", inode); jfs_err("Is remount racy?"); noisy--; } return 0; } tid = txBegin(inode->i_sb, COMMIT_INODE); mutex_lock(&JFS_IP(inode)->commit_mutex); /* * Retest inode state after taking commit_mutex */ if (inode->i_nlink && test_cflag(COMMIT_Dirty, inode)) rc = txCommit(tid, 1, &inode, wait ? COMMIT_SYNC : 0); txEnd(tid); mutex_unlock(&JFS_IP(inode)->commit_mutex); return rc;}
开发者ID:marc1706,项目名称:desire_kernel_35,代码行数:44,
示例12: jfs_truncate_nolock/* * Guts of jfs_truncate. Called with locks already held. Can be called * with directory for truncating directory index table. */void jfs_truncate_nolock(struct inode *ip, loff_t length){ loff_t newsize; tid_t tid; ASSERT(length >= 0); if (test_cflag(COMMIT_Nolink, ip)) { xtTruncate(0, ip, length, COMMIT_WMAP); return; } do { tid = txBegin(ip->i_sb, 0); /* * The commit_mutex cannot be taken before txBegin. * txBegin may block and there is a chance the inode * could be marked dirty and need to be committed * before txBegin unblocks */ mutex_lock(&JFS_IP(ip)->commit_mutex); newsize = xtTruncate(tid, ip, length, COMMIT_TRUNCATE | COMMIT_PWMAP); if (newsize < 0) { txEnd(tid); mutex_unlock(&JFS_IP(ip)->commit_mutex); break; } ip->i_mtime = ip->i_ctime = CURRENT_TIME; mark_inode_dirty(ip); txCommit(tid, 1, &ip, 0); txEnd(tid); mutex_unlock(&JFS_IP(ip)->commit_mutex); } while (newsize > length); /* Truncate isn't always atomic */}
开发者ID:marc1706,项目名称:desire_kernel_35,代码行数:43,
示例13: jfs_link/* * NAME: jfs_link(vp, dvp, name, crp) * * FUNCTION: create a link to <vp> by the name = <name> * in the parent directory <dvp> * * PARAMETER: vp - target object * dvp - parent directory of new link * name - name of new link to target object * crp - credential * * RETURN: Errors from subroutines * * note: * JFS does NOT support link() on directories (to prevent circular * path in the directory hierarchy); * EPERM: the target object is a directory, and either the caller * does not have appropriate privileges or the implementation prohibits * using link() on directories [XPG4.2]. * * JFS does NOT support links between file systems: * EXDEV: target object and new link are on different file systems and * implementation does not support links between file systems [XPG4.2]. */static int jfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry){ int rc; tid_t tid; struct inode *ip = old_dentry->d_inode; ino_t ino; struct component_name dname; struct btstack btstack; struct inode *iplist[2]; jfs_info("jfs_link: %s %s", old_dentry->d_name.name, dentry->d_name.name); if (ip->i_nlink == JFS_LINK_MAX) return -EMLINK; dquot_initialize(dir); tid = txBegin(ip->i_sb, 0); mutex_lock_nested(&JFS_IP(dir)->commit_mutex, COMMIT_MUTEX_PARENT); mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD); /* * scan parent directory for entry/freespace */ if ((rc = get_UCSname(&dname, dentry))) goto out; if ((rc = dtSearch(dir, &dname, &ino, &btstack, JFS_CREATE))) goto free_dname; /* * create entry for new link in parent directory */ ino = ip->i_ino; if ((rc = dtInsert(tid, dir, &dname, &ino, &btstack))) goto free_dname; /* update object inode */ inc_nlink(ip); /* for new link */ ip->i_ctime = CURRENT_TIME; dir->i_ctime = dir->i_mtime = CURRENT_TIME; mark_inode_dirty(dir); ihold(ip); iplist[0] = ip; iplist[1] = dir; rc = txCommit(tid, 2, &iplist[0], 0); if (rc) { ip->i_nlink--; /* never instantiated */ iput(ip); } else d_instantiate(dentry, ip);free_dname: free_UCSname(&dname);out: txEnd(tid); mutex_unlock(&JFS_IP(ip)->commit_mutex); mutex_unlock(&JFS_IP(dir)->commit_mutex); jfs_info("jfs_link: rc:%d", rc); return rc;}
开发者ID:Berrrry,项目名称:SPH-L710_NA_Kernel,代码行数:93,
示例14: jfs_create/* * NAME: jfs_create(dip, dentry, mode) * * FUNCTION: create a regular file in the parent directory <dip> * with name = <from dentry> and mode = <mode> * * PARAMETER: dip - parent directory vnode * dentry - dentry of new file * mode - create mode (rwxrwxrwx). * nd- nd struct * * RETURN: Errors from subroutines * */static int jfs_create(struct inode *dip, struct dentry *dentry, int mode, struct nameidata *nd){ int rc = 0; tid_t tid; /* transaction id */ struct inode *ip = NULL; /* child directory inode */ ino_t ino; struct component_name dname; /* child directory name */ struct btstack btstack; struct inode *iplist[2]; struct tblock *tblk; jfs_info("jfs_create: dip:0x%p name:%s", dip, dentry->d_name.name); dquot_initialize(dip); /* * search parent directory for entry/freespace * (dtSearch() returns parent directory page pinned) */ if ((rc = get_UCSname(&dname, dentry))) goto out1; /* * Either iAlloc() or txBegin() may block. Deadlock can occur if we * block there while holding dtree page, so we allocate the inode & * begin the transaction before we search the directory. */ ip = ialloc(dip, mode); if (IS_ERR(ip)) { rc = PTR_ERR(ip); goto out2; } tid = txBegin(dip->i_sb, 0); mutex_lock_nested(&JFS_IP(dip)->commit_mutex, COMMIT_MUTEX_PARENT); mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD); rc = jfs_init_acl(tid, ip, dip); if (rc) goto out3; rc = jfs_init_security(tid, ip, dip, &dentry->d_name); if (rc) { txAbort(tid, 0); goto out3; } if ((rc = dtSearch(dip, &dname, &ino, &btstack, JFS_CREATE))) { jfs_err("jfs_create: dtSearch returned %d", rc); txAbort(tid, 0); goto out3; } tblk = tid_to_tblock(tid); tblk->xflag |= COMMIT_CREATE; tblk->ino = ip->i_ino; tblk->u.ixpxd = JFS_IP(ip)->ixpxd; iplist[0] = dip; iplist[1] = ip; /* * initialize the child XAD tree root in-line in inode */ xtInitRoot(tid, ip); /* * create entry in parent directory for child directory * (dtInsert() releases parent directory page) */ ino = ip->i_ino; if ((rc = dtInsert(tid, dip, &dname, &ino, &btstack))) { if (rc == -EIO) { jfs_err("jfs_create: dtInsert returned -EIO"); txAbort(tid, 1); /* Marks Filesystem dirty */ } else txAbort(tid, 0); /* Filesystem full */ goto out3; } ip->i_op = &jfs_file_inode_operations; ip->i_fop = &jfs_file_operations; ip->i_mapping->a_ops = &jfs_aops;//.........这里部分代码省略.........
开发者ID:Berrrry,项目名称:SPH-L710_NA_Kernel,代码行数:101,
示例15: jfs_unlink/* * NAME: jfs_unlink(dip, dentry) * * FUNCTION: remove a link to object <vp> named by <name> * from parent directory <dvp> * * PARAMETER: dip - inode of parent directory * dentry - dentry of object to be removed * * RETURN: errors from subroutines * * note: * temporary file: if one or more processes have the file open * when the last link is removed, the link will be removed before * unlink() returns, but the removal of the file contents will be * postponed until all references to the files are closed. * * JFS does NOT support unlink() on directories. * */static int jfs_unlink(struct inode *dip, struct dentry *dentry){ int rc; tid_t tid; /* transaction id */ struct inode *ip = dentry->d_inode; ino_t ino; struct component_name dname; /* object name */ struct inode *iplist[2]; struct tblock *tblk; s64 new_size = 0; int commit_flag; jfs_info("jfs_unlink: dip:0x%p name:%s", dip, dentry->d_name.name); /* Init inode for quota operations. */ dquot_initialize(dip); dquot_initialize(ip); if ((rc = get_UCSname(&dname, dentry))) goto out; IWRITE_LOCK(ip, RDWRLOCK_NORMAL); tid = txBegin(dip->i_sb, 0); mutex_lock_nested(&JFS_IP(dip)->commit_mutex, COMMIT_MUTEX_PARENT); mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD); iplist[0] = dip; iplist[1] = ip; /* * delete the entry of target file from parent directory */ ino = ip->i_ino; if ((rc = dtDelete(tid, dip, &dname, &ino, JFS_REMOVE))) { jfs_err("jfs_unlink: dtDelete returned %d", rc); if (rc == -EIO) txAbort(tid, 1); /* Marks FS Dirty */ txEnd(tid); mutex_unlock(&JFS_IP(ip)->commit_mutex); mutex_unlock(&JFS_IP(dip)->commit_mutex); IWRITE_UNLOCK(ip); goto out1; } ASSERT(ip->i_nlink); ip->i_ctime = dip->i_ctime = dip->i_mtime = CURRENT_TIME; mark_inode_dirty(dip); /* update target's inode */ inode_dec_link_count(ip); /* * commit zero link count object */ if (ip->i_nlink == 0) { assert(!test_cflag(COMMIT_Nolink, ip)); /* free block resources */ if ((new_size = commitZeroLink(tid, ip)) < 0) { txAbort(tid, 1); /* Marks FS Dirty */ txEnd(tid); mutex_unlock(&JFS_IP(ip)->commit_mutex); mutex_unlock(&JFS_IP(dip)->commit_mutex); IWRITE_UNLOCK(ip); rc = new_size; goto out1; } tblk = tid_to_tblock(tid); tblk->xflag |= COMMIT_DELETE; tblk->u.ip = ip; } /* * Incomplete truncate of file data can * result in timing problems unless we synchronously commit the * transaction. */ if (new_size)//.........这里部分代码省略.........
开发者ID:Berrrry,项目名称:SPH-L710_NA_Kernel,代码行数:101,
示例16: jfs_rmdir/* * NAME: jfs_rmdir(dip, dentry) * * FUNCTION: remove a link to child directory * * PARAMETER: dip - parent inode * dentry - child directory dentry * * RETURN: -EINVAL - if name is . or .. * -EINVAL - if . or .. exist but are invalid. * errors from subroutines * * note: * if other threads have the directory open when the last link * is removed, the "." and ".." entries, if present, are removed before * rmdir() returns and no new entries may be created in the directory, * but the directory is not removed until the last reference to * the directory is released (cf.unlink() of regular file). */static int jfs_rmdir(struct inode *dip, struct dentry *dentry){ int rc; tid_t tid; /* transaction id */ struct inode *ip = dentry->d_inode; ino_t ino; struct component_name dname; struct inode *iplist[2]; struct tblock *tblk; jfs_info("jfs_rmdir: dip:0x%p name:%s", dip, dentry->d_name.name); /* Init inode for quota operations. */ dquot_initialize(dip); dquot_initialize(ip); /* directory must be empty to be removed */ if (!dtEmpty(ip)) { rc = -ENOTEMPTY; goto out; } if ((rc = get_UCSname(&dname, dentry))) { goto out; } tid = txBegin(dip->i_sb, 0); mutex_lock_nested(&JFS_IP(dip)->commit_mutex, COMMIT_MUTEX_PARENT); mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD); iplist[0] = dip; iplist[1] = ip; tblk = tid_to_tblock(tid); tblk->xflag |= COMMIT_DELETE; tblk->u.ip = ip; /* * delete the entry of target directory from parent directory */ ino = ip->i_ino; if ((rc = dtDelete(tid, dip, &dname, &ino, JFS_REMOVE))) { jfs_err("jfs_rmdir: dtDelete returned %d", rc); if (rc == -EIO) txAbort(tid, 1); txEnd(tid); mutex_unlock(&JFS_IP(ip)->commit_mutex); mutex_unlock(&JFS_IP(dip)->commit_mutex); goto out2; } /* update parent directory's link count corresponding * to ".." entry of the target directory deleted */ dip->i_ctime = dip->i_mtime = CURRENT_TIME; inode_dec_link_count(dip); /* * OS/2 could have created EA and/or ACL */ /* free EA from both persistent and working map */ if (JFS_IP(ip)->ea.flag & DXD_EXTENT) { /* free EA pages */ txEA(tid, ip, &JFS_IP(ip)->ea, NULL); } JFS_IP(ip)->ea.flag = 0; /* free ACL from both persistent and working map */ if (JFS_IP(ip)->acl.flag & DXD_EXTENT) { /* free ACL pages */ txEA(tid, ip, &JFS_IP(ip)->acl, NULL); } JFS_IP(ip)->acl.flag = 0; /* mark the target directory as deleted */ clear_nlink(ip); mark_inode_dirty(ip); rc = txCommit(tid, 2, &iplist[0], 0);//.........这里部分代码省略.........
开发者ID:Berrrry,项目名称:SPH-L710_NA_Kernel,代码行数:101,
示例17: jfs_mknod/* * NAME: jfs_mknod * * FUNCTION: Create a special file (device) */static int jfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev){ struct jfs_inode_info *jfs_ip; struct btstack btstack; struct component_name dname; ino_t ino; struct inode *ip; struct inode *iplist[2]; int rc; tid_t tid; struct tblock *tblk; if (!new_valid_dev(rdev)) return -EINVAL; jfs_info("jfs_mknod: %s", dentry->d_name.name); dquot_initialize(dir); if ((rc = get_UCSname(&dname, dentry))) goto out; ip = ialloc(dir, mode); if (IS_ERR(ip)) { rc = PTR_ERR(ip); goto out1; } jfs_ip = JFS_IP(ip); tid = txBegin(dir->i_sb, 0); mutex_lock_nested(&JFS_IP(dir)->commit_mutex, COMMIT_MUTEX_PARENT); mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD); rc = jfs_init_acl(tid, ip, dir); if (rc) goto out3; rc = jfs_init_security(tid, ip, dir, &dentry->d_name); if (rc) { txAbort(tid, 0); goto out3; } if ((rc = dtSearch(dir, &dname, &ino, &btstack, JFS_CREATE))) { txAbort(tid, 0); goto out3; } tblk = tid_to_tblock(tid); tblk->xflag |= COMMIT_CREATE; tblk->ino = ip->i_ino; tblk->u.ixpxd = JFS_IP(ip)->ixpxd; ino = ip->i_ino; if ((rc = dtInsert(tid, dir, &dname, &ino, &btstack))) { txAbort(tid, 0); goto out3; } ip->i_op = &jfs_file_inode_operations; jfs_ip->dev = new_encode_dev(rdev); init_special_inode(ip, ip->i_mode, rdev); mark_inode_dirty(ip); dir->i_ctime = dir->i_mtime = CURRENT_TIME; mark_inode_dirty(dir); iplist[0] = dir; iplist[1] = ip; rc = txCommit(tid, 2, iplist, 0);out3: txEnd(tid); mutex_unlock(&JFS_IP(ip)->commit_mutex); mutex_unlock(&JFS_IP(dir)->commit_mutex); if (rc) { free_ea_wmap(ip); ip->i_nlink = 0; unlock_new_inode(ip); iput(ip); } else { d_instantiate(dentry, ip); unlock_new_inode(ip); }out1: free_UCSname(&dname);out: jfs_info("jfs_mknod: returning %d", rc); return rc;//.........这里部分代码省略.........
开发者ID:Berrrry,项目名称:SPH-L710_NA_Kernel,代码行数:101,
示例18: MovingOnint MovingOn (/* const */char allMap [MASSLAYER][MASSSIZE][MASSSIZE], int layer, int* pos, int x, int y, int* nyamka) { HDC WallImage = txLoadImage("images/DoorMetall.bmp"); HDC DoorImage = txLoadImage("images/spinportal.bmp"); HDC FloorImage = txLoadImage("images/plitkafloor.bmp"); HDC FoodImage = txLoadImage("images/edaplitka.bmp"); HDC KnifeImage = txLoadImage("images/plasma-bulb.bmp"); int vy = 0; int vx = 0; int t = 0; int colo = TX_BLACK; HDC KNIF = KnifeImage; txBegin (); while (true) { txSetFillColor (MEOW_COLOR); txClear(); DrawKarta (0, 0, 1 * SIZEB, 1 * SIZEB, allMap, layer, FoodImage, WallImage, DoorImage, FloorImage, KNIF); if (t % 16 == 1) { if (KNIF == KnifeImage) KNIF = FloorImage; else if (KNIF == FloorImage) KNIF = KnifeImage; } MovePelByXY (&x, &y, &vx, &vy, allMap, layer); pelmen (x, y, 15, 6, 6, t % 15, t % 15); if (allMap [layer][YM][XM] == 'w') *pos = 1; else if (allMap [layer][YM][XM] == 'v') *pos = 2; else if (allMap [layer][YM][XM] == 'y') *pos = 3; else if (allMap [layer][YM][XM] == 'z') *pos = 4; if (allMap[layer][YM][XM] == NYAM) { allMap[layer][YM][XM] = SPACE; *nyamka = *nyamka += 1; } if (allMap [layer][YM][XM] == WIN) return 1; if (allMap [layer][YM][XM] == 'A') return 2; if (allMap [layer][YM][XM] == 'B') return 3; if (allMap [layer][YM][XM] == 'C') return 4; if (allMap[layer][YM][XM] == KNIFE) if (KNIF == KnifeImage) return 0; t++; txSleep (30); } txEnd(); txDeleteDC (WallImage); txDeleteDC (DoorImage); txDeleteDC (FloorImage); txDeleteDC (FoodImage); txDeleteDC (KnifeImage); }
开发者ID:Timshbnv,项目名称:pelmV,代码行数:73,
示例19: jfs_link/* * NAME: jfs_link(vp, dvp, name, crp) * * FUNCTION: create a link to <vp> by the name = <name> * in the parent directory <dvp> * * PARAMETER: vp - target object * dvp - parent directory of new link * name - name of new link to target object * crp - credential * * RETURN: Errors from subroutines * * note: * JFS does NOT support link() on directories (to prevent circular * path in the directory hierarchy); * EPERM: the target object is a directory, and either the caller * does not have appropriate privileges or the implementation prohibits * using link() on directories [XPG4.2]. * * JFS does NOT support links between file systems: * EXDEV: target object and new link are on different file systems and * implementation does not support links between file systems [XPG4.2]. */int jfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry){ int rc; tid_t tid; struct inode *ip = old_dentry->d_inode; ino_t ino; struct component_name dname; struct btstack btstack; struct inode *iplist[2]; jFYI(1, ("jfs_link: %s %s/n", old_dentry->d_name.name, dentry->d_name.name)); /* JFS does NOT support link() on directories */ if (S_ISDIR(ip->i_mode)) return -EPERM; tid = txBegin(ip->i_sb, 0); down(&JFS_IP(dir)->commit_sem); down(&JFS_IP(ip)->commit_sem); if (ip->i_nlink == JFS_LINK_MAX) { rc = EMLINK; goto out; } /* * scan parent directory for entry/freespace */ if ((rc = get_UCSname(&dname, dentry, JFS_SBI(ip->i_sb)->nls_tab))) goto out; if ((rc = dtSearch(dir, &dname, &ino, &btstack, JFS_CREATE))) goto out; /* * create entry for new link in parent directory */ ino = ip->i_ino; if ((rc = dtInsert(tid, dir, &dname, &ino, &btstack))) goto out; /* update object inode */ ip->i_nlink++; /* for new link */ ip->i_ctime = CURRENT_TIME; mark_inode_dirty(dir); atomic_inc(&ip->i_count); d_instantiate(dentry, ip); iplist[0] = ip; iplist[1] = dir; rc = txCommit(tid, 2, &iplist[0], 0); out: txEnd(tid); up(&JFS_IP(dir)->commit_sem); up(&JFS_IP(ip)->commit_sem); jFYI(1, ("jfs_link: rc:%d/n", rc)); return -rc;}
开发者ID:muromec,项目名称:linux-ezxdev,代码行数:89,
示例20: fizicvoid fizic () { int i = 0, k = 0; CBall Mol [3200] = {}; CBall Mol2 [3200] = {}; txTextCursor (false); double time = 0; int davlenK = 0, davlenK_s = 0; int davlenN = 0, davlenN_s = 0; int K = 0, N = 0; int t = 0; double X_Sten = XWindow / 2, X_Sten_S = XWindow / 2; double temper = 0; double temper_s = 0; int Zoom = 0; int interv = 0; int l1 = 0, l2 = 0; Dlya_Graf (); HDC Molekula = txLoadImage ("Image//Молекула гелия.bmp"); HDC Molekula2 = txLoadImage ("Image//Молекула 3.bmp"); Mass1 (Mol , N); Mass2 (Mol2, K); text ("Для помощи нажмите I", XWindow / 2 + 30, YWindow - 40, TX_GREEN, 30, 8); while (!GetAsyncKeyState (VK_ESCAPE)) { txBegin (); kolba (); //txSetColor (TX_WHITE); //Clear (XWindow - 510, YWindow - 90, XWindow - 120, YWindow - 10); txSetColor (RGB(0, 0, 255), 7); txLine (X_Sten, 250, X_Sten, YWindow); if (GetAsyncKeyState (VK_RIGHT)) X_Sten ++; if (GetAsyncKeyState (VK_LEFT)) X_Sten --; else if (X_Sten < 200 && i + k > 150) X_Sten += 0.25; if (X_Sten > XWindow / 2) X_Sten = XWindow / 2; if (X_Sten < 125) X_Sten = 125; Ottalkiv (i, Mol, &temper); Ottalkiv (k, Mol2, &temper); for (K = 0; K < k; K++) { Molek (&Mol2 [K], X_Sten); kart (&Mol2 [K], Molekula2); if (Mol2[K].y - Mol2[K].rad == 250)davlenK += 2; temper += temp (Mol2 [K].vx, Mol2 [K].vy); //if (GetAsyncKeyState ('G')) Mol2 [K].vy -= 0.05; } for (N = 0; N < i; N++) { Molek (&Mol [N], X_Sten); kart (&Mol [N], Molekula); if (Mol[N].y - Mol[N].rad == 250) davlenN ++; temper += temp (Mol [N].vx, Mol [N].vy); //if (GetAsyncKeyState ('G')) Mol [N].vy -= 0.05; } if (t > 75) { Manometr (davlenK, XWindow / 2 - 150, 110, TX_WHITE, "Давление оранжевых:"); Manometr (davlenN, XWindow / 2 - 350, 110, TX_WHITE, "Давление зеленых:"); Grafik (X_Sten_S + XWindow / 2 - 100/*XWindow / 2 + time + 2*/, temper_s / 5, X_Sten + XWindow / 2 - 100/*XWindow / 2 + time + 2 + 0.05 * 75*/, temper / 5); t = 0; davlenK_s = davlenK; davlenN_s = davlenN; temper_s = temper; X_Sten_S = X_Sten; davlenK = 0; davlenN = 0; } if (temper > 70000) { while (Zoom < 2500) { vzriv (Zoom, X_Sten / 2, YWindow / 2); Zoom += 10; txSleep (0); } text ("Максимальная температура превышена :(", XWindow / 2 - 500, YWindow / 2, RGB(0, 255, 0), 50, 25); //txMessageBox ("Вы взорвались!", ":( :(", 2); /*if (txMessageBox ("Вы взорвались!", ":( :(", 2) == IDABORT) _txExit = true;*/ break; //if (txMessageBox ("Вы взорвались!", ":( :(", 2) == IDABORT) } Manometr (i + k, 150, 110, TX_WHITE, "Количество:"); if (temper > 50000)//.........这里部分代码省略.........
开发者ID:aleks311001,项目名称:Physics,代码行数:101,
示例21: jfs_mkdir/* * NAME: jfs_mkdir(dip, dentry, mode) * * FUNCTION: create a child directory in the parent directory <dip> * with name = <from dentry> and mode = <mode> * * PARAMETER: dip - parent directory vnode * dentry - dentry of child directory * mode - create mode (rwxrwxrwx). * * RETURN: Errors from subroutines * * note: * EACCESS: user needs search+write permission on the parent directory */static int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode){ int rc = 0; tid_t tid; /* transaction id */ struct inode *ip = NULL; /* child directory inode */ ino_t ino; struct component_name dname; /* child directory name */ struct btstack btstack; struct inode *iplist[2]; struct tblock *tblk; jfs_info("jfs_mkdir: dip:0x%p name:%s", dip, dentry->d_name.name); /* link count overflow on parent directory ? */ if (dip->i_nlink == JFS_LINK_MAX) { rc = -EMLINK; goto out1; } /* * search parent directory for entry/freespace * (dtSearch() returns parent directory page pinned) */ if ((rc = get_UCSname(&dname, dentry))) goto out1; /* * Either iAlloc() or txBegin() may block. Deadlock can occur if we * block there while holding dtree page, so we allocate the inode & * begin the transaction before we search the directory. */ ip = ialloc(dip, S_IFDIR | mode); if (ip == NULL) { rc = -ENOSPC; goto out2; } tid = txBegin(dip->i_sb, 0); mutex_lock(&JFS_IP(dip)->commit_mutex); mutex_lock(&JFS_IP(ip)->commit_mutex); rc = jfs_init_acl(tid, ip, dip); if (rc) goto out3; rc = jfs_init_security(tid, ip, dip); if (rc) { txAbort(tid, 0); goto out3; } if ((rc = dtSearch(dip, &dname, &ino, &btstack, JFS_CREATE))) { jfs_err("jfs_mkdir: dtSearch returned %d", rc); txAbort(tid, 0); goto out3; } tblk = tid_to_tblock(tid); tblk->xflag |= COMMIT_CREATE; tblk->ino = ip->i_ino; tblk->u.ixpxd = JFS_IP(ip)->ixpxd; iplist[0] = dip; iplist[1] = ip; /* * initialize the child directory in-line in inode */ dtInitRoot(tid, ip, dip->i_ino); /* * create entry in parent directory for child directory * (dtInsert() releases parent directory page) */ ino = ip->i_ino; if ((rc = dtInsert(tid, dip, &dname, &ino, &btstack))) { if (rc == -EIO) { jfs_err("jfs_mkdir: dtInsert returned -EIO"); txAbort(tid, 1); /* Marks Filesystem dirty */ } else txAbort(tid, 0); /* Filesystem full */ goto out3; }//.........这里部分代码省略.........
开发者ID:FatSunHYS,项目名称:OSCourseDesign,代码行数:101,
示例22: jfs_symlinkstatic int jfs_symlink(struct inode *dip, struct dentry *dentry, const char *name){ int rc; tid_t tid; ino_t ino = 0; struct component_name dname; int ssize; /* source pathname size */ struct btstack btstack; struct inode *ip = dentry->d_inode; unchar *i_fastsymlink; s64 xlen = 0; int bmask = 0, xsize; s64 extent = 0, xaddr; struct metapage *mp; struct super_block *sb; struct tblock *tblk; struct inode *iplist[2]; jfs_info("jfs_symlink: dip:0x%p name:%s", dip, name); dquot_initialize(dip); ssize = strlen(name) + 1; /* * search parent directory for entry/freespace * (dtSearch() returns parent directory page pinned) */ if ((rc = get_UCSname(&dname, dentry))) goto out1; /* * allocate on-disk/in-memory inode for symbolic link: * (iAlloc() returns new, locked inode) */ ip = ialloc(dip, S_IFLNK | 0777); if (IS_ERR(ip)) { rc = PTR_ERR(ip); goto out2; } tid = txBegin(dip->i_sb, 0); mutex_lock_nested(&JFS_IP(dip)->commit_mutex, COMMIT_MUTEX_PARENT); mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD); rc = jfs_init_security(tid, ip, dip, &dentry->d_name); if (rc) goto out3; tblk = tid_to_tblock(tid); tblk->xflag |= COMMIT_CREATE; tblk->ino = ip->i_ino; tblk->u.ixpxd = JFS_IP(ip)->ixpxd; /* fix symlink access permission * (dir_create() ANDs in the u.u_cmask, * but symlinks really need to be 777 access) */ ip->i_mode |= 0777; /* * write symbolic link target path name */ xtInitRoot(tid, ip); /* * write source path name inline in on-disk inode (fast symbolic link) */ if (ssize <= IDATASIZE) { ip->i_op = &jfs_fast_symlink_inode_operations; i_fastsymlink = JFS_IP(ip)->i_inline; memcpy(i_fastsymlink, name, ssize); ip->i_size = ssize - 1; /* * if symlink is > 128 bytes, we don't have the space to * store inline extended attributes */ if (ssize > sizeof (JFS_IP(ip)->i_inline)) JFS_IP(ip)->mode2 &= ~INLINEEA; jfs_info("jfs_symlink: fast symlink added ssize:%d name:%s ", ssize, name); } /* * write source path name in a single extent */ else { jfs_info("jfs_symlink: allocate extent ip:0x%p", ip); ip->i_op = &jfs_symlink_inode_operations; ip->i_mapping->a_ops = &jfs_aops; /*//.........这里部分代码省略.........
开发者ID:Berrrry,项目名称:SPH-L710_NA_Kernel,代码行数:101,
示例23: jfs_symlinkint jfs_symlink(struct inode *dip, struct dentry *dentry, const char *name){ int rc; tid_t tid; ino_t ino = 0; struct component_name dname; int ssize; /* source pathname size */ struct btstack btstack; struct inode *ip = dentry->d_inode; unchar *i_fastsymlink; s64 xlen = 0; int bmask = 0, xsize; s64 xaddr; struct metapage *mp; struct super_block *sb; struct tblock *tblk; struct inode *iplist[2]; jFYI(1, ("jfs_symlink: dip:0x%p name:%s/n", dip, name)); ssize = strlen(name) + 1; /* * search parent directory for entry/freespace * (dtSearch() returns parent directory page pinned) */ if ((rc = get_UCSname(&dname, dentry, JFS_SBI(dip->i_sb)->nls_tab))) goto out1; /* * allocate on-disk/in-memory inode for symbolic link: * (iAlloc() returns new, locked inode) */ ip = ialloc(dip, S_IFLNK | 0777); if (ip == NULL) { rc = ENOSPC; goto out2; } tid = txBegin(dip->i_sb, 0); down(&JFS_IP(dip)->commit_sem); down(&JFS_IP(ip)->commit_sem); if ((rc = dtSearch(dip, &dname, &ino, &btstack, JFS_CREATE))) goto out3; tblk = tid_to_tblock(tid); tblk->xflag |= COMMIT_CREATE; tblk->ip = ip; /* * create entry for symbolic link in parent directory */ ino = ip->i_ino; if ((rc = dtInsert(tid, dip, &dname, &ino, &btstack))) { jERROR(1, ("jfs_symlink: dtInsert returned %d/n", rc)); /* discard ne inode */ goto out3; } /* fix symlink access permission * (dir_create() ANDs in the u.u_cmask, * but symlinks really need to be 777 access) */ ip->i_mode |= 0777; /* * write symbolic link target path name */ xtInitRoot(tid, ip); /* * write source path name inline in on-disk inode (fast symbolic link) */ if (ssize <= IDATASIZE) { ip->i_op = &jfs_symlink_inode_operations; i_fastsymlink = JFS_IP(ip)->i_inline; memcpy(i_fastsymlink, name, ssize); ip->i_size = ssize - 1; /* * if symlink is > 128 bytes, we don't have the space to * store inline extended attributes */ if (ssize > sizeof (JFS_IP(ip)->i_inline)) JFS_IP(ip)->mode2 &= ~INLINEEA; jFYI(1, ("jfs_symlink: fast symlink added ssize:%d name:%s /n", ssize, name));//.........这里部分代码省略.........
开发者ID:muromec,项目名称:linux-ezxdev,代码行数:101,
示例24: jfs_rename/* * NAME: jfs_rename * * FUNCTION: rename a file or directory */static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry){ struct btstack btstack; ino_t ino; struct component_name new_dname; struct inode *new_ip; struct component_name old_dname; struct inode *old_ip; int rc; tid_t tid; struct tlock *tlck; struct dt_lock *dtlck; struct lv *lv; int ipcount; struct inode *iplist[4]; struct tblock *tblk; s64 new_size = 0; int commit_flag; jfs_info("jfs_rename: %s %s", old_dentry->d_name.name, new_dentry->d_name.name); dquot_initialize(old_dir); dquot_initialize(new_dir); old_ip = old_dentry->d_inode; new_ip = new_dentry->d_inode; if ((rc = get_UCSname(&old_dname, old_dentry))) goto out1; if ((rc = get_UCSname(&new_dname, new_dentry))) goto out2; /* * Make sure source inode number is what we think it is */ rc = dtSearch(old_dir, &old_dname, &ino, &btstack, JFS_LOOKUP); if (rc || (ino != old_ip->i_ino)) { rc = -ENOENT; goto out3; } /* * Make sure dest inode number (if any) is what we think it is */ rc = dtSearch(new_dir, &new_dname, &ino, &btstack, JFS_LOOKUP); if (!rc) { if ((!new_ip) || (ino != new_ip->i_ino)) { rc = -ESTALE; goto out3; } } else if (rc != -ENOENT) goto out3; else if (new_ip) { /* no entry exists, but one was expected */ rc = -ESTALE; goto out3; } if (S_ISDIR(old_ip->i_mode)) { if (new_ip) { if (!dtEmpty(new_ip)) { rc = -ENOTEMPTY; goto out3; } } else if ((new_dir != old_dir) && (new_dir->i_nlink == JFS_LINK_MAX)) { rc = -EMLINK; goto out3; } } else if (new_ip) { IWRITE_LOCK(new_ip, RDWRLOCK_NORMAL); /* Init inode for quota operations. */ dquot_initialize(new_ip); } /* * The real work starts here */ tid = txBegin(new_dir->i_sb, 0); /* * How do we know the locking is safe from deadlocks? * The vfs does the hard part for us. Any time we are taking nested * commit_mutexes, the vfs already has i_mutex held on the parent. * Here, the vfs has already taken i_mutex on both old_dir and new_dir. */ mutex_lock_nested(&JFS_IP(new_dir)->commit_mutex, COMMIT_MUTEX_PARENT); mutex_lock_nested(&JFS_IP(old_ip)->commit_mutex, COMMIT_MUTEX_CHILD); if (old_dir != new_dir) mutex_lock_nested(&JFS_IP(old_dir)->commit_mutex, COMMIT_MUTEX_SECOND_PARENT);//.........这里部分代码省略.........
开发者ID:Berrrry,项目名称:SPH-L710_NA_Kernel,代码行数:101,
示例25: DvigChel_1int DvigChel_1 (int x, int y){ int time_end = clock(); Point_t loc = {x, y}; Score_t score = {0}; Chel_t chel = {&loc, SPEED}; Reaction_t react = {&loc, &score}; PointEN_t locEN = {291, 195, 5, 5}; PointEN_t locEN2 = {500, 500, 1, 1}; PointEN_t locEN3 = {400, 550, 4, 4}; int time = 0; int counter = -2; int counteren = 0; DrawLevel(); HDC Cover = txLoadImage ("Resourses//Images//Cover.bmp"); txPlaySound ("Resourses//Music//track_1.wav", SND_ASYNC); DrawArbuz (386, 59); DrawArbuz (449, 269); DrawArbuz (95, 402); DrawArbuz (345, 449); DrawArbuz (723, 491); DrawArbuz (703, 294); while (1) { txBegin(); DrawTimeTable(); Interface (&score, &time, &time_end); DrawWalls_1(); Bonus (&score); txSetColor (TX_YELLOW); txSetFillColor (TX_YELLOW); txRectangle (locEN.x - 13, locEN.y - 13, locEN.x + 13, locEN.y + 13); MoveEnemy (&locEN); counteren++; if (counteren % 12 < 5) DrawEnemy_1 (&locEN); else if (counteren % 12 < 9) DrawEnemy_2 (&locEN); else DrawEnemy_3 (&locEN); if ((loc.x < locEN.x + 14) && (loc.x > locEN.x - 12) && (loc.y < locEN.y + 13) && (loc.y > locEN.y - 12)) return 0; txSetColor (TX_YELLOW); txSetFillColor (TX_YELLOW); txRectangle (locEN2.x - 13, locEN2.y - 13, locEN2.x + 13, locEN2.y + 13); MoveEnemy (&locEN2); counteren++; if (counteren % 12 < 5) DrawEnemy_1 (&locEN2); else if (counteren % 12 < 9) DrawEnemy_2 (&locEN2); else DrawEnemy_3 (&locEN2); if ((loc.x < locEN2.x + 14) && (loc.x > locEN2.x - 12) && (loc.y < locEN2.y + 13) && (loc.y > locEN2.y - 12)) return 0; txSetColor (TX_YELLOW); txSetFillColor (TX_YELLOW); txRectangle (locEN3.x - 13, locEN3.y - 13, locEN3.x + 13, locEN3.y + 13); MoveEnemy (&locEN3); counteren++; if (counteren % 12 < 5) DrawEnemy_1 (&locEN3); else//.........这里部分代码省略.........
开发者ID:alexeyqu,项目名称:int-alexeyqu,代码行数:101,
注:本文中的txBegin函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ txCommit函数代码示例 C++ tx函数代码示例 |