commit 69b6c0ebb74e32e8623fafdf17b1fcbc28696fca
Author: Yiannis Pericleous <[EMAIL PROTECTED]>
Date:   Tue May 29 21:43:22 2007 -0400

    use 2 bytes for namelen in odf cache dir dirents

diff --git a/fs/unionfs/odf.c b/fs/unionfs/odf.c
index 73af6dc..5518611 100644
--- a/fs/unionfs/odf.c
+++ b/fs/unionfs/odf.c
@@ -1289,6 +1289,7 @@ int odf_write_dirent(struct file *filp, const char *name, 
int namelen,
                                u64 ino, unsigned int d_type)
 {
        int err = 0;
+       __le16 le16;
        __le32 le32;
        __le64 le64;
        unsigned char byte;
@@ -1312,10 +1313,10 @@ int odf_write_dirent(struct file *filp, const char 
*name, int namelen,
                goto out;
 
        /* name length */
-       byte = (unsigned char)namelen;
-       err = filp->f_op->write(filp, (char*)&byte,
-                       sizeof(unsigned char), &filp->f_pos);
-       if (err != sizeof(unsigned char))
+       le16 = cpu_to_le16(namelen);
+       err = filp->f_op->write(filp, (char*)&le16,
+                       sizeof(__le16), &filp->f_pos);
+       if (err != sizeof(__le16))
                goto out;
 
        /* type */
@@ -1347,6 +1348,7 @@ int odf_read_dirent(struct file *filp, char **name, int 
*namelen,
 {
        int err = 0;
        mm_segment_t oldfs;
+       __le16 le16;
        __le32 le32;
        __le64 le64;
        unsigned char byte;
@@ -1378,13 +1380,13 @@ int odf_read_dirent(struct file *filp, char **name, int 
*namelen,
        *ino = le64_to_cpu(le64);
 
        /* name length */
-       err = filp->f_op->read(filp, (char*)&byte,
-                       sizeof(unsigned char), &filp->f_pos);
-       if (err != sizeof(unsigned char)) {
+       err = filp->f_op->read(filp, (char*)&le16,
+                       sizeof(__le16), &filp->f_pos);
+       if (err != sizeof(__le16)) {
                err = -EIO;
                goto out;
        }
-       *namelen = byte;
+       *namelen = le16_to_cpu(le16);
        if (*namelen <= 0) {
                err = -EFAULT;
                goto out;
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs

Reply via email to