*/
#include <linux/config.h>
-#include <linux/sched.h>
+#include <linux/vs_base.h>
#include <linux/vs_context.h>
#include <linux/fs.h>
#include <linux/proc_fs.h>
-#include <linux/devpts_fs.h>
#include <linux/namei.h>
-#include <linux/mount.h>
-#include <linux/parser.h>
#include <linux/vserver/inode.h>
-#include <linux/vserver/xid.h>
#include <asm/errno.h>
#include <asm/uaccess.h>
static int __vc_get_iattr(struct inode *in, uint32_t *xid, uint32_t *flags, uint32_t *mask)
{
- struct proc_dir_entry *entry;
-
if (!in || !in->i_sb)
return -ESRCH;
*mask |= IATTR_XID;
}
- switch (in->i_sb->s_magic) {
- case PROC_SUPER_MAGIC:
- entry = PROC_I(in)->pde;
+ if (in->i_sb->s_magic == PROC_SUPER_MAGIC) {
+ struct proc_dir_entry *entry = PROC_I(in)->pde;
// check for specific inodes ?
if (entry)
*flags |= (entry->vx_flags & IATTR_FLAGS);
else
*flags |= (PROC_I(in)->vx_flags & IATTR_FLAGS);
- break;
-
- case DEVPTS_SUPER_MAGIC:
- *xid = in->i_xid;
- *mask |= IATTR_XID;
- break;
-
- default:
- break;
}
return 0;
}
int vc_get_iattr(uint32_t id, void __user *data)
{
struct nameidata nd;
- struct vcmd_ctx_iattr_v1 vc_data = { .xid = -1 };
+ struct vcmd_ctx_iattr_v1 vc_data;
int ret;
if (!vx_check(0, VX_ADMIN))
static int __vc_set_iattr(struct dentry *de, uint32_t *xid, uint32_t *flags, uint32_t *mask)
{
struct inode *in = de->d_inode;
- int error = 0, is_proc = 0, has_xid = 0;
+ int error = 0, is_proc = 0;
if (!in || !in->i_sb)
return -ESRCH;
is_proc = (in->i_sb->s_magic == PROC_SUPER_MAGIC);
if ((*mask & IATTR_FLAGS) && !is_proc)
return -EINVAL;
-
- has_xid = (in->i_sb->s_flags & MS_TAGXID) ||
- (in->i_sb->s_magic == DEVPTS_SUPER_MAGIC);
- if ((*mask & IATTR_XID) && !has_xid)
+ if ((*mask & IATTR_XID) && !(in->i_sb->s_flags & MS_TAGXID))
return -EINVAL;
down(&in->i_sem);
#ifdef CONFIG_VSERVER_LEGACY
+#include <linux/proc_fs.h>
#define PROC_DYNAMIC_FIRST 0xF0000000UL
}
#endif
-
-int vx_parse_xid(char *string, xid_t *xid, int remove)
-{
- static match_table_t tokens = {
- {1, "xid=%u"},
- {0, NULL}
- };
- substring_t args[MAX_OPT_ARGS];
- int token, option = 0;
-
- if (!string)
- return 0;
-
- token = match_token(string, tokens, args);
- if (token && xid && !match_int(args, &option))
- *xid = option;
-
- vxdprintk(VXD_CBIT(xid, 7),
- "vx_parse_xid(»%s«): %d:#%d",
- string, token, option);
-
- if (token && remove) {
- char *p = strstr(string, "xid=");
- char *q = p;
-
- if (p) {
- while (*q != '\0' && *q != ',')
- q++;
- while (*q)
- *p++ = *q++;
- while (*p)
- *p++ = '\0';
- }
- }
- return token;
-}
-
-void vx_propagate_xid(struct nameidata *nd, struct inode *inode)
-{
- xid_t new_xid = 0;
- struct vfsmount *mnt;
- int propagate;
-
- if (!nd)
- return;
- mnt = nd->mnt;
- if (!mnt)
- return;
-
- propagate = (mnt->mnt_flags & MNT_XID);
- if (propagate)
- new_xid = mnt->mnt_xid;
-
- vxdprintk(VXD_CBIT(xid, 7),
- "vx_propagate_xid(%p[#%lu.%d]): %d,%d",
- inode, inode->i_ino, inode->i_xid,
- new_xid, (propagate)?1:0);
-
- if (propagate)
- inode->i_xid = new_xid;
-}
-
-#include <linux/module.h>
-
-EXPORT_SYMBOL_GPL(vx_propagate_xid);
-