本文整理汇总了C++中IBLOCK函数的典型用法代码示例。如果您正苦于以下问题:C++ IBLOCK函数的具体用法?C++ IBLOCK怎么用?C++ IBLOCK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IBLOCK函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ilock
// Lock the given inode.
void
ilock(struct inode *ip)
{
struct buf *bp;
struct dinode *dip;
if(ip == 0 || ip->ref < 1)
panic("ilock");
acquire(&icache.lock);
while(ip->flags & I_BUSY)
sleep(ip, &icache.lock);
ip->flags |= I_BUSY;
release(&icache.lock);
if(!(ip->flags & I_VALID)){
bp = bread(ip->dev, IBLOCK(ip->inum));
dip = (struct dinode*)bp->data + ip->inum%IPB;
ip->type = dip->type;
ip->major = dip->major;
ip->minor = dip->minor;
ip->nlink = dip->nlink;
ip->size = dip->size;
memmove(ip->addrs, dip->addrs, sizeof(ip->addrs));
brelse(bp);
ip->flags |= I_VALID;
if(ip->type == 0)
panic("ilock: no type");
}
}
开发者ID:guneetsinghmehta,项目名称:CS537_OS,代码行数:31,代码来源:fs.c
示例2: ilock
// Lock the given inode.
// Reads the inode from disk if necessary.
void ilock(struct inode* ip)
{
struct buf* bp;
struct dinode* dip;
// cprintf("ilock \n");
if (ip == 0 || ip->ref < 1)
panic("ilock");
acquire(&icache.lock);
while (ip->flags & I_BUSY)
sleep(ip, &icache.lock);
ip->flags |= I_BUSY;
release(&icache.lock);
if (!(ip->flags & I_VALID)) {
struct superblock sb;
sb = sbs[ip->part->number];
// cprintf("inode inum %d , part Number %d \n",ip->inum,ip->part->number);
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
dip = (struct dinode*)bp->data + ip->inum % IPB;
ip->type = dip->type;
ip->major = dip->major;
ip->minor = dip->minor;
ip->nlink = dip->nlink;
ip->size = dip->size;
memmove(ip->addrs, dip->addrs, sizeof(ip->addrs));
brelse(bp);
ip->flags |= I_VALID;
if (ip->type == 0)
panic("ilock: no type");
}
}
开发者ID:asafbennatan,项目名称:xv6-public,代码行数:35,代码来源:fs.c
示例3: ialloc
//PAGEBREAK!
// Allocate a new inode with the given type on device dev.
// A free inode has a type of zero.
struct inode*
ialloc(uint dev, short type)
{
int inum;
struct buf *bp;
struct dinode *dip;
struct superblock sb;
readsb(dev, &sb);
for(inum = 1; inum < sb.ninodes; inum++){
bp = bread(dev, IBLOCK(inum));
dip = (struct dinode*)bp->data + inum%IPB;
if(dip->type == 0){ // a free inode
memset(dip, 0, sizeof(*dip));
dip->type = type;
log_write(bp); // mark it allocated on the disk
brelse(bp);
return iget(dev, inum);
}
brelse(bp);
}
panic("ialloc: no inodes");
return 0;
}
开发者ID:Lulkafe,项目名称:xv6_rpi_port,代码行数:28,代码来源:fs.c
示例4: sfs_ilock
// Lock the given inode.
// Reads the inode from disk if necessary.
static void
sfs_ilock(struct inode *ip)
{
struct sfs_inode *sin = vop_info(ip, sfs_inode);
struct buf *bp;
struct sfs_dinode *dip;
if(sin == 0 || sin->ref < 1)
panic("ilock");
acquire(&icache.lock);
while(sin->flags & I_BUSY)
sleep(ip, &icache.lock);
sin->flags |= I_BUSY;
release(&icache.lock);
if(!(sin->flags & I_VALID)){
// cprintf("dev=%d, inum=%d\n", sin->dev, sin->inum);
bp = bread(sin->dev, IBLOCK(sin->inum));
dip = (struct sfs_dinode*)bp->data + sin->inum%IPB;
sin->type = dip->type;
sin->major = dip->major;
sin->minor = dip->minor;
sin->nlink = dip->nlink;
sin->size = dip->size;
memmove(sin->addrs, dip->addrs, sizeof(sin->addrs));
brelse(bp);
sin->flags |= I_VALID;
if(sin->type == 0)
panic("ilock: no type");
}
}
开发者ID:wzc11,项目名称:xv6_fs,代码行数:34,代码来源:sfs_inode.c
示例5: rinode
void
rinode(uint inum, struct dinode *ip)
{
char buf[BSIZE];
uint bn;
struct dinode *dip;
bn = IBLOCK(inum, sb);
rsect(bn, buf);
dip = ((struct dinode*)buf) + (inum % IPB);
*ip = *dip;
}
开发者ID:Dsdubov,项目名称:xv6,代码行数:12,代码来源:mkfs.c
示例6: winode
void
winode(uint inum, struct dinode *ip)
{
char buf[BSIZE];
uint bn;
struct dinode *dip;
bn = IBLOCK(inum);
printf("winode %d\n", bn);
rsect(bn, buf);
dip = ((struct dinode*)buf) + (inum % IPB);
*dip = *ip;
wsect(bn, buf);
}
开发者ID:kazunobu-fujii,项目名称:xv6,代码行数:14,代码来源:mkfs.c
示例7: log_iupdate
void
log_iupdate(struct inode *ip)
{
struct dinode *dip;
bp[b_index] = bread(ip->dev, IBLOCK(ip->inum));
dip = (struct dinode*)bp[b_index]->data + ip->inum%IPB;
dip->type = ip->type;
dip->major = ip->major;
dip->minor = ip->minor;
dip->nlink = ip->nlink;
dip->size = ip->size;
memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
b_index++;
}
开发者ID:fenster,项目名称:xv6-staus-treffert,代码行数:14,代码来源:logfs.c
示例8: sfs_iupdate
// Copy a modified in-memory inode to disk.
void
sfs_iupdate(struct inode *ip)
{
struct sfs_inode *sin = vop_info(ip, sfs_inode);
struct buf *bp;
struct sfs_dinode *dip;
bp = bread(sin->dev, IBLOCK(sin->inum));
dip = (struct sfs_dinode*)bp->data + sin->inum%IPB;
dip->type = sin->type;
dip->major = sin->major;
dip->minor = sin->minor;
dip->nlink = sin->nlink;
dip->size = sin->size;
memmove(dip->addrs, sin->addrs, sizeof(sin->addrs));
log_write(bp);
brelse(bp);
}
开发者ID:wzc11,项目名称:xv6_fs,代码行数:19,代码来源:sfs_inode.c
示例9: iupdate
// Copy a modified in-memory inode to disk.
void
iupdate(struct inode *ip)
{
struct buf *bp;
struct dinode *dip;
bp = bread(ip->dev, IBLOCK(ip->inum));
dip = (struct dinode*)bp->data + ip->inum%IPB;
dip->type = ip->type;
dip->major = ip->major;
dip->minor = ip->minor;
dip->nlink = ip->nlink;
dip->size = ip->size;
// cprintf("iupdate - password in memory: %s\n",ip->password);
dip->passwordSet = ip->passwordSet;
memmove(dip->password, ip->password, 10);
memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
log_write(bp);
brelse(bp);
}
开发者ID:eldardamari,项目名称:operatingSystems,代码行数:21,代码来源:fs.c
示例10: iupdate
// Copy a modified in-memory inode to disk.
void iupdate(struct inode* ip)
{
// cprintf("iupdate \n");
struct buf* bp;
struct dinode* dip;
struct superblock sb;
sb = sbs[ip->part->number];
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
dip = (struct dinode*)bp->data + ip->inum % IPB;
dip->type = ip->type;
dip->major = ip->major;
dip->minor = ip->minor;
dip->nlink = ip->nlink;
dip->size = ip->size;
memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
log_write(bp, ip->part->number);
brelse(bp);
}
开发者ID:asafbennatan,项目名称:xv6-public,代码行数:22,代码来源:fs.c
示例11: iupdate
// Copy a modified in-memory inode to disk.
void
iupdate(struct inode *ip)
{
struct buf *bp;
struct dinode *dip;
bp = bread(ip->dev, IBLOCK(ip->inum));
dip = (struct dinode*)bp->data + ip->inum%IPB;
dip->type = ip->type;
dip->major = ip->major;
dip->minor = ip->minor;
dip->nlink = ip->nlink;
dip->size = ip->size;
memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
/*vvv TASK 1.1 vvv*/
dip->indirect2 = ip->indirect2;
/*^^^^^^^^^^^^^^^^^^*/
/*vvv TASK 2 vvv*/
memmove(dip->password, ip->password, sizeof(ip->password));
/*^^^^^^^^^^^^^^^^^^*/
log_write(bp);
brelse(bp);
}
开发者ID:bitc,项目名称:3,代码行数:24,代码来源:fs.c
示例12: ialloc
// PAGEBREAK!
// Allocate a new inode with the given type on device dev.
// A free inode has a type of zero.
struct inode* ialloc(uint dev, short type, int partitionNumber)
{
// cprintf("ialloc \n");
int inum;
struct buf* bp;
struct dinode* dip;
struct superblock sb;
sb = sbs[partitionNumber];
// cprintf("ialloc pnumber %d , numberofnods %d \n", partitionNumber, sb.ninodes);
for (inum = 1; inum < sb.ninodes; inum++) {
// cprintf("checking inode %d \n", inum);
bp = bread(dev, IBLOCK(inum, sb));
dip = (struct dinode*)bp->data + inum % IPB;
if (dip->type == 0) { // a free inode
memset(dip, 0, sizeof(*dip));
dip->type = type;
log_write(bp, partitionNumber); // mark it allocated on the disk
brelse(bp);
return iget(dev, inum, partitionNumber);
}
brelse(bp);
}
panic("ialloc: no inodes");
}
开发者ID:asafbennatan,项目名称:xv6-public,代码行数:27,代码来源:fs.c
示例13: MAXITS
/* Subroutine */ int sstein_(integer *n, real *d, real *e, integer *m, real *
w, integer *iblock, integer *isplit, real *z, integer *ldz, real *
work, integer *iwork, integer *ifail, integer *info)
{
/* -- LAPACK routine (version 2.0) --
Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
Courant Institute, Argonne National Lab, and Rice University
September 30, 1994
Purpose
=======
SSTEIN computes the eigenvectors of a real symmetric tridiagonal
matrix T corresponding to specified eigenvalues, using inverse
iteration.
The maximum number of iterations allowed for each eigenvector is
specified by an internal parameter MAXITS (currently set to 5).
Arguments
=========
N (input) INTEGER
The order of the matrix. N >= 0.
D (input) REAL array, dimension (N)
The n diagonal elements of the tridiagonal matrix T.
E (input) REAL array, dimension (N)
The (n-1) subdiagonal elements of the tridiagonal matrix
T, in elements 1 to N-1. E(N) need not be set.
M (input) INTEGER
The number of eigenvectors to be found. 0 <= M <= N.
W (input) REAL array, dimension (N)
The first M elements of W contain the eigenvalues for
which eigenvectors are to be computed. The eigenvalues
should be grouped by split-off block and ordered from
smallest to largest within the block. ( The output array
W from SSTEBZ with ORDER = 'B' is expected here. )
IBLOCK (input) INTEGER array, dimension (N)
The submatrix indices associated with the corresponding
eigenvalues in W; IBLOCK(i)=1 if eigenvalue W(i) belongs to
the first submatrix from the top, =2 if W(i) belongs to
the second submatrix, etc. ( The output array IBLOCK
from SSTEBZ is expected here. )
ISPLIT (input) INTEGER array, dimension (N)
The splitting points, at which T breaks up into submatrices.
The first submatrix consists of rows/columns 1 to
ISPLIT( 1 ), the second of rows/columns ISPLIT( 1 )+1
through ISPLIT( 2 ), etc.
( The output array ISPLIT from SSTEBZ is expected here. )
Z (output) REAL array, dimension (LDZ, M)
The computed eigenvectors. The eigenvector associated
with the eigenvalue W(i) is stored in the i-th column of
Z. Any vector which fails to converge is set to its current
iterate after MAXITS iterations.
LDZ (input) INTEGER
The leading dimension of the array Z. LDZ >= max(1,N).
WORK (workspace) REAL array, dimension (5*N)
IWORK (workspace) INTEGER array, dimension (N)
IFAIL (output) INTEGER array, dimension (M)
On normal exit, all elements of IFAIL are zero.
If one or more eigenvectors fail to converge after
MAXITS iterations, then their indices are stored in
array IFAIL.
INFO (output) INTEGER
= 0: successful exit.
< 0: if INFO = -i, the i-th argument had an illegal value
> 0: if INFO = i, then i eigenvectors failed to converge
in MAXITS iterations. Their indices are stored in
array IFAIL.
Internal Parameters
===================
MAXITS INTEGER, default = 5
The maximum number of iterations performed.
EXTRA INTEGER, default = 2
The number of iterations performed after norm growth
criterion is satisfied, should be at least 1.
=====================================================================
Test the input parameters.
//.........这里部分代码省略.........
开发者ID:deepakantony,项目名称:vispack,代码行数:101,代码来源:sstein.c
示例14: interval
/* Subroutine */ int sstebz_(char *range, char *order, integer *n, real *vl,
real *vu, integer *il, integer *iu, real *abstol, real *d, real *e,
integer *m, integer *nsplit, real *w, integer *iblock, integer *
isplit, real *work, integer *iwork, integer *info)
{
/* -- LAPACK routine (version 2.0) --
Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
Courant Institute, Argonne National Lab, and Rice University
September 30, 1994
Purpose
=======
SSTEBZ computes the eigenvalues of a symmetric tridiagonal
matrix T. The user may ask for all eigenvalues, all eigenvalues
in the half-open interval (VL, VU], or the IL-th through IU-th
eigenvalues.
To avoid overflow, the matrix must be scaled so that its
largest element is no greater than overflow**(1/2) *
underflow**(1/4) in absolute value, and for greatest
accuracy, it should not be much smaller than that.
See W. Kahan "Accurate Eigenvalues of a Symmetric Tridiagonal
Matrix", Report CS41, Computer Science Dept., Stanford
University, July 21, 1966.
Arguments
=========
RANGE (input) CHARACTER
= 'A': ("All") all eigenvalues will be found.
= 'V': ("Value") all eigenvalues in the half-open interval
(VL, VU] will be found.
= 'I': ("Index") the IL-th through IU-th eigenvalues (of the
entire matrix) will be found.
ORDER (input) CHARACTER
= 'B': ("By Block") the eigenvalues will be grouped by
split-off block (see IBLOCK, ISPLIT) and
ordered from smallest to largest within
the block.
= 'E': ("Entire matrix")
the eigenvalues for the entire matrix
will be ordered from smallest to
largest.
N (input) INTEGER
The order of the tridiagonal matrix T. N >= 0.
VL (input) REAL
VU (input) REAL
If RANGE='V', the lower and upper bounds of the interval to
be searched for eigenvalues. Eigenvalues less than or equal
to VL, or greater than VU, will not be returned. VL < VU.
Not referenced if RANGE = 'A' or 'I'.
IL (input) INTEGER
IU (input) INTEGER
If RANGE='I', the indices (in ascending order) of the
smallest and largest eigenvalues to be returned.
1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0.
Not referenced if RANGE = 'A' or 'V'.
ABSTOL (input) REAL
The absolute tolerance for the eigenvalues. An eigenvalue
(or cluster) is considered to be located if it has been
determined to lie in an interval whose width is ABSTOL or
less. If ABSTOL is less than or equal to zero, then ULP*|T|
will be used, where |T| means the 1-norm of T.
Eigenvalues will be computed most accurately when ABSTOL is
set to twice the underflow threshold 2*SLAMCH('S'), not zero.
D (input) REAL array, dimension (N)
The n diagonal elements of the tridiagonal matrix T.
E (input) REAL array, dimension (N-1)
The (n-1) off-diagonal elements of the tridiagonal matrix T.
M (output) INTEGER
The actual number of eigenvalues found. 0 <= M <= N.
(See also the description of INFO=2,3.)
NSPLIT (output) INTEGER
The number of diagonal blocks in the matrix T.
1 <= NSPLIT <= N.
W (output) REAL array, dimension (N)
On exit, the first M elements of W will contain the
eigenvalues. (SSTEBZ may use the remaining N-M elements as
workspace.)
//.........这里部分代码省略.........
开发者ID:bliss-sid,项目名称:OCR,代码行数:101,代码来源:SSTEBZ.C
示例15: IBLOCK
struct dinode *inodeFromINum(uint inum) {
uint blockNum = IBLOCK(inum);
void *blockPtr = blockPtrFromBNum(blockNum);
return (struct dinode *) blockPtr + (inum % IPB);
}
开发者ID:r1ptide64,项目名称:p5a,代码行数:5,代码来源:fscheck.c
注:本文中的IBLOCK函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论