vserver 1.9.3
[linux-2.6.git] / fs / ncpfs / dir.c
index cfb6c29..2dc2d86 100644 (file)
@@ -174,7 +174,7 @@ ncp_force_unlink(struct inode *dir, struct dentry* dentry)
 {
         int res=0x9c,res2;
        struct nw_modify_dos_info info;
-       __u32 old_nwattr;
+       __le32 old_nwattr;
        struct inode *inode;
 
        memset(&info, 0, sizeof(info));
@@ -211,8 +211,8 @@ ncp_force_rename(struct inode *old_dir, struct dentry* old_dentry, char *_old_na
        struct nw_modify_dos_info info;
         int res=0x90,res2;
        struct inode *old_inode = old_dentry->d_inode;
-       __u32 old_nwattr = NCP_FINFO(old_inode)->nwattr;
-       __u32 new_nwattr = 0; /* shut compiler warning */
+       __le32 old_nwattr = NCP_FINFO(old_inode)->nwattr;
+       __le32 new_nwattr = 0; /* shut compiler warning */
        int old_nwattr_changed = 0;
        int new_nwattr_changed = 0;
 
@@ -395,8 +395,7 @@ static time_t ncp_obtain_mtime(struct dentry *dentry)
        if (ncp_obtain_info(server, inode, NULL, &i))
                return 0;
 
-       return ncp_date_dos2unix(le16_to_cpu(i.modifyTime),
-                                               le16_to_cpu(i.modifyDate));
+       return ncp_date_dos2unix(i.modifyTime, i.modifyDate);
 }
 
 static int ncp_readdir(struct file *filp, void *dirent, filldir_t filldir)
@@ -767,7 +766,9 @@ int ncp_conn_logged_in(struct super_block *sb)
        if (ncp_single_volume(server)) {
                int len;
                struct dentry* dent;
-               __u32 volNumber, dirEntNum, DosDirNum;
+               __u32 volNumber;
+               __le32 dirEntNum;
+               __le32 DosDirNum;
                __u8 __name[NCP_MAXPATHLEN + 1];
 
                len = sizeof(__name);
@@ -886,7 +887,7 @@ out_close:
 }
 
 int ncp_create_new(struct inode *dir, struct dentry *dentry, int mode,
-                  dev_t rdev, int attributes)
+                  dev_t rdev, __le32 attributes)
 {
        struct ncp_server *server = NCP_SERVER(dir);
        struct ncp_entry_info finfo;
@@ -979,7 +980,8 @@ static int ncp_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 
        error = -EACCES;
        if (ncp_open_create_file_or_subdir(server, dir, __name,
-                                          OC_MODE_CREATE, aDIR, 0xffff,
+                                          OC_MODE_CREATE, aDIR,
+                                          cpu_to_le16(0xffff),
                                           &finfo) == 0)
        {
                if (ncp_is_nfs_extras(server, finfo.volume)) {
@@ -1213,8 +1215,9 @@ static int local2utc(int time)
 
 /* Convert a MS-DOS time/date pair to a UNIX date (seconds since 1 1 70). */
 int
-ncp_date_dos2unix(unsigned short time, unsigned short date)
+ncp_date_dos2unix(__le16 t, __le16 d)
 {
+       unsigned short time = le16_to_cpu(t), date = le16_to_cpu(d);
        int month, year, secs;
 
        /* first subtract and mask after that... Otherwise, if
@@ -1231,13 +1234,14 @@ ncp_date_dos2unix(unsigned short time, unsigned short date)
 
 /* Convert linear UNIX date to a MS-DOS time/date pair. */
 void
-ncp_date_unix2dos(int unix_date, unsigned short *time, unsigned short *date)
+ncp_date_unix2dos(int unix_date, __le16 *time, __le16 *date)
 {
        int day, year, nl_day, month;
 
        unix_date = utc2local(unix_date);
-       *time = (unix_date % 60) / 2 + (((unix_date / 60) % 60) << 5) +
-           (((unix_date / 3600) % 24) << 11);
+       *time = cpu_to_le16(
+               (unix_date % 60) / 2 + (((unix_date / 60) % 60) << 5) +
+               (((unix_date / 3600) % 24) << 11));
        day = unix_date / 86400 - 3652;
        year = day / 365;
        if ((year + 3) / 4 + 365 * year > day)
@@ -1252,5 +1256,5 @@ ncp_date_unix2dos(int unix_date, unsigned short *time, unsigned short *date)
                        if (day_n[month] > nl_day)
                                break;
        }
-       *date = nl_day - day_n[month - 1] + 1 + (month << 5) + (year << 9);
+       *date = cpu_to_le16(nl_day - day_n[month - 1] + 1 + (month << 5) + (year << 9));
 }