vserver 1.9.5.x5
[linux-2.6.git] / fs / smbfs / inode.c
index 1001a64..4765aaa 100644 (file)
@@ -368,7 +368,6 @@ parse_options(struct smb_mount_data_kernel *mnt, char *options)
                                &optopt, &optarg, &flags, &value)) > 0) {
 
                VERBOSE("'%s' -> '%s'\n", optopt, optarg ? optarg : "<none>");
-
                switch (c) {
                case 1:
                        /* got a "flag" option */
@@ -383,15 +382,19 @@ parse_options(struct smb_mount_data_kernel *mnt, char *options)
                        break;
                case 'u':
                        mnt->uid = value;
+                       flags |= SMB_MOUNT_UID;
                        break;
                case 'g':
                        mnt->gid = value;
+                       flags |= SMB_MOUNT_GID;
                        break;
                case 'f':
                        mnt->file_mode = (value & S_IRWXUGO) | S_IFREG;
+                       flags |= SMB_MOUNT_FMODE;
                        break;
                case 'd':
                        mnt->dir_mode = (value & S_IRWXUGO) | S_IFDIR;
+                       flags |= SMB_MOUNT_DMODE;
                        break;
                case 'i':
                        strlcpy(mnt->codepage.local_name, optarg, 
@@ -429,9 +432,9 @@ smb_show_options(struct seq_file *s, struct vfsmount *m)
                if (mnt->flags & opts[i].flag)
                        seq_printf(s, ",%s", opts[i].name);
 
-       if (mnt->uid != 0)
+       if (mnt->flags & SMB_MOUNT_UID)
                seq_printf(s, ",uid=%d", mnt->uid);
-       if (mnt->gid != 0)
+       if (mnt->flags & SMB_MOUNT_GID)
                seq_printf(s, ",gid=%d", mnt->gid);
        if (mnt->mounted_uid != 0)
                seq_printf(s, ",mounted_uid=%d", mnt->mounted_uid);
@@ -440,8 +443,10 @@ smb_show_options(struct seq_file *s, struct vfsmount *m)
         * Defaults for file_mode and dir_mode are unknown to us; they
         * depend on the current umask of the user doing the mount.
         */
-       seq_printf(s, ",file_mode=%04o", mnt->file_mode & S_IRWXUGO);
-       seq_printf(s, ",dir_mode=%04o", mnt->dir_mode & S_IRWXUGO);
+       if (mnt->flags & SMB_MOUNT_FMODE)
+               seq_printf(s, ",file_mode=%04o", mnt->file_mode & S_IRWXUGO);
+       if (mnt->flags & SMB_MOUNT_DMODE)
+               seq_printf(s, ",dir_mode=%04o", mnt->dir_mode & S_IRWXUGO);
 
        if (strcmp(mnt->codepage.local_name, CONFIG_NLS_DEFAULT))
                seq_printf(s, ",iocharset=%s", mnt->codepage.local_name);
@@ -488,7 +493,7 @@ smb_put_super(struct super_block *sb)
        smb_kfree(server);
 }
 
-int smb_fill_super(struct super_block *sb, void *raw_data, int silent)
+static int smb_fill_super(struct super_block *sb, void *raw_data, int silent)
 {
        struct smb_sb_info *server;
        struct smb_mount_data_kernel *mnt;
@@ -511,6 +516,7 @@ int smb_fill_super(struct super_block *sb, void *raw_data, int silent)
        sb->s_blocksize_bits = 10;
        sb->s_magic = SMB_SUPER_MAGIC;
        sb->s_op = &smb_sops;
+       sb->s_time_gran = 100;
 
        server = smb_kmalloc(sizeof(struct smb_sb_info), GFP_KERNEL);
        if (!server)
@@ -566,8 +572,13 @@ int smb_fill_super(struct super_block *sb, void *raw_data, int silent)
                mnt->file_mode = (oldmnt->file_mode & S_IRWXUGO) | S_IFREG;
                mnt->dir_mode = (oldmnt->dir_mode & S_IRWXUGO) | S_IFDIR;
 
-               mnt->flags = (oldmnt->file_mode >> 9);
+               mnt->flags = (oldmnt->file_mode >> 9) | SMB_MOUNT_UID |
+                       SMB_MOUNT_GID | SMB_MOUNT_FMODE | SMB_MOUNT_DMODE;
        } else {
+               mnt->file_mode = S_IRWXU | S_IRGRP | S_IXGRP |
+                               S_IROTH | S_IXOTH | S_IFREG;
+               mnt->dir_mode = S_IRWXU | S_IRGRP | S_IXGRP |
+                               S_IROTH | S_IXOTH | S_IFDIR;
                if (parse_options(mnt, raw_data))
                        goto out_bad_option;
        }
@@ -591,7 +602,7 @@ int smb_fill_super(struct super_block *sb, void *raw_data, int silent)
        /*
         * Keep the super block locked while we get the root inode.
         */
-       smb_init_root_dirent(server, &root);
+       smb_init_root_dirent(server, &root, sb);
        root_inode = smb_iget(sb, &root);
        if (!root_inode)
                goto out_no_root;
@@ -599,6 +610,7 @@ int smb_fill_super(struct super_block *sb, void *raw_data, int silent)
        sb->s_root = d_alloc_root(root_inode);
        if (!sb->s_root)
                goto out_no_root;
+
        smb_new_dentry(sb->s_root);
 
        return 0;