Lines Matching +full:record +full:- +full:size

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Persistent Storage - ramfs parts.
43 struct pstore_record *record; member
50 size_t size; member
59 if (private->record) { in free_pstore_private()
60 kvfree(private->record->buf); in free_pstore_private()
61 kfree(private->record->priv); in free_pstore_private()
62 kfree(private->record); in free_pstore_private()
70 struct pstore_private *ps = s->private; in pstore_ftrace_seq_start()
77 data->off = ps->total_size % REC_SIZE; in pstore_ftrace_seq_start()
78 data->off += *pos * REC_SIZE; in pstore_ftrace_seq_start()
79 if (data->off + REC_SIZE > ps->total_size) in pstore_ftrace_seq_start()
92 struct pstore_private *ps = s->private; in pstore_ftrace_seq_next()
96 data->off += REC_SIZE; in pstore_ftrace_seq_next()
97 if (data->off + REC_SIZE > ps->total_size) in pstore_ftrace_seq_next()
105 struct pstore_private *ps = s->private; in pstore_ftrace_seq_show()
112 rec = (struct pstore_ftrace_record *)(ps->record->buf + data->off); in pstore_ftrace_seq_show()
114 seq_printf(s, "CPU:%d ts:%llu %08lx %08lx %ps <- %pS\n", in pstore_ftrace_seq_show()
117 rec->ip, rec->parent_ip, (void *)rec->ip, in pstore_ftrace_seq_show()
118 (void *)rec->parent_ip); in pstore_ftrace_seq_show()
133 struct seq_file *sf = file->private_data; in pstore_file_read()
134 struct pstore_private *ps = sf->private; in pstore_file_read()
136 if (ps->record->type == PSTORE_TYPE_FTRACE) in pstore_file_read()
139 ps->record->buf, ps->total_size); in pstore_file_read()
144 struct pstore_private *ps = inode->i_private; in pstore_file_open()
149 if (ps->record->type == PSTORE_TYPE_FTRACE) in pstore_file_open()
156 sf = file->private_data; in pstore_file_open()
157 sf->private = ps; in pstore_file_open()
164 struct seq_file *sf = file->private_data; in pstore_file_llseek()
166 if (sf->op) in pstore_file_llseek()
180 * platform driver to erase the record from persistent store.
184 struct pstore_private *p = d_inode(dentry)->i_private; in pstore_unlink()
185 struct pstore_record *record = p->record; in pstore_unlink() local
187 if (!record->psi->erase) in pstore_unlink()
188 return -EPERM; in pstore_unlink()
192 if (!list_empty(&p->list)) in pstore_unlink()
193 list_del_init(&p->list); in pstore_unlink()
195 return -ENOENT; in pstore_unlink()
196 p->dentry = NULL; in pstore_unlink()
199 scoped_guard(mutex, &record->psi->read_mutex) in pstore_unlink()
200 record->psi->erase(record); in pstore_unlink()
207 struct pstore_private *p = inode->i_private; in pstore_evict_inode()
222 inode->i_ino = get_next_ino(); in pstore_get_inode()
243 struct pstore_context *ctx = fc->fs_private; in pstore_parse_param()
254 ctx->kmsg_bytes = result.uint_32; in pstore_parse_param()
257 return -EINVAL; in pstore_parse_param()
275 struct pstore_context *ctx = fc->fs_private; in pstore_reconfigure()
277 sync_filesystem(fc->root->d_sb); in pstore_reconfigure()
278 pstore_set_kmsg_bytes(ctx->kmsg_bytes); in pstore_reconfigure()
296 * Having no backend is fine -- no records appear. in psinfo_lock_root()
297 * Not being mounted is fine -- nothing to do. in psinfo_lock_root()
302 root = pstore_sb->s_root; in psinfo_lock_root()
319 if (pos->record->psi == psi) { in pstore_put_backend_records()
320 list_del_init(&pos->list); in pstore_put_backend_records()
321 d_invalidate(pos->dentry); in pstore_put_backend_records()
322 simple_unlink(d_inode(root), pos->dentry); in pstore_put_backend_records()
323 pos->dentry = NULL; in pstore_put_backend_records()
335 * Load it up with "size" bytes of data from "buf".
336 * Set the mtime & ctime to the date that this record was originally stored.
338 int pstore_mkfile(struct dentry *root, struct pstore_record *record) in pstore_mkfile() argument
344 size_t size = record->size + record->ecc_notice_size; in pstore_mkfile() local
347 return -EINVAL; in pstore_mkfile()
353 if (pos->record->type == record->type && in pstore_mkfile()
354 pos->record->id == record->id && in pstore_mkfile()
355 pos->record->psi == record->psi) in pstore_mkfile()
356 return -EEXIST; in pstore_mkfile()
359 inode = pstore_get_inode(root->d_sb); in pstore_mkfile()
361 return -ENOMEM; in pstore_mkfile()
362 inode->i_mode = S_IFREG | 0444; in pstore_mkfile()
363 inode->i_fop = &pstore_file_operations; in pstore_mkfile()
364 scnprintf(name, sizeof(name), "%s-%s-%llu%s", in pstore_mkfile()
365 pstore_type_to_name(record->type), in pstore_mkfile()
366 record->psi->name, record->id, in pstore_mkfile()
367 record->compressed ? ".enc.z" : ""); in pstore_mkfile()
371 return -ENOMEM; in pstore_mkfile()
375 return -ENOMEM; in pstore_mkfile()
377 private->dentry = dentry; in pstore_mkfile()
378 private->record = record; in pstore_mkfile()
379 inode->i_size = private->total_size = size; in pstore_mkfile()
380 inode->i_private = private; in pstore_mkfile()
382 if (record->time.tv_sec) in pstore_mkfile()
384 inode_set_ctime_to_ts(inode, record->time)); in pstore_mkfile()
388 list_add(&(no_free_ptr(private))->list, &records_list); in pstore_mkfile()
395 * files in our filesystem. Don't warn about -EEXIST errors
396 * when we are re-scanning the backing store looking to add new
413 struct pstore_context *ctx = fc->fs_private; in pstore_fill_super()
416 sb->s_maxbytes = MAX_LFS_FILESIZE; in pstore_fill_super()
417 sb->s_blocksize = PAGE_SIZE; in pstore_fill_super()
418 sb->s_blocksize_bits = PAGE_SHIFT; in pstore_fill_super()
419 sb->s_magic = PSTOREFS_MAGIC; in pstore_fill_super()
420 sb->s_op = &pstore_ops; in pstore_fill_super()
421 sb->s_time_gran = 1; in pstore_fill_super()
423 pstore_set_kmsg_bytes(ctx->kmsg_bytes); in pstore_fill_super()
427 inode->i_mode = S_IFDIR | 0750; in pstore_fill_super()
428 inode->i_op = &pstore_dir_inode_operations; in pstore_fill_super()
429 inode->i_fop = &simple_dir_operations; in pstore_fill_super()
432 sb->s_root = d_make_root(inode); in pstore_fill_super()
433 if (!sb->s_root) in pstore_fill_super()
434 return -ENOMEM; in pstore_fill_super()
446 if (fc->root) in pstore_get_tree()
454 kfree(fc->fs_private); in pstore_free_fc()
482 return -ENOMEM; in pstore_init_fs_context()
486 * every time we (re)mount the single-sb filesystem with the in pstore_init_fs_context()
489 ctx->kmsg_bytes = kmsg_bytes; in pstore_init_fs_context()
491 fc->fs_private = ctx; in pstore_init_fs_context()
492 fc->ops = &pstore_context_ops; in pstore_init_fs_context()