Skip to contentSkip to conversation

rpdfs: Add basic getattr and setattr support.

PATCH Applied Chris Kirby 2 participants 2 messages Feb 24 – Feb 25

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rpdfs: Add basic getattr and setattr support.

Add basic getattr and setattr support.

For now, the only statx request supported by getattr is STATX_BTIME. All other stat info is filled in from the vfs inode using generic_fillattr().

setattr lacks support for ATTR_SIZE, since we don't have a truncate operation yet.

---
 fs/rpdfs/balloc.c |  2 +-
 fs/rpdfs/dir.c    |  2 ++
 fs/rpdfs/file.c   |  3 ++
 fs/rpdfs/inode.c  | 71 +++++++++++++++++++++++++++++++++++++++++++++++
 fs/rpdfs/inode.h  |  7 +++++
 5 files changed, 84 insertions(+), 1 deletion(-)
fs/rpdfs/balloc.c +1 -1
index ab14b812297c..09ed17d995f0 100644
@@ -96,7 +96,7 @@ void rpdfs_balloc_start_apply(struct rpdfs_fs_info *rfi, struct rpdfs_transactio
 
 /*
  * Apply and return the result of an allocation that was prepared by
- * _prepare_alloc.  The caller can use _txn_use_prepare() to get the
+ * _prepare_alloc.  The caller can use _txn_use_prepared() to get the
  * allocated block.
  */
 int rpdfs_balloc_apply_alloc(struct rpdfs_fs_info *rfi, struct rpdfs_transaction *txn,
fs/rpdfs/dir.c +2 -0
index 115f879d8fb1..7ae8faf74161 100644
@@ -677,9 +677,11 @@ static int rpdfs_readdir(struct file *file, struct dir_context *ctx)
 
 const struct inode_operations rpdfs_dir_iops = {
 	.create		= rpdfs_create,
+	.getattr	= rpdfs_getattr,
 	.lookup		= rpdfs_lookup,
 	.mkdir		= rpdfs_mkdir,
 	.rename		= rpdfs_rename,
+	.setattr	= rpdfs_setattr,
 };
 
 const struct file_operations rpdfs_dir_fops = {
fs/rpdfs/file.c +3 -0
index 4c62d5e85caf..22532d8cdf63 100644
@@ -3,8 +3,11 @@
 #include <linux/fs.h>
 
 #include "file.h"
+#include "inode.h"
 
 const struct inode_operations rpdfs_file_iops = {
+	.getattr	= rpdfs_getattr,
+	.setattr	= rpdfs_setattr,
 };
 
 const struct file_operations rpdfs_file_fops = {
fs/rpdfs/inode.c +71 -0

89 lines not on this page · raw message

fs/rpdfs/inode.h +7 -0
index 28edaf01f542..a57017a4fca0 100644
@@ -52,6 +52,13 @@ int rpdfs_write_inode(struct inode *inode, struct writeback_control *wbc);
 
 void rpdfs_inode_init_ops(struct inode *inode);
 
+int rpdfs_getattr(struct mnt_idmap *idmap, const struct path *path,
+		  struct kstat *stat, u32 request_mask,
+		  unsigned int query_flags);
+
+int rpdfs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
+		  struct iattr *attr);
+
 struct inode *rpdfs_iget(struct super_block *sb, struct rpdfs_ino_gen *ig);
 struct inode *rpdfs_new_inode(struct super_block *sb, struct rpdfs_ino_gen *ig);
 int rpdfs_inode_txn_prepare(struct rpdfs_fs_info *rfi, struct rpdfs_transaction *txn,
Signature · 1 line
2.53.0
Applied
#1 lore raw
Quoted 1 line · Chris Kirby

Add basic getattr and setattr support.

Applied, thanks!

- z