• Home
  • Raw
  • Download

Lines Matching refs:fs

44 errcode_t ext2fs_mmp_read(ext2_filsys fs, blk64_t mmp_blk, void *buf)  in ext2fs_mmp_read()  argument
50 if ((mmp_blk <= fs->super->s_first_data_block) || in ext2fs_mmp_read()
51 (mmp_blk >= ext2fs_blocks_count(fs->super))) in ext2fs_mmp_read()
59 if (fs->mmp_fd <= 0) { in ext2fs_mmp_read()
69 if (stat(fs->device_name, &st) == 0 && in ext2fs_mmp_read()
73 fs->mmp_fd = open(fs->device_name, flags); in ext2fs_mmp_read()
74 if (fs->mmp_fd < 0) { in ext2fs_mmp_read()
80 if (fs->mmp_cmp == NULL) { in ext2fs_mmp_read()
81 int align = ext2fs_get_dio_alignment(fs->mmp_fd); in ext2fs_mmp_read()
83 retval = ext2fs_get_memalign(fs->blocksize, align, in ext2fs_mmp_read()
84 &fs->mmp_cmp); in ext2fs_mmp_read()
89 if ((blk64_t) ext2fs_llseek(fs->mmp_fd, mmp_blk * fs->blocksize, in ext2fs_mmp_read()
91 mmp_blk * fs->blocksize) { in ext2fs_mmp_read()
96 if (read(fs->mmp_fd, fs->mmp_cmp, fs->blocksize) != fs->blocksize) { in ext2fs_mmp_read()
101 mmp_cmp = fs->mmp_cmp; in ext2fs_mmp_read()
103 if (!(fs->flags & EXT2_FLAG_IGNORE_CSUM_ERRORS) && in ext2fs_mmp_read()
104 !ext2fs_mmp_csum_verify(fs, mmp_cmp)) in ext2fs_mmp_read()
111 if (buf != NULL && buf != fs->mmp_cmp) in ext2fs_mmp_read()
112 memcpy(buf, fs->mmp_cmp, fs->blocksize); in ext2fs_mmp_read()
126 errcode_t ext2fs_mmp_write(ext2_filsys fs, blk64_t mmp_blk, void *buf) in ext2fs_mmp_write() argument
135 fs->mmp_last_written = tv.tv_sec; in ext2fs_mmp_write()
137 if (fs->super->s_mmp_block < fs->super->s_first_data_block || in ext2fs_mmp_write()
138 fs->super->s_mmp_block > ext2fs_blocks_count(fs->super)) in ext2fs_mmp_write()
145 retval = ext2fs_mmp_csum_set(fs, mmp_s); in ext2fs_mmp_write()
151 retval = io_channel_write_blk64(fs->io, mmp_blk, -(int)sizeof(struct mmp_struct), buf); in ext2fs_mmp_write()
158 io_channel_flush(fs->io); in ext2fs_mmp_write()
197 static errcode_t ext2fs_mmp_reset(ext2_filsys fs) in ext2fs_mmp_reset() argument
202 if (fs->mmp_buf == NULL) { in ext2fs_mmp_reset()
203 retval = ext2fs_get_mem(fs->blocksize, &fs->mmp_buf); in ext2fs_mmp_reset()
208 memset(fs->mmp_buf, 0, fs->blocksize); in ext2fs_mmp_reset()
209 mmp_s = fs->mmp_buf; in ext2fs_mmp_reset()
219 strncpy((char *) mmp_s->mmp_bdevname, fs->device_name, in ext2fs_mmp_reset()
222 mmp_s->mmp_check_interval = fs->super->s_mmp_update_interval; in ext2fs_mmp_reset()
226 retval = ext2fs_mmp_write(fs, fs->super->s_mmp_block, fs->mmp_buf); in ext2fs_mmp_reset()
232 errcode_t ext2fs_mmp_update(ext2_filsys fs) in ext2fs_mmp_update() argument
234 return ext2fs_mmp_update2(fs, 0); in ext2fs_mmp_update()
237 errcode_t ext2fs_mmp_clear(ext2_filsys fs) in ext2fs_mmp_clear() argument
242 if (!(fs->flags & EXT2_FLAG_RW)) in ext2fs_mmp_clear()
245 retval = ext2fs_mmp_reset(fs); in ext2fs_mmp_clear()
253 errcode_t ext2fs_mmp_init(ext2_filsys fs) in ext2fs_mmp_init() argument
256 struct ext2_super_block *sb = fs->super; in ext2fs_mmp_init()
266 if (fs->mmp_buf == NULL) { in ext2fs_mmp_init()
267 retval = ext2fs_get_mem(fs->blocksize, &fs->mmp_buf); in ext2fs_mmp_init()
272 retval = ext2fs_alloc_block2(fs, 0, fs->mmp_buf, &mmp_block); in ext2fs_mmp_init()
278 retval = ext2fs_mmp_reset(fs); in ext2fs_mmp_init()
296 errcode_t ext2fs_mmp_start(ext2_filsys fs) in ext2fs_mmp_start() argument
304 if (fs->mmp_buf == NULL) { in ext2fs_mmp_start()
305 retval = ext2fs_get_mem(fs->blocksize, &fs->mmp_buf); in ext2fs_mmp_start()
310 retval = ext2fs_mmp_read(fs, fs->super->s_mmp_block, fs->mmp_buf); in ext2fs_mmp_start()
314 mmp_s = fs->mmp_buf; in ext2fs_mmp_start()
316 mmp_check_interval = fs->super->s_mmp_update_interval; in ext2fs_mmp_start()
342 retval = ext2fs_mmp_read(fs, fs->super->s_mmp_block, fs->mmp_buf); in ext2fs_mmp_start()
352 if (!(fs->flags & EXT2_FLAG_RW)) in ext2fs_mmp_start()
361 strncpy((char *) mmp_s->mmp_bdevname, fs->device_name, in ext2fs_mmp_start()
364 retval = ext2fs_mmp_write(fs, fs->super->s_mmp_block, fs->mmp_buf); in ext2fs_mmp_start()
370 retval = ext2fs_mmp_read(fs, fs->super->s_mmp_block, fs->mmp_buf); in ext2fs_mmp_start()
380 retval = ext2fs_mmp_write(fs, fs->super->s_mmp_block, fs->mmp_buf); in ext2fs_mmp_start()
399 errcode_t ext2fs_mmp_stop(ext2_filsys fs) in ext2fs_mmp_stop() argument
405 if (!ext2fs_has_feature_mmp(fs->super) || in ext2fs_mmp_stop()
406 !(fs->flags & EXT2_FLAG_RW) || (fs->flags & EXT2_FLAG_SKIP_MMP) || in ext2fs_mmp_stop()
407 (fs->mmp_buf == NULL) || (fs->mmp_cmp == NULL)) in ext2fs_mmp_stop()
410 retval = ext2fs_mmp_read(fs, fs->super->s_mmp_block, fs->mmp_buf); in ext2fs_mmp_stop()
415 mmp = fs->mmp_buf; in ext2fs_mmp_stop()
416 mmp_cmp = fs->mmp_cmp; in ext2fs_mmp_stop()
423 retval = ext2fs_mmp_write(fs, fs->super->s_mmp_block, fs->mmp_cmp); in ext2fs_mmp_stop()
426 if (fs->mmp_fd > 0) { in ext2fs_mmp_stop()
427 close(fs->mmp_fd); in ext2fs_mmp_stop()
428 fs->mmp_fd = -1; in ext2fs_mmp_stop()
433 if (!ext2fs_has_feature_mmp(fs->super) || in ext2fs_mmp_stop()
434 !(fs->flags & EXT2_FLAG_RW) || (fs->flags & EXT2_FLAG_SKIP_MMP)) in ext2fs_mmp_stop()
446 errcode_t ext2fs_mmp_update2(ext2_filsys fs, int immediately) in ext2fs_mmp_update2() argument
453 if (!ext2fs_has_feature_mmp(fs->super) || in ext2fs_mmp_update2()
454 !(fs->flags & EXT2_FLAG_RW) || (fs->flags & EXT2_FLAG_SKIP_MMP)) in ext2fs_mmp_update2()
459 tv.tv_sec - fs->mmp_last_written < EXT2_MIN_MMP_UPDATE_INTERVAL) in ext2fs_mmp_update2()
462 retval = ext2fs_mmp_read(fs, fs->super->s_mmp_block, NULL); in ext2fs_mmp_update2()
466 mmp = fs->mmp_buf; in ext2fs_mmp_update2()
467 mmp_cmp = fs->mmp_cmp; in ext2fs_mmp_update2()
474 retval = ext2fs_mmp_write(fs, fs->super->s_mmp_block, fs->mmp_buf); in ext2fs_mmp_update2()
479 if (!ext2fs_has_feature_mmp(fs->super) || in ext2fs_mmp_update2()
480 !(fs->flags & EXT2_FLAG_RW) || (fs->flags & EXT2_FLAG_SKIP_MMP)) in ext2fs_mmp_update2()