struct inode *new_inode(register struct inode *dir, __u16 mode) { register struct inode *inode; if (!(inode = get_empty_inode())) return inode; inode->i_gid =(__u8) current->egid; if (dir) { inode->i_sb = dir->i_sb; inode->i_dev = inode->i_sb->s_dev; inode->i_flags = inode->i_sb->s_flags; if (dir->i_mode & S_ISGID) { inode->i_gid = dir->i_gid; if (S_ISDIR(mode)) mode |= S_ISGID; } } if (S_ISLNK(mode)) mode |= 0777; else mode &= ~(current->fs.umask & 0777); inode->i_mode = mode; inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; #ifdef BLOAT_FS inode->i_blocks = inode->i_blksize = 0; #endif set_ops(inode); return inode; }
static void read_inode(register struct inode *inode) { struct super_block *sb = inode->i_sb; register struct super_operations *sop; lock_inode(inode); if (sb && (sop = sb->s_op) && sop->read_inode) { sop->read_inode(inode); if (inode->i_op == NULL) set_ops(inode); } unlock_inode(inode); }
void main(int argc, char **argv) { char *arg, **eargv = argv, work[MAX_PARGS]; FILE *fid; int eargc = 0, c; if (emess_dat.Prog_name = strrchr(*argv,DIR_CHAR)) ++emess_dat.Prog_name; else emess_dat.Prog_name = *argv; if (argc <= 1 ) { (void)fprintf(stderr, usage, pj_release, emess_dat.Prog_name); exit (0); } /* process run line arguments */ while (--argc > 0) { /* collect run line arguments */ if(**++argv == '-') for(arg = *argv;;) { switch(*++arg) { case '\0': /* position of "stdin" */ if (arg[-1] == '-') eargv[eargc++] = "-"; break; case 'i': /* input control */ case 'o': /* output control */ if (--argc <= 0) goto noargument; strncpy(work, *++argv, MAX_PARGS); set_ops(work, *arg == 'i' ? &input : &output); continue; case 'r': /* nad27/83 conversion zone */ if (--argc <= 0) goto noargument; czone = *++argv; continue; case 'E': /* echo ascii input to ascii output */ echoin = 1; continue; case 't': /* set col. one char */ if (arg[1]) tag = *++arg; else emess(1,"missing -t col. 1 tag"); continue; case 'W': /* specify seconds precision */ case 'w': /* -W for constant field width */ if ((c = arg[1]) != 0 && isdigit(c)) { set_rtodms(c - '0', *arg == 'W'); ++arg; } else emess(1,"-W argument missing or non-digit"); continue; case 'f': /* alternate output format degrees or xy */ if (--argc <= 0) goto noargument; oform = *++argv; continue; case 'e': /* error line alternative */ if (--argc <= 0) noargument: emess(1,"missing argument for -%c",*arg); oterr = *++argv; continue; default: emess(1, "invalid option: -%c",*arg); break; } break; } else /* assumed to be input file name(s) */ eargv[eargc++] = *argv; } if (eargc == 0) /* if no specific files force sysin */ eargv[eargc++] = "-"; /* done with parameter and control input */ setup(); /* process input file list */ for ( ; eargc-- ; ++eargv) { if (**eargv == '-') { fid = stdin; emess_dat.File_name = "<stdin>"; } else { if ((fid = fopen(*eargv, "r")) == NULL) { emess(-2, *eargv, "input file"); continue; } emess_dat.File_name = *eargv; } emess_dat.File_line = 0; /* process file */ process(fid); (void)fclose(fid); emess_dat.File_name = 0; } exit(0); /* normal completion */ }