int _cp(char *src, char *dest) { int fd, gd, ino, p_ino, dev = running->cwd->dev, temp; char src_path[INODE_NAME], dest_path[INODE_NAME], parent_path[INODE_NAME*2]; MINODE *pip; strcpy(src_path, src); strcpy(dest_path, dest); strcpy(parent_path, dirname(dest)); if (dest[0] == '/') { dev = root->dev; } temp = dev; ino = get_inode(dest_path, &temp, TRUE); if (ino < 0) // Must first create the destination file { p_ino = get_inode(parent_path, &dev, FALSE); if (p_ino < 0) { return p_ino; } pip = iget(dev, p_ino); __creat(pip, basename(dest_path), REG_FILE); iput(pip); } fd = __open(src_path, 0); // open the source file for read if (fd < 0) { return fd; } gd = __open(dest_path, 1); // open the dest file for write if (gd < 0) { return gd; } int n = 0, counter = 0; char cp_buf[BLKSIZE]; bzero(cp_buf, BLKSIZE); while ( (n = __read(fd, cp_buf, BLKSIZE)) > 0 ) // Read from the source file { if (n < 0) break; __write(gd, cp_buf, n); // Write to the destination file bzero(cp_buf, BLKSIZE); counter++; } __close(fd); __close(gd); return 0; }
printpathto() { while(count == 0){ ino_t this_inode = get_inode( "." ); char its_name[BUFSIZ]; chdir( ".." ); inum_to_name( this_inode , its_name ); par_inode = get_inode( "." ); if ( par_inode == get_inode( ".." ) ){ count=1; } strcpy(temp[count2], its_name); count2++; count3++; }//end while count2=count2-1; count3=count3-1; int i; for(i=0; i<=count2; i++){ printf("/%s", temp[count3] ); count3--; } }
void do_list_recursive(jfs_t *jfs, char *pathname, int inodenum) { struct inode i_node; struct dirent* dir_entry; int dir_size, bytes_done=0; char block[BLOCKSIZE]; get_inode(jfs, inodenum, &i_node); dir_size = i_node.size; /* read in the first block */ jfs_read_block(jfs, block, i_node.blockptrs[0]); /* walk the directory printing out the files */ dir_entry = (struct dirent*)block; while (1) { /* the filename isn't null-terminated on disk, so we have to copy it to get a null-terminated version we can work with */ char filename[MAX_FILENAME_LEN + 1]; memcpy(filename, dir_entry->name, dir_entry->namelen); filename[dir_entry->namelen] = '\0'; if (dir_entry->file_type == DT_DIRECTORY) { struct inode this_inode; get_inode(jfs, dir_entry->inode, &this_inode); printf("%s/%s (directory %d bytes)\n", pathname, filename, this_inode.size); } else if (dir_entry->file_type == DT_FILE) { struct inode this_inode; get_inode(jfs, dir_entry->inode, &this_inode); printf("%s/%s %d bytes\n", pathname, filename, this_inode.size); } else { printf("%s/%s bad file type: %d\n", pathname, filename, dir_entry->file_type); } /* if the dirent refers to a directory, and it's not "." or "..", then we want to list it's contents too */ if (dir_entry->file_type == DT_DIRECTORY && (strcmp(filename, ".") != 0) && (strcmp(filename, "..") != 0)) { /* extend the pathname with the name of this subdirectory*/ char newpathname[strlen(filename) + strlen(pathname) + 2]; strcpy(newpathname, pathname); strcat(newpathname, "/"); strcat(newpathname, filename); /* list the contents of the subdirectory */ do_list_recursive(jfs, newpathname, dir_entry->inode); } bytes_done += dir_entry->entry_len; dir_entry = (struct dirent*)(block + bytes_done); /* have we finished yet? */ if (bytes_done >= dir_size) { break; } } }
void printpathto(ino_t this_inode){ ino_t my_inode; char its_name[BUFSIZ]; char full_path[BUFSIZ]; char temp[BUFSIZ]; while(1){ my_inode = get_inode("."); if (get_inode("..") != this_inode){ chdir(".."); inum_to_name(this_inode, its_name, BUFSIZ); my_inode = get_inode("."); this_inode = my_inode; strcpy(temp,full_path); sprintf(full_path, "/%s%s",its_name,temp); } else{ break; } } printf("%s", full_path); }
int main(){ ino_t this_inode; ino_t my_inode; char its_name[BUFSIZ]; struct names *Head; struct names *temp; Head = (names*)malloc(sizeof(names)); // Head->its_name = NULL; Head->next = NULL; this_inode = get_inode("."); while(get_inode("..") != this_inode){ chdir(".."); inum_to_name(this_inode, its_name, BUFSIZ); temp = (names*)malloc(sizeof(names)); strncpy(temp->its_name,its_name,BUFSIZ); temp->next = Head; Head = temp; my_inode = get_inode("."); this_inode = my_inode; } temp = Head; while(temp->next){ printf("/%s", temp->its_name); temp = temp->next; } putchar('\n'); return 0; }
/*根据路径查找对应的inode信息*/ void get_inode_bypath(char *src,struct inode *ret_node) { u32 node_num=pwd,i; if(src[0]=='/') node_num=root; struct dir_ent ent; char *result=NULL,*last=src,*ori_src=src; result=strtok(src,"/"); while(result!=NULL) { get_inode(node_num,ret_node); fseek(fimg,ret_node->i_start_sect*SECTOR_SIZE,SEEK_SET); for(i=0;i<ret_node->i_size;i++) { fread(&ent,sizeof(ent),1,fimg); if(strcmp(ent.name,result)==0){ node_num=ent.i_num; break; } } if(i==ret_node->i_size){ ret_node->i_num=-1; return ; } last=result; result=strtok(NULL,"/"); } get_inode(node_num,ret_node); if(ori_src!=last) strcpy(ori_src,last); }
static void proto_handle_hlnk(conn_t* cn, const char* line) { // read next line to get target char target[PATH_MAX]; if(!conn_readline(cn, target, sizeof target)) { conn_perror(cn, "ERROR No data\n"); conn_abort(cn); return; } if(strcmp(target, line)==0) { conn_printf(cn, "ERROR Cannot make a link to itself!\n"); conn_abort(cn); return; } // Check if inode is the same, if so, dont bother if(get_inode(target) != get_inode(line)) { if(link(target, line)==-1) { conn_perror(cn, "ERROR link()"); conn_abort(cn); return; } } conn_printf(cn, "GET %s\n", line); }
int search(int devId, char names[64][128], int dirsRemaining, int pIno) { char buf[BLKSIZE]; INODE *parent; INODE *file; parent = get_inode(devId, pIno); int i = 0, tIno = 0; for(i = 0; i < 12 && !tIno && parent->i_block[i]; i++) { //getchar(); get_block(devId, parent->i_block[i], buf); tIno = findName(buf, names[0]); } if(!dirsRemaining) { //if we at the end of the search printf("Found %s at %d\n", names[0], tIno); return tIno; } else { file = get_inode(devId, tIno); if(S_ISDIR(file->i_mode)) { //getchar(); return search(devId, names + 1, dirsRemaining -1, tIno); } else { return 0; } } }
static char * rwalk1(Fid *fid, char *name, Qid *qid) { Xfile *f=xfile(fid, Asis); int nr, sinbr = 0; chat("walk1(fid=%d,name=\"%s\")...", fid->fid, name); errno = 0; if( !f ){ chat("no xfile..."); goto error; } if( !(fid->qid.type & QTDIR) ){ chat("qid.type=0x%x...", fid->qid.type); goto error; } sinbr = f->pinbr; if( name == 0 || name[0] == 0 || !strcmp(name, ".") ){ *qid = fid->qid; goto ok; }else if( !strcmp(name, "..") ){ if( fid->qid.path == f->xf->rootqid.path ){ chat("walkup from root..."); *qid = fid->qid; goto ok; } if( get_inode(f, f->pinbr) < 0 ) goto error; if( f->pinbr == EXT2_ROOT_INODE ){ *qid = f->xf->rootqid; f->pinbr = EXT2_ROOT_INODE; } else { *qid = (Qid){f->pinbr,0,QTDIR}; f->inbr = f->pinbr; if( (nr = get_file(f, "..")) < 0 ) goto error; f->pinbr = nr; } }else{ f->pinbr = f->inbr; if( (nr = get_file(f, name)) < 0 ) goto error; if( get_inode(f, nr) < 0 ) goto error; *qid = (Qid){nr,0,0}; if( nr == EXT2_ROOT_INODE ) *qid = f->xf->rootqid; else if( S_ISDIR(getmode(f)) ) qid->type = QTDIR; /*strcpy(f->name, thdr.name);*/ } ok: chat("OK\n"); return 0; error: f->pinbr = sinbr; chat("%s\n", xerrstr(Enonexist)); return xerrstr(Enonexist); }
int main(int argc, char **argv) { char * target_file_path; char target_file_name[256]; unsigned int tpath_index, tfile_index; struct ext2_inode parent, target; if(argc != 3) { fprintf(stderr, "Usage: ext2_rm <image file name> <target path>\n"); exit(1); } if (ext2_init(argv[1]) == -1){ exit(1); } // check target path if(!check_file_path(argv[2]) ) { printf("invaid abs path\n"); return ENOENT; } // get target file path and name target_file_path = malloc(strlen(argv[2])); get_last_entry(argv[2],target_file_name, target_file_path); // check if it is vaild target file name if (! strlen(target_file_name)){ printf("invaid target file name\n"); return ENOENT; } if (is_dir(argv[2])){ printf("invaid target file name\n"); return ENOENT; } // get inode index for source file and target file tfile_index = get_inode_index(argv[2]); tpath_index = get_inode_index(target_file_path); free(target_file_path); // check if source path and target path vaild if(!tpath_index){ printf("No such file or directory\n"); return ENOENT; } // check if the target is the file if(tfile_index){ if(! (get_inode(tfile_index)->i_mode & EXT2_S_IFREG)){ printf("%s not a file\n", target_file_name); return ENOENT; } } remove_inode(get_inode(tpath_index), get_inode(tfile_index), tfile_index); return 0; }
/* * Returns inode type */ static int get_inode_for_path(struct ext2_driver *ext2, const char *path, struct ext2_inode *inode) { char *begin = (char *)path, *end; struct ext2_inode parent = get_inode(ext2, EXT2_ROOT_INO); struct ext2_dir_entry_2 temp_dir; int ret; /* To keep code below symmetric, setup parent to be root */ get_dentry_from_parent(ext2, &parent, ".", &temp_dir); again: while (*begin == '/') begin++; if (*begin == 0) { /* * ends here on "/" * ends here on "/foo/" */ goto out; } end = strchr(begin, '/'); if (end == NULL) { /* * ends here on "/foo" * ends here on "/foo/bar" */ ret = get_dentry_from_parent(ext2, &parent, (const char *)begin, &temp_dir); if (ret) return -1; } else { int ret; char temp_file[end - begin + 1]; /* +1 for null terminate */ temp_file[end - begin] = 0; strncpy(temp_file, begin, end - begin); ret = get_dentry_from_parent(ext2, &parent, temp_file, &temp_dir); if (ret) { printf("couldn't find %s\n", temp_file); } else { if (temp_dir.file_type != EXT2_FT_DIR) { printf("%s is not a dir\n", temp_file); return -1; } begin = end; end = NULL; parent = get_inode(ext2, temp_dir.inode); goto again; } } out: *inode = get_inode(ext2, temp_dir.inode); return temp_dir.file_type; }
int file_open(char *pathOf) { struct inode_block *inode_block = NULL; struct inode *inode = NULL; int i; int inum = path_to_inode(pathOf); get_inode(&inode_block, &inode, inum); // Check if the file exists. If not then error out if (inum == -1) { DEBUG2 && printf("File not found\n"); return ERR_FILE_NOT_FOUND; } get_inode(&inode_block, &inode, inum); if (inode->is_dir == 1) { DEBUG2 && printf("The file is a directory\n"); return ERR_FILE_NOT_FOUND; } DEBUG1 && printf("File does exist, is not a directory and is in inode number %d\n", inum); //allowing multiple opens of the same file so we need not check if a file is already opened //we just add whatever file we get whether its been opened alread or not /* for (i = 0; i < 20; i++) { if (open_file_table[i].currently_opened == 1 && open_file_table[i].inode_number == inum){ printf("File already opened\n"); return ERR_FILE_ALREADY_OPEN; } } */ DEBUG1 && printf("Adding to open file table\n"); // If file exists and is not open, then add an entry to the open file table for (i = 0; i < 20; i++) { if (open_file_table[i].currently_opened == 0) { open_file_table[i].inode_number = inum; open_file_table[i].currently_opened = 1; open_file_table[i].seek_position = 0; DEBUG1 && printf("File added to open file table\n"); return i; //this is the index in the table were we put inode } } DEBUG1 && printf("Maximum files opened. Cannot open file\n"); return ERR_TOO_MANY_FILES_OPEN; }
void printpathto(ino_t this_inode) { ino_t my_inode; char its_name[BUFSIZ]; if (get_inode("..") != this_inode) { chdir(".."); /* enter parent dir */ inum_to_name(this_inode, its_name); my_inode = get_inode("."); printpathto(my_inode); printf("/%s", its_name); } }
void FilePath::printPathTo(ino_t this_inode) { ino_t my_inode; char its_name[BUFSIZ]; if( get_inode("..") != this_inode) { chdir(".."); inum_to_name(this_inode, its_name, BUFSIZ); my_inode = get_inode("."); printPathTo(my_inode); printf("/%s", its_name); } strcpy(path, its_name); }
/* recursively print dir name of this_inode * get parent_inode of this_inode * print name of this_inode * recursively call method of parent_inode */ void printpathto(ino_t this_inode) { ino_t my_inode; char its_name[BUFSIZ]; if (get_inode("..") != this_inode) { chdir(".."); /* dir name of this_inode depends on parent dir file*/ inum_to_name(this_inode, its_name, BUFSIZ); my_inode = get_inode("."); printpathto(my_inode); printf("/%s", its_name); } }
void printpathto (ino_t this_inode) { ino_t my_inode; char its_name[BUFSIZE]; if (get_inode("..") != this_inode) { chdir(".."); inum_to_name(this_inode, its_name, BUFSIZE); my_inode = get_inode("."); printpathto(my_inode); printf("%s", its_name); } }
int main(int argc, char *argv[]) { FILE *f; struct superblock sb; struct inode inode; if (argc < 3) { printf("Usage: %s <image file> <inode #>\n", argv[0]); return 1; } f = fopen(argv[1], "r"); if (f == NULL) { perror("fopen"); return 1; } if (get_superblock(f, &sb)) return 1; // Fetch the specified inode if (get_inode(&sb, strtoul(argv[2], NULL, 0), &inode)) return 1; // Print out the data contained in the inode if (print_inode_data(&sb, &inode)) return 1; fclose(f); return 0; }
static bool_t L2_Translate_m (USDCallback_cl *self, USD_StreamID sid /* IN */, USD_ClientID cid /* IN */, const FileIO_Request *req /* IN */, USD_Extent *extent /* OUT */, uint32_t *notification /* OUT */ ) { ext2fs_st *st = self->st; Client_st *cur; Ext2_Handle handle; struct inode *ino; FTRC("entered: self=%p, st=%p.\n", self, st); if (req->nblocks == 0) { /* Inode prefectch */ ino = get_inode(st, req->user1); release_inode(st, ino); return False; } /* All checked once by L1 (XXX are there concurrency problems?) */ cur = (Client_st *)(word_t)cid; handle = req->user1; ino = cur->handles[handle].ino; translate(st, ino, req, extent); FTRC("leaving, returning true.\n"); return(True); }
int main(int argc, char ** argv) { // Extract the file given in the second argument from the filesystem image // given in the first. if (argc != 3) { printf("usage: ext2cat <filesystem_image> <path_within_filesystem>\n"); exit(1); } char * fs_path = argv[1]; char * file_path = argv[2]; void * fs = mmap_fs(fs_path); // Get the inode for our target file. __u32 target_ino_num = get_inode_by_path(fs, file_path); if (target_ino_num == 0) { printf("cat: %s does not exist\n", file_path); return 1; } struct ext2_inode * target_ino = get_inode(fs, target_ino_num); __u32 block_size = get_block_size(fs); __u32 size = target_ino->i_size; __u32 bytes_read = 0; void * buf = calloc(size, 1); // Read the file one block at a time. In the real world, there would be a // lot of error-handling code here. __u32 bytes_left; for (int i = 0; i < EXT2_NDIR_BLOCKS; i++) { bytes_left = size - bytes_read; if (bytes_left == 0) break; __u32 bytes_to_read = bytes_left > block_size ? block_size : bytes_left; void * block = get_block(fs, target_ino->i_block[i]); memcpy(buf + bytes_read, block, bytes_to_read); bytes_read += bytes_to_read; } if (bytes_read < size) { /*printf("%s: file uses indirect blocks. output was truncated!\n", argv[0]);*/ /* Get the number of the block that stores the array of indirect block numbers */ __u32 * indir_block = get_block(fs, target_ino->i_block[EXT2_NDIR_BLOCKS]); /* Calculate the limit of the number of the indirect blocks*/ int limit = block_size / sizeof(__u32); for (int i = 0; i < limit; i++) { bytes_left = size - bytes_read; if (bytes_left == 0) break; __u32 bytes_to_read = bytes_left > block_size ? block_size : bytes_left; void * block = get_block(fs, indir_block[i]); memcpy(buf + bytes_read, block, bytes_to_read); bytes_read += bytes_to_read; } } write(1, buf, bytes_read); return 0; }
/*===========================================================================* * fs_mountpoint * *===========================================================================*/ PUBLIC int fs_mountpoint() { /* This function looks up the mount point, it checks the condition whether * the partition can be mounted on the inode or not. */ register struct inode *rip; int r = OK; mode_t bits; /* Temporarily open the file. */ if( (rip = get_inode(fs_dev, fs_m_in.REQ_INODE_NR)) == NULL) return(EINVAL); if(rip->i_mountpoint) r = EBUSY; /* It may not be special. */ bits = rip->i_mode & I_TYPE; if (bits == I_BLOCK_SPECIAL || bits == I_CHAR_SPECIAL) r = ENOTDIR; put_inode(rip); if(r == OK) rip->i_mountpoint = TRUE; return(r); }
int main() { printpathto( get_inode( "." ) ); /* print path to here */ putchar('\n'); /* then add newline */ return 0; }
size_t ext2_get_size(uint8_t *fs, int inum) { struct ext2_inode *inode = get_inode(fs, inum); uint64_t temp = inode->i_size_high; temp = temp << 32; temp = temp | (inode->i_size); return temp; }
/*===========================================================================* * fs_rdlink * *===========================================================================*/ int fs_rdlink() { block_t b; /* block containing link text */ struct buf *bp; /* buffer containing link text */ register struct inode *rip; /* target inode */ register int r; /* return value */ size_t copylen; copylen = min( (size_t) fs_m_in.REQ_MEM_SIZE, UMAX_FILE_POS); /* Temporarily open the file. */ if( (rip = get_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL) return(EINVAL); if(!S_ISLNK(rip->i_mode)) r = EACCES; else if ((b = read_map(rip, (off_t) 0)) == NO_BLOCK) r = EIO; else { /* Passed all checks */ /* We can safely cast to unsigned, because copylen is guaranteed to be below max file size */ copylen = min( copylen, (unsigned) rip->i_size); bp = get_block(rip->i_dev, b, NORMAL); r = sys_safecopyto(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT, (vir_bytes) 0, (vir_bytes) b_data(bp), (size_t) copylen); put_block(bp, DIRECTORY_BLOCK); if (r == OK) fs_m_out.RES_NBYTES = copylen; } put_inode(rip); return(r); }
// Find the inode number for a file by its full path. // This is the functionality that ext2cat ultimately needs. __u32 get_inode_by_path(void * fs, char * path) { int num_slashes = get_number_of_slashes(path); char ** pathComponents = split_path(path); struct ext2_inode * dir = get_root_dir(fs); __u32 inode = 0; // loop through each part of path to file for (int i = 0; i < num_slashes; i++) { // look up inode of ith part of path inode = get_inode_from_dir(fs, dir, pathComponents[i]); // check if invalid if (inode == 0) { return 0; } // unless last iteration update inode entry to next file/directory if (i < num_slashes - 1) { dir = get_inode(fs,inode); // can't find right constant for this (value for dir is 16832) // so going to leave out error checking for now //if (dir->i_mode != LINUX_S_IFDIR) { // error path is too long // printf("Error path is too long\n"); // return 0; //} } } return inode; }
/*===========================================================================* * go_up * *===========================================================================*/ static int go_up( char path[PATH_MAX], /* path to take the last part from */ struct inode *ino, /* inode of the current directory */ struct inode **res_ino, /* place to store resulting inode */ struct sffs_attr *attr /* place to store inode attributes */ ) { /* Given an inode, progress into the parent directory. */ struct inode *parent; int r; pop_path(path); parent = ino->i_parent; assert(parent != NULL); if ((r = verify_path(path, parent, attr, NULL)) != OK) return r; get_inode(parent); *res_ino = parent; return r; }
int main(int argc, char *argv[]) { print_path_to(get_inode(".")); /* print path to here */ putchar('\n'); return 0; }
/** * <Ring 1> Do some preparation. * *****************************************************************************/ PRIVATE void init_fs() { int i; /* f_desc_table[] */ for (i = 0; i < NR_FILE_DESC; i++) memset(&f_desc_table[i], 0, sizeof(struct file_desc)); /* inode_table[] */ for (i = 0; i < NR_INODE; i++) memset(&inode_table[i], 0, sizeof(struct inode)); /* super_block[] */ struct super_block * sb = super_block; for (; sb < &super_block[NR_SUPER_BLOCK]; sb++) sb->sb_dev = NO_DEV; /* open the device: hard disk */ MESSAGE driver_msg; driver_msg.type = DEV_OPEN; driver_msg.DEVICE = MINOR(ROOT_DEV); assert(dd_map[MAJOR(ROOT_DEV)].driver_nr != INVALID_DRIVER); send_recv(BOTH, dd_map[MAJOR(ROOT_DEV)].driver_nr, &driver_msg); /* make FS */ mkfs(); /* load super block of ROOT */ read_super_block(ROOT_DEV); sb = get_super_block(ROOT_DEV); assert(sb->magic == MAGIC_V1); root_inode = get_inode(ROOT_DEV, ROOT_INODE); }
void ext4_create_resize_inode() { struct block_allocation *reserve_inode_alloc = create_allocation(); u32 reserve_inode_len = 0; unsigned int i; struct ext4_inode *inode = get_inode(EXT4_RESIZE_INO); if (inode == NULL) { error("failed to get resize inode"); return; } for (i = 0; i < aux_info.groups; i++) { if (ext4_bg_has_super_block(i)) { u64 group_start_block = aux_info.first_data_block + i * info.blocks_per_group; u32 reserved_block_start = group_start_block + 1 + aux_info.bg_desc_blocks; u32 reserved_block_len = info.bg_desc_reserve_blocks; append_region(reserve_inode_alloc, reserved_block_start, reserved_block_len, i); reserve_inode_len += reserved_block_len; } } inode_attach_resize(inode, reserve_inode_alloc); inode->i_mode = S_IFREG | S_IRUSR | S_IWUSR; inode->i_links_count = 1; free_alloc(reserve_inode_alloc); }
int dfs_opendir(struct file *filp, char *name) { struct filsys *fs; int len; vfs_ino_t ino; struct inode *inode; fs = (struct filsys *) filp->fs->data; len = strlen(name); ino = lookup_name(fs, DFS_INODE_ROOT, name, len); if (ino == -1) return -1; inode = get_inode(fs, ino); if (!inode) return -1; if (!VFS_S_ISDIR(inode->desc->mode)) { release_inode(inode); return -1; } filp->data = inode; return 0; }
/* Allocate the blocks to hold a journal inode and connect them to the reserved journal inode */ void ext4_create_journal_inode() { struct ext4_inode *inode = get_inode(EXT4_JOURNAL_INO); if (inode == NULL) { error("failed to get journal inode"); return; } u8 *journal_data = inode_allocate_data_extents(inode, info.journal_blocks * info.block_size, info.journal_blocks * info.block_size); if (!journal_data) { error("failed to allocate extents for journal data"); return; } inode->i_mode = S_IFREG | S_IRUSR | S_IWUSR; inode->i_links_count = 1; journal_superblock_t *jsb = (journal_superblock_t *)journal_data; jsb->s_header.h_magic = htonl(JBD2_MAGIC_NUMBER); jsb->s_header.h_blocktype = htonl(JBD2_SUPERBLOCK_V2); jsb->s_blocksize = htonl(info.block_size); jsb->s_maxlen = htonl(info.journal_blocks); jsb->s_nr_users = htonl(1); jsb->s_first = htonl(1); jsb->s_sequence = htonl(1); memcpy(aux_info.sb->s_jnl_blocks, &inode->i_block, sizeof(inode->i_block)); }