linux-um archives
 help / color / mirror / Atom feed
From: BlaisorBlade <blaisorblade_spam@yahoo.it>
To: user-mode-linux-user@lists.sourceforge.net,
	user-mode-linux-devel@lists.sourceforge.net
Cc: Jeff Dike <jdike@addtoit.com>
Subject: [uml-devel] Hostfs and Humfs
Date: Thu, 1 Apr 2004 18:53:43 +0100	[thread overview]
Message-ID: <200404011953.43255.blaisorblade_spam@yahoo.it> (raw)
In-Reply-To: <200403300217.i2U2HKxc026892@ccure.user-mode-linux.org>

[-- Attachment #1: Type: text/plain, Size: 1105 bytes --]

Alle 04:17, martedì 30 marzo 2004, Jeff Dike ha scritto:
> tim@unclewebster.com said:
> > Is there any clever way to reset the root password for users, aside
> > from  deleting the cow? "linux single" is fine, but aside from that?
>
> I'm finishing up a new hostfs-like filesystem which I want to become the
> preferred mechanism to boot UMLs because of its ability to mmap data from
> the host, eliminating duplicate copies of file data in memory.

Al Viro said you that ubd=mmap won't work, right? Would you give me the magic 
words to search on the LKML or forward the messages to the -devel list?

Also, I've started writing a little patch for 2.6 to hostfs to generalize it 
like you said (which I attached). It is just 2-3 hours of work, since I had 
some doubt: do you like adding a hostfs_user_operations stored into 
super_block->s_fs_info and calling all the functions of hostfs_user.c 
indirectly (the trivial and long part I did not do yet)?

Would it be useful for your "humfs", as it seems to me?

-- 
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729

[-- Attachment #2: Abstract_hostfs.patch --]
[-- Type: text/x-diff, Size: 4870 bytes --]

--- ./fs/hostfs/hostfs_kern.c.fix	2004-03-01 18:59:47.000000000 +0100
+++ ./fs/hostfs/hostfs_kern.c	2004-03-01 19:26:03.000000000 +0100
@@ -33,6 +33,30 @@
 	struct inode vfs_inode;
 };
 
+struct hostfs_private_fs_info { /* To fill s_fs_info; it will need a list_head field.*/
+	struct hostfs_user_operations *ops;
+	struct list_head link;
+};
+
+/* For now no locking, it is called in initialization.*/
+static struct hostfs_private_fs_info hostfs_info;
+
+int register_hostfs_ops(struct hostfs_user_operations* ops)
+{
+	hostfs_info.ops = ops;
+	return 0;
+}
+
+static inline struct hostfs_user_operations* HOSTFS_OPS_INO(struct inode* ino)
+{
+	return ((struct hostfs_private_fs_info*) ino->i_sb->s_fs_info)->ops;
+}
+
+static inline struct hostfs_user_operations* HOSTFS_OPS_FILE(struct file* file)
+{
+	return ((struct hostfs_private_fs_info*) file->f_dentry->d_sb->s_fs_info)->ops;
+}
+
 static inline struct hostfs_inode_info *HOSTFS_I(struct inode *inode)
 {
 	return(list_entry(inode, struct hostfs_inode_info, vfs_inode));
@@ -927,6 +951,8 @@
 	sb->s_blocksize_bits = 10;
 	sb->s_magic = HOSTFS_SUPER_MAGIC;
 	sb->s_op = &hostfs_sbops;
+	/* Just temporary;*/
+	sb->s_fs_info = &hostfs_info;
 
 	if((data == NULL) || (*data == '\0')) 
 		data = root_ino;
--- ./fs/hostfs/hostfs.h.fix	2004-02-20 18:43:27.000000000 +0100
+++ ./fs/hostfs/hostfs.h	2004-03-01 19:21:05.000000000 +0100
@@ -31,6 +31,7 @@
 	unsigned int	ia_attr_flags;
 };
 
+#if 0
 extern int stat_file(const char *path, unsigned long long *inode_out, 
 		     int *mode_out, int *nlink_out, int *uid_out, int *gid_out,
 		     unsigned long long *size_out, struct timespec *atime_out, 
@@ -64,6 +65,46 @@
 		     long long *files_out, long long *ffree_out, 
 		     void *fsid_out, int fsid_size, long *namelen_out, 
 		     long *spare_out);
+#endif
+
+struct hostfs_user_operations {
+	int (*stat_file)(const char *path, unsigned long long *inode_out, 
+			     int *mode_out, int *nlink_out, int *uid_out, int *gid_out,
+			     unsigned long long *size_out, struct timespec *atime_out, 
+			     struct timespec *mtime_out, struct timespec *ctime_out, 
+			     int *blksize_out, unsigned long long *blocks_out);
+	int (*access_file)(char *path, int r, int w, int x);
+	int (*open_file)(char *path, int r, int w, int append);
+	int (*file_type)(const char *path, int *rdev);
+	void *(*open_dir)(char *path, int *err_out);
+	char *(*read_dir)(void *stream, unsigned long long *pos, 
+			      unsigned long long *ino_out, int *len_out);
+	void (*close_file)(void *stream);
+	void (*close_dir)(void *stream);
+	int (*read_file)(int fd, unsigned long long *offset, char *buf, int len);
+	int (*write_file)(int fd, unsigned long long *offset, const char *buf,
+			      int len);
+	int (*lseek_file)(int fd, long long offset, int whence);
+	int (*file_create)(char *name, int ur, int uw, int ux, int gr, 
+			       int gw, int gx, int or, int ow, int ox);
+	int (*set_attr)(const char *file, struct hostfs_iattr *attrs);
+	int (*make_symlink)(const char *from, const char *to);
+	int (*unlink_file)(const char *file);
+	int (*do_mkdir)(const char *file, int mode);
+	int (*do_rmdir)(const char *file);
+	int (*do_mknod)(const char *file, int mode, int dev);
+	int (*link_file)(const char *from, const char *to);
+	int (*do_readlink)(char *file, char *buf, int size);
+	int (*rename_file)(char *from, char *to);
+	int (*do_statfs)(char *root, long *bsize_out, long long *blocks_out, 
+			     long long *bfree_out, long long *bavail_out, 
+			     long long *files_out, long long *ffree_out, 
+			     void *fsid_out, int fsid_size, long *namelen_out, 
+			     long *spare_out);
+};
+
+/* For now only one hostfs_user_operations can be registered */
+extern int register_hostfs_ops(struct hostfs_user_operations * ops);
 
 #endif
 
--- ./fs/hostfs/hostfs_user.c.fix	2004-03-01 19:02:15.000000000 +0100
+++ ./fs/hostfs/hostfs_user.c	2004-03-01 19:25:04.000000000 +0100
@@ -341,6 +341,31 @@
 	return(0);
 }
 
+static struct hostfs_user_operations host_ops = {
+	.stat_file      = stat_file,
+	.file_type      = file_type,
+	.access_file    = access_file,
+	.open_file      = open_file,
+	.open_dir       = open_dir,
+	.read_dir       = read_dir,
+	.read_file      = read_file,
+	.write_file     = write_file,
+	.lseek_file     = lseek_file,
+	.close_file     = close_file,
+	.close_dir      = close_dir,
+	.file_create    = file_create,
+	.set_attr       = set_attr,
+	.make_symlink   = make_symlink,
+	.unlink_file    = unlink_file,
+	.do_mkdir       = do_mkdir,
+	.do_rmdir       = do_rmdir,
+	.do_mknod       = do_mknod,
+	.link_file      = link_file,
+	.do_readlink    = do_readlink,
+	.rename_file    = rename_file,
+	.do_statfs      = do_statfs,
+};
+
 /*
  * Overrides for Emacs so that we follow Linus's tabbing style.
  * Emacs will notice this stuff at the end of the file and automatically

       reply	other threads:[~2004-04-01 17:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <40686E7D.2080600@unclewebster.com>
     [not found] ` <200403300217.i2U2HKxc026892@ccure.user-mode-linux.org>
2004-04-01 17:53   ` BlaisorBlade [this message]
2004-04-01 19:54     ` [uml-devel] Re: [uml-user] Hostfs and Humfs Jeff Dike
     [not found]     ` <200404051840.i35IeHhZ029055@ccure.user-mode-linux.org>
2004-04-09 17:54       ` [uml-devel] " BlaisorBlade
2004-04-11 14:51   ` [uml-devel] Re: [uml-user] one drawback to using cows commercially BlaisorBlade
2004-04-13  4:58     ` Jeff Dike
2004-05-26 23:57     ` update on cowlinks - was: " roland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200404011953.43255.blaisorblade_spam@yahoo.it \
    --to=blaisorblade_spam@yahoo.it \
    --cc=jdike@addtoit.com \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    --cc=user-mode-linux-user@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox