int init_dynamic_protocol() { if(unlikely(domain_cache_init() != 0)) { goto err; } if (unlikely(study_cache_init() != 0)) { goto err; } if (unlikely(dns_study_cache_init() != 0)) { goto err; } if (unlikely(dynamic_cache_init() != 0)) { goto err; } if (unlikely(ftp_cache_init() != 0)) { goto err; } //indirect_cache_init(); // pack_test_init(); //test h_cache #if 0 if (unlikely(session_cache_init() != 0)) { goto err; } #endif return 0; err: E("init_dynamic_protocol fail\n"); exit(1); }
struct super_block* ftp_read_super(struct super_block* sb, void *opts, int silent){ struct ftp_sb_info *info; struct ftp_fattr root; struct inode *root_inode; lock_super(sb); info=(struct ftp_sb_info *)kmalloc(sizeof(struct ftp_sb_info),GFP_KERNEL); if(!info){ DEBUG(" Not enough kmem to allocate info!!\n"); goto out; } ftp_cache_init(); memset(info,0,sizeof(struct ftp_sb_info)); sb->u.generic_sbp = info; sb->s_blocksize = 1024; sb->s_blocksize_bits = 10; sb->s_magic = FTP_SUPER_MAGIC; sb->s_op = &ftp_sops; sb->s_flags |= MS_RDONLY; info->mnt.version = FTP_VERSION; info->mnt.file_mode = (S_IRWXU | S_IRGRP | S_IROTH | S_IFREG); info->mnt.dir_mode = (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH | S_IFDIR); info->mnt.uid = current->uid; info->mnt.gid = current->gid; info->ctrl_sock = NULL; info->data_sock = NULL; info->sem = MUTEX; DEBUG(" uid:%d gid:%d\n",current->uid,current->gid); if(ftp_parse_options(info, opts)<0){ DEBUG(" Wrong options!\n"); goto out_no_opts; } DEBUG(" Mounting %u.%u.%u.%u:%u, user %s, password %s\n", info->address.sin_addr.s_addr & 0xff, (info->address.sin_addr.s_addr >> 8) & 0xff, (info->address.sin_addr.s_addr >> 16) & 0xff, (info->address.sin_addr.s_addr >> 24) & 0xff, ntohs(info->address.sin_port), info->user, info->pass); if(ftp_connect(info)<0){ DEBUG(" Shit!\n"); goto out_no_opts; } ftp_init_root_dirent(info, &root); root_inode = ftp_iget(sb, &root); if(!root_inode) goto out_no_root; sb->s_root = d_alloc_root(root_inode, NULL); if(!sb->s_root) goto out_no_root; unlock_super(sb); DEBUG(" Mount succeded!\n"); return sb; out_no_root: iput(root_inode); out_no_opts: kfree(info); out: unlock_super(sb); DEBUG(" Mount failed!!\n"); return NULL; }