fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / fs / ncpfs / symlink.c
index 15697bc..e3d26c1 100644 (file)
@@ -20,7 +20,6 @@
  *
  */
 
-#include <linux/config.h>
 
 #include <asm/uaccess.h>
 
@@ -36,8 +35,8 @@
 /* these magic numbers must appear in the symlink file -- this makes it a bit
    more resilient against the magic attributes being set on random files. */
 
-#define NCP_SYMLINK_MAGIC0     le32_to_cpu(0x6c6d7973)     /* "symlnk->" */
-#define NCP_SYMLINK_MAGIC1     le32_to_cpu(0x3e2d6b6e)
+#define NCP_SYMLINK_MAGIC0     cpu_to_le32(0x6c6d7973)     /* "symlnk->" */
+#define NCP_SYMLINK_MAGIC1     cpu_to_le32(0x3e2d6b6e)
 
 /* ----- read a symbolic link ------------------------------------------ */
 
@@ -49,7 +48,7 @@ static int ncp_symlink_readpage(struct file *file, struct page *page)
        char *buf = kmap(page);
 
        error = -ENOMEM;
-       rawlink=(char *)kmalloc(NCP_MAX_SYMLINK_SIZE, GFP_KERNEL);
+       rawlink = kmalloc(NCP_MAX_SYMLINK_SIZE, GFP_KERNEL);
        if (!rawlink)
                goto fail;
 
@@ -67,8 +66,8 @@ static int ncp_symlink_readpage(struct file *file, struct page *page)
 
        if (NCP_FINFO(inode)->flags & NCPI_KLUDGE_SYMLINK) {
                if (length<NCP_MIN_SYMLINK_SIZE || 
-                   ((__u32 *)rawlink)[0]!=NCP_SYMLINK_MAGIC0 ||
-                   ((__u32 *)rawlink)[1]!=NCP_SYMLINK_MAGIC1)
+                   ((__le32 *)rawlink)[0]!=NCP_SYMLINK_MAGIC0 ||
+                   ((__le32 *)rawlink)[1]!=NCP_SYMLINK_MAGIC1)
                        goto failEIO;
                link = rawlink + 8;
                length -= 8;
@@ -99,7 +98,7 @@ fail:
 /*
  * symlinks can't do much...
  */
-struct address_space_operations ncp_symlink_aops = {
+const struct address_space_operations ncp_symlink_aops = {
        .readpage       = ncp_symlink_readpage,
 };
        
@@ -110,7 +109,8 @@ int ncp_symlink(struct inode *dir, struct dentry *dentry, const char *symname) {
        char *rawlink;
        int length, err, i, outlen;
        int kludge;
-       int mode, attr;
+       int mode;
+       __le32 attr;
        unsigned int hdr;
 
        DPRINTK("ncp_symlink(dir=%p,dentry=%p,symname=%s)\n",dir,dentry,symname);
@@ -126,15 +126,15 @@ int ncp_symlink(struct inode *dir, struct dentry *dentry, const char *symname) {
        /* EPERM is returned by VFS if symlink procedure does not exist */
                return -EPERM;
   
-       rawlink=(char *)kmalloc(NCP_MAX_SYMLINK_SIZE, GFP_KERNEL);
+       rawlink = kmalloc(NCP_MAX_SYMLINK_SIZE, GFP_KERNEL);
        if (!rawlink)
                return -ENOMEM;
 
        if (kludge) {
                mode = 0;
                attr = aSHARED | aHIDDEN;
-               ((__u32 *)rawlink)[0]=NCP_SYMLINK_MAGIC0;
-               ((__u32 *)rawlink)[1]=NCP_SYMLINK_MAGIC1;
+               ((__le32 *)rawlink)[0]=NCP_SYMLINK_MAGIC0;
+               ((__le32 *)rawlink)[1]=NCP_SYMLINK_MAGIC1;
                hdr = 8;
        } else {
                mode = S_IFLNK | S_IRWXUGO;