Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 16cce6d2 authored by Latchesar Ionkov's avatar Latchesar Ionkov Committed by Linus Torvalds
Browse files

[PATCH] v9fs: add extension field to Tcreate



Implement a new way of creating special files.  Instead of Tcreate+Twstat,
add one more field to Tcreate that contains special file description.

Signed-off-by: default avatarLatchesar Ionkov <lucho@ionkov.net>
Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 5174fdab
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -334,8 +334,8 @@ v9fs_t_remove(struct v9fs_session_info *v9ses, u32 fid,
 */

int
v9fs_t_create(struct v9fs_session_info *v9ses, u32 fid, char *name,
	      u32 perm, u8 mode, struct v9fs_fcall **rcp)
v9fs_t_create(struct v9fs_session_info *v9ses, u32 fid, char *name, u32 perm,
	u8 mode, char *extension, struct v9fs_fcall **rcp)
{
	int ret;
	struct v9fs_fcall *tc;
@@ -343,7 +343,9 @@ v9fs_t_create(struct v9fs_session_info *v9ses, u32 fid, char *name,
	dprintk(DEBUG_9P, "fid %d name '%s' perm %x mode %d\n",
		fid, name, perm, mode);

	tc = v9fs_create_tcreate(fid, name, perm, mode);
	tc = v9fs_create_tcreate(fid, name, perm, mode, extension,
		v9ses->extended);

	if (!IS_ERR(tc)) {
		ret = v9fs_mux_rpc(v9ses->mux, tc, rcp);
		kfree(tc);
+2 −1
Original line number Diff line number Diff line
@@ -235,6 +235,7 @@ struct Tcreate {
	struct v9fs_str name;
	u32 perm;
	u8 mode;
	struct v9fs_str extension;
};

struct Rcreate {
@@ -364,7 +365,7 @@ int v9fs_t_remove(struct v9fs_session_info *v9ses, u32 fid,
		  struct v9fs_fcall **rcall);

int v9fs_t_create(struct v9fs_session_info *v9ses, u32 fid, char *name,
		  u32 perm, u8 mode, struct v9fs_fcall **rcall);
	u32 perm, u8 mode, char *extension, struct v9fs_fcall **rcall);

int v9fs_t_read(struct v9fs_session_info *v9ses, u32 fid,
		u64 offset, u32 count, struct v9fs_fcall **rcall);
+7 −1
Original line number Diff line number Diff line
@@ -666,7 +666,8 @@ struct v9fs_fcall *v9fs_create_topen(u32 fid, u8 mode)
	return fc;
}

struct v9fs_fcall *v9fs_create_tcreate(u32 fid, char *name, u32 perm, u8 mode)
struct v9fs_fcall *v9fs_create_tcreate(u32 fid, char *name, u32 perm, u8 mode,
	char *extension, int extended)
{
	int size;
	struct v9fs_fcall *fc;
@@ -674,6 +675,9 @@ struct v9fs_fcall *v9fs_create_tcreate(u32 fid, char *name, u32 perm, u8 mode)
	struct cbuf *bufp = &buffer;

	size = 4 + 2 + strlen(name) + 4 + 1;	/* fid[4] name[s] perm[4] mode[1] */
	if (extended && extension!=NULL)
		size += 2 + strlen(extension);	/* extension[s] */

	fc = v9fs_create_common(bufp, size, TCREATE);
	if (IS_ERR(fc))
		goto error;
@@ -682,6 +686,8 @@ struct v9fs_fcall *v9fs_create_tcreate(u32 fid, char *name, u32 perm, u8 mode)
	v9fs_put_str(bufp, name, &fc->params.tcreate.name);
	v9fs_put_int32(bufp, perm, &fc->params.tcreate.perm);
	v9fs_put_int8(bufp, mode, &fc->params.tcreate.mode);
	if (extended)
		v9fs_put_str(bufp, extension, &fc->params.tcreate.extension);

	if (buf_check_overflow(bufp)) {
		kfree(fc);
+2 −1
Original line number Diff line number Diff line
@@ -39,7 +39,8 @@ struct v9fs_fcall *v9fs_create_tflush(u16 oldtag);
struct v9fs_fcall *v9fs_create_twalk(u32 fid, u32 newfid, u16 nwname,
	char **wnames);
struct v9fs_fcall *v9fs_create_topen(u32 fid, u8 mode);
struct v9fs_fcall *v9fs_create_tcreate(u32 fid, char *name, u32 perm, u8 mode);
struct v9fs_fcall *v9fs_create_tcreate(u32 fid, char *name, u32 perm, u8 mode,
	char *extension, int extended);
struct v9fs_fcall *v9fs_create_tread(u32 fid, u64 offset, u32 count);
struct v9fs_fcall *v9fs_create_twrite(u32 fid, u64 offset, u32 count,
	const char __user *data);
+15 −17
Original line number Diff line number Diff line
@@ -79,19 +79,20 @@ int v9fs_file_open(struct inode *inode, struct file *file)
		goto put_fid;
	}

	vfid = kmalloc(sizeof(struct v9fs_fid), GFP_KERNEL);
	if (vfid == NULL) {
		dprintk(DEBUG_ERROR, "out of memory\n");
		goto clunk_fid;
		}

	/* TODO: do special things for O_EXCL, O_NOFOLLOW, O_SYNC */
	/* translate open mode appropriately */
	omode = v9fs_uflags2omode(file->f_flags);
	err = v9fs_t_open(v9ses, fid, omode, &fcall);
	if (err < 0) {
		PRINT_FCALL_ERROR("open failed", fcall);
		goto destroy_vfid;
		goto clunk_fid;
	}

	vfid = kmalloc(sizeof(struct v9fs_fid), GFP_KERNEL);
	if (vfid == NULL) {
		dprintk(DEBUG_ERROR, "out of memory\n");
		err = -ENOMEM;
		goto clunk_fid;
	}

	file->private_data = vfid;
@@ -106,9 +107,6 @@ int v9fs_file_open(struct inode *inode, struct file *file)

	return 0;

destroy_vfid:
	v9fs_fid_destroy(vfid);

clunk_fid:
	v9fs_t_clunk(v9ses, fid);

Loading