]> err.no Git - linux-2.6/blobdiff - fs/9p/conv.c
[libata] ahci: add JMicron PCI IDs
[linux-2.6] / fs / 9p / conv.c
index 55ccfa10ee9eeed3cf65f3efd855468b9125b88e..a767e05b60bf3d03eb9438344246be3bdc71bbfc 100644 (file)
@@ -8,9 +8,8 @@
  *  Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov>
  *
  *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ *  it under the terms of the GNU General Public License version 2
+ *  as published by the Free Software Foundation.
  *
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -56,7 +55,7 @@ static inline int buf_check_overflow(struct cbuf *buf)
        return buf->p > buf->ep;
 }
 
-static inline int buf_check_size(struct cbuf *buf, int len)
+static int buf_check_size(struct cbuf *buf, int len)
 {
        if (buf->p + len > buf->ep) {
                if (buf->p < buf->ep) {
@@ -72,7 +71,7 @@ static inline int buf_check_size(struct cbuf *buf, int len)
        return 1;
 }
 
-static inline void *buf_alloc(struct cbuf *buf, int len)
+static void *buf_alloc(struct cbuf *buf, int len)
 {
        void *ret = NULL;
 
@@ -84,7 +83,7 @@ static inline void *buf_alloc(struct cbuf *buf, int len)
        return ret;
 }
 
-static inline void buf_put_int8(struct cbuf *buf, u8 val)
+static void buf_put_int8(struct cbuf *buf, u8 val)
 {
        if (buf_check_size(buf, 1)) {
                buf->p[0] = val;
@@ -92,7 +91,7 @@ static inline void buf_put_int8(struct cbuf *buf, u8 val)
        }
 }
 
-static inline void buf_put_int16(struct cbuf *buf, u16 val)
+static void buf_put_int16(struct cbuf *buf, u16 val)
 {
        if (buf_check_size(buf, 2)) {
                *(__le16 *) buf->p = cpu_to_le16(val);
@@ -100,7 +99,7 @@ static inline void buf_put_int16(struct cbuf *buf, u16 val)
        }
 }
 
-static inline void buf_put_int32(struct cbuf *buf, u32 val)
+static void buf_put_int32(struct cbuf *buf, u32 val)
 {
        if (buf_check_size(buf, 4)) {
                *(__le32 *)buf->p = cpu_to_le32(val);
@@ -108,7 +107,7 @@ static inline void buf_put_int32(struct cbuf *buf, u32 val)
        }
 }
 
-static inline void buf_put_int64(struct cbuf *buf, u64 val)
+static void buf_put_int64(struct cbuf *buf, u64 val)
 {
        if (buf_check_size(buf, 8)) {
                *(__le64 *)buf->p = cpu_to_le64(val);
@@ -116,13 +115,19 @@ static inline void buf_put_int64(struct cbuf *buf, u64 val)
        }
 }
 
-static inline void buf_put_stringn(struct cbuf *buf, const char *s, u16 slen)
+static char *buf_put_stringn(struct cbuf *buf, const char *s, u16 slen)
 {
+       char *ret;
+
+       ret = NULL;
        if (buf_check_size(buf, slen + 2)) {
                buf_put_int16(buf, slen);
+               ret = buf->p;
                memcpy(buf->p, s, slen);
                buf->p += slen;
        }
+
+       return ret;
 }
 
 static inline void buf_put_string(struct cbuf *buf, const char *s)
@@ -130,7 +135,7 @@ static inline void buf_put_string(struct cbuf *buf, const char *s)
        buf_put_stringn(buf, s, strlen(s));
 }
 
-static inline u8 buf_get_int8(struct cbuf *buf)
+static u8 buf_get_int8(struct cbuf *buf)
 {
        u8 ret = 0;
 
@@ -142,7 +147,7 @@ static inline u8 buf_get_int8(struct cbuf *buf)
        return ret;
 }
 
-static inline u16 buf_get_int16(struct cbuf *buf)
+static u16 buf_get_int16(struct cbuf *buf)
 {
        u16 ret = 0;
 
@@ -154,7 +159,7 @@ static inline u16 buf_get_int16(struct cbuf *buf)
        return ret;
 }
 
-static inline u32 buf_get_int32(struct cbuf *buf)
+static u32 buf_get_int32(struct cbuf *buf)
 {
        u32 ret = 0;
 
@@ -166,7 +171,7 @@ static inline u32 buf_get_int32(struct cbuf *buf)
        return ret;
 }
 
-static inline u64 buf_get_int64(struct cbuf *buf)
+static u64 buf_get_int64(struct cbuf *buf)
 {
        u64 ret = 0;
 
@@ -178,7 +183,7 @@ static inline u64 buf_get_int64(struct cbuf *buf)
        return ret;
 }
 
-static inline void buf_get_str(struct cbuf *buf, struct v9fs_str *vstr)
+static void buf_get_str(struct cbuf *buf, struct v9fs_str *vstr)
 {
        vstr->len = buf_get_int16(buf);
        if (!buf_check_overflow(buf) && buf_check_size(buf, vstr->len)) {
@@ -190,7 +195,7 @@ static inline void buf_get_str(struct cbuf *buf, struct v9fs_str *vstr)
        }
 }
 
-static inline void buf_get_qid(struct cbuf *bufp, struct v9fs_qid *qid)
+static void buf_get_qid(struct cbuf *bufp, struct v9fs_qid *qid)
 {
        qid->type = buf_get_int8(bufp);
        qid->version = buf_get_int32(bufp);
@@ -254,7 +259,7 @@ static int v9fs_size_wstat(struct v9fs_wstat *wstat, int extended)
  *
  */
 
-static inline void
+static void
 buf_get_stat(struct cbuf *bufp, struct v9fs_stat *stat, int extended)
 {
        stat->size = buf_get_int16(bufp);
@@ -427,21 +432,25 @@ static inline void v9fs_put_int64(struct cbuf *bufp, u64 val, u64 * p)
        buf_put_int64(bufp, val);
 }
 
-static inline void
+static void
 v9fs_put_str(struct cbuf *bufp, char *data, struct v9fs_str *str)
 {
-       if (data) {
-               str->len = strlen(data);
-               str->str = bufp->p;
-       } else {
-               str->len = 0;
-               str->str = NULL;
-       }
+       int len;
+       char *s;
+
+       if (data)
+               len = strlen(data);
+       else
+               len = 0;
 
-       buf_put_stringn(bufp, data, str->len);
+       s = buf_put_stringn(bufp, data, len);
+       if (str) {
+               str->len = len;
+               str->str = s;
+       }
 }
 
-static inline int
+static int
 v9fs_put_user_data(struct cbuf *bufp, const char __user * data, int count,
                   unsigned char **pdata)
 {
@@ -526,6 +535,7 @@ struct v9fs_fcall *v9fs_create_tversion(u32 msize, char *version)
        return fc;
 }
 
+#if 0
 struct v9fs_fcall *v9fs_create_tauth(u32 afid, char *uname, char *aname)
 {
        int size;
@@ -549,6 +559,7 @@ struct v9fs_fcall *v9fs_create_tauth(u32 afid, char *uname, char *aname)
       error:
        return fc;
 }
+#endif  /*  0  */
 
 struct v9fs_fcall *
 v9fs_create_tattach(u32 fid, u32 afid, char *uname, char *aname)
@@ -654,7 +665,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;
@@ -662,6 +674,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;
@@ -670,6 +685,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);