Lines Matching defs:super
105 get_inode(int fd, struct fs *super, ino_t ino)
117 if (super != NULL && super->fs_magic == FS_UFS2_MAGIC) {
125 if (!ipbuf || ino < last || ino >= last + INOCNT(super)) {
126 if (super->fs_magic == FS_UFS2_MAGIC &&
127 (!cgp || cg != ino_to_cg(super, ino))) {
128 cg = ino_to_cg(super, ino);
129 if (!cgp && !(cgp = malloc(super->fs_cgsize)))
131 if (lseek(fd, (off_t)cgtod(super, cg) << super->fs_fshift, 0) < 0)
133 if (read(fd, cgp, super->fs_cgsize) != super->fs_cgsize)
139 && !(ipbuf = malloc(INOSZ(super))))
141 last = rounddown(ino, INOCNT(super));
142 if (lseek(fd, (off_t)ino_to_fsba(super, last) << super->fs_fshift, 0) < (off_t)0
143 || read(fd, ipbuf, INOSZ(super)) != (ssize_t)INOSZ(super))
147 if (super->fs_magic == FS_UFS1_MAGIC)
149 &((struct ufs1_dinode *)ipbuf)[ino % INOCNT(super)]);
150 di2 = &((struct ufs2_dinode *)ipbuf)[ino % INOCNT(super)];
152 if (isclr(cg_inosused(cgp), ino % super->fs_ipg))
163 static int virtualblocks(struct fs *super, union dinode *dp)
167 sz = DIP(super, dp, di_size);
169 if (lblkno(super,sz) >= UFS_NDADDR) {
170 nblk = blkroundup(super,sz);
172 nblk += super->fs_bsize;
179 if (lblkno(super,sz) >= UFS_NDADDR) {
180 nblk = blkroundup(super,sz);
181 sz = lblkno(super,nblk);
182 sz = (sz - UFS_NDADDR + NINDIR(super) - 1) / NINDIR(super);
184 nblk += sz * super->fs_bsize;
186 sz = (sz - 1 + NINDIR(super) - 1) / NINDIR(super);
189 nblk = fragroundup(super,sz);
196 isfree(struct fs *super, union dinode *dp)
199 return (DIP(super, dp, di_mode) & IFMT) == 0;
202 switch (DIP(super, dp, di_mode) & IFMT) {
215 errx(1, "unknown IFMT 0%o", DIP(super, dp, di_mode) & IFMT);
368 dofsizes(int fd, struct fs *super, char *name)
376 maxino = super->fs_ncg * super->fs_ipg - 1;
383 if ((dp = get_inode(fd,super,inode))
385 && ((DIP(super, dp, di_mode) & IFMT) == IFREG
386 || (DIP(super, dp, di_mode) & IFMT) == IFDIR)
388 && !isfree(super, dp)
391 sz = estimate ? virtualblocks(super, dp) :
392 actualblocks(super, dp);
440 douser(int fd, struct fs *super, char *name)
447 maxino = super->fs_ncg * super->fs_ipg - 1;
450 if ((dp = get_inode(fd,super,inode))
451 && !isfree(super, dp))
452 uses(DIP(super, dp, di_uid),
453 estimate ? virtualblocks(super, dp) :
454 actualblocks(super, dp),
455 DIP(super, dp, di_atime));
480 donames(int fd, struct fs *super, char *name)
487 maxino = super->fs_ncg * super->fs_ipg - 1;
498 if ((dp = get_inode(fd,super,inode))
499 && !isfree(super, dp)) {
500 printf("%s\t",user(DIP(super, dp, di_uid))->name);